Class OggVorbisEncoder
Raw PCM data encoder to Ogg Vorbis audio format.
Inheritance
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Tools/AudioTool/OggVorbisEncoder.h
Syntax
public class OggVorbisEncoder : public AudioEncoder
Constructors
~OggVorbisEncoder()
OggVorbisEncoder()
Methods
Close()
Closes the encoder and flushes the last of the data into the write buffer (triggers the write callback). This is called automatically when the writer goes out of scope.
Declaration
public void Close()
Convert(byte* samples, AudioDataInfo& info, BytesContainer& result, float quality = 0.5f)
Converts the input PCM samples buffer into the encoder audio format.
Declaration
public virtual bool Convert(byte* samples, AudioDataInfo& info, BytesContainer& result, float quality = 0.5f) override
Parameters
byte
samples
The buffer containing samples in PCM format. All samples should be in signed integer format. |
AudioDataInfo
info
The input information describing meta-data of the audio in the samples buffer. |
BytesContainer
result
The output data. |
float
quality
The output data compression quality (normalized in range [0;1]). |
Returns
bool
True if the data is invalid or conversion failed, otherwise false. |
Overrides
Flush()
Flushes the last of the data into the write buffer (triggers the write callback). This is called automatically when the writer is closed or goes out of scope.
Declaration
public void Flush()
Open(WriteCallback writeCallback, uint32 sampleRate, uint32 bitDepth, uint32 numChannels, float quality, void* userData=nullptr)
Sets up the writer. Should be called before calling Write().
Declaration
public bool Open(WriteCallback writeCallback, uint32 sampleRate, uint32 bitDepth, uint32 numChannels, float quality, void* userData=nullptr)
Parameters
WriteCallback
writeCallback
Callback that will be triggered when the writer is ready to output some data. The callback should copy the provided data into its own buffer. |
uint32
sampleRate
Determines how many samples per second the written data will have. |
uint32
bitDepth
Determines the size of a single sample, in bits. |
uint32
numChannels
Determines the number of audio channels. Channel data will be output interleaved in the output buffer. |
float
quality
The output data compression quality (normalized in range [0;1]). |
void
userData
The custom used data passed to the write callback. |
Returns
bool
True if failed to open the data, otherwise false. |
Write(byte* samples, uint32 numSamples)
Writes a new set of samples and converts them to Ogg Vorbis.
Declaration
public void Write(byte* samples, uint32 numSamples)
Parameters
byte
samples
The samples in PCM format. 8-bit samples should be unsigned, but higher bit depths signed. Each sample is assumed to be the bit depth that was provided to the Open() method. |
uint32
numSamples
The number of samples to encode. |