1 #ifndef _TTF_H_
2 #define _TTF_H_
3 
4 /* cfg-port offsets 0,1, are midi ports, . */
5 #define ADDP_0 3
6 #define ADDP_1 4
7 #define ADDP_2 5
8 #define ADDP_3 6
9 #define ADDP_4 7
10 #define ADDP_5 8
11 #define ADDP_6 9
12 #define ADDP_7 10
13 #define ADDP_8 11
14 #define ADDP_9 12
15 #define ADDP_10 13
16 #define ADDP_11 14
17 #define ADDP_12 15
18 #define ADDP_13 16
19 #define ADDP_14 17
20 #define ADDP_15 18
21 
22 #define PORTIDX(x) ADDP_##x
23 
24 #define MAINTAINER <HTTPP/gareus.org/rgareus#me>
25 #define MIDIEXTURI <HTTPP/lv2plug.in/ns/ext/midi#MidiEvent>
26 
27 #define TTF_DEF(DOAPNAME, MODNAME, INSUPPORTS) \
28 	a lv2:Plugin, lv2:MIDIPlugin ; \
29 	doap:name DOAPNAME ; \
30 	mod:label MODNAME ; \
31 	@MODBRAND@ \
32 	@VERSION@ \
33 	doap:license <HTTPP/usefulinc.com/doap/licenses/gpl> ; \
34   lv2:project <HTTPP/gareus.org/oss/lv2/midifilter> ; \
35 	lv2:optionalFeature lv2:hardRTCapable ; \
36 	lv2:requiredFeature urid:map ; \
37 	lv2:port \
38 	[ \
39 		a atom:AtomPort , \
40 			lv2:InputPort ; \
41 		atom:bufferType atom:Sequence ; \
42 		atom:supports MIDIEXTURI INSUPPORTS; \
43 		lv2:index 0 ; \
44 		lv2:symbol "midiin" ; \
45 		lv2:name "MIDI In" \
46 	] , [ \
47 		a atom:AtomPort , \
48 			lv2:OutputPort ; \
49 		atom:bufferType atom:Sequence ; \
50 		atom:supports MIDIEXTURI ; \
51 		lv2:index 1 ; \
52 		lv2:symbol "midiout" ; \
53 		lv2:name "MIDI Out"; \
54 	] , [ \
55 		a lv2:OutputPort, \
56 			lv2:ControlPort ; \
57 		lv2:name "latency" ; \
58 		lv2:index 2 ; \
59 		lv2:symbol "latency" ; \
60 		lv2:minimum 0 ; \
61 		lv2:maximum 192000 ; \
62 		lv2:portProperty lv2:reportsLatency, lv2:integer, pprops:notOnGUI; \
63 	]
64 
65 #define TTF_DEFAULTDEF(DOAPNAME, MODNAME) TTF_DEF(DOAPNAME, MODNAME,)
66 
67 #define TTF_PORT(TYPE, IDX, SYM, DESC, VMIN, VMAX, VDFLT, ATTR) \
68 	[ \
69     a TYPE, \
70       lv2:ControlPort ; \
71     lv2:index PORTIDX(IDX) ; \
72     lv2:symbol SYM ; \
73     lv2:name DESC; \
74     lv2:minimum VMIN ; \
75     lv2:maximum VMAX ; \
76     lv2:default VDFLT; \
77     ATTR \
78   ]
79 
80 #define TTF_IPORT(IDX, SYM, DESC, VMIN, VMAX, VDFLT, ATTR) \
81 	TTF_PORT(lv2:InputPort, IDX, SYM, DESC, VMIN, VMAX, VDFLT, ATTR)
82 
83 #define TTF_IPORTFLOAT(IDX, SYM, DESC, VMIN, VMAX, VDFLT) \
84 	TTF_IPORT(IDX, SYM, DESC, VMIN, VMAX, VDFLT, )
85 
86 #define TTF_IPORTINT(IDX, SYM, DESC, VMIN, VMAX, VDFLT) \
87 	TTF_IPORT(IDX, SYM, DESC, VMIN, VMAX, VDFLT, lv2:portProperty lv2:integer)
88 
89 #define TTF_IPORTTOGGLE(IDX, SYM, DESC, VDFLT) \
90 	TTF_IPORT(IDX, SYM, DESC, 0, 1, VDFLT, lv2:portProperty lv2:integer; lv2:portProperty lv2:toggled)
91 
92 #define PORTENUM16 \
93 	lv2:scalePoint [ rdfs:label "01" ; rdf:value  1 ] ; \
94 	lv2:scalePoint [ rdfs:label "02" ; rdf:value  2 ] ; \
95 	lv2:scalePoint [ rdfs:label "03" ; rdf:value  3 ] ; \
96 	lv2:scalePoint [ rdfs:label "04" ; rdf:value  4 ] ; \
97 	lv2:scalePoint [ rdfs:label "05" ; rdf:value  5 ] ; \
98 	lv2:scalePoint [ rdfs:label "06" ; rdf:value  6 ] ; \
99 	lv2:scalePoint [ rdfs:label "07" ; rdf:value  7 ] ; \
100 	lv2:scalePoint [ rdfs:label "08" ; rdf:value  8 ] ; \
101 	lv2:scalePoint [ rdfs:label "09" ; rdf:value  9 ] ; \
102 	lv2:scalePoint [ rdfs:label "10" ; rdf:value 10 ] ; \
103 	lv2:scalePoint [ rdfs:label "11" ; rdf:value 11 ] ; \
104 	lv2:scalePoint [ rdfs:label "12" ; rdf:value 12 ] ; \
105 	lv2:scalePoint [ rdfs:label "13" ; rdf:value 13 ] ; \
106 	lv2:scalePoint [ rdfs:label "14" ; rdf:value 14 ] ; \
107 	lv2:scalePoint [ rdfs:label "15" ; rdf:value 15 ] ; \
108 	lv2:scalePoint [ rdfs:label "16" ; rdf:value 16 ] ; \
109 	lv2:portProperty lv2:integer; lv2:portProperty lv2:enumeration;
110 
111 #define SPX(LBL,VAL) \
112 	lv2:scalePoint [ rdfs:label LBL ; rdf:value VAL ] ;
113 
114 #define PORTENUMZ(ZEROLABEL) \
115 	lv2:scalePoint [ rdfs:label ZEROLABEL; rdf:value  0 ] ; \
116 	PORTENUM16
117 
118 #define DOC_CHANZ \
119 	rdfs:comment "MIDI Channel number 1..16 (0: disable channel)"
120 
121 #define DOC_CHANF \
122 	rdfs:comment "MIDI Channel (1..16) on which the filter is active; 0: any). Data on other channels is passed though unmodified."
123 
124 #define NOTENAMES \
125 	lv2:scalePoint [ rdfs:label "C"  ; rdf:value 0 ] ; \
126 	lv2:scalePoint [ rdfs:label "C#" ; rdf:value 1 ] ; \
127 	lv2:scalePoint [ rdfs:label "D"  ; rdf:value 2 ] ; \
128 	lv2:scalePoint [ rdfs:label "D#" ; rdf:value 3 ] ; \
129 	lv2:scalePoint [ rdfs:label "E"  ; rdf:value 4 ] ; \
130 	lv2:scalePoint [ rdfs:label "F"  ; rdf:value 5 ] ; \
131 	lv2:scalePoint [ rdfs:label "F#" ; rdf:value 6 ] ; \
132 	lv2:scalePoint [ rdfs:label "G"  ; rdf:value 7 ] ; \
133 	lv2:scalePoint [ rdfs:label "G#" ; rdf:value 8 ] ; \
134 	lv2:scalePoint [ rdfs:label "A"  ; rdf:value 9 ] ; \
135 	lv2:scalePoint [ rdfs:label "A#" ; rdf:value 10 ] ; \
136 	lv2:scalePoint [ rdfs:label "B"  ; rdf:value 11 ] ; \
137 	lv2:portProperty lv2:integer; lv2:portProperty lv2:enumeration;
138 
139 #define NOTENAMESOFF \
140 	lv2:scalePoint [ rdfs:label "OFF" ; rdf:value -1 ] ; \
141 	NOTENAMES
142 
143 #endif
144 
145 /* variable part */
146 
147 #ifdef MFD_FLT
148 #undef MFD_FLT
149 #endif
150 
151 #ifdef MX_FILTER
152 #define MFD_FLT(ID, FNX) \
153 	else if (!strcmp(descriptor->URI, MFP_URI "#" # FNX)) { self->filter_fn = filter_midi_ ## FNX; filter_init_ ## FNX(self); }
154 
155 #elif (defined MX_DESC)
156 
157 #define MFD_FLT(ID, FNX) \
158 	MF_DESCRIPTOR(ID, "" # FNX)
159 
160 #elif (defined MX_MANIFEST)
161 
162 #define MFD_FLT(ID, FNX) \
163   <HTTPP/gareus.org/oss/lv2/midifilterHASH ## FNX> \
164 	a lv2:Plugin ; \
165 	lv2:binary <@LV2NAME@@LIB_EXT@>  ; \
166 	rdfs:seeAlso <@LV2NAME@.ttl> . \
167 
168 #elif (defined MX_MODGUI)
169 
170 #define MFD_FLT(ID, FNX) \
171 	<HTTPP/gareus.org/oss/lv2/midifilterHASH ## FNX> \
172 	modgui:gui [ \
173 		modgui:resourcesDirectory <modgui> ; \
174 		modgui:iconTemplate <modgui/icon_DASH_ ## FNX ##_DOT_html> ; \
175 		modgui:stylesheet   <modgui/x42-style.css> ; \
176 		modgui:screenshot   <modgui/screenshot_DASH_ ## FNX ##_DOT_png> ; \
177 		modgui:thumbnail    <modgui/thumbnail_DASH_ ## FNX ##_DOT_png> ; \
178 		modgui:brand "x42" ; \
179 		modgui:label # FNX ; \
180 	].
181 
182 #else
183 
184 #define MFD_FLT(ID, FNX)
185 
186 #endif
187