Classes | Static Public Member Functions | List of all members
cpp3ds::SoundFileFactory Class Reference

Manages and instantiates sound file readers and writers. More...

#include <SoundFileFactory.hpp>

Static Public Member Functions

template<typename T >
static void registerReader ()
 Register a new reader. More...
 
template<typename T >
static void unregisterReader ()
 Unregister a reader. More...
 
template<typename T >
static void registerWriter ()
 Register a new writer. More...
 
template<typename T >
static void unregisterWriter ()
 Unregister a writer. More...
 
static SoundFileReadercreateReaderFromFilename (const std::string &filename)
 Instantiate the right reader for the given file on disk. More...
 
static SoundFileReadercreateReaderFromMemory (const void *data, std::size_t sizeInBytes)
 Instantiate the right codec for the given file in memory. More...
 
static SoundFileReadercreateReaderFromStream (InputStream &stream)
 Instantiate the right codec for the given file in stream. More...
 
static SoundFileWritercreateWriterFromFilename (const std::string &filename)
 Instantiate the right writer for the given file on disk. More...
 

Detailed Description

Manages and instantiates sound file readers and writers.

This class is where all the sound file readers and writers are registered.

You should normally only need to use its registration and unregistration functions; readers/writers creation and manipulation are wrapped into the higher-level classes cpp3ds::InputSoundFile and cpp3ds::OutputSoundFile.

To register a new reader (writer) use the cpp3ds::SoundFileFactory::registerReader (registerWriter) static function. You don't have to call the unregisterReader (unregisterWriter) function, unless you want to unregister a format before your application ends (typically, when a plugin is unloaded).

Usage example:

cpp3ds::SoundFileFactory::registerReader<MySoundFileReader>();
cpp3ds::SoundFileFactory::registerWriter<MySoundFileWriter>();
See also
cpp3ds::InputSoundFile, cpp3ds::OutputSoundFile, cpp3ds::SoundFileReader, cpp3ds::SoundFileWriter

Definition at line 45 of file SoundFileFactory.hpp.

Member Function Documentation

static SoundFileReader* cpp3ds::SoundFileFactory::createReaderFromFilename ( const std::string &  filename)
static

Instantiate the right reader for the given file on disk.

It's up to the caller to release the returned reader

Parameters
filenamePath of the sound file
Returns
A new sound file reader that can read the given file, or null if no reader can handle it
See also
createReaderFromMemory, createReaderFromStream
static SoundFileReader* cpp3ds::SoundFileFactory::createReaderFromMemory ( const void *  data,
std::size_t  sizeInBytes 
)
static

Instantiate the right codec for the given file in memory.

It's up to the caller to release the returned reader

Parameters
dataPointer to the file data in memory
sizeInBytesTotal size of the file data, in bytes
Returns
A new sound file codec that can read the given file, or null if no codec can handle it
See also
createReaderFromFilename, createReaderFromStream
static SoundFileReader* cpp3ds::SoundFileFactory::createReaderFromStream ( InputStream stream)
static

Instantiate the right codec for the given file in stream.

It's up to the caller to release the returned reader

Parameters
streamSource stream to read from
Returns
A new sound file codec that can read the given file, or null if no codec can handle it
See also
createReaderFromFilename, createReaderFromMemory
static SoundFileWriter* cpp3ds::SoundFileFactory::createWriterFromFilename ( const std::string &  filename)
static

Instantiate the right writer for the given file on disk.

It's up to the caller to release the returned writer

Parameters
filenamePath of the sound file
Returns
A new sound file writer that can write given file, or null if no writer can handle it
template<typename T >
static void cpp3ds::SoundFileFactory::registerReader ( )
static

Register a new reader.

See also
unregisterReader
template<typename T >
static void cpp3ds::SoundFileFactory::registerWriter ( )
static

Register a new writer.

See also
unregisterWriter
template<typename T >
static void cpp3ds::SoundFileFactory::unregisterReader ( )
static

Unregister a reader.

See also
registerReader
template<typename T >
static void cpp3ds::SoundFileFactory::unregisterWriter ( )
static

Unregister a writer.

See also
registerWriter

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