nCine::AudioStream class

Streams audio decoded on the fly into a rotating set of OpenAL buffers.

Used for long sounds such as music, where decoding the whole file into memory would be wasteful. Owned by AudioStreamPlayer, which feeds it through enqueue().

Constructors, destructors, conversion operators

~AudioStream()

Public functions

auto bufferId() const -> std::uint32_t
Returns the OpenAL id of the currently playing buffer, or 0 if none.
auto bytesPerSample() const -> std::int32_t
Returns the number of bytes per sample.
auto numChannels() const -> std::int32_t
Returns the number of audio channels.
auto frequency() const -> std::int32_t
Returns the sample frequency.
auto numSamples() const -> std::int32_t
Returns the total number of samples, or -1 if unknown.
auto duration() const -> float
Returns the duration in seconds.
auto bufferSize() const -> std::int32_t
Returns the total decoded size in bytes, or -1 if unknown.
auto numStreamSamples() const -> std::int32_t
Returns the number of samples held by a single streaming buffer.
auto streamBufferSize() 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 true if the stream is looping.
void setLooping(bool value)
Sets whether the stream should loop.

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