Audacity 3.2.0
|
#include <PlaybackSchedule.h>
Classes | |
struct | SlotData |
Public Member Functions | |
NewDefaultPlaybackPolicy (AudacityProject &project, double trackEndTime, double loopEndTime, bool loopEnabled, bool variableSpeed) | |
~NewDefaultPlaybackPolicy () override | |
void | Initialize (PlaybackSchedule &schedule, double rate) override |
Called before starting an audio stream. More... | |
Mixer::WarpOptions | MixerWarpOptions (PlaybackSchedule &schedule) override |
Options to use when constructing mixers for each playback track. More... | |
BufferTimes | SuggestedBufferTimes (PlaybackSchedule &schedule) override |
Provide hints for construction of playback RingBuffer objects. More... | |
bool | Done (PlaybackSchedule &schedule, unsigned long) override |
Returns true if schedule.GetTrackTime() has reached the end of playback. More... | |
PlaybackSlice | GetPlaybackSlice (PlaybackSchedule &schedule, size_t available) override |
Choose length of one fetch of samples from tracks in a call to AudioIO::FillPlayBuffers. More... | |
std::pair< double, double > | AdvancedTrackTime (PlaybackSchedule &schedule, double trackTime, size_t nSamples) override |
Compute a new point in a track's timeline from an old point and a real duration. More... | |
bool | RepositionPlayback (PlaybackSchedule &schedule, const Mixers &playbackMixers, size_t frames, size_t available) override |
AudioIO::FillPlayBuffers calls this to update its cursors into tracks for changes of position or speed. More... | |
bool | Looping (const PlaybackSchedule &) const override |
Public Member Functions inherited from PlaybackPolicy | |
virtual | ~PlaybackPolicy ()=0 |
virtual void | Initialize (PlaybackSchedule &schedule, double rate) |
Called before starting an audio stream. More... | |
virtual void | Finalize (PlaybackSchedule &schedule) |
Called after stopping of an audio stream or an unsuccessful start. More... | |
virtual Mixer::WarpOptions | MixerWarpOptions (PlaybackSchedule &schedule) |
Options to use when constructing mixers for each playback track. More... | |
virtual BufferTimes | SuggestedBufferTimes (PlaybackSchedule &schedule) |
Provide hints for construction of playback RingBuffer objects. More... | |
virtual bool | AllowSeek (PlaybackSchedule &schedule) |
Whether repositioning commands are allowed during playback. More... | |
virtual bool | Done (PlaybackSchedule &schedule, unsigned long outputFrames) |
Returns true if schedule.GetTrackTime() has reached the end of playback. More... | |
virtual double | OffsetTrackTime (PlaybackSchedule &schedule, double offset) |
Called when the play head needs to jump a certain distance. More... | |
virtual std::chrono::milliseconds | SleepInterval (PlaybackSchedule &schedule) |
How long to wait between calls to AudioIO::TrackBufferExchange. More... | |
virtual PlaybackSlice | GetPlaybackSlice (PlaybackSchedule &schedule, size_t available) |
Choose length of one fetch of samples from tracks in a call to AudioIO::FillPlayBuffers. More... | |
virtual std::pair< double, double > | AdvancedTrackTime (PlaybackSchedule &schedule, double trackTime, size_t nSamples) |
Compute a new point in a track's timeline from an old point and a real duration. More... | |
virtual bool | RepositionPlayback (PlaybackSchedule &schedule, const Mixers &playbackMixers, size_t frames, size_t available) |
AudioIO::FillPlayBuffers calls this to update its cursors into tracks for changes of position or speed. More... | |
virtual bool | Looping (const PlaybackSchedule &schedule) const |
Private Member Functions | |
bool | RevertToOldDefault (const PlaybackSchedule &schedule) const |
void | WriteMessage () |
double | GetPlaySpeed () |
Private Attributes | |
AudacityProject & | mProject |
MessageBuffer< SlotData > | mMessageChannel |
Observer::Subscription | mRegionSubscription |
Observer::Subscription | mSpeedSubscription |
double | mLastPlaySpeed { 1.0 } |
const double | mTrackEndTime |
double | mLoopEndTime |
size_t | mRemaining { 0 } |
bool | mProgress { true } |
bool | mLoopEnabled { true } |
bool | mVariableSpeed { false } |
Additional Inherited Members | |
Public Types inherited from PlaybackPolicy | |
using | Duration = std::chrono::duration< double > |
using | Mixers = std::vector< std::unique_ptr< Mixer > > |
Protected Attributes inherited from PlaybackPolicy | |
double | mRate = 0 |
Definition at line 329 of file PlaybackSchedule.h.
NewDefaultPlaybackPolicy::NewDefaultPlaybackPolicy | ( | AudacityProject & | project, |
double | trackEndTime, | ||
double | loopEndTime, | ||
bool | loopEnabled, | ||
bool | variableSpeed | ||
) |
Definition at line 169 of file PlaybackSchedule.cpp.
|
overridedefault |
|
overridevirtual |
Compute a new point in a track's timeline from an old point and a real duration.
Needed because playback might be at non-unit speed.
Called one or more times between GetPlaybackSlice and RepositionPlayback, until the sum of the nSamples values equals the most recent playback slice (including any trailing silence).
Reimplemented from PlaybackPolicy.
Definition at line 274 of file PlaybackSchedule.cpp.
References PlaybackPolicy::AdvancedTrackTime(), PlaybackSchedule::mEnvelope, min(), mLastPlaySpeed, PlaybackPolicy::mRate, mRemaining, PlaybackSchedule::mT0, PlaybackSchedule::mT1, mVariableSpeed, PlaybackSchedule::ReversedTime(), RevertToOldDefault(), and PlaybackSchedule::SolveWarpedLength().
|
overridevirtual |
Returns true if schedule.GetTrackTime() has reached the end of playback.
outputFrames | how many playback frames were taken from RingBuffers |
Reimplemented from PlaybackPolicy.
Definition at line 222 of file PlaybackSchedule.cpp.
References PlaybackSchedule::GetTrackTime(), PlaybackPolicy::mRate, PlaybackSchedule::mT1, PlaybackSchedule::ReversedTime(), and RevertToOldDefault().
|
overridevirtual |
Choose length of one fetch of samples from tracks in a call to AudioIO::FillPlayBuffers.
available | upper bound for the length of the fetch |
Reimplemented from PlaybackPolicy.
Definition at line 235 of file PlaybackSchedule.cpp.
References min(), mLastPlaySpeed, PlaybackPolicy::mRate, mRemaining, PlaybackSchedule::mWarpedTime, PlaybackSchedule::RealTimeAdvance(), PlaybackSchedule::RealTimeRemaining(), RevertToOldDefault(), and TimeQueueGrainSize.
|
private |
Definition at line 413 of file PlaybackSchedule.cpp.
References ProjectAudioIO::Get(), ProjectAudioIO::GetPlaySpeed(), mProject, and mVariableSpeed.
Referenced by Initialize(), MixerWarpOptions(), and WriteMessage().
|
overridevirtual |
Called before starting an audio stream.
Reimplemented from PlaybackPolicy.
Definition at line 181 of file PlaybackSchedule.cpp.
References ViewInfo::Get(), ProjectAudioIO::Get(), GetPlaySpeed(), PlaybackPolicy::Initialize(), mLastPlaySpeed, mLoopEnabled, mLoopEndTime, mMessageChannel, mProject, mRegionSubscription, mSpeedSubscription, PlaybackSchedule::mT0, mVariableSpeed, ViewInfo::playRegion, Observer::Publisher< Message, NotifyAll >::Subscribe(), and WriteMessage().
|
overridevirtual |
Reimplemented from PlaybackPolicy.
Definition at line 400 of file PlaybackSchedule.cpp.
References mLoopEnabled.
|
overridevirtual |
Options to use when constructing mixers for each playback track.
Reimplemented from PlaybackPolicy.
Definition at line 196 of file PlaybackSchedule.cpp.
References GetPlaySpeed(), PlaybackPolicy::MixerWarpOptions(), and mVariableSpeed.
|
overridevirtual |
AudioIO::FillPlayBuffers calls this to update its cursors into tracks for changes of position or speed.
frames | how many samples were just now buffered for play |
available | how many more samples may be buffered |
Reimplemented from PlaybackPolicy.
Definition at line 303 of file PlaybackSchedule.cpp.
References PlaybackSchedule::TimeQueue::GetLastTime(), mLastPlaySpeed, mLoopEnabled, mLoopEndTime, mMessageChannel, PlaybackPolicy::mRate, mRemaining, PlaybackSchedule::mT0, PlaybackSchedule::mT1, PlaybackSchedule::mTimeQueue, mTrackEndTime, mVariableSpeed, PlaybackSchedule::mWarpedLength, PlaybackSchedule::RealDuration(), PlaybackSchedule::RealTimeInit(), PlaybackSchedule::RealTimeRemaining(), PlaybackSchedule::RealTimeRestart(), PlaybackPolicy::RepositionPlayback(), RevertToOldDefault(), and PlaybackSchedule::TimeQueue::SetLastTime().
|
private |
Definition at line 215 of file PlaybackSchedule.cpp.
References PlaybackSchedule::TimeQueue::GetLastTime(), mLoopEnabled, mLoopEndTime, and PlaybackSchedule::mTimeQueue.
Referenced by AdvancedTrackTime(), Done(), GetPlaybackSlice(), and RepositionPlayback().
|
overridevirtual |
Provide hints for construction of playback RingBuffer objects.
Reimplemented from PlaybackPolicy.
Definition at line 207 of file PlaybackSchedule.cpp.
|
private |
Definition at line 405 of file PlaybackSchedule.cpp.
References ViewInfo::Get(), GetPlaySpeed(), mMessageChannel, mProject, and ViewInfo::playRegion.
Referenced by Initialize().
|
private |
Definition at line 380 of file PlaybackSchedule.h.
Referenced by AdvancedTrackTime(), GetPlaybackSlice(), Initialize(), and RepositionPlayback().
|
private |
Definition at line 385 of file PlaybackSchedule.h.
Referenced by Initialize(), Looping(), RepositionPlayback(), and RevertToOldDefault().
|
private |
Definition at line 382 of file PlaybackSchedule.h.
Referenced by Initialize(), RepositionPlayback(), and RevertToOldDefault().
|
private |
Definition at line 375 of file PlaybackSchedule.h.
Referenced by Initialize(), RepositionPlayback(), and WriteMessage().
|
private |
Definition at line 384 of file PlaybackSchedule.h.
|
private |
Definition at line 365 of file PlaybackSchedule.h.
Referenced by GetPlaySpeed(), Initialize(), and WriteMessage().
|
private |
Definition at line 377 of file PlaybackSchedule.h.
Referenced by Initialize().
|
private |
Definition at line 383 of file PlaybackSchedule.h.
Referenced by AdvancedTrackTime(), GetPlaybackSlice(), and RepositionPlayback().
|
private |
Definition at line 378 of file PlaybackSchedule.h.
Referenced by Initialize().
|
private |
Definition at line 381 of file PlaybackSchedule.h.
Referenced by RepositionPlayback().
|
private |
Definition at line 386 of file PlaybackSchedule.h.
Referenced by AdvancedTrackTime(), GetPlaySpeed(), Initialize(), MixerWarpOptions(), and RepositionPlayback().