32 #define RTOSC_INVALID_MIDI 255
52 template<
int len,
int elms>
55 std::array<MidiAddr<len>,elms>
table;
73 bool has(uint8_t ch, uint8_t ctl)
const
76 if(e.ch == ch && e.ctl == ctl)
85 if(e.ch==ch && e.ctl == ctl)
93 if(e.ch==ch && e.ctl == ctl)
100 const char *args = index(port.
name,
':');
103 if(index(args,
'f')) {
108 *end = index(start,
':');
114 }
else if(index(args,
'i'))
116 else if(index(args,
'T'))
123 void addElm(uint8_t ch, uint8_t ctl,
const char *path)
127 if(!port || port->
ports) {
133 strncpy(e->path,path,len);
137 error_cb(
"Failed to read metadata", path);
146 strncpy(e.path,path,len);
150 error_cb(
"Failed to read metadata", path);
168 if(strlen(s) > len) {
176 void process(uint8_t ch, uint8_t ctl, uint8_t val)
199 (val<64 ?
"F" :
"T"));
209 float x = val!=64.0 ? val/127.0 : 0.5;
214 while(*meta && *meta !=
',' && pos < 3)
215 shape[pos++] = *meta++;
219 while(*meta && *meta!=
',') meta++; meta++;
220 float min = atof(meta);
221 while(*meta && *meta!=
',') meta++; meta++;
222 float max = atof(meta);
226 if(!strcmp(
"lin",shape))
227 return x*(max-min)+min;
228 else if(!strcmp(
"log", shape)) {
229 const float b = log(min);
230 const float a = log(max)-b;