1 /*!
2  * @file lv2_common.h
3  * @brief URI definitions and mapping for QMidiArp LV2 plugins
4  *
5  *
6  *      Copyright 2011 - 2017 <qmidiarp-devel@lists.sourceforge.net>
7  *
8  *      This program is free software; you can redistribute it and/or modify
9  *      it under the terms of the GNU General Public License as published by
10  *      the Free Software Foundation; either version 2 of the License, or
11  *      (at your option) any later version.
12  *
13  *      This program is distributed in the hope that it will be useful,
14  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *      GNU General Public License for more details.
17  *
18  *      You should have received a copy of the GNU General Public License
19  *      along with this program; if not, write to the Free Software
20  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  *      MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef LV2_COMMON_H
26 #define LV2_COMMON_H
27 
28 #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
29 #include "lv2/lv2plug.in/ns/ext/urid/urid.h"
30 #include "lv2/lv2plug.in/ns/ext/atom/atom.h"
31 #include "lv2/lv2plug.in/ns/ext/atom/forge.h"
32 #include "lv2/lv2plug.in/ns/ext/midi/midi.h"
33 #include "lv2/lv2plug.in/ns/ext/atom/util.h"
34 #include "lv2/lv2plug.in/ns/ext/time/time.h"
35 #include "lv2/lv2plug.in/ns/ext/state/state.h"
36 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
37 
38 #define LV2_MIDI_EVENT_URI "http://lv2plug.in/ns/ext/midi#MidiEvent"
39 
40 #define QMIDIARP_LV2_URI "https://git.code.sf.net/p/qmidiarp"
41 #define QMIDIARP_LV2_PREFIX QMIDIARP_LV2_URI "#"
42 
43 typedef struct {
44     LV2_URID atom_Object;
45     LV2_URID atom_Blank;
46     LV2_URID atom_Float;
47     LV2_URID atom_Int;
48     LV2_URID atom_Vector;
49     LV2_URID atom_Long;
50     LV2_URID atom_String;
51     LV2_URID atom_eventTransfer;
52     LV2_URID atom_Resource;
53     LV2_URID time_Position;
54     LV2_URID time_frame;
55     LV2_URID time_barBeat;
56     LV2_URID time_beatsPerMinute;
57     LV2_URID time_speed;
58     LV2_URID midi_MidiEvent;
59     LV2_URID atom_Sequence;
60     LV2_URID hex_customwave;
61     LV2_URID hex_mutemask;
62     LV2_URID pattern_string;
63     LV2_URID ui_up;
64     LV2_URID ui_down;
65     LV2_URID flip_wave;
66 } QMidiArpURIs;
67 
map_uris(LV2_URID_Map * urid_map,QMidiArpURIs * uris)68 static inline void map_uris(LV2_URID_Map* urid_map, QMidiArpURIs* uris) {
69     uris->atom_Object         = urid_map->map(urid_map->handle, LV2_ATOM__Object);
70     uris->atom_Blank          = urid_map->map(urid_map->handle, LV2_ATOM__Blank);
71     uris->atom_Float          = urid_map->map(urid_map->handle, LV2_ATOM__Float);
72     uris->atom_Int            = urid_map->map(urid_map->handle, LV2_ATOM__Int);
73     uris->atom_Vector         = urid_map->map(urid_map->handle, LV2_ATOM__Vector);
74     uris->atom_Long           = urid_map->map(urid_map->handle, LV2_ATOM__Long);
75     uris->atom_String         = urid_map->map(urid_map->handle, LV2_ATOM__String);
76     uris->atom_eventTransfer  = urid_map->map(urid_map->handle, LV2_ATOM__eventTransfer);
77     uris->atom_Resource       = urid_map->map(urid_map->handle, LV2_ATOM__Resource);
78     uris->time_Position       = urid_map->map(urid_map->handle, LV2_TIME__Position);
79     uris->time_frame          = urid_map->map(urid_map->handle, LV2_TIME__frame);
80     uris->time_barBeat        = urid_map->map(urid_map->handle, LV2_TIME__barBeat);
81     uris->time_beatsPerMinute = urid_map->map(urid_map->handle, LV2_TIME__beatsPerMinute);
82     uris->time_speed          = urid_map->map(urid_map->handle, LV2_TIME__speed);
83     uris->midi_MidiEvent      = urid_map->map(urid_map->handle, LV2_MIDI__MidiEvent);
84     uris->atom_Sequence       = urid_map->map(urid_map->handle, LV2_ATOM__Sequence);
85     uris->hex_customwave      = urid_map->map(urid_map->handle, QMIDIARP_LV2_PREFIX "WAVEHEX");
86     uris->hex_mutemask        = urid_map->map(urid_map->handle, QMIDIARP_LV2_PREFIX "MUTEHEX");
87     uris->pattern_string      = urid_map->map(urid_map->handle, QMIDIARP_LV2_PREFIX "ARPPATTERN");
88     uris->ui_up               = urid_map->map(urid_map->handle, QMIDIARP_LV2_PREFIX "UI_UP");
89     uris->flip_wave           = urid_map->map(urid_map->handle, QMIDIARP_LV2_PREFIX "FLIP_WAVE");
90 }
91 #endif
92