13
0

add more debugging to portaudio/MME MIDI backend

This commit is contained in:
Paul Davis 2015-10-06 11:01:58 -04:00
parent 8431d102b9
commit 89156be67a

View File

@ -360,14 +360,19 @@ WinMMEMidiOutputDevice::midi_output_thread ()
while (!m_thread_quit) {
if (!wait (m_queue_semaphore)) {
DEBUG_MIDI ("WinMMEMidiOut: output thread waiting for semaphore failed\n");
break;
}
DEBUG_MIDI ("WinMMEMidiOut: output thread woken by semaphore\n");
MidiEventHeader h (0, 0);
uint8_t data[MAX_MIDI_MSG_SIZE];
const uint32_t read_space = m_midi_buffer->read_space ();
DEBUG_MIDI (string_compose ("WinMMEMidiOut: total readable MIDI data %1\n", read_space));
if (read_space > sizeof(MidiEventHeader)) {
if (m_midi_buffer->read ((uint8_t*)&h, sizeof(MidiEventHeader)) !=
sizeof(MidiEventHeader)) {
@ -425,6 +430,8 @@ WinMMEMidiOutputDevice::midi_output_thread ()
((double)(current_time - h.time)) / 1000.0));
}
DEBUG_MIDI (string_compose ("WinMMEMidiOut: MIDI event size: %1 time %2 now %3\n", h.size, h.time, current_time));
DWORD message = 0;
MMRESULT result;
switch (h.size) {
@ -466,7 +473,11 @@ WinMMEMidiOutputDevice::midi_output_thread ()
// Sysex messages may be sent synchronously or asynchronously. The
// choice is up to the WinMME driver. So, we wait until the message is
// sent, regardless of the driver's choice.
DEBUG_MIDI ("WinMMEMidiOut: wait for sysex semaphore\n");
if (!wait (m_sysex_semaphore)) {
DEBUG_MIDI ("WinMMEMidiOut: wait for sysex semaphore - failed!\n");
break;
}