Search Results for

    Show / Hide Table of Contents

    Class MP3Decoder

    Decodes .mp3 audio data into raw PCM format.

    Inheritance
    AudioDecoder
    MP3Decoder
    Inherited Members
    AudioDecoder::~AudioDecoder()
    Assembly: FlaxEngine.dll
    File: Engine/Tools/AudioTool/MP3Decoder.h
    Syntax
    public class MP3Decoder : public AudioDecoder

    Constructors

    MP3Decoder()

    Initializes a new instance of the MP3Decoder class.

    Declaration
    public MP3Decoder()

    Methods

    Convert(ReadStream* stream, AudioDataInfo& info, Array<byte>& result, uint32 offset = 0)

    Tries to open the specified stream with audio data and loads the whole audio data.

    Declaration
    public virtual bool Convert(ReadStream* stream, AudioDataInfo& info, Array<byte>& result, uint32 offset = 0) override
    Parameters
    ReadStream stream

    The data stream audio data is stored in. Must be valid until decoder usage end. Decoder may cache this pointer for the later usage.

    AudioDataInfo info

    The output information describing meta-data of the audio in the stream.

    Array<byte> result

    The output data.

    uint32 offset

    The offset.

    Returns
    bool

    True if the data is invalid or conversion failed, otherwise false.

    Overrides
    AudioDecoder::Convert(ReadStream* stream, AudioDataInfo& info, Array<byte>& result, uint32 offset = 0)

    IsValid(ReadStream* stream, uint32 offset = 0)

    Checks if the data in the provided stream valid audio data for the current format. You should check this before calling Open().

    Declaration
    public virtual bool IsValid(ReadStream* stream, uint32 offset = 0) override
    Parameters
    ReadStream stream

    The stream to check.

    uint32 offset

    The offset at which audio data in the stream begins, in bytes.

    Returns
    bool

    True if the data is valid, otherwise false.

    Overrides
    AudioDecoder::IsValid(ReadStream* stream, uint32 offset = 0)

    Open(ReadStream* stream, AudioDataInfo& info, uint32 offset = 0)

    Tries to open the specified stream with audio data. Must be called before any reads or seeks.

    Declaration
    public virtual bool Open(ReadStream* stream, AudioDataInfo& info, uint32 offset = 0) override
    Parameters
    ReadStream stream

    The data stream audio data is stored in. Must be valid until decoder usage end. Decoder may cache this pointer for the later usage.

    AudioDataInfo info

    The output information describing meta-data of the audio in the stream.

    uint32 offset

    The offset.

    Returns
    bool

    True if the data is invalid, otherwise false.

    Overrides
    AudioDecoder::Open(ReadStream* stream, AudioDataInfo& info, uint32 offset = 0)

    Read(byte* samples, uint32 numSamples)

    Reads a set of samples from the audio data.

    All values are returned as signed values.

    Declaration
    public virtual void Read(byte* samples, uint32 numSamples) override
    Parameters
    byte samples

    Pre-allocated buffer to store the samples in.

    uint32 numSamples

    The number of samples to read.

    Overrides
    AudioDecoder::Read(byte* samples, uint32 numSamples)

    Seek(uint32 offset)

    Moves the read pointer to the specified offset. Any further Read() calls will read from this location. User must ensure not to seek past the end of the data.

    Declaration
    public virtual void Seek(uint32 offset) override
    Parameters
    uint32 offset

    The offset to move the pointer in. In number of samples.

    Overrides
    AudioDecoder::Seek(uint32 offset)

    See Also

    AudioDecoder
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat