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

A class that handles encoding and decoding sound data to/from various formats. More...

#include <omSoundConverter.h>

Public Member Functions

 SoundConverter ()
 Create a default sound converter which can encode or decode any of the supported sound formats. More...
 
Size getTranscoderCount () const
 Return the total number of transcoders that this sound converter supports. More...
 
SoundTranscodergetTranscoder (SoundFormat format) const
 Return a pointer to the transcoder for the specified sound format. More...
 
Bool addTranscoder (SoundTranscoder *newTranscoder)
 Add a new transcoder to this sound converter. More...
 
Bool removeTranscoder (SoundFormat format)
 Remove the transcoder from this converter with the specified sound format. More...
 
void clearTranscoders ()
 Remove all transcoders from this sound converter. More...
 
Bool canEncode (const SoundFormat &format) const
 Return whether or not this transcoder is able to encode the specified sound format. More...
 
Bool canEncode (const SoundFormat &format, const Sound &sound) const
 Return whether or not this transcoder is able to encode the specified sound. More...
 
Bool encode (const SoundFormat &format, const UTF8String &filePath, const Sound &sound) const
 Save the specified sound object at the specified ID location. More...
 
Bool encode (const SoundFormat &format, DataOutputStream &stream, const Sound &sound) const
 Save the specified sound object at the specified stream. More...
 
Bool encode (const UTF8String &filePath, const Sound &sound) const
 Save the specified sound object at the specified file path. More...
 
Bool canDecode (const SoundFormat &format) const
 Return whether or not this converter can decode the specified sound format. More...
 
Bool canDecode (const SoundFormat &format, const UTF8String &filePath) const
 Return whether or not the specified identifier refers to a valid sound for this transcoder. More...
 
Bool decode (const SoundFormat &format, const UTF8String &filePath, Sound &sound) const
 Load the sound pointed to by the specified identifier. More...
 
Bool decode (const SoundFormat &format, DataInputStream &stream, Sound &sound) const
 Load the sound located at the current position in the given data stream.. More...
 
Bool decode (const SoundFormat &format, const Shared< DataInputStream > &stream, Sound &sound) const
 Load the sound located at the current position in the given data stream.. More...
 
Bool decode (const UTF8String &filePath, Sound &sound) const
 Load the sound pointed to by the specified file path. More...
 

Detailed Description

A class that handles encoding and decoding sound data to/from various formats.

Constructor & Destructor Documentation

om::sound::io::SoundConverter::SoundConverter ( )

Create a default sound converter which can encode or decode any of the supported sound formats.

In order to encode unsupported sound formats, the user should create a class that inherits from SoundTranscoder and add it to this converter for the correct format.

Member Function Documentation

Size om::sound::io::SoundConverter::getTranscoderCount ( ) const
inline

Return the total number of transcoders that this sound converter supports.

SoundTranscoder* om::sound::io::SoundConverter::getTranscoder ( SoundFormat  format) const

Return a pointer to the transcoder for the specified sound format.

If that format is not supported by the converter, a NULL pointer is returned.

Bool om::sound::io::SoundConverter::addTranscoder ( SoundTranscoder newTranscoder)

Add a new transcoder to this sound converter.

If transcoder pointer is not NULL, the transcoder is added to the converter for its format (accessed by calling getFormat() on the transcoder). If there already exists a transcoder for that format, it is replaced. The method returns whether or not the new transcoder was successfully added.

Bool om::sound::io::SoundConverter::removeTranscoder ( SoundFormat  format)

Remove the transcoder from this converter with the specified sound format.

If there is a transcoder with that format, it is removed and TRUE is returned. Otherwise, the converter is unchanged and FALSE is returned.

void om::sound::io::SoundConverter::clearTranscoders ( )

Remove all transcoders from this sound converter.

After this operation, the sound converter will not be able to decode or encode sounds in any format until new transcoder objects are added to it.

Bool om::sound::io::SoundConverter::canEncode ( const SoundFormat format) const

Return whether or not this transcoder is able to encode the specified sound format.

Bool om::sound::io::SoundConverter::canEncode ( const SoundFormat format,
const Sound sound 
) const

Return whether or not this transcoder is able to encode the specified sound.

Bool om::sound::io::SoundConverter::encode ( const SoundFormat format,
const UTF8String &  filePath,
const Sound sound 
) const

Save the specified sound object at the specified ID location.

The method returns whether or not the sound was successfully written.

Bool om::sound::io::SoundConverter::encode ( const SoundFormat format,
DataOutputStream stream,
const Sound sound 
) const

Save the specified sound object at the specified stream.

Bool om::sound::io::SoundConverter::encode ( const UTF8String &  filePath,
const Sound sound 
) const

Save the specified sound object at the specified file path.

The output file type is determined by the file path's extension. The method returns whether or not the sound was successfully written.

Bool om::sound::io::SoundConverter::canDecode ( const SoundFormat format) const

Return whether or not this converter can decode the specified sound format.

Bool om::sound::io::SoundConverter::canDecode ( const SoundFormat format,
const UTF8String &  filePath 
) const

Return whether or not the specified identifier refers to a valid sound for this transcoder.

If the identifier represents a valid sound, TRUE is returned. Otherwise, if the sound is not valid, FALSE is returned.

Bool om::sound::io::SoundConverter::decode ( const SoundFormat format,
const UTF8String &  filePath,
Sound sound 
) const

Load the sound pointed to by the specified identifier.

Bool om::sound::io::SoundConverter::decode ( const SoundFormat format,
DataInputStream stream,
Sound sound 
) const

Load the sound located at the current position in the given data stream..

Bool om::sound::io::SoundConverter::decode ( const SoundFormat format,
const Shared< DataInputStream > &  stream,
Sound sound 
) const

Load the sound located at the current position in the given data stream..

Bool om::sound::io::SoundConverter::decode ( const UTF8String &  filePath,
Sound sound 
) const

Load the sound pointed to by the specified file path.

The output file type is determined by the file path's extension.


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