diff options
| author | garyscavone <garyscavone@users.noreply.github.com> | 2016-02-03 13:13:51 -0500 |
|---|---|---|
| committer | garyscavone <garyscavone@users.noreply.github.com> | 2016-02-03 13:13:51 -0500 |
| commit | 109edc86fee6153f97a0a4e0fb63b3971a6bb30c (patch) | |
| tree | 51c82ea03395bf93d94077f1fc91da27fa0cb39b | |
| parent | 28321c051ed849b0fbd1f7b1aaee19b8ca807390 (diff) | |
| parent | 74c92f7c9b93415650d7d449c7d0a5de0e803b26 (diff) | |
Merge pull request #57 from szymonkaliski/fix/virtual-ports-close
fix virtual ports closing in OSX
| -rw-r--r-- | RtMidi.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -667,11 +667,17 @@ void MidiInCore :: openVirtualPort( const std::string portName ) void MidiInCore :: closePort( void ) { - if ( connected_ ) { - CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); + CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); + + if ( data->endpoint ) { + MIDIEndpointDispose( data->endpoint ); + } + + if ( data->port ) { MIDIPortDispose( data->port ); - connected_ = false; } + + connected_ = false; } unsigned int MidiInCore :: getPortCount() @@ -956,11 +962,17 @@ void MidiOutCore :: openPort( unsigned int portNumber, const std::string portNam void MidiOutCore :: closePort( void ) { - if ( connected_ ) { - CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); + CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); + + if ( data->endpoint ) { + MIDIEndpointDispose( data->endpoint ); + } + + if ( data->port ) { MIDIPortDispose( data->port ); - connected_ = false; } + + connected_ = false; } void MidiOutCore :: openVirtualPort( std::string portName ) |
