1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

A not-harmful change to MIDI timing for Windows and Mac...

... and hoping it is positively helpful for Linux.

In AudioIO::MidiTime(), compute one of the terms by different means.

Use PaStreamInfo::outputLatency.

Do not use the difference of PaStreamCallbackTimeInfo::outputBufferDacTime
and PaStreamCallbackTimeInfo::currentTime.

Which debugging shows is very nearly the same value for Windows and Mac.

But we suspect the PaStreamCallbackTimeInfo fields are not correctly reported
on Linux.
This commit is contained in:
Paul Licameli
2017-08-27 03:26:44 -04:00
parent faa7d1828a
commit 582e574ab8
2 changed files with 45 additions and 14 deletions

View File

@@ -528,20 +528,27 @@ private:
// MIDI_PLAYBACK:
PmStream *mMidiStream;
PmError mLastPmError;
/// Latency value for PortMidi
long mMidiLatency;
PaTime mMidiTimeCorrection; // seconds
/// Latency of MIDI synthesizer
long mSynthLatency;
long mSynthLatency; // ms
// These fields are used to synchronize MIDI with audio:
/// PortAudio's clock time
volatile double mAudioCallbackClockTime;
/// PortAudio's currentTime -- its origin is unspecified! So that's why
/// we also record the above
/// PRL: no longer using the next two because they are not reliably
/// reported to the audio callback on Linux.
/// Compute the approximate difference of them by other means now:
/// use PaStreamInfo::outputLatency.
/*
/// PortAudio's currentTime -- its origin is unspecified!
volatile double mAudioCallbackOutputCurrentTime;
/// PortAudio's outTime
volatile double mAudioCallbackOutputDacTime;
*/
/// Number of frames output, including pauses
volatile long mNumFrames;
/// How many frames of zeros were output due to pauses?