Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
FileManager Class Reference

The FileManager manages all file input and output plugins. More...

#include <FileManager.h>

Static Public Member Functions

static void registerInput (std::shared_ptr< IFileInput > input)
 Registers a file input used to create an IReader to read from a file.
 
static void registerOutput (std::shared_ptr< IFileOutput > output)
 Registers a file output used to create an IWriter to write to a file.
 
static std::shared_ptr< IReadercreateReader (const std::string &filename, int stream=0)
 Creates a file reader for the given filename if a registed IFileInput is able to read it.
 
static std::shared_ptr< IReadercreateReader (std::shared_ptr< Buffer > buffer, int stream=0)
 Creates a file reader for the given buffer if a registed IFileInput is able to read it.
 
static std::vector< StreamInfoqueryStreams (const std::string &filename)
 Queries the streams of a sound file.
 
static std::vector< StreamInfoqueryStreams (std::shared_ptr< Buffer > buffer)
 Queries the streams of a sound file.
 
static std::shared_ptr< IWritercreateWriter (const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
 Creates a file writer that writes a sound to the given file path.
 

Detailed Description

The FileManager manages all file input and output plugins.

Member Function Documentation

◆ createReader() [1/2]

static std::shared_ptr< IReader > FileManager::createReader ( const std::string & filename,
int stream = 0 )
static

Creates a file reader for the given filename if a registed IFileInput is able to read it.

Parameters
filenameThe path to the file.
streamThe index of the audio stream within the file if it contains multiple audio streams.
Returns
The reader created.
Exceptions
ExceptionIf no file input can read the file an exception is thrown.

◆ createReader() [2/2]

static std::shared_ptr< IReader > FileManager::createReader ( std::shared_ptr< Buffer > buffer,
int stream = 0 )
static

Creates a file reader for the given buffer if a registed IFileInput is able to read it.

Parameters
bufferThe buffer to read the file from.
streamThe index of the audio stream within the file if it contains multiple audio streams.
Returns
The reader created.
Exceptions
ExceptionIf no file input can read the file an exception is thrown.

◆ createWriter()

static std::shared_ptr< IWriter > FileManager::createWriter ( const std::string & filename,
DeviceSpecs specs,
Container format,
Codec codec,
unsigned int bitrate )
static

Creates a file writer that writes a sound to the given file path.

Existing files will be overwritten.

Parameters
filenameThe file path to write to.
specsThe output specification.
formatThe container format for the file.
codecThe codec used inside the container.
bitrateThe bitrate to write with.
Returns
A writer that creates the file.
Exceptions
ExceptionIf no file output can write the file with the given specification an exception is thrown.

◆ queryStreams() [1/2]

static std::vector< StreamInfo > FileManager::queryStreams ( const std::string & filename)
static

Queries the streams of a sound file.

Parameters
filenamePath to the file to be read.
Returns
A vector with as many streams as there are in the file.
Exceptions
ExceptionThrown if the file specified cannot be read.

◆ queryStreams() [2/2]

static std::vector< StreamInfo > FileManager::queryStreams ( std::shared_ptr< Buffer > buffer)
static

Queries the streams of a sound file.

Parameters
bufferThe in-memory file buffer.
Returns
A vector with as many streams as there are in the file.
Exceptions
ExceptionThrown if the file specified cannot be read.

◆ registerInput()

static void FileManager::registerInput ( std::shared_ptr< IFileInput > input)
static

Registers a file input used to create an IReader to read from a file.

Parameters
inputThe IFileInput to register.

◆ registerOutput()

static void FileManager::registerOutput ( std::shared_ptr< IFileOutput > output)
static

Registers a file output used to create an IWriter to write to a file.

Parameters
outputThe IFileOutput to register.

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