summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaryscavone <garyscavone@users.noreply.github.com>2016-02-03 16:05:14 -0500
committergaryscavone <garyscavone@users.noreply.github.com>2016-02-03 16:05:14 -0500
commit447308a38f22211910439b6c7483aba7862d3f0e (patch)
tree51989ba6fa1107b708387ad9719c12732cf48b53
parent7b6ed715587f3390fb4ef6b3eb532a630b5d1e7c (diff)
parent6a06b40251823c27aa444979829621baef1ad433 (diff)
Merge pull request #46 from hard-mode/master
Always allocate JACK ringbuffers.
-rw-r--r--RtMidi.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/RtMidi.cpp b/RtMidi.cpp
index 4beaec9..782789e 100644
--- a/RtMidi.cpp
+++ b/RtMidi.cpp
@@ -2690,6 +2690,10 @@ void MidiOutJack :: connect()
JackMidiData *data = static_cast<JackMidiData *> (apiData_);
if ( data->client )
return;
+
+ // Initialize output ringbuffers
+ data->buffSize = jack_ringbuffer_create( JACK_RINGBUFFER_SIZE );
+ data->buffMessage = jack_ringbuffer_create( JACK_RINGBUFFER_SIZE );
// Initialize JACK client
if (( data->client = jack_client_open( clientName.c_str(), JackNoStartServer, NULL )) == 0) {
@@ -2699,8 +2703,6 @@ void MidiOutJack :: connect()
}
jack_set_process_callback( data->client, jackProcessOut, data );
- data->buffSize = jack_ringbuffer_create( JACK_RINGBUFFER_SIZE );
- data->buffMessage = jack_ringbuffer_create( JACK_RINGBUFFER_SIZE );
jack_activate( data->client );
}
@@ -2708,12 +2710,12 @@ MidiOutJack :: ~MidiOutJack()
{
JackMidiData *data = static_cast<JackMidiData *> (apiData_);
closePort();
-
+
+ // Cleanup
+ jack_ringbuffer_free( data->buffSize );
+ jack_ringbuffer_free( data->buffMessage );
if ( data->client ) {
- // Cleanup
jack_client_close( data->client );
- jack_ringbuffer_free( data->buffSize );
- jack_ringbuffer_free( data->buffMessage );
}
delete data;