Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::Audio::CAudioReader Class Reference

Audio reader for decoding audio data to raw PCM wave data. This class is intended for reading audio samples (e.g., for analysis, visualization, or custom processing) and does not support direct playback. More...

#include <Engine/CAudioReader.h>

Public Member Functions

 CAudioReader (IStream *stream, IAudioDecoder::EDecoderType type, ISoundDriver *driver)
 CAudioReader (const char *file, ISoundDriver *driver)
void initReader ()
 Initialize the reader and create the appropriate decoder.
EStatus initDecoder ()
 Initialize the decoder.
EStatus readAudio (unsigned char *data, int size)
 Read and decode audio data into a buffer as raw PCM samples.
IAudioDecoder::EDecoderType getDecoderType ()
 Get the decoder type.
IAudioDecodergetDecoder ()
 Get the underlying decoder.
IStreamgetStream ()
 Get the underlying stream.
ISoundSource::ESourceState getState ()
 Get the current state of the reader.

Protected Attributes

bool m_isError
int m_initState
IAudioDecoderm_decoder
ISoundDriverm_driver
IMutexm_mutex
IStreamm_stream
ISoundSource::ESourceState m_state
IAudioDecoder::EDecoderType m_decodeType

Detailed Description

Audio reader for decoding audio data to raw PCM wave data. This class is intended for reading audio samples (e.g., for analysis, visualization, or custom processing) and does not support direct playback.

Member Function Documentation

◆ getDecoder()

IAudioDecoder * Skylicht::Audio::CAudioReader::getDecoder ( )
inline

Get the underlying decoder.

Returns
Pointer to IAudioDecoder

◆ getDecoderType()

IAudioDecoder::EDecoderType Skylicht::Audio::CAudioReader::getDecoderType ( )
inline

Get the decoder type.

Returns
EDecoderType

◆ getState()

ISoundSource::ESourceState Skylicht::Audio::CAudioReader::getState ( )
inline

Get the current state of the reader.

Returns
ESourceState

◆ getStream()

IStream * Skylicht::Audio::CAudioReader::getStream ( )
inline

Get the underlying stream.

Returns
Pointer to IStream

◆ initDecoder()

EStatus Skylicht::Audio::CAudioReader::initDecoder ( )

Initialize the decoder.

Returns
Status of the initialization

◆ readAudio()

EStatus Skylicht::Audio::CAudioReader::readAudio ( unsigned char * data,
int size )

Read and decode audio data into a buffer as raw PCM samples.

Parameters
dataThe destination buffer to store PCM data
sizeThe amount of data to read in bytes
Returns
Status of the read operation

The documentation for this class was generated from the following file: