diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2014-11-03 15:59:42 -0500 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2014-11-03 15:59:42 -0500 |
| commit | c39bb17ab47499fc9827abc100b94fb8c71715ed (patch) | |
| tree | 84e26bf0ffefdfc81f4b816a603ac25158a95410 | |
| parent | bde543abbf4b22eaf5b250c81761d984ce9060e6 (diff) | |
Changed firstErrorOccurred to be class variable; Fix to ALSA input receiver id.
| -rw-r--r-- | RtMidi.cpp | 17 | ||||
| -rw-r--r-- | RtMidi.h | 1 |
2 files changed, 13 insertions, 5 deletions
@@ -241,16 +241,15 @@ void MidiApi :: setErrorCallback( RtMidiErrorCallback errorCallback, void *userD void MidiApi :: error( RtMidiError::Type type, std::string errorString ) { if ( errorCallback_ ) { - static bool firstErrorOccured = false; - if ( firstErrorOccured ) + if ( firstErrorOccured_ ) return; - firstErrorOccured = true; + firstErrorOccured_ = true; const std::string errorMessage = errorString; errorCallback_( type, errorMessage, errorCallbackUserData_); - firstErrorOccured = false; + firstErrorOccured_ = false; return; } @@ -1472,6 +1471,7 @@ void MidiInAlsa :: openPort( unsigned int portNumber, const std::string portName snd_seq_addr_t sender, receiver; sender.client = snd_seq_port_info_get_client( src_pinfo ); sender.port = snd_seq_port_info_get_port( src_pinfo ); + receiver.client = snd_seq_client_id( data->seq ); snd_seq_port_info_t *pinfo; snd_seq_port_info_alloca( &pinfo ); @@ -1501,7 +1501,6 @@ 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 ) { @@ -2263,6 +2262,14 @@ std::string MidiOutWinMM :: getPortName( unsigned int portNumber ) stringName = std::string( deviceCaps.szPname ); #endif + // Next lines added to add the portNumber to the name so that + // the device's names are sure to be listed with individual names + // even when they have the same brand name + std::ostringstream os; + os << " "; + os << portNumber; + stringName += os.str(); + return stringName; } @@ -460,6 +460,7 @@ protected: bool connected_; std::string errorString_; RtMidiErrorCallback errorCallback_; + bool firstErrorOccurred_; void *errorCallbackUserData_; }; |
