diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2014-03-26 11:05:19 -0400 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2014-03-26 11:05:19 -0400 |
| commit | 6a13d5e8d8310d071d99e4ecdd240189238d6c40 (patch) | |
| tree | f1d64d71519e07e5e97448de336a1e80791c68ed /RtMidi.cpp | |
| parent | 409bb15748e6a8762d81ad4a27741f486cbd4b97 (diff) | |
ALSA openPort() fix to better distinguish sender and receiver port (from Russell Smyth).
Diffstat (limited to 'RtMidi.cpp')
| -rw-r--r-- | RtMidi.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1490,10 +1490,10 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName return; } - snd_seq_port_info_t *pinfo; - snd_seq_port_info_alloca( &pinfo ); + snd_seq_port_info_t *src_pinfo; + snd_seq_port_info_alloca( &src_pinfo ); AlsaMidiData *data = static_cast<AlsaMidiData *> (apiData_); - if ( portInfo( data->seq, pinfo, SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ, (int) portNumber ) == 0 ) { + if ( portInfo( data->seq, src_pinfo, SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ, (int) portNumber ) == 0 ) { std::ostringstream ost; ost << "MidiInAlsa::openPort: the 'portNumber' argument (" << portNumber << ") is invalid."; errorString_ = ost.str(); @@ -1502,9 +1502,11 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName } snd_seq_addr_t sender, receiver; - sender.client = snd_seq_port_info_get_client( pinfo ); - sender.port = snd_seq_port_info_get_port( pinfo ); - receiver.client = snd_seq_client_id( data->seq ); + sender.client = snd_seq_port_info_get_client( src_pinfo ); + sender.port = snd_seq_port_info_get_port( src_pinfo ); + + snd_seq_port_info_t *pinfo; + snd_seq_port_info_alloca( &pinfo ); if ( data->vport < 0 ) { snd_seq_port_info_set_client( pinfo, 0 ); snd_seq_port_info_set_port( pinfo, 0 ); @@ -1531,6 +1533,7 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName data->vport = snd_seq_port_info_get_port(pinfo); } + receiver.client = snd_seq_port_info_get_client( pinfo ); receiver.port = data->vport; if ( !data->subscription ) { |
