Loading [MathJax]/jax/input/TeX/config.js

⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.

 
Axmol Engine 2.4.0-ce063c5
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Loading...
Searching...
No Matches
AudioDecoderMp3 Class Reference

The class for decoding compressed audio file to PCM buffer. More...

#include <AudioDecoderMp3.h>

Inherits AudioDecoder.

Public Member Functions

bool open (std::string_view path) override
 Opens an audio file specified by a file path.
 
void close () override
 Closes opened audio file.
 
uint32_t read (uint32_t framesToRead, char *pcmBuf) override
 Reads audio frames of PCM format.
 
bool seek (uint32_t frameOffset) override
 Sets frame offest to be read.
 
- Public Member Functions inherited from AudioDecoder
virtual bool isOpened () const
 Checks whether decoder has opened file successfully.
 
virtual uint32_t readFixedFrames (uint32_t framesToRead, char *pcmBuf)
 Reads fixed audio frames of PCM format.
 
virtual uint32_t getTotalFrames () const
 Gets total frames of current audio.
 
virtual uint32_t framesToBytes (uint32_t frames) const
 The helper function for convert frames to bytes.
 
virtual uint32_t bytesToFrames (uint32_t bytes) const
 The helper function for convert bytes to frames.
 
virtual uint32_t getSampleRate () const
 Gets sample rate of current audio.
 
virtual uint32_t getChannelCount () const
 Gets the channel count of current audio.
 

Detailed Description

The class for decoding compressed audio file to PCM buffer.

Member Function Documentation

◆ open()

bool open ( std::string_view path)
overridevirtual

Opens an audio file specified by a file path.

Returns
true if succeed, otherwise false.

Implements AudioDecoder.

◆ close()

void close ( )
overridevirtual

Closes opened audio file.

Note
The method will also be automatically invoked in the destructor.

Implements AudioDecoder.

◆ read()

uint32_t read ( uint32_t framesToRead,
char * pcmBuf )
overridevirtual

Reads audio frames of PCM format.

Parameters
framesToReadThe number of frames excepted to be read.
pcmBufThe buffer to hold the frames to be read, its size should be >= |framesToRead| / samplesPerBlock * _bytesPerBlock.
Returns
The number of frames actually read, it's probably less than 'framesToRead'. Returns 0 means reach the end of file.

Implements AudioDecoder.

◆ seek()

bool seek ( uint32_t frameOffset)
overridevirtual

Sets frame offest to be read.

Parameters
frameOffsetThe frame offest to be set.
Returns
true if succeed, otherwise false

Implements AudioDecoder.


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