1 /* B.Slizr
2  * Step Sequencer Effect Plugin
3  *
4  * Copyright (C) 2018, 2019 by Sven Jähnichen
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef MAIN_H_
22 #define MAIN_H_
23 
24 #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
25 #include <lv2/lv2plug.in/ns/ext/atom/util.h>
26 #include <lv2/lv2plug.in/ns/ext/urid/urid.h>
27 #include <lv2/lv2plug.in/ns/ext/time/time.h>
28 
29 #define NOTIFYBUFFERSIZE 64
30 #define MONITORBUFFERSIZE 64
31 #define MAXSTEPS 16
32 #define BSLIZR_URI "https://www.jahnichen.de/plugins/lv2/BSlizr"
33 #define BSLIZR_GUI_URI "https://www.jahnichen.de/plugins/lv2/BSlizr#gui"
34 
35 typedef enum {
36 	Control_1	= 0,
37 	Control_2	= 1,
38 	Notify		= 2,
39 	AudioPorts	= 3,
40 	AudioIn_1	= 3,
41 	AudioIn_2	= 4,
42 	AudioOut_1	= 5,
43 	AudioOut_2	= 6,
44 	NrAudioPorts	= 4,
45 	Controllers	= 7,
46 	Attack		= 7,
47 	Release		= 8,
48 	SequencesPerBar	= 9,
49 	NrSteps		= 10,
50 	Step_		= 11,
51 	NrControllers	= 20
52 } BSlizrPortIndex;
53 
54 typedef struct
55 {
56 	LV2_URID atom_Float;
57 	LV2_URID atom_Int;
58 	LV2_URID atom_Object;
59 	LV2_URID atom_Blank;
60 	LV2_URID atom_eventTransfer;
61 	LV2_URID atom_Vector;
62 	LV2_URID time_Position;
63 	LV2_URID time_barBeat;
64 	LV2_URID time_beatsPerMinute;
65 	LV2_URID time_beatsPerBar;
66 	LV2_URID time_beatUnit;
67 	LV2_URID time_speed;
68 	LV2_URID ui_on;
69 	LV2_URID ui_off;
70 	LV2_URID notify_event;
71 	LV2_URID notify_key;
72 	LV2_URID notify_messageEvent;
73 	LV2_URID notify_message;
74 }  BSlizrURIs;
75 
76 typedef struct {
77 	float position;
78 	float inputMin;
79 	float inputMax;
80 	float outputMin;
81 	float outputMax;
82 } BSlizrNotifications;
83 
84 const BSlizrNotifications defaultNotification = {0.0, 0.0, 0.0, 0.0, 0.0};
85 
getURIs(LV2_URID_Map * m,BSlizrURIs * uris)86 void getURIs (LV2_URID_Map* m, BSlizrURIs* uris)
87 {
88 	uris->atom_Float = m->map(m->handle, LV2_ATOM__Float);
89 	uris->atom_Int = m->map(m->handle, LV2_ATOM__Int);
90 	uris->atom_Object = m->map(m->handle, LV2_ATOM__Object);
91 	uris->atom_Blank = m->map(m->handle, LV2_ATOM__Blank);
92 	uris->atom_eventTransfer = m->map(m->handle, LV2_ATOM__eventTransfer);
93 	uris->atom_Vector = m->map(m->handle, LV2_ATOM__Vector);
94 	uris->time_Position = m->map(m->handle, LV2_TIME__Position);
95 	uris->time_barBeat = m->map(m->handle, LV2_TIME__barBeat);
96 	uris->time_beatsPerMinute = m->map(m->handle, LV2_TIME__beatsPerMinute);
97 	uris->time_beatUnit = m->map(m->handle, LV2_TIME__beatUnit);
98 	uris->time_beatsPerBar = m->map(m->handle, LV2_TIME__beatsPerBar);
99 	uris->time_speed = m->map(m->handle, LV2_TIME__speed);
100 	uris->ui_on = m->map(m->handle, BSLIZR_URI "#UIon");
101 	uris->ui_off = m->map(m->handle, BSLIZR_URI "#UIoff");
102 	uris->notify_event = m->map(m->handle, BSLIZR_URI "#NOTIFYev");
103 	uris->notify_key = m->map(m->handle, BSLIZR_URI "#NOTIFYkey");
104 	uris->notify_messageEvent = m->map(m->handle, BSLIZR_URI "#NOTIFYmessageEvent");
105 	uris->notify_message = m->map(m->handle, BSLIZR_URI "#NOTIFYmessage");
106 }
107 
108 #endif /* MAIN_H_ */
109