Om
1.0.0
A universal framework for multimedia simulation
|
A class that handles streaming encoding of the compressed .ogg audio format. More...
#include <omSoundFLACEncoder.h>
Public Member Functions | |
FLACEncoder (DataOutputStream *outputStream, Size numChannels, SampleRate newSampleRate, const SoundFormatSettings &newFormatSettings=SoundFormatSettings()) | |
Create a .ogg stream encoder with the given number of channels, bitrate, and sample rate. More... | |
virtual | ~FLACEncoder () |
Destroy this .ogg encoder and release all associated resources. More... | |
virtual void | flush () |
Flush all pending sound data to be encoded to the encoder's data output stream. More... | |
virtual Bool | canSeek () const |
Return whether or not seeking is allowed by this .ogg file encoder. More... | |
virtual Bool | canSeek (Int64 relativeSampleOffset) const |
Return if this .ogg encoder's current position can be moved by the specified signed sample offset. More... | |
virtual Int64 | seek (Int64 relativeSampleOffset) |
Move the current sample frame position of the encoder by the specified signed amount. More... | |
SoundSize | getLengthInSamples () const |
Return the total number of samples that have been encoded by this .ogg encoder. More... | |
Double | getLengthInSeconds () const |
Return the total length of sound in seconds that has been encoded by this .ogg encoder. More... | |
virtual Size | getChannelCount () const |
Return the number of channels that are being written by the .ogg encoder. More... | |
virtual SampleRate | getSampleRate () const |
Return the sample rate at which this .ogg encoder is encoding. More... | |
virtual SampleType | getNativeSampleType () const |
Return the type of sample data that is being written by this .ogg encoder. More... | |
virtual Bool | isValid () const |
Return whether or not this .ogg encoder is writing a valid FLAC file. More... | |
Public Member Functions inherited from om::sound::base::SoundOutputStream | |
virtual | ~SoundOutputStream () |
Destroy this sound output stream and release any resources associated with it. More... | |
SoundResult | write (const SoundBuffer &buffer, Size numSamples) |
Write the specified number of samples from a sound buffer to the output stream. More... | |
Additional Inherited Members |
A class that handles streaming encoding of the compressed .ogg audio format.
This class uses an abstract data stream for output, allowing it to encode .ogg data to a file, network destination, or other destination.
om::sound::io::FLACEncoder::FLACEncoder | ( | DataOutputStream * | outputStream, |
Size | numChannels, | ||
SampleRate | newSampleRate, | ||
const SoundFormatSettings & | newFormatSettings = SoundFormatSettings() |
||
) |
Create a .ogg stream encoder with the given number of channels, bitrate, and sample rate.
An encoder created by this constructor will write an .ogg file stream with the specified number of channels and bit rate. The constructor also allows the user to specify whether or not variable-bitrate encoding is used, the default is yes. The encoder uses the specified sample rate for all incoming audio, automatically sample rate converting any audio that doesn't match the output sample rate.
|
virtual |
Destroy this .ogg encoder and release all associated resources.
|
virtual |
Flush all pending sound data to be encoded to the encoder's data output stream.
Implements om::sound::base::SoundOutputStream.
|
virtual |
Return whether or not seeking is allowed by this .ogg file encoder.
Reimplemented from om::sound::base::SoundOutputStream.
Return if this .ogg encoder's current position can be moved by the specified signed sample offset.
This sample offset is specified as the number of sample frames to move in the stream - a frame is equal to one sample for each channel in the stream.
Reimplemented from om::sound::base::SoundOutputStream.
Move the current sample frame position of the encoder by the specified signed amount.
This method attempts to seek the position of the encoder by the specified amount. The method returns the signed amount that the position in the stream was changed by. Thus, if seeking is not allowed, 0 is returned. Otherwise, the stream should seek as far as possible in the specified direction and return the actual change in position.
Reimplemented from om::sound::base::SoundOutputStream.
|
inline |
Return the total number of samples that have been encoded by this .ogg encoder.
|
inline |
Return the total length of sound in seconds that has been encoded by this .ogg encoder.
|
virtual |
Return the number of channels that are being written by the .ogg encoder.
This is the number of channels that should be provided to the write() method. If less than this number of channels is provided, silence is written for the other channels. Superfluous channels are ignored.
This value is set in a constructor of the encoder and once set, is read-only.
Implements om::sound::base::SoundOutputStream.
|
virtual |
Return the sample rate at which this .ogg encoder is encoding.
This is the sample rate to which all incoming sound data is converted to before being written to the output stream. The output sample rate can be set in the encoder's constructor. After contruction, the sample rate is read-only and cannot be changed. If not set during construction, the encoder can automatically auto-detect the sample rate of the first buffer of output audio and use that sample rate thenceforth. In that case, this method will return a sample rate of 0 until the incoming sample rate is detected.
Implements om::sound::base::SoundOutputStream.
|
virtual |
Return the type of sample data that is being written by this .ogg encoder.
Since FLAC encodes data in frequency domain, this method always returns the type of SAMPLE_32F.
Implements om::sound::base::SoundOutputStream.
|
inlinevirtual |
Return whether or not this .ogg encoder is writing a valid FLAC file.
This method can return FALSE, indicating the encoder cannot be used, and should be checked by the user to see if the chosen FLAC format is supported by the encoder. The encoder can also be invalid if the destination file or stream cannot be opened or is not valid.
Implements om::sound::base::SoundOutputStream.