Audacity 3.2.0
|
#include <PlaybackSchedule.h>
Classes | |
class | TimeQueue |
Public Member Functions | |
PlaybackPolicy & | GetPolicy () |
const PlaybackPolicy & | GetPolicy () const |
void | Init (double t0, double t1, const AudioIOStartStreamOptions &options, const RecordingSchedule *pRecordingSchedule) |
double | ComputeWarpedLength (double t0, double t1) const |
Compute signed duration (in seconds at playback) of the specified region of the track. More... | |
double | SolveWarpedLength (double t0, double length) const |
Compute how much unwarped time must have elapsed if length seconds of warped time has elapsed, and add to t0. More... | |
bool | ReversedTime () const |
True if the end time is before the start time. More... | |
double | GetSequenceTime () const |
Get current track time value, unadjusted. More... | |
void | SetSequenceTime (double time) |
Set current track time value, unadjusted. More... | |
void | ResetMode () |
double | RealDuration (double trackTime1) const |
double | RealDurationSigned (double trackTime1) const |
double | RealTimeRemaining () const |
void | RealTimeAdvance (double increment) |
void | RealTimeInit (double trackTime) |
void | RealTimeRestart () |
Public Attributes | |
double | mT0 |
Playback starts at offset of mT0, which is measured in seconds. More... | |
double | mT1 |
Playback ends at offset of mT1, which is measured in seconds. Note that mT1 may be less than mT0 during scrubbing. More... | |
std::atomic< double > | mTime |
double | mWarpedTime |
double | mWarpedLength |
const BoundedEnvelope * | mEnvelope |
class AUDIO_IO_API PlaybackSchedule::TimeQueue | mTimeQueue |
Private Attributes | |
std::unique_ptr< PlaybackPolicy > | mpPlaybackPolicy |
std::atomic< bool > | mPolicyValid { false } |
Definition at line 160 of file PlaybackSchedule.h.
double PlaybackSchedule::ComputeWarpedLength | ( | double | t0, |
double | t1 | ||
) | const |
Compute signed duration (in seconds at playback) of the specified region of the track.
Takes a region of the time track (specified by the unwarped time points in the project), and calculates how long it will actually take to play this region back, taking the time track's warping effects into account.
t0 | unwarped time to start calculation from |
t1 | unwarped time to stop calculation at |
t0 > t1
Definition at line 207 of file PlaybackSchedule.cpp.
References Envelope::IntegralOfInverse(), and mEnvelope.
Referenced by anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Initialize(), and RealDurationSigned().
PlaybackPolicy & PlaybackSchedule::GetPolicy | ( | ) |
Definition at line 154 of file PlaybackSchedule.cpp.
References mPolicyValid, and mpPlaybackPolicy.
Referenced by AudioIO::AllocateBuffers(), AudioIO::AudioThread(), AudioIoCallback::CallbackCheckCompletion(), AudioIoCallback::CallbackDoSeek(), AudioIoCallback::DrainInputBuffers(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::FillOtherBuffers(), AudioIoCallback::FillOutputBuffers(), GetPolicy(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), AudioIO::ProcessPlaybackSlices(), PlaybackSchedule::TimeQueue::Producer(), AudioIO::StartStream(), AudioIO::StartStreamCleanup(), and AudioIO::StopStream().
const PlaybackPolicy & PlaybackSchedule::GetPolicy | ( | ) | const |
Definition at line 163 of file PlaybackSchedule.cpp.
References GetPolicy().
|
inline |
Get current track time value, unadjusted.
Returns a time in seconds.
Definition at line 324 of file PlaybackSchedule.h.
Referenced by PlaybackPolicy::Done(), DefaultPlaybackPolicy::Done(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Done(), AudioIoCallback::DrainInputBuffers(), AudioIO::GetStreamTime(), AudioIO::IsCapturing(), PlaybackPolicy::OffsetSequenceTime(), DefaultPlaybackPolicy::OffsetSequenceTime(), and AudioIO::StartStream().
void PlaybackSchedule::Init | ( | double | t0, |
double | t1, | ||
const AudioIOStartStreamOptions & | options, | ||
const RecordingSchedule * | pRecordingSchedule | ||
) |
Definition at line 168 of file PlaybackSchedule.cpp.
References AudioIOStartStreamOptions::envelope, mEnvelope, RecordingSchedule::mLatencyCorrection, mPolicyValid, mpPlaybackPolicy, RecordingSchedule::mPreRoll, mT0, mT1, mWarpedLength, mWarpedTime, AudioIOStartStreamOptions::policyFactory, RealDuration(), and SetSequenceTime().
Referenced by AudioIO::StartStream().
double PlaybackSchedule::RealDuration | ( | double | trackTime1 | ) | const |
Definition at line 223 of file PlaybackSchedule.cpp.
References RealDurationSigned().
Referenced by Init(), DefaultPlaybackPolicy::RepositionPlayback(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
double PlaybackSchedule::RealDurationSigned | ( | double | trackTime1 | ) | const |
Definition at line 228 of file PlaybackSchedule.cpp.
References ComputeWarpedLength(), and mT0.
Referenced by RealDuration(), and RealTimeInit().
void PlaybackSchedule::RealTimeAdvance | ( | double | increment | ) |
Definition at line 238 of file PlaybackSchedule.cpp.
References mWarpedTime.
Referenced by PlaybackPolicy::GetPlaybackSlice(), and DefaultPlaybackPolicy::GetPlaybackSlice().
void PlaybackSchedule::RealTimeInit | ( | double | trackTime | ) |
Definition at line 243 of file PlaybackSchedule.cpp.
References mWarpedTime, and RealDurationSigned().
Referenced by PlaybackPolicy::OffsetSequenceTime(), DefaultPlaybackPolicy::OffsetSequenceTime(), and DefaultPlaybackPolicy::RepositionPlayback().
double PlaybackSchedule::RealTimeRemaining | ( | ) | const |
Definition at line 233 of file PlaybackSchedule.cpp.
References mWarpedLength, and mWarpedTime.
Referenced by PlaybackPolicy::GetPlaybackSlice(), DefaultPlaybackPolicy::GetPlaybackSlice(), and DefaultPlaybackPolicy::RepositionPlayback().
void PlaybackSchedule::RealTimeRestart | ( | ) |
Definition at line 248 of file PlaybackSchedule.cpp.
References mWarpedTime.
Referenced by DefaultPlaybackPolicy::RepositionPlayback().
|
inline |
Definition at line 332 of file PlaybackSchedule.h.
Referenced by AudioIO::StartStream(), and AudioIO::StopStream().
|
inline |
True if the end time is before the start time.
Definition at line 315 of file PlaybackSchedule.h.
Referenced by PlaybackPolicy::AdvancedTrackTime(), DefaultPlaybackPolicy::AdvancedTrackTime(), PlaybackPolicy::Done(), and DefaultPlaybackPolicy::Done().
|
inline |
Set current track time value, unadjusted.
Definition at line 329 of file PlaybackSchedule.h.
Referenced by AudioIoCallback::CallbackDoSeek(), Init(), AudioIO::StartStream(), and AudioIoCallback::UpdateTimePosition().
double PlaybackSchedule::SolveWarpedLength | ( | double | t0, |
double | length | ||
) | const |
Compute how much unwarped time must have elapsed if length seconds of warped time has elapsed, and add to t0.
t0 | The unwarped time (seconds from project start) at which to start |
length | How many seconds of real time went past; signed |
Definition at line 215 of file PlaybackSchedule.cpp.
References mEnvelope, and Envelope::SolveIntegralOfInverse().
Referenced by PlaybackPolicy::AdvancedTrackTime(), DefaultPlaybackPolicy::AdvancedTrackTime(), and anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::AdvancedTrackTime().
const BoundedEnvelope* PlaybackSchedule::mEnvelope |
Definition at line 189 of file PlaybackSchedule.h.
Referenced by PlaybackPolicy::AdvancedTrackTime(), DefaultPlaybackPolicy::AdvancedTrackTime(), ComputeWarpedLength(), Init(), PlaybackPolicy::MixerWarpOptions(), SolveWarpedLength(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
|
private |
Definition at line 358 of file PlaybackSchedule.h.
Referenced by GetPolicy(), and Init().
|
private |
Definition at line 357 of file PlaybackSchedule.h.
Referenced by GetPolicy(), and Init().
double PlaybackSchedule::mT0 |
Playback starts at offset of mT0, which is measured in seconds.
Definition at line 162 of file PlaybackSchedule.h.
Referenced by DefaultPlaybackPolicy::AdvancedTrackTime(), AudioIO::AllocateBuffers(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::ComputeOtherTimings(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::FillOtherBuffers(), Init(), DefaultPlaybackPolicy::Initialize(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Initialize(), ScrubbingPlaybackPolicy::Initialize(), AudioIO::IsCapturing(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::MidiLoopOffset(), PlaybackPolicy::OffsetSequenceTime(), DefaultPlaybackPolicy::OffsetSequenceTime(), RealDurationSigned(), DefaultPlaybackPolicy::RepositionPlayback(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::StartPortMidiStream(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
double PlaybackSchedule::mT1 |
Playback ends at offset of mT1, which is measured in seconds. Note that mT1 may be less than mT0 during scrubbing.
Definition at line 164 of file PlaybackSchedule.h.
Referenced by PlaybackPolicy::AdvancedTrackTime(), DefaultPlaybackPolicy::AdvancedTrackTime(), PlaybackPolicy::Done(), DefaultPlaybackPolicy::Done(), anonymous_namespace{MIDIPlay.h}::Iterator::GetNextEvent(), Init(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Initialize(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::MidiLoopOffset(), PlaybackPolicy::OffsetSequenceTime(), DefaultPlaybackPolicy::OffsetSequenceTime(), and DefaultPlaybackPolicy::RepositionPlayback().
std::atomic<double> PlaybackSchedule::mTime |
Current track time position during playback, in seconds. Initialized by the main thread but updated by worker threads during playback or recording, and periodically reread by the main thread for purposes such as display update.
Definition at line 169 of file PlaybackSchedule.h.
class AUDIO_IO_API PlaybackSchedule::TimeQueue PlaybackSchedule::mTimeQueue |
Referenced by AudioIO::AllocateBuffers(), AudioIoCallback::CallbackDoSeek(), AudioIO::ProcessPlaybackSlices(), DefaultPlaybackPolicy::RepositionPlayback(), DefaultPlaybackPolicy::RevertToOldDefault(), AudioIO::StartStream(), AudioIO::StartStreamCleanup(), AudioIO::StopStream(), and AudioIoCallback::UpdateTimePosition().
double PlaybackSchedule::mWarpedLength |
Real length to be played (if looping, for each pass) after warping via a time track, computed just once when starting the stream. Length in real seconds between mT0 and mT1. Always positive.
Definition at line 179 of file PlaybackSchedule.h.
Referenced by Init(), RealTimeRemaining(), DefaultPlaybackPolicy::RepositionPlayback(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
double PlaybackSchedule::mWarpedTime |
Accumulated real time (not track position), starting at zero (unlike mTime), and wrapping back to zero each time around looping play. Thus, it is the length in real seconds between mT0 and mTime.
Definition at line 174 of file PlaybackSchedule.h.
Referenced by DefaultPlaybackPolicy::GetPlaybackSlice(), Init(), RealTimeAdvance(), RealTimeInit(), RealTimeRemaining(), and RealTimeRestart().