11#ifndef __AUDACITY_PLAYBACK_SCHEDULE__
12#define __AUDACITY_PLAYBACK_SCHEDULE__
58 size_t available,
size_t frames_,
size_t toProduce_)
73 using Duration = std::chrono::duration<double>;
104 unsigned long outputFrames
111 virtual double OffsetSequenceTime(
PlaybackSchedule &schedule,
double offset );
116 virtual std::chrono::milliseconds
135 virtual std::pair<double, double>
137 double trackTime,
size_t nSamples );
139 using Mixers = std::vector<std::unique_ptr<Mixer>>;
145 virtual bool RepositionPlayback(
226 double GetLastTime()
const;
228 void SetLastTime(
double time);
233 double Consumer(
size_t nSamples,
double rate );
239 void Prime(
double time );
257 std::atomic<int> head { 0 };
258 std::atomic<int> tail { 0 };
261 std::atomic<Node*> next{};
266 std::atomic_flag active { ATOMIC_FLAG_INIT };
271 size_t written { 0 };
290 double t0,
double t1,
303 double ComputeWarpedLength(
double t0,
double t1)
const;
312 double SolveWarpedLength(
double t0,
double length)
const;
325 {
return mTime.load(std::memory_order_relaxed); }
330 { mTime.store(time, std::memory_order_relaxed); }
333 mPolicyValid.store(
false, std::memory_order_release);
338 double RealDuration(
double trackTime1)
const;
342 double RealDurationSigned(
double trackTime1)
const;
345 double RealTimeRemaining()
const;
348 void RealTimeAdvance(
double increment );
352 void RealTimeInit(
double trackTime );
354 void RealTimeRestart();
358 std::atomic<bool> mPolicyValid{
false };
std::vector< std::vector< float > > PRCrossfadeData
constexpr size_t TimeQueueGrainSize
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Functions for doing the mixdown of the tracks.
Directs which parts of tracks to fetch for playback.
std::vector< std::unique_ptr< Mixer > > Mixers
virtual ~PlaybackPolicy()=0
std::chrono::duration< double > Duration
std::vector< std::unique_ptr< Node > > mNodePool
TimeQueue & operator=(const TimeQueue &)=delete
TimeQueue(const TimeQueue &)=delete
struct holding stream options, including a pointer to the time warp info and AudioIOListener and whet...
Immutable structure is an argument to Mixer's constructor.
Duration latency
Try not to let ring buffer contents fall below this.
Duration ringBufferDelay
Length of ring buffer.
Duration batchSize
Try to put at least this much into the ring buffer in each pass.
std::vector< Record > records
std::unique_ptr< PlaybackPolicy > mpPlaybackPolicy
double mT0
Playback starts at offset of mT0, which is measured in seconds.
double mT1
Playback ends at offset of mT1, which is measured in seconds. Note that mT1 may be less than mT0 duri...
bool ReversedTime() const
True if the end time is before the start time.
const BoundedEnvelope * mEnvelope
void SetSequenceTime(double time)
Set current track time value, unadjusted.
double GetSequenceTime() const
Get current track time value, unadjusted.
std::atomic< double > mTime
Describes an amount of contiguous (but maybe time-warped) data to be extracted from tracks to play.
const size_t toProduce
Not more than frames; the difference will be trailing silence.
PlaybackSlice(size_t available, size_t frames_, size_t toProduce_)
Constructor enforces some invariants.
const size_t frames
Total number of frames to be buffered.
double TotalCorrection() const
double mLatencyCorrection
PRCrossfadeData mCrossfadeData