Audacity 3.2.0
Public Types | Public Member Functions | List of all members
AudioGraph::Source Class Referenceabstract

Upstream producer of sample streams, taking Buffers as external context. More...

#include <AudioGraphSource.h>

Inheritance diagram for AudioGraph::Source:
[legend]

Public Types

using Buffers = AudioGraph::Buffers
 

Public Member Functions

virtual ~Source ()
 
virtual bool AcceptsBuffers (const Buffers &buffers) const =0
 
virtual bool AcceptsBlockSize (size_t blockSize) const =0
 
virtual std::optional< size_t > Acquire (Buffers &data, size_t bound)=0
 Occupy vacant space in Buffers with some data. More...
 
virtual sampleCount Remaining () const =0
 Result includes any amount Acquired and not yet Released. More...
 
virtual bool Release ()=0
 Caller is done examining last Acquire()d positions. More...
 
virtual bool Terminates () const
 Needed only to make some postconditions assertable; defaults true. More...
 

Detailed Description

Upstream producer of sample streams, taking Buffers as external context.

Definition at line 27 of file AudioGraphSource.h.

Member Typedef Documentation

◆ Buffers

Definition at line 29 of file AudioGraphSource.h.

Constructor & Destructor Documentation

◆ ~Source()

AudioGraph::Source::~Source ( )
virtualdefault

Member Function Documentation

◆ AcceptsBlockSize()

virtual bool AudioGraph::Source::AcceptsBlockSize ( size_t  blockSize) const
pure virtual

Implemented in DownmixStage, MixerSource, WideSampleSource, and EffectStage.

Referenced by PerTrackEffect::ProcessTrack(), and AudioGraph::Task::Task().

Here is the caller graph for this function:

◆ AcceptsBuffers()

virtual bool AudioGraph::Source::AcceptsBuffers ( const Buffers buffers) const
pure virtual

Implemented in DownmixStage, EffectStage, MixerSource, and WideSampleSource.

Referenced by PerTrackEffect::ProcessTrack(), and AudioGraph::Task::Task().

Here is the caller graph for this function:

◆ Acquire()

virtual std::optional< size_t > AudioGraph::Source::Acquire ( Buffers data,
size_t  bound 
)
pure virtual

Occupy vacant space in Buffers with some data.

May exceeed a single block of production Can assume same buffer is passed each time, while the caller advances it over the previous production, or discards it, or rotates the buffer. May rewind or rotate the buffer.

Returns
number of positions available to read from data or nullopt to fail
Precondition
AcceptsBuffers(data)
AcceptsBlockSize(data.BlockSize())
bound <= data.BlockSize()
data.BlockSize() <= data.Remaining()
Postcondition
result: !result || *result <= bound
result: !result || *result <= data.Remaining()
result: !result || *result <= Remaining()
data.Remaining() > 0
result: !result || bound == 0 || Remaining() == 0 || *result > 0 (progress guarantee)
!Terminates() or Remaining() was not previously defined, or is unchanged

Implemented in EffectStage, MixerSource, WideSampleSource, and DownmixStage.

Referenced by Mixer::Process().

Here is the caller graph for this function:

◆ Release()

virtual bool AudioGraph::Source::Release ( )
pure virtual

Caller is done examining last Acquire()d positions.

May be called only after at least one successful call to Acquire()

Returns
success
Postcondition
!Terminates() or Remaining() reduced by what was last returned by Acquire()

Implemented in DownmixStage, EffectStage, MixerSource, and WideSampleSource.

Referenced by Mixer::Process().

Here is the caller graph for this function:

◆ Remaining()

virtual sampleCount AudioGraph::Source::Remaining ( ) const
pure virtual

Result includes any amount Acquired and not yet Released.

May be undefined before the first successful call to Acquire()

Postcondition
result: result >= 0

Implemented in DownmixStage, EffectStage, MixerSource, and WideSampleSource.

◆ Terminates()

bool AudioGraph::Source::Terminates ( ) const
virtual

Needed only to make some postconditions assertable; defaults true.

Reimplemented in MixerSource.

Definition at line 14 of file AudioGraphSource.cpp.

15{
16 return true;
17}

The documentation for this class was generated from the following files: