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

Try to clarify real time / track time distinction in comments...

... Rather than the confusing old terminology of "warped" time, meaning the
real time after accounting for time track, though that persists mostly in the
names of variables now mostly used only within PlaybackSchedule.

"Track" time refers to a position in a wave track, as indexed by the time
ruler.

"Real" time is indexed by the other scale of numbers drawn in the time track,
which is drawn on the screen with nonuniform spacing (so "warped" in that
sense), but it corresponds to uniform actual time.
This commit is contained in:
Paul Licameli
2018-08-11 15:03:29 -04:00
parent 72b71bbe08
commit ce1ce688ff
2 changed files with 10 additions and 9 deletions

View File

@@ -1988,7 +1988,7 @@ int AudioIO::StartStream(const TransportTracks &tracks,
// killing performance. // killing performance.
// //
// (warped) playback time to produce with each filling of the buffers // real playback time to produce with each filling of the buffers
// by the Audio thread (except at the end of playback): // by the Audio thread (except at the end of playback):
// usually, make fillings fewer and longer for less CPU usage. // usually, make fillings fewer and longer for less CPU usage.
// But for useful scrubbing, we can't run too far ahead without checking // But for useful scrubbing, we can't run too far ahead without checking
@@ -2101,7 +2101,7 @@ int AudioIO::StartStream(const TransportTracks &tracks,
{ {
mPlaybackBuffers[i] = std::make_unique<RingBuffer>(floatSample, playbackBufferSize); mPlaybackBuffers[i] = std::make_unique<RingBuffer>(floatSample, playbackBufferSize);
// MB: use normal time for the end time, not warped time! // use track time for the end time, not real time!
WaveTrackConstArray mixTracks; WaveTrackConstArray mixTracks;
mixTracks.push_back(mPlaybackTracks[i]); mixTracks.push_back(mPlaybackTracks[i]);
@@ -3874,7 +3874,8 @@ void AudioIO::FillBuffers()
bool progress = true; bool progress = true;
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
if (mPlaybackSchedule.Interactive()) if (mPlaybackSchedule.Interactive())
// scrubbing does not use warped time and length // scrubbing and play-at-speed are not limited by the real time
// and length accumulators
frames = limitSampleBufferSize(frames, mScrubDuration); frames = limitSampleBufferSize(frames, mScrubDuration);
else else
#endif #endif
@@ -4430,7 +4431,7 @@ void AudioIO::FillMidiBuffers()
break; break;
} }
SetHasSolo(hasSolo); SetHasSolo(hasSolo);
// If we compute until mNextEventTime > current audio track time, // If we compute until mNextEventTime > current audio time,
// we would have a built-in compute-ahead of mAudioOutLatency, and // we would have a built-in compute-ahead of mAudioOutLatency, and
// it's probably good to compute MIDI when we compute audio (so when // it's probably good to compute MIDI when we compute audio (so when
// we stop, both stop about the same time). // we stop, both stop about the same time).

View File

@@ -429,7 +429,7 @@ class AUDACITY_DLL_API AudioIO final {
*/ */
static int GetOptimalSupportedSampleRate(); static int GetOptimalSupportedSampleRate();
/** \brief During playback, the (unwarped) track time most recently played /** \brief During playback, the track time most recently played
* *
* When playing looped, this will start from t0 again, * When playing looped, this will start from t0 again,
* too. So the returned time should be always between * too. So the returned time should be always between
@@ -520,7 +520,7 @@ private:
void PrepareMidiIterator(bool send = true, double offset = 0); void PrepareMidiIterator(bool send = true, double offset = 0);
bool StartPortMidiStream(); bool StartPortMidiStream();
// Compute nondecreasing time stamps, accounting for pauses, but not the // Compute nondecreasing real time stamps, accounting for pauses, but not the
// synth latency. // synth latency.
double UncorrectedMidiEventTime(); double UncorrectedMidiEventTime();
@@ -648,7 +648,7 @@ private:
std::vector< std::pair< int, int > > mPendingNotesOff; std::vector< std::pair< int, int > > mPendingNotesOff;
#endif #endif
/// Time at which the next event should be output, measured in seconds. /// Real time at which the next event should be output, measured in seconds.
/// Note that this could be a note's time+duration for note offs. /// Note that this could be a note's time+duration for note offs.
double mNextEventTime; double mNextEventTime;
/// Track of next event /// Track of next event
@@ -840,7 +840,7 @@ private:
std::atomic<double> mTime; std::atomic<double> mTime;
/// Accumulated real time (not track position), starting at zero (unlike /// Accumulated real time (not track position), starting at zero (unlike
/// mTime), and wrapping back to zero each time around looping play. /// mTime), and wrapping back to zero each time around looping play.
/// Thus, it is the length in real seconds between mT0 and mTime. /// Thus, it is the length in real seconds between mT0 and mTime.
double mWarpedTime; double mWarpedTime;
@@ -939,7 +939,7 @@ private:
// time track if one is given; result is always nonnegative // time track if one is given; result is always nonnegative
double RealDuration(double trackTime1) const; double RealDuration(double trackTime1) const;
// How much real ("warped") time left? // How much real time left?
double RealTimeRemaining() const; double RealTimeRemaining() const;
// Advance the real time position // Advance the real time position