1 /*
2  * JACK Rack
3  *
4  * Original:
5  * Copyright (C) Robert Ham 2002, 2003 (node@users.sourceforge.net)
6  *
7  * Modification for MLT:
8  * Copyright (C) 2004-2014 Meltytech, LLC
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24 
25 #ifndef __JR_PLUGIN_H__
26 #define __JR_PLUGIN_H__
27 
28 #include <glib.h>
29 #include <ladspa.h>
30 #include <pthread.h>
31 #include <jack/jack.h>
32 
33 #include "process.h"
34 #include "plugin_desc.h"
35 
36 typedef struct _ladspa_holder ladspa_holder_t;
37 typedef struct _plugin plugin_t;
38 
39 struct _ladspa_holder
40 {
41   LADSPA_Handle instance;
42   lff_t * ui_control_fifos;
43   LADSPA_Data * control_memory;
44   LADSPA_Data * status_memory;
45 
46   jack_port_t **             aux_ports;
47 };
48 
49 struct _plugin
50 {
51   plugin_desc_t *            desc;
52   gint                       enabled;
53 
54   gint                       copies;
55   ladspa_holder_t *          holders;
56   LADSPA_Data **             audio_input_memory;
57   LADSPA_Data **             audio_output_memory;
58 
59   gboolean                   wet_dry_enabled;
60   /* 1.0 = all wet, 0.0 = all dry, 0.5 = 50% wet/50% dry */
61   LADSPA_Data *              wet_dry_values;
62   lff_t *                    wet_dry_fifos;
63 
64   plugin_t *                 next;
65   plugin_t *                 prev;
66 
67   const LADSPA_Descriptor *  descriptor;
68   void *                     dl_handle;
69   struct _jack_rack *        jack_rack;
70 
71 };
72 
73 void       process_add_plugin            (process_info_t *, plugin_t *plugin);
74 plugin_t * process_remove_plugin         (process_info_t *, plugin_t *plugin);
75 void       process_ablise_plugin         (process_info_t *, plugin_t *plugin, gboolean able);
76 void       process_ablise_plugin_wet_dry (process_info_t *, plugin_t *plugin, gboolean enable);
77 void       process_move_plugin           (process_info_t *, plugin_t *plugin, gint up);
78 plugin_t * process_change_plugin         (process_info_t *, plugin_t *plugin, plugin_t * new_plugin);
79 
80 struct _jack_rack;
81 struct _ui;
82 
83 plugin_t * plugin_new (plugin_desc_t * plugin_desc, struct _jack_rack * jack_rack);
84 void       plugin_destroy (plugin_t * plugin);
85 
86 void plugin_connect_input_ports (plugin_t * plugin, LADSPA_Data ** inputs);
87 void plugin_connect_output_ports (plugin_t * plugin);
88 
89 #endif /* __JR_PLUGIN_H__ */
90