10 #ifndef PLAYD_AUDIO_HPP 11 #define PLAYD_AUDIO_HPP 19 #include "../response.hpp" 50 virtual ~Audio() =
default;
81 virtual void SetPosition(std::uint64_t position) = 0;
92 virtual const std::string &
File()
const = 0;
110 virtual std::uint64_t
Position()
const = 0;
132 std::uint64_t
Position()
const override;
133 const std::string &
File()
const override;
156 PipeAudio(std::unique_ptr<AudioSource> src,
157 std::unique_ptr<AudioSink> sink);
160 const std::string &
File()
const override;
166 std::uint64_t
Position()
const override;
170 std::unique_ptr<AudioSource>
src;
173 std::unique_ptr<AudioSink>
sink;
189 bool DecodeIfFrameEmpty();
197 bool FrameFinished()
const;
200 void TransferFrame();
203 #endif // PLAYD_AUDIO_HPP Declaration of the AudioSource class.
State
Enumeration of possible states for this Audio.
Abstract class for audio output sinks.
The Audio is currently playing.
The Audio has ended and can't play without a seek.
virtual const std::string & File() const =0
This Audio's current file.
virtual ~Audio()=default
Virtual, empty destructor for Audio.
AudioSource::DecodeVector::iterator frame_iterator
The current position in the current decoded frame.
virtual std::uint64_t Position() const =0
This Audio's current position.
virtual void SetPosition(std::uint64_t position)=0
Attempts to seek to the given position.
AudioSource::DecodeVector frame
The current decoded frame.
A dummy Audio implementation representing a lack of file.
virtual void SetPlaying(bool playing)=0
Sets whether this Audio should be playing or not.
virtual Audio::State CurrentState() const =0
The state of this Audio.
std::vector< std::uint8_t > DecodeVector
Type of decoded sample vectors.
std::unique_ptr< AudioSource > src
The source of audio data.
A concrete implementation of Audio as a 'pipe'.
virtual State Update()=0
Performs an update cycle on this Audio.
The Audio has been stopped, or not yet played.
std::unique_ptr< AudioSink > sink
The sink to which audio data is sent.