AudioStream class
#include <nCine/Audio/AudioStream.h>
Streams audio decoded on the fly into a rotating set of backend buffers.
Used for long sounds such as music, owned by AudioStreamPlayer. Where NCINE_HAS_NATIVE_AUDIO is defined, the device plays the file by itself (see IAudioDevice::
Constructors, destructors, conversion operators
Public functions
-
auto GetBufferId() const -> std::
uint32_t - Returns the backend id of the currently playing buffer, or
0if none. -
auto GetBytesPerSample() const -> std::
int32_t - Returns the number of bytes per sample.
-
auto GetChannelCount() const -> std::
int32_t - Returns the number of audio channels.
-
auto GetFrequency() const -> std::
int32_t - Returns the sample frequency.
-
auto GetSampleCount() const -> std::
int32_t - Returns the total number of samples, or
-1if unknown. - auto GetDuration() const -> float
- Returns the duration in seconds.
-
auto GetBufferSize() const -> std::
int32_t - Returns the total decoded size in bytes, or
-1if unknown. -
auto GetStreamSampleCount() const -> std::
int32_t - Returns the number of samples held by a single streaming buffer.
-
auto GetStreamBufferSize() const -> std::
int32_t - Returns the size of a single streaming buffer in bytes.
-
auto Enqueue(std::
uint32_t source, bool looping) -> bool - Decodes and enqueues new buffers and unqueues processed ones.
-
void Stop(std::
uint32_t source) - Unqueues any remaining buffers and rewinds the reader.
- auto IsLooping() const -> bool
- Returns
trueif the stream is looping. - void SetLooping(bool value)
- Sets whether the stream should loop.
- auto GetModuleState(AudioModuleState& state) const -> bool partially supported
- Returns the state of a tracker module at the position being heard,
falseif the stream isn't a module. -
auto SetModulePosition(std::
uint32_t source, std:: int32_t order, std:: int32_t row, bool restart, bool looping) -> bool partially supported - Jumps to a row of a position in the order list of a tracker module.
-
auto SetModuleSpeed(std::
int32_t speed) -> bool partially supported - Sets the ticks per row of a tracker module until the module changes them.
-
auto SetModuleTempo(std::
int32_t tempo) -> bool partially supported - Sets the tempo of a tracker module until the module changes it.
-
auto SlideModuleChannelVolume(std::
int32_t channel, float volume, std:: int32_t milliseconds) -> bool partially supported - Changes the volume of a channel of a tracker module gradually,
volumeis in0.0to1.0.
Function documentation
bool nCine:: AudioStream:: Enqueue(std:: uint32_t source,
bool looping)
Decodes and enqueues new buffers and unqueues processed ones.
| Returns | false once the stream has been entirely decoded and played |
|---|
bool nCine:: AudioStream:: GetModuleState(AudioModuleState& state) const
Returns the state of a tracker module at the position being heard, false if the stream isn't a module.
bool nCine:: AudioStream:: SetModulePosition(std:: uint32_t source,
std:: int32_t order,
std:: int32_t row,
bool restart,
bool looping)
Jumps to a row of a position in the order list of a tracker module.
The queued audio is dropped. With restart, the queue is filled again from the new position and the source plays at once, otherwise it stays stopped until Enqueue() is called.
bool nCine:: AudioStream:: SetModuleSpeed(std:: int32_t speed)
Sets the ticks per row of a tracker module until the module changes them.
bool nCine:: AudioStream:: SetModuleTempo(std:: int32_t tempo)
Sets the tempo of a tracker module until the module changes it.
bool nCine:: AudioStream:: SlideModuleChannelVolume(std:: int32_t channel,
float volume,
std:: int32_t milliseconds)
Changes the volume of a channel of a tracker module gradually, volume is in 0.0 to 1.0.