1 /*
2  * Author: Harry van Haaren 2014
3  *         harryhaaren@gmail.com
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18  * MA 02110-1301, USA.
19  */
20 
21 #ifndef OPENAV_DELLA
22 #define OPENAV_DELLA
23 
24 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
25 
26 #define DELLA_URI    "http://www.openavproductions.com/artyfx#della"
27 #define DELLA_UI_URI "http://www.openavproductions.com/artyfx#della/gui"
28 
29 typedef enum {
30 	// audio
31 	DELLA_INPUT = 0,
32 	DELLA_OUTPUT,
33 
34 	// controls
35 	DELLA_TIME,
36 	DELLA_VOLUME,
37 	DELLA_FEEDBACK,
38 	DELLA_ACTIVE,
39 
40 	DELLA_ATOM_IN,
41 } DellaPortIndex;
42 
43 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
44 #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
45 
46 class Delay;
47 
48 class Della
49 {
50 public:
51 	Della(int rate);
~Della()52 	~Della() {}
53 	static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
54 	                              double samplerate,
55 	                              const char* bundle_path,
56 	                              const LV2_Feature* const* features);
57 	static void activate(LV2_Handle instance);
58 	static void deactivate(LV2_Handle instance);
59 	static void connect_port(LV2_Handle instance, uint32_t port, void *data);
60 	static void run(LV2_Handle instance, uint32_t n_samples);
61 	static void cleanup(LV2_Handle instance);
62 	static const void* extension_data(const char* uri);
63 
64 	/// audio buffers
65 	float* audioInput;
66 	float* audioOutput;
67 
68 	/// control signals
69 	float* controlDelay;
70 	float* controlVolume;
71 	float* controlFeedback;
72 	float* controlActive;
73 
74 	/// Atom port
75 	LV2_URID time_Position;
76 	LV2_URID time_barBeat;
77 	LV2_URID time_beatsPerMinute;
78 	LV2_URID time_speed;
79 
80 	LV2_URID atom_Blank;
81 	LV2_URID atom_Float;
82 
83 	LV2_URID_Map* map;
84 	LV2_Atom_Sequence* atom_port;
85 
86 private:
87 	/// runtime variables
88 	bool active;
89 	Delay* delay;
90 };
91 
92 #endif // OPENAV_DELLA
93