Mercurial > hg > svcore
comparison data/midi/rtmidi/RtMidi.cpp @ 1450:a12fd0456f0c streaming-csv-writer
Merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 17 Apr 2018 10:35:42 +0100 |
parents | 48e9f538e6e9 |
children |
comparison
equal
deleted
inserted
replaced
1449:deabf9fd3d28 | 1450:a12fd0456f0c |
---|---|
1224 | 1224 |
1225 case SND_SEQ_EVENT_SENSING: // Active sensing | 1225 case SND_SEQ_EVENT_SENSING: // Active sensing |
1226 if ( !( data->ignoreFlags & 0x04 ) ) doDecode = true; | 1226 if ( !( data->ignoreFlags & 0x04 ) ) doDecode = true; |
1227 break; | 1227 break; |
1228 | 1228 |
1229 case SND_SEQ_EVENT_SYSEX: | 1229 case SND_SEQ_EVENT_SYSEX: |
1230 if ( (data->ignoreFlags & 0x01) ) break; | 1230 if ( (data->ignoreFlags & 0x01) ) break; |
1231 if ( ev->data.ext.len > apiData->bufferSize ) { | 1231 if ( ev->data.ext.len > apiData->bufferSize ) { |
1232 apiData->bufferSize = ev->data.ext.len; | 1232 apiData->bufferSize = ev->data.ext.len; |
1233 free( buffer ); | 1233 free( buffer ); |
1234 buffer = (unsigned char *) malloc( apiData->bufferSize ); | 1234 buffer = (unsigned char *) malloc( apiData->bufferSize ); |
1236 data->doInput = false; | 1236 data->doInput = false; |
1237 std::cerr << "\nMidiInAlsa::alsaMidiHandler: error resizing buffer memory!\n\n"; | 1237 std::cerr << "\nMidiInAlsa::alsaMidiHandler: error resizing buffer memory!\n\n"; |
1238 break; | 1238 break; |
1239 } | 1239 } |
1240 } | 1240 } |
1241 doDecode = true; | |
1242 break; | |
1241 | 1243 |
1242 default: | 1244 default: |
1243 doDecode = true; | 1245 doDecode = true; |
1244 } | 1246 } |
1245 | 1247 |
1571 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); | 1573 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); |
1572 if ( data->vport < 0 ) { | 1574 if ( data->vport < 0 ) { |
1573 snd_seq_port_info_t *pinfo; | 1575 snd_seq_port_info_t *pinfo; |
1574 snd_seq_port_info_alloca( &pinfo ); | 1576 snd_seq_port_info_alloca( &pinfo ); |
1575 snd_seq_port_info_set_capability( pinfo, | 1577 snd_seq_port_info_set_capability( pinfo, |
1576 SND_SEQ_PORT_CAP_WRITE | | 1578 SND_SEQ_PORT_CAP_WRITE | |
1577 SND_SEQ_PORT_CAP_SUBS_WRITE ); | 1579 SND_SEQ_PORT_CAP_SUBS_WRITE ); |
1578 snd_seq_port_info_set_type( pinfo, | 1580 snd_seq_port_info_set_type( pinfo, |
1579 SND_SEQ_PORT_TYPE_MIDI_GENERIC | | 1581 SND_SEQ_PORT_TYPE_MIDI_GENERIC | |
1580 SND_SEQ_PORT_TYPE_APPLICATION ); | 1582 SND_SEQ_PORT_TYPE_APPLICATION ); |
1581 snd_seq_port_info_set_midi_channels(pinfo, 16); | 1583 snd_seq_port_info_set_midi_channels(pinfo, 16); |
1582 #ifndef AVOID_TIMESTAMPING | 1584 #ifndef AVOID_TIMESTAMPING |
1583 snd_seq_port_info_set_timestamping(pinfo, 1); | 1585 snd_seq_port_info_set_timestamping(pinfo, 1); |
1584 snd_seq_port_info_set_timestamp_real(pinfo, 1); | 1586 snd_seq_port_info_set_timestamp_real(pinfo, 1); |
1585 snd_seq_port_info_set_timestamp_queue(pinfo, data->queue_id); | 1587 snd_seq_port_info_set_timestamp_queue(pinfo, data->queue_id); |
1687 int result1 = snd_seq_open( &seq, "default", SND_SEQ_OPEN_OUTPUT, SND_SEQ_NONBLOCK ); | 1689 int result1 = snd_seq_open( &seq, "default", SND_SEQ_OPEN_OUTPUT, SND_SEQ_NONBLOCK ); |
1688 if ( result1 < 0 ) { | 1690 if ( result1 < 0 ) { |
1689 errorString_ = "MidiOutAlsa::initialize: error creating ALSA sequencer client object."; | 1691 errorString_ = "MidiOutAlsa::initialize: error creating ALSA sequencer client object."; |
1690 error( RtMidiError::DRIVER_ERROR, errorString_ ); | 1692 error( RtMidiError::DRIVER_ERROR, errorString_ ); |
1691 return; | 1693 return; |
1692 } | 1694 } |
1693 | 1695 |
1694 // Set client name. | 1696 // Set client name. |
1695 snd_seq_set_client_name( seq, clientName.c_str() ); | 1697 snd_seq_set_client_name( seq, clientName.c_str() ); |
1696 | 1698 |
1697 // Save our api-specific connection information. | 1699 // Save our api-specific connection information. |
1720 apiData_ = (void *) data; | 1722 apiData_ = (void *) data; |
1721 } | 1723 } |
1722 | 1724 |
1723 unsigned int MidiOutAlsa :: getPortCount() | 1725 unsigned int MidiOutAlsa :: getPortCount() |
1724 { | 1726 { |
1725 snd_seq_port_info_t *pinfo; | 1727 snd_seq_port_info_t *pinfo; |
1726 snd_seq_port_info_alloca( &pinfo ); | 1728 snd_seq_port_info_alloca( &pinfo ); |
1727 | 1729 |
1728 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); | 1730 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); |
1729 return portInfo( data->seq, pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, -1 ); | 1731 return portInfo( data->seq, pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, -1 ); |
1730 } | 1732 } |
1731 | 1733 |
1770 errorString_ = "MidiOutAlsa::openPort: no MIDI output sources found!"; | 1772 errorString_ = "MidiOutAlsa::openPort: no MIDI output sources found!"; |
1771 error( RtMidiError::NO_DEVICES_FOUND, errorString_ ); | 1773 error( RtMidiError::NO_DEVICES_FOUND, errorString_ ); |
1772 return; | 1774 return; |
1773 } | 1775 } |
1774 | 1776 |
1775 snd_seq_port_info_t *pinfo; | 1777 snd_seq_port_info_t *pinfo; |
1776 snd_seq_port_info_alloca( &pinfo ); | 1778 snd_seq_port_info_alloca( &pinfo ); |
1777 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); | 1779 AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); |
1778 if ( portInfo( data->seq, pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, (int) portNumber ) == 0 ) { | 1780 if ( portInfo( data->seq, pinfo, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, (int) portNumber ) == 0 ) { |
1779 std::ostringstream ost; | 1781 std::ostringstream ost; |
1780 ost << "MidiOutAlsa::openPort: the 'portNumber' argument (" << portNumber << ") is invalid."; | 1782 ost << "MidiOutAlsa::openPort: the 'portNumber' argument (" << portNumber << ") is invalid."; |
1781 errorString_ = ost.str(); | 1783 errorString_ = ost.str(); |