summaryrefslogtreecommitdiff
path: root/RtMidi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'RtMidi.cpp')
-rw-r--r--RtMidi.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/RtMidi.cpp b/RtMidi.cpp
index ce6db63..4beaec9 100644
--- a/RtMidi.cpp
+++ b/RtMidi.cpp
@@ -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 )