Changeset 1877:f4c9adb1f6e7 in roaraudio
- Timestamp:
- 05/23/09 17:45:20 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/midi.c
r1876 r1877 150 150 151 151 switch (s->info.codec) { 152 case ROAR_CODEC_MIDI: 153 return midi_conv_mes2midi(id); 154 break; 152 155 default: 153 156 streams_delete(id); … … 282 285 } 283 286 287 #define _nb len++; *(d++) 284 288 int midi_conv_mes2midi (int id) { 285 return -1; 286 } 289 struct roar_stream * s; 290 struct roar_stream_server * ss; 291 struct roar_buffer * buf = g_midi_mess.buf; 292 struct midi_message * mes = NULL; 293 unsigned char data[3]; 294 unsigned char * d; 295 int len; 296 297 if ( g_streams[id] == NULL ) 298 return -1; 299 300 ROAR_DBG("midi_conv_mes2midi(id=%i) = ?", id); 301 302 s = ROAR_STREAM(ss = g_streams[id]); 303 304 while (buf != NULL) { 305 if ( roar_buffer_get_data(buf, (void**)&mes) == -1 ) { 306 return -1; 307 } 308 309 if (mes->type == MIDI_TYPE_CLOCK_TICK || mes->type == MIDI_TYPE_CLOCK_START || mes->type == MIDI_TYPE_CLOCK_STOP ) { 310 if ( stream_vio_s_write(ss, &(mes->type), 1) != 1 ) { 311 streams_delete(id); 312 return -1; 313 } 314 } else { 315 len = 0; 316 d = data; 317 318 _nb = (mes->type & 0xF0) | (mes->channel & 0x0F); 319 320 switch (mes->type) { 321 case MIDI_TYPE_NOTE_ON: 322 case MIDI_TYPE_NOTE_OFF: 323 case MIDI_TYPE_PA: 324 case MIDI_TYPE_CONTROLER: 325 _nb = mes->kk; 326 _nb = mes->vv; 327 break; 328 case MIDI_TYPE_PROGRAM: 329 case MIDI_TYPE_MA: 330 _nb = mes->vv; 331 break; 332 case MIDI_TYPE_PB: 333 case MIDI_TYPE_SYSEX: 334 break; 335 } 336 337 if ( stream_vio_s_write(ss, data, len) != len ) { 338 streams_delete(id); 339 return -1; 340 } 341 } 342 343 if ( roar_buffer_get_next(buf, &buf) == -1 ) 344 buf = NULL; 345 } 346 347 return 0; 348 } 349 #undef _nb 287 350 288 351 int midi_new_bufmes (struct roar_buffer ** buf, struct midi_message ** mes) {
Note: See TracChangeset
for help on using the changeset viewer.