Abstract class for audio output sinks. More...
#include <audio_sink.hpp>
Public Types | |
using | TransferIterator = AudioSource::DecodeVector::iterator |
Type of iterators used in the Transfer() method. | |
Public Member Functions | |
virtual | ~AudioSink ()=default |
Virtual, empty destructor for AudioSink. | |
virtual void | Start ()=0 |
Starts the audio stream. More... | |
virtual void | Stop ()=0 |
Stops the audio stream. More... | |
virtual Audio::State | State () |
Gets this AudioSink's current state (playing/stopped/at end). More... | |
virtual std::uint64_t | Position ()=0 |
Gets the current played position in the song, in samples. More... | |
virtual void | SetPosition (std::uint64_t samples)=0 |
Sets the current played position, given a position in samples. More... | |
virtual void | SourceOut ()=0 |
Tells this AudioSink that the source has run out. More... | |
virtual void | Transfer (TransferIterator &start, const TransferIterator &end)=0 |
Transfers a range of sample bytes into the AudioSink. More... | |
Abstract class for audio output sinks.
Definition at line 28 of file audio_sink.hpp.
|
pure virtual |
Gets the current played position in the song, in samples.
As this may be executing whilst the playing callback is running, do not expect it to be highly accurate.
Implemented in SdlAudioSink.
|
pure virtual |
Sets the current played position, given a position in samples.
This flushes out the AudioSink ready to receive sample data from the new position.
samples | The new position, as a count of elapsed samples. |
Implemented in SdlAudioSink.
|
pure virtual |
Tells this AudioSink that the source has run out.
When this occurs, the next time the ringbuf goes empty, the sink has also run out and should stop.
Implemented in SdlAudioSink.
|
pure virtual |
|
virtual |
Gets this AudioSink's current state (playing/stopped/at end).
Reimplemented in SdlAudioSink.
Definition at line 31 of file audio_sink.cpp.
References SdlAudioSink::FORMATS, Audio::NONE, and SdlAudioSink::RINGBUF_POWER.
|
pure virtual |
|
pure virtual |
Transfers a range of sample bytes into the AudioSink.
The range may be empty, but must be valid.
start | An iterator denoting the start of the range. This iterator will be advanced by the number of bytes accepted. |
end | An iterator denoting the end of the range. |
Implemented in SdlAudioSink.