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

A class that handles streaming decoding of the PCM AIFF audio format. More...

#include <omSoundAIFFDecoder.h>

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

Public Member Functions

 AIFFDecoder (DataInputStream *aiffStream)
 Create a new AIFF decoder that is decoding from the specified data input stream. More...
 
 ~AIFFDecoder ()
 Release all resources associated with this AIFFDecoder object. More...
 
SoundSize getLengthInSamples () const
 Get the length in samples of the AIFF file that is being decoded. More...
 
Double getLengthInSeconds () const
 Get the length in seconds of the AIFF file that is being decoded. More...
 
SampleIndex getCurrentSampleIndex () const
 Get the index of the sample currently being read from the AIFF file. More...
 
Double getCurrentTime () const
 Get the time in seconds within the AIFF 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...
 
Bool isValid () const
 Return whether or not this AIFF decoder is reading a valid AIFF 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 PCM AIFF audio format.

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

Constructor & Destructor Documentation

om::sound::io::AIFFDecoder::AIFFDecoder ( DataInputStream aiffStream)

Create a new AIFF 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 aiff file information. Otherwise, reading from the AIFF file will fail.

om::sound::io::AIFFDecoder::~AIFFDecoder ( )

Release all resources associated with this AIFFDecoder object.

Member Function Documentation

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

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

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

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

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

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

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

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

virtual Bool om::sound::io::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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::AIFFDecoder::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.

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

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

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


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