Audacity 3.2.0
|
Directs which parts of tracks to fetch for playback. More...
#include <PlaybackSchedule.h>
Classes | |
struct | BufferTimes |
Times are in seconds. More... | |
Public Types | |
using | Duration = std::chrono::duration< double > |
using | Mixers = std::vector< std::unique_ptr< Mixer > > |
Public Member Functions | |
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.GetSequenceTime() has reached the end of playback. More... | |
virtual double | OffsetSequenceTime (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::SequenceBufferExchange. 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 |
Protected Attributes | |
double | mRate = 0 |
Directs which parts of tracks to fetch for playback.
A non-default policy object may be created each time playback begins, and if so it is destroyed when playback stops, not reused in the next playback.
Methods of the object are passed a PlaybackSchedule as context.
Definition at line 71 of file PlaybackSchedule.h.
using PlaybackPolicy::Duration = std::chrono::duration<double> |
Definition at line 73 of file PlaybackSchedule.h.
using PlaybackPolicy::Mixers = std::vector<std::unique_ptr<Mixer> > |
Definition at line 139 of file PlaybackSchedule.h.
|
virtual |
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 in DefaultPlaybackPolicy, anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 117 of file PlaybackSchedule.cpp.
References PlaybackSchedule::mEnvelope, mRate, PlaybackSchedule::mT1, PlaybackSchedule::ReversedTime(), and PlaybackSchedule::SolveWarpedLength().
Referenced by DefaultPlaybackPolicy::AdvancedTrackTime().
|
virtual |
Whether repositioning commands are allowed during playback.
Reimplemented in ScrubbingPlaybackPolicy.
Definition at line 58 of file PlaybackSchedule.cpp.
Referenced by AudioIoCallback::FillOutputBuffers().
|
virtual |
Returns true if schedule.GetSequenceTime() has reached the end of playback.
outputFrames | how many playback frames were taken from RingBuffers |
Reimplemented in DefaultPlaybackPolicy, anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 63 of file PlaybackSchedule.cpp.
References PlaybackSchedule::GetSequenceTime(), mRate, PlaybackSchedule::mT1, and PlaybackSchedule::ReversedTime().
Referenced by AudioIoCallback::CallbackCheckCompletion(), and AudioIoCallback::DrainInputBuffers().
|
virtual |
Called after stopping of an audio stream or an unsuccessful start.
Reimplemented in ScrubbingPlaybackPolicy.
Definition at line 28 of file PlaybackSchedule.cpp.
Referenced by AudioIO::StartStreamCleanup(), and AudioIO::StopStream().
|
virtual |
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 in DefaultPlaybackPolicy, anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 91 of file PlaybackSchedule.cpp.
References min(), mRate, PlaybackSchedule::RealTimeAdvance(), PlaybackSchedule::RealTimeRemaining(), and TimeQueueGrainSize.
|
virtual |
Called before starting an audio stream.
Reimplemented in DefaultPlaybackPolicy, anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 23 of file PlaybackSchedule.cpp.
References mRate.
Referenced by DefaultPlaybackPolicy::Initialize(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Initialize(), ScrubbingPlaybackPolicy::Initialize(), and AudioIO::StartStream().
|
virtual |
Reimplemented in DefaultPlaybackPolicy.
Definition at line 142 of file PlaybackSchedule.cpp.
Referenced by anonymous_namespace{MIDIPlay.h}::MIDIPlay::FillOtherBuffers(), and anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent().
|
virtual |
Options to use when constructing mixers for each playback track.
Reimplemented in DefaultPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 30 of file PlaybackSchedule.cpp.
References PlaybackSchedule::mEnvelope.
Referenced by DefaultPlaybackPolicy::MixerWarpOptions().
|
virtual |
Called when the play head needs to jump a certain distance.
offset | signed amount requested to be added to schedule::GetSequenceTime() |
Reimplemented in DefaultPlaybackPolicy, and anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy.
Definition at line 75 of file PlaybackSchedule.cpp.
References PlaybackSchedule::GetSequenceTime(), PlaybackSchedule::mT0, PlaybackSchedule::mT1, and PlaybackSchedule::RealTimeInit().
Referenced by AudioIoCallback::CallbackDoSeek(), and AudioIO::StartStream().
|
virtual |
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 in DefaultPlaybackPolicy, anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 136 of file PlaybackSchedule.cpp.
Referenced by DefaultPlaybackPolicy::RepositionPlayback().
|
virtual |
How long to wait between calls to AudioIO::SequenceBufferExchange.
Reimplemented in ScrubbingPlaybackPolicy.
Definition at line 84 of file PlaybackSchedule.cpp.
Referenced by AudioIO::AudioThread().
|
virtual |
Provide hints for construction of playback RingBuffer objects.
Reimplemented in DefaultPlaybackPolicy, and ScrubbingPlaybackPolicy.
Definition at line 36 of file PlaybackSchedule.cpp.
Referenced by AudioIO::AllocateBuffers().
|
protected |
Definition at line 156 of file PlaybackSchedule.h.
Referenced by AdvancedTrackTime(), DefaultPlaybackPolicy::AdvancedTrackTime(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::AdvancedTrackTime(), ScrubbingPlaybackPolicy::AdvancedTrackTime(), Done(), DefaultPlaybackPolicy::Done(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::Done(), GetPlaybackSlice(), DefaultPlaybackPolicy::GetPlaybackSlice(), anonymous_namespace{ProjectAudioManager.cpp}::CutPreviewPlaybackPolicy::GetPlaybackSlice(), ScrubbingPlaybackPolicy::GetPlaybackSlice(), Initialize(), DefaultPlaybackPolicy::RepositionPlayback(), and ScrubbingPlaybackPolicy::RepositionPlayback().