Search Results for

    Show / Hide Table of Contents

    Class AudioDecoder

    Interface used for implementations that parse audio formats into a set of PCM samples.

    Inheritance
    AudioDecoder
    Assembly: FlaxEngine.dll
    File: Engine/Tools/AudioTool/AudioDecoder.h
    Syntax
    public class AudioDecoder

    Constructors

    ~AudioDecoder()

    Finalizes an instance of the AudioDecoder class.

    Declaration
    public virtual ~AudioDecoder()

    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)
    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.

    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) = 0
    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.

    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) = 0
    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.

    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) = 0
    Parameters
    byte samples

    Pre-allocated buffer to store the samples in.

    uint32 numSamples

    The number of samples to read.

    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) = 0
    Parameters
    uint32 offset

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

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