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_FRIZA
22 #define OPENAV_FRIZA
23 
24 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
25 
26 #define FRIZA_URI    "http://www.openavproductions.com/artyfx#friza"
27 #define FRIZA_UI_URI "http://www.openavproductions.com/artyfx#friza/gui"
28 
29 typedef enum {
30 	// Audio
31 	FRIZA_INPUT = 0,
32 	FRIZA_OUTPUT,
33 
34 	// Control inputs
35 	FRIZA_DO_IT,
36 	FRIZA_LENGTH,
37 	FRIZA_POSITION,
38 	FRIZA_VOLUME,
39 } FrizaPortIndex;
40 
41 class SampleHoldShift;
42 
43 class Friza
44 {
45 public:
46 	Friza(int rate);
47 	~Friza();
48 	static LV2_Handle instantiate(const LV2_Descriptor* descriptor,
49 	                              double samplerate,
50 	                              const char* bundle_path,
51 	                              const LV2_Feature* const* features);
52 	static void activate(LV2_Handle instance);
53 	static void deactivate(LV2_Handle instance);
54 	static void connect_port(LV2_Handle instance, uint32_t port, void *data);
55 	static void run(LV2_Handle instance, uint32_t n_samples);
56 	static void cleanup(LV2_Handle instance);
57 	static const void* extension_data(const char* uri);
58 
59 	/// audio buffers
60 	float* audioInput;
61 	float* audioOutput;
62 
63 	/// control values
64 	float* doIt;
65 	float* length;
66 	float* position;
67 	float* volume;
68 
69 private:
70 	SampleHoldShift* shs;
71 };
72 
73 #endif // OPENAV_FRIZA
74