From 77d7ed5de0306ef6e1747ceee2ab5423f40bfaa2 Mon Sep 17 00:00:00 2001 From: Devin Anderson Date: Sat, 30 Apr 2011 14:24:29 -0700 Subject: [PATCH] WinMME: Add debugging code to input events in an effort to solve latency and jitter issues. Minor change to output port error message. --- windows/winmme/JackWinMMEInputPort.cpp | 12 +++++++++++- windows/winmme/JackWinMMEOutputPort.cpp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/windows/winmme/JackWinMMEInputPort.cpp b/windows/winmme/JackWinMMEInputPort.cpp index ae4c4927..2f712189 100644 --- a/windows/winmme/JackWinMMEInputPort.cpp +++ b/windows/winmme/JackWinMMEInputPort.cpp @@ -139,7 +139,17 @@ void JackWinMMEInputPort::EnqueueMessage(DWORD timestamp, size_t length, jack_midi_data_t *data) { - jack_nframes_t frame = GetFramesFromTime(start_time + (timestamp * 1000)); + jack_nframes_t frame = + GetFramesFromTime(start_time + (((jack_time_t) timestamp) * 1000)); + + // Debugging code + jack_time_t current_time = GetMicroSeconds(); + jack_log("JackWinMMEInputPort::EnqueueMessage - enqueueing event at %f " + "(frame: %d) with start offset '%d' scheduled for frame '%d'", + ((double) current_time) / 1000.0, GetFramesFromTime(current_time), + timestamp, frame); + // End debugging code + switch (thread_queue->EnqueueEvent(frame, length, data)) { case JackMidiWriteQueue::BUFFER_FULL: jack_error("JackWinMMEInputPort::EnqueueMessage - The thread queue " diff --git a/windows/winmme/JackWinMMEOutputPort.cpp b/windows/winmme/JackWinMMEOutputPort.cpp index 1a1cb47b..7e96ef54 100644 --- a/windows/winmme/JackWinMMEOutputPort.cpp +++ b/windows/winmme/JackWinMMEOutputPort.cpp @@ -149,7 +149,7 @@ JackWinMMEOutputPort::Execute() -((LONGLONG) ((frame_time - current_time) * 10)); if (! SetWaitableTimer(timer, &due_time, 0, NULL, NULL, 0)) { WriteOSError("JackWinMMEOutputPort::Execute", - "ChangeTimerQueueTimer"); + "SetWaitableTimer"); break; }