Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::sound::io::FLACDecoder Class Reference

A class that handles streaming decoding of the compresed .ogg audio format. More...

#include <omSoundFLACDecoder.h>

Inheritance diagram for om::sound::io::FLACDecoder:
om::sound::base::SoundInputStream

Public Member Functions

 FLACDecoder (DataInputStream *oggStream)
 Create a new ogg decoder that is decoding from the specified data input stream. More...
 
 ~FLACDecoder ()
 Release all resources associated with this FLACDecoder object. More...
 
SoundSize getLengthInSamples () const
 Get the length in samples of the .ogg file that is being decoded. More...
 
Double getLengthInSeconds () const
 Get the length in seconds of the .ogg file that is being decoded. More...
 
SampleIndex getCurrentSampleIndex () const
 Get the index of the sample currently being read from the .ogg file. More...
 
Double getCurrentTime () const
 Get the time in seconds within the .ogg file of the current read position of this decoder. More...
 
virtual Bool canSeek () const
 Return whether or not seeking is allowed in this input stream. More...
 
virtual Bool canSeek (Int64 relativeSampleOffset) const
 Return whether or not this input stream's current position can be moved by the specified signed sample offset. More...
 
virtual Int64 seek (Int64 relativeSampleOffset)
 Move the current sample frame position in the stream by the specified signed amount. More...
 
virtual SoundSize getSamplesRemaining () const
 Return the number of samples remaining in the sound input stream. More...
 
virtual SampleIndex getPosition () const
 Return the current position of the stream within itself. More...
 
virtual Size getChannelCount () const
 Return the number of channels that are in the sound input stream. More...
 
virtual SampleRate getSampleRate () const
 Return the sample rate of the sound input stream's source audio data. More...
 
virtual SampleType getNativeSampleType () const
 Return the actual sample type used in the stream. More...
 
Float getBitRate () const
 Return a value indicating the nominal bitrate for the currently decoded ogg file. More...
 
Float getMinBitRate () const
 Return a value indicating the minimum bitrate for the currently decoded ogg file. More...
 
Float getMaxBitRate () const
 Return a value indicating the maximum bitrate for the currently decoded ogg file. More...
 
Bool isValid () const
 Return whether or not this ogg decoder is reading a valid .ogg file. More...
 
- Public Member Functions inherited from om::sound::base::SoundInputStream
virtual ~SoundInputStream ()
 Destroy this sound input stream and release any resources associated with it. More...
 
SoundResult read (SoundBuffer &buffer, Size numSamples)
 Read the specified number of samples from the input stream into a sound buffer. More...
 
Bool hasSamplesRemaining () const
 Return whether or not this sound input stream has any samples remaining in the stream. More...
 

Additional Inherited Members

Detailed Description

A class that handles streaming decoding of the compresed .ogg audio format.

This class uses an abstract data stream for input, allowing it to decode .ogg data from a file, network source, or other source.

Constructor & Destructor Documentation

om::sound::io::FLACDecoder::FLACDecoder ( DataInputStream oggStream)

Create a new ogg decoder that is decoding from the specified data input stream.

The stream must already be open for reading and should point to the first byte of the ogg file information. Otherwise, reading from the .ogg file will fail.

om::sound::io::FLACDecoder::~FLACDecoder ( )

Release all resources associated with this FLACDecoder object.

Member Function Documentation

SoundSize om::sound::io::FLACDecoder::getLengthInSamples ( ) const
inline

Get the length in samples of the .ogg file that is being decoded.

Double om::sound::io::FLACDecoder::getLengthInSeconds ( ) const
inline

Get the length in seconds of the .ogg file that is being decoded.

SampleIndex om::sound::io::FLACDecoder::getCurrentSampleIndex ( ) const
inline

Get the index of the sample currently being read from the .ogg file.

Double om::sound::io::FLACDecoder::getCurrentTime ( ) const
inline

Get the time in seconds within the .ogg file of the current read position of this decoder.

virtual Bool om::sound::io::FLACDecoder::canSeek ( ) const
virtual

Return whether or not seeking is allowed in this input stream.

Reimplemented from om::sound::base::SoundInputStream.

virtual Bool om::sound::io::FLACDecoder::canSeek ( Int64  relativeSampleOffset) const
virtual

Return whether or not this input stream'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::SoundInputStream.

virtual Int64 om::sound::io::FLACDecoder::seek ( Int64  relativeSampleOffset)
virtual

Move the current sample frame position in the stream by the specified signed amount.

This method attempts to seek the position in the stream 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::SoundInputStream.

virtual SoundSize om::sound::io::FLACDecoder::getSamplesRemaining ( ) const
virtual

Return the number of samples remaining in the sound input stream.

The value returned must only be a lower bound on the total number of sample frames in the stream. For instance, if there are samples remaining, the method should return at least 1. If there are no samples remaining, the method should return 0.

Implements om::sound::base::SoundInputStream.

virtual SampleIndex om::sound::io::FLACDecoder::getPosition ( ) const
virtual

Return the current position of the stream within itself.

The returned value indicates the sample index of the current read position within the sound stream. For unbounded streams, this indicates the number of samples that have been read by the stream since it was opened.

Implements om::sound::base::SoundInputStream.

virtual Size om::sound::io::FLACDecoder::getChannelCount ( ) const
virtual

Return the number of channels that are in the sound input stream.

This is the number of channels that will be read with each read call to the stream's read method.

Implements om::sound::base::SoundInputStream.

virtual SampleRate om::sound::io::FLACDecoder::getSampleRate ( ) const
virtual

Return the sample rate of the sound input stream's source audio data.

Since some types of streams support variable sampling rates, this value is not necessarily the sample rate of all audio that is read from the stream. However, for most streams, this value represents the sample rate of the entire stream. One should always test the sample rate of the buffers returned by the stream to see what their sample rates are before doing any operations that assume a sampling rate.

Implements om::sound::base::SoundInputStream.

virtual SampleType om::sound::io::FLACDecoder::getNativeSampleType ( ) const
virtual

Return the actual sample type used in the stream.

This is the format of the stream's source data. For instance, a file might be encoded with 8-bit, 16-bit or 24-bit samples. This value indicates that sample type. For formats that don't have a native sample type, such as those which use frequency domain encoding, this function should return SampleType::SAMPLE_32F, indicating that the stream's native format is 32-bit floating point samples.

Implements om::sound::base::SoundInputStream.

Float om::sound::io::FLACDecoder::getBitRate ( ) const
inline

Return a value indicating the nominal bitrate for the currently decoded ogg file.

This method returns the nominal bitrate if the file is valid, or 0 if the file is invalid.

Float om::sound::io::FLACDecoder::getMinBitRate ( ) const
inline

Return a value indicating the minimum bitrate for the currently decoded ogg file.

This method returns the minimum bitrate if the file is valid, or 0 if the file is invalid.

Float om::sound::io::FLACDecoder::getMaxBitRate ( ) const
inline

Return a value indicating the maximum bitrate for the currently decoded ogg file.

This method returns the maximum bitrate if the file is valid, or 0 if the file is invalid.

Bool om::sound::io::FLACDecoder::isValid ( ) const
virtual

Return whether or not this ogg decoder is reading a valid .ogg file.

Implements om::sound::base::SoundInputStream.


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