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_BITTA 22 #define OPENAV_BITTA 23 24 #include "lv2/lv2plug.in/ns/lv2core/lv2.h" 25 26 #define BITTA_URI "http://www.openavproductions.com/artyfx#bitta" 27 #define BITTA_UI_URI "http://www.openavproductions.com/artyfx#bitta/gui" 28 29 typedef enum { 30 // audio 31 BITTA_INPUT_L = 0, 32 BITTA_OUTPUT_L, 33 34 // controls 35 BITTA_CRUSH, 36 BITTA_DRYWET, 37 BITTA_ACTIVE, 38 39 BITTA_ATOM_IN, 40 } BittaPortIndex; 41 42 #include "lv2/lv2plug.in/ns/ext/urid/urid.h" 43 #include "lv2/lv2plug.in/ns/ext/atom/atom.h" 44 45 class BitCrusher; 46 47 class Bitta 48 { 49 public: 50 Bitta(int rate); ~Bitta()51 ~Bitta() {} 52 static LV2_Handle instantiate(const LV2_Descriptor* descriptor, 53 double samplerate, 54 const char* bundle_path, 55 const LV2_Feature* const* features); 56 static void activate(LV2_Handle instance); 57 static void deactivate(LV2_Handle instance); 58 static void connect_port(LV2_Handle instance, uint32_t port, void *data); 59 static void run(LV2_Handle instance, uint32_t n_samples); 60 static void cleanup(LV2_Handle instance); 61 static const void* extension_data(const char* uri); 62 63 /// audio buffers 64 float* audioInputL; 65 float* audioOutputL; 66 67 /// control signals 68 float* controlCrush; 69 float* controlActive; 70 float* controlDryWet; 71 72 /// Atom port 73 LV2_URID time_Position; 74 LV2_URID time_barBeat; 75 LV2_URID time_beatsPerMinute; 76 LV2_URID time_speed; 77 78 LV2_URID atom_Blank; 79 LV2_URID atom_Float; 80 81 LV2_URID_Map* map; 82 LV2_Atom_Sequence* atom_port; 83 84 private: 85 /// runtime variables 86 bool active; 87 BitCrusher* bitcrusher; 88 }; 89 90 #endif // OPENAV_BITTA 91