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-2021 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 __JLH_PROCESS_H__
26 #define __JLH_PROCESS_H__
27 
28 #include <glib.h>
29 #ifdef WITH_JACK
30 #include <jack/jack.h>
31 #endif
32 #include <ladspa.h>
33 
34 #include "lock_free_fifo.h"
35 
36 typedef struct _process_info process_info_t;
37 
38 /** this is what gets passed to the process() callback and contains all
39     the data the process callback will need */
40 struct _process_info {
41 
42   /** the plugin instance chain */
43   struct _plugin * chain;
44   struct _plugin * chain_end;
45 
46 #ifdef WITH_JACK
47   jack_client_t * jack_client;
48   unsigned long port_count;
49   jack_port_t ** jack_input_ports;
50   jack_port_t ** jack_output_ports;
51 #endif
52 
53   unsigned long channels;
54   LADSPA_Data ** jack_input_buffers;
55   LADSPA_Data ** jack_output_buffers;
56   LADSPA_Data *  silent_buffer;
57 
58   char * jack_client_name;
59   int quit;
60 };
61 
62 #ifndef WITH_JACK
63 typedef guint32 jack_nframes_t;
64 #endif
65 extern jack_nframes_t sample_rate;
66 extern jack_nframes_t buffer_size;
67 
68 process_info_t * process_info_new (const char * client_name,
69 	unsigned long rack_channels, gboolean connect_inputs, gboolean connect_outputs);
70 void process_info_destroy (process_info_t * procinfo);
71 
72 void process_info_set_channels (process_info_t * procinfo,
73 	unsigned long channels, gboolean connect_inputs, gboolean connect_outputs);
74 
75 int process_ladspa (process_info_t * procinfo, jack_nframes_t frames,
76                     LADSPA_Data ** inputs, LADSPA_Data ** outputs);
77 
78 #ifdef WITH_JACK
79 int process_jack (jack_nframes_t frames, void * data);
80 #endif
81 
82 void process_quit (process_info_t * procinfo);
83 
84 #endif /* __JLH_PROCESS_H__ */
85