PortAudio backend RT-safe MIDI buffer allocation
[ardour.git] / libs / backends / portaudio / winmmemidi_output_device.cc
index 89011d34d3c772151775ed8671f996dd3f7079bd..2f6ad018958120e2cdfb6aa20c2b55c29e2b22d5 100644 (file)
@@ -32,7 +32,6 @@
 
 // remove dup with input_device
 static const uint32_t MIDI_BUFFER_SIZE = 32768;
-static const uint32_t MAX_MIDI_MSG_SIZE = 256; // fix this for sysex
 static const uint32_t MAX_QUEUE_SIZE = 4096;
 
 namespace ARDOUR {
@@ -118,13 +117,7 @@ WinMMEMidiOutputDevice::close (std::string& error_msg)
 {
        // return error message for first error encountered?
        bool success = true;
-       MMRESULT result = midiOutReset (m_handle);
-       if (result != MMSYSERR_NOERROR) {
-               error_msg = get_error_string (result);
-               DEBUG_MIDI (error_msg);
-               success = false;
-       }
-       result = midiOutClose (m_handle);
+       MMRESULT result = midiOutClose (m_handle);
        if (result != MMSYSERR_NOERROR) {
                error_msg = get_error_string (result);
                DEBUG_MIDI (error_msg);
@@ -367,7 +360,7 @@ WinMMEMidiOutputDevice::midi_output_thread ()
                DEBUG_MIDI ("WinMMEMidiOut: output thread woken by semaphore\n");
 
                MidiEventHeader h (0, 0);
-               uint8_t data[MAX_MIDI_MSG_SIZE];
+               uint8_t data[MaxWinMidiEventSize];
 
                const uint32_t read_space = m_midi_buffer->read_space ();
 
@@ -381,7 +374,7 @@ WinMMEMidiOutputDevice::midi_output_thread ()
                        }
                        assert (read_space >= h.size);
 
-                       if (h.size > MAX_MIDI_MSG_SIZE) {
+                       if (h.size > MaxWinMidiEventSize) {
                                m_midi_buffer->increment_read_idx (h.size);
                                DEBUG_MIDI ("WinMMEMidiOut: MIDI event too large!\n");
                                continue;