Ver código fonte

ALSA openPort() fix to better distinguish sender and receiver port (from Russell Smyth).

Gary Scavone 11 anos atrás
pai
commit
6a13d5e8d8
2 arquivos alterados com 10 adições e 6 exclusões
  1. 9 6
      RtMidi.cpp
  2. 1 0
      doc/release.txt

+ 9 - 6
RtMidi.cpp

@@ -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 ) {

+ 1 - 0
doc/release.txt

@@ -15,6 +15,7 @@ v2.1.0: (?? 2014)
 - updated OS-X sysex sending mechanism to use normal message sending, which fixes a problem where virtual ports didn't receive sysex messages
 - Windows update to avoid lockups when shutting down while sending/receiving sysex messages (ptarabbia)
 - OS-X fix to avoid empty messages in callbacks when ignoring sysex messages and split sysexes are received (codepainters)
+- ALSA openPort fix to better distinguish sender and receiver (Russell Smyth)
 
 v2.0.1: (26 July 2012)
 - small fixes for problems reported by Chris Arndt (scoping, preprocessor, and include)