395 | | switch(p->getDataType()) { |
---|
396 | | default: |
---|
397 | | debugError("bad type: %d\n", p->getDataType()); |
---|
398 | | return -1; |
---|
399 | | case Port::E_MidiEvent: |
---|
400 | | { |
---|
401 | | quadlet_t *buffer=(quadlet_t *)(p->getBufferAddress()); |
---|
402 | | |
---|
403 | | assert(nevents + offset <= p->getBufferSize()); |
---|
404 | | |
---|
405 | | buffer+=offset; |
---|
406 | | |
---|
407 | | // clear |
---|
408 | | memset(buffer, 0, nevents * 4); |
---|
409 | | |
---|
410 | | // assumes that dbc%8 == 0, which is always true if data points to the |
---|
411 | | // start of a packet in blocking mode |
---|
412 | | // midi events that belong to the same time mpx-ed block should all be |
---|
413 | | // timed at the SYT timestamp of the packet. This basically means that they |
---|
414 | | // all correspond to the first audio frame in the packet. |
---|
415 | | for(j = location; j < nevents; j += 8) { |
---|
416 | | target_event=(quadlet_t *)(data + ((j * m_dimension) + position)); |
---|
417 | | sample_int=ntohl(*target_event); |
---|
418 | | // FIXME: this assumes that 2X and 3X speed isn't used, |
---|
419 | | // because only the 1X slot is put into the ringbuffer |
---|
420 | | if(IEC61883_AM824_GET_LABEL(sample_int) != IEC61883_AM824_LABEL_MIDI_NO_DATA) { |
---|
421 | | sample_int=(sample_int >> 16) & 0x000000FF; |
---|
422 | | sample_int |= 0x01000000; // flag that there is a midi event present |
---|
423 | | *buffer = sample_int; |
---|
424 | | } |
---|
425 | | buffer += 8; // skip 8 frames |
---|
426 | | } |
---|
427 | | } |
---|
428 | | break; |
---|
| 395 | quadlet_t *buffer=(quadlet_t *)(p->getBufferAddress()); |
---|
| 396 | |
---|
| 397 | assert(nevents + offset <= p->getBufferSize()); |
---|
| 398 | |
---|
| 399 | buffer+=offset; |
---|
| 400 | |
---|
| 401 | // clear |
---|
| 402 | memset(buffer, 0, nevents * 4); |
---|
| 403 | |
---|
| 404 | // assumes that dbc%8 == 0, which is always true if data points to the |
---|
| 405 | // start of a packet in blocking mode |
---|
| 406 | // midi events that belong to the same time mpx-ed block should all be |
---|
| 407 | // timed at the SYT timestamp of the packet. This basically means that they |
---|
| 408 | // all correspond to the first audio frame in the packet. |
---|
| 409 | for(j = location; j < nevents; j += 8) { |
---|
| 410 | target_event=(quadlet_t *)(data + ((j * m_dimension) + position)); |
---|
| 411 | sample_int=ntohl(*target_event); |
---|
| 412 | // FIXME: this assumes that 2X and 3X speed isn't used, |
---|
| 413 | // because only the 1X slot is put into the ringbuffer |
---|
| 414 | if(IEC61883_AM824_GET_LABEL(sample_int) != IEC61883_AM824_LABEL_MIDI_NO_DATA) { |
---|
| 415 | sample_int=(sample_int >> 16) & 0x000000FF; |
---|
| 416 | sample_int |= 0x01000000; // flag that there is a midi event present |
---|
| 417 | *buffer = sample_int; |
---|
| 418 | } |
---|
| 419 | buffer += 8; // skip 8 frames |
---|