mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Use wxGetUTCTimeMillis in preference to wxGetLocalTimeMillis
For internal time-difference test, it is significantly faster, and does not suffer from daylight-saving time shifts.
This commit is contained in:
parent
0fbea5f9ea
commit
6a4663e19c
@ -5044,7 +5044,7 @@ bool AudioIoCallback::FillOutputBuffers(
|
|||||||
// wxASSERT( maxLen == toGet );
|
// wxASSERT( maxLen == toGet );
|
||||||
|
|
||||||
em.RealtimeProcessEnd();
|
em.RealtimeProcessEnd();
|
||||||
mLastPlaybackTimeMillis = ::wxGetLocalTimeMillis();
|
mLastPlaybackTimeMillis = ::wxGetUTCTimeMillis();
|
||||||
|
|
||||||
ClampBuffer( outputFloats, framesPerBuffer*numPlaybackChannels );
|
ClampBuffer( outputFloats, framesPerBuffer*numPlaybackChannels );
|
||||||
if (outputMeterFloats != outputFloats)
|
if (outputMeterFloats != outputFloats)
|
||||||
|
@ -751,7 +751,7 @@ size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers
|
|||||||
|
|
||||||
// Remember when we started so we can calculate the amount of latency we
|
// Remember when we started so we can calculate the amount of latency we
|
||||||
// are introducing
|
// are introducing
|
||||||
wxMilliClock_t start = wxGetLocalTimeMillis();
|
wxMilliClock_t start = wxGetUTCTimeMillis();
|
||||||
|
|
||||||
// Allocate the in/out buffer arrays
|
// Allocate the in/out buffer arrays
|
||||||
float **ibuf = (float **) alloca(chans * sizeof(float *));
|
float **ibuf = (float **) alloca(chans * sizeof(float *));
|
||||||
@ -798,7 +798,7 @@ size_t EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remember the latency
|
// Remember the latency
|
||||||
mRealtimeLatency = (int) (wxGetLocalTimeMillis() - start).GetValue();
|
mRealtimeLatency = (int) (wxGetUTCTimeMillis() - start).GetValue();
|
||||||
|
|
||||||
mRealtimeLock.Leave();
|
mRealtimeLock.Leave();
|
||||||
|
|
||||||
|
@ -1153,7 +1153,7 @@ VSTEffect::VSTEffect(const wxString & path, VSTEffect *master)
|
|||||||
memset(&mTimeInfo, 0, sizeof(mTimeInfo));
|
memset(&mTimeInfo, 0, sizeof(mTimeInfo));
|
||||||
mTimeInfo.samplePos = 0.0;
|
mTimeInfo.samplePos = 0.0;
|
||||||
mTimeInfo.sampleRate = 44100.0; // this is a bogus value, but it's only for the display
|
mTimeInfo.sampleRate = 44100.0; // this is a bogus value, but it's only for the display
|
||||||
mTimeInfo.nanoSeconds = wxGetLocalTimeMillis().ToDouble();
|
mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
|
||||||
mTimeInfo.tempo = 120.0;
|
mTimeInfo.tempo = 120.0;
|
||||||
mTimeInfo.timeSigNumerator = 4;
|
mTimeInfo.timeSigNumerator = 4;
|
||||||
mTimeInfo.timeSigDenominator = 4;
|
mTimeInfo.timeSigDenominator = 4;
|
||||||
@ -1390,7 +1390,7 @@ bool VSTEffect::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames W
|
|||||||
// Initialize time info
|
// Initialize time info
|
||||||
memset(&mTimeInfo, 0, sizeof(mTimeInfo));
|
memset(&mTimeInfo, 0, sizeof(mTimeInfo));
|
||||||
mTimeInfo.sampleRate = mSampleRate;
|
mTimeInfo.sampleRate = mSampleRate;
|
||||||
mTimeInfo.nanoSeconds = wxGetLocalTimeMillis().ToDouble();
|
mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
|
||||||
mTimeInfo.tempo = 120.0;
|
mTimeInfo.tempo = 120.0;
|
||||||
mTimeInfo.timeSigNumerator = 4;
|
mTimeInfo.timeSigNumerator = 4;
|
||||||
mTimeInfo.timeSigDenominator = 4;
|
mTimeInfo.timeSigDenominator = 4;
|
||||||
@ -2414,7 +2414,7 @@ void VSTEffect::NeedEditIdle(bool state)
|
|||||||
|
|
||||||
VstTimeInfo *VSTEffect::GetTimeInfo()
|
VstTimeInfo *VSTEffect::GetTimeInfo()
|
||||||
{
|
{
|
||||||
mTimeInfo.nanoSeconds = wxGetLocalTimeMillis().ToDouble();
|
mTimeInfo.nanoSeconds = wxGetUTCTimeMillis().ToDouble();
|
||||||
return &mTimeInfo;
|
return &mTimeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ enum TimeUnit {
|
|||||||
|
|
||||||
struct SeekInfo
|
struct SeekInfo
|
||||||
{
|
{
|
||||||
wxLongLong mLastSelectionAdjustment { ::wxGetLocalTimeMillis() };
|
wxLongLong mLastSelectionAdjustment { ::wxGetUTCTimeMillis() };
|
||||||
double mSeekShort{ 0.0 };
|
double mSeekShort{ 0.0 };
|
||||||
double mSeekLong{ 0.0 };
|
double mSeekLong{ 0.0 };
|
||||||
};
|
};
|
||||||
@ -183,7 +183,7 @@ void SeekWhenAudioActive(double seekStep, wxLongLong &lastSelectionAdjustment)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
lastSelectionAdjustment = ::wxGetLocalTimeMillis();
|
lastSelectionAdjustment = ::wxGetUTCTimeMillis();
|
||||||
|
|
||||||
gAudioIO->SeekStream(seekStep);
|
gAudioIO->SeekStream(seekStep);
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ void SeekLeftOrRight
|
|||||||
|
|
||||||
// If the last adjustment was very recent, we are
|
// If the last adjustment was very recent, we are
|
||||||
// holding the key down and should move faster.
|
// holding the key down and should move faster.
|
||||||
const wxLongLong curtime = ::wxGetLocalTimeMillis();
|
const wxLongLong curtime = ::wxGetUTCTimeMillis();
|
||||||
enum { MIN_INTERVAL = 50 };
|
enum { MIN_INTERVAL = 50 };
|
||||||
const bool fast =
|
const bool fast =
|
||||||
(curtime - info.mLastSelectionAdjustment < MIN_INTERVAL);
|
(curtime - info.mLastSelectionAdjustment < MIN_INTERVAL);
|
||||||
@ -379,7 +379,7 @@ void DoCursorMove(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastSelectionAdjustment = ::wxGetLocalTimeMillis();
|
lastSelectionAdjustment = ::wxGetUTCTimeMillis();
|
||||||
MoveWhenAudioInactive(project, seekStep, TIME_UNIT_SECONDS);
|
MoveWhenAudioInactive(project, seekStep, TIME_UNIT_SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
|
|||||||
|
|
||||||
// If the last adjustment was very recent, we are
|
// If the last adjustment was very recent, we are
|
||||||
// holding the key down and should move faster.
|
// holding the key down and should move faster.
|
||||||
wxLongLong curtime = ::wxGetLocalTimeMillis();
|
wxLongLong curtime = ::wxGetUTCTimeMillis();
|
||||||
int pixels = step;
|
int pixels = step;
|
||||||
if( curtime - info.mLastSelectionAdjustment < 50 )
|
if( curtime - info.mLastSelectionAdjustment < 50 )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user