StreamDecodeRequest struct
#include <nCine/Audio/IAudioDevice.h>
Request to decode one buffer of audio stream data, usually on the decoding thread.
Shared by the AudioStream and the device, so it outlives a stream destroyed mid-decode. One request is reused for the whole lifetime of a stream.
Public types
-
enum class State : std::
uint8_t { Idle, Pending, Ready } - State of the request.
Constructors, destructors, conversion operators
Public functions
- void Execute()
- Decodes one buffer of data and marks the request as ready.
-
auto ExecuteSlice(std::
int32_t maxBytes) -> bool - Decodes at most
maxBytesmore of the buffer, continuing where the previous call stopped.
Public variables
-
std::
shared_ptr<IAudioReader> Reader - Reader that decodes the data, shared with the owning stream.
-
std::
unique_ptr<char[]> Buffer - Destination buffer for the decoded data.
-
std::
int32_t BufferSize - Size of the destination buffer in bytes.
-
std::
int32_t BytesRead - Number of decoded bytes, valid when the state is State::
Ready. - bool Looping
- Whether the reader rewinds and keeps decoding when the end of data is reached.
-
std::
atomic<State> CurrentState - Current state of the request.
Enum documentation
Function documentation
bool nCine:: StreamDecodeRequest:: ExecuteSlice(std:: int32_t maxBytes)
Decodes at most maxBytes more of the buffer, continuing where the previous call stopped.
| Returns | true once the buffer is full or the data has ended, which is when the request is marked ready |
|---|
For devices without a decoding thread. BytesRead must be zero when the request is submitted.