1 /*
2  * Copyright (C) 2011 Hermann Meyer, James Warden, Andreas Degert, Pete Shorthose
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  * --------------------------------------------------------------------------
18  *
19  *
20  *
21  *
22  * ----------------------------------------------------------------------------
23  */
24 
25 #pragma once
26 
27 #ifndef _GX_PLUGINLV2_H
28 #define _GX_PLUGINLV2_H
29 
30 // forward declarations (need not be resolved for plugin definition)
31 struct PluginLV2;
32 
33 struct value_pair {
34     const char *value_id;
35     const char *value_label;
36 };
37 
38 /*
39 ** structure for plugin definition
40 */
41 
42 typedef void (*inifunc)(uint32_t samplingFreq, PluginLV2 *plugin);
43 typedef int (*activatefunc)(bool start, PluginLV2 *plugin);
44 typedef void (*clearstatefunc)(PluginLV2 *plugin);
45 typedef void (*process_mono_audio) (int count, float *input, float *output, PluginLV2 *plugin);
46 typedef void (*process_stereo_audio) (int count, float *input1, float *input2,
47 				      float *output1, float *output2, PluginLV2 *plugin);
48 typedef void (*registerfunc)(uint32_t port,void* data, PluginLV2 *plugin);
49 typedef void (*deletefunc)(PluginLV2 *plugin);
50 
51 typedef PluginLV2 *(*plug) ();
52 
53 #define PLUGINLV2_VERMAJOR_MASK 0xff00
54 #define PLUGINLV2_VERSION       0x0500
55 
56 struct PluginLV2 {
57     int version;	 // = PLUGINLV2_VERSION
58 
59     const char* id;	 // must be unique
60     const char* name;	 // displayed name (not translated) (may be 0)
61     // maximal one of mono_audio, stereo_audio must be set
62     // all function pointers in PluginLV2 can be independently set to 0
63     process_mono_audio mono_audio; // function for mono audio processing
64     process_stereo_audio stereo_audio; //function for stereo audio processing
65 
66     inifunc set_samplerate; // called before audio processing and when rate changes
67     activatefunc activate_plugin; // called when taking in / out of pressing chain
68     registerfunc connect_ports; // called once after module loading (register parameter ids)
69     clearstatefunc clear_state;	// clear internal audio state; may be called
70 				// before calling the process function
71     deletefunc delete_instance; // delete this plugin instance
72 };
73 
74 #endif /* !_GX_PLUGINLV2_H */
75