286 virtual std::optional<std::uint64_t>
onLoop();
295 [[nodiscard]]
void* getSound() const override;
301 std::unique_ptr<Impl> m_impl;
SoundSource(const SoundSource &)=default
Copy constructor.
std::function< void(const float *inputFrames, unsigned int &inputFrameCount, float *outputFrames, unsigned int &outputFrameCount, unsigned int frameChannelCount)> EffectProcessor
Callable that is provided with sound data for processing.
Status
Enumeration of the sound source states.
void setLooping(bool loop)
Set whether or not the stream should loop after reaching the end.
std::vector< SoundChannel > getChannelMap() const
Get the map of position in sample frame to sound channel.
SoundStream(SoundStream &&) noexcept
Move constructor.
unsigned int getChannelCount() const
Return the number of channels of the stream.
void pause() override
Pause the audio stream.
void initialize(unsigned int channelCount, unsigned int sampleRate, const std::vector< SoundChannel > &channelMap)
Define the audio stream parameters.
bool isLooping() const
Tell whether or not the stream is in loop mode.
Status getStatus() const override
Get the current status of the stream (stopped, paused, playing)
void setEffectProcessor(EffectProcessor effectProcessor) override
Set the effect processor to be applied to the sound.
void stop() override
Stop playing the audio stream.
unsigned int getSampleRate() const
Get the stream sample rate of the stream.
virtual void onSeek(Time timeOffset)=0
Change the current playing position in the stream source.
virtual bool onGetData(Chunk &data)=0
Request a new chunk of audio samples from the stream source.
virtual std::optional< std::uint64_t > onLoop()
Change the current playing position in the stream source to the beginning of the loop.
~SoundStream() override
Destructor.
Time getPlayingOffset() const
Get the current playing position of the stream.
void play() override
Start or resume playing the audio stream.
void setPlayingOffset(Time timeOffset)
Change the current playing position of the stream.
SoundChannel
Types of sound channels that can be read/written from sound buffers/files.
Structure defining a chunk of audio data to stream.
const std::int16_t * samples
Pointer to the audio samples.
std::size_t sampleCount
Number of samples pointed by Samples.