clanSound Sound Providers

Classes

class  clan::SoundProvider_Raw
 Sound provider in a raw PCM format (no header in file). More...
 
class  clan::SoundProvider_Wave
 Windows WAVE sample format (.wav) sound provider. More...
 
class  clan::SoundProviderFactory
 Sound Provider Factor class. More...
 
class  clan::SoundProviderType
 Sound provider type. More...
 
class  clan::SoundProviderType_Register< SoundProviderClass >
 Class template to register a sound provider type. More...
 

Operations

static SoundProviderclan::SoundProviderFactory::load (const std::string &filename, bool streamed, const FileSystem &fs, const std::string &type=std::string())
 Loads an sample file from 'filename', using the provider identified by 'type'. More...
 
static SoundProviderclan::SoundProviderFactory::load (const std::string &fullname, bool streamed, const std::string &type=std::string())
 Loads an sample file from 'filename', using the provider identified by 'type'. More...
 
static SoundProviderclan::SoundProviderFactory::load (IODevice &file, bool streamed, const std::string &type)
 Loads an sample file from 'file', using the provider identified by 'type'. More...
 

Construction

 clan::SoundProvider_Raw::SoundProvider_Raw (void *sound_data, int num_samples, int bytes_per_sample, bool stereo, int frequency=22050)
 Constructs a sound provider based on some raw PCM data. More...
 
virtual clan::SoundProvider_Raw::~SoundProvider_Raw ()
 

Operations

virtual SoundProvider_Sessionclan::SoundProvider_Raw::begin_session () override
 Called by SoundBuffer when a new session starts. More...
 
virtual void clan::SoundProvider_Raw::end_session (SoundProvider_Session *session) override
 Called by SoundBuffer when a session has finished. After this call,. More...
 

Implementation

class clan::SoundProvider_Raw::SoundProvider_Raw_Session
 

Construction

 clan::SoundProviderType::SoundProviderType (const std::string &type)
 Registers a sound provider type in the SoundProviderFactory. More...
 
virtual clan::SoundProviderType::~SoundProviderType ()
 Unregisters a sound provider type in the SoundProviderFactory. More...
 

Operations

virtual SoundProviderclan::SoundProviderType::load (const std::string &filename, bool streamed, const FileSystem &file_system)=0
 Called to load with this sound provider type. More...
 
virtual SoundProviderclan::SoundProviderType::load (IODevice &file, bool streamed)=0
 

Construction

 clan::SoundProviderType_Register< SoundProviderClass >::SoundProviderType_Register (const std::string &type)
 Registers sound provider type in the SoundProviderFactory. More...
 

Operations

virtual SoundProviderclan::SoundProviderType_Register< SoundProviderClass >::load (const std::string &filename, bool stream, const FileSystem &fs) override
 Called to load static with this sound provider type. More...
 
virtual SoundProviderclan::SoundProviderType_Register< SoundProviderClass >::load (IODevice &file, bool stream) override
 Called to load static with this sound provider type. More...
 

Construction

 clan::SoundProvider_Wave::SoundProvider_Wave (const std::string &filename, const FileSystem &fs, bool stream=false)
 Constructs a sound provider based on a Windows wave (.wav) file. More...
 
 clan::SoundProvider_Wave::SoundProvider_Wave (const std::string &fullname, bool stream=false)
 
 clan::SoundProvider_Wave::SoundProvider_Wave (IODevice &file, bool stream=false)
 
virtual clan::SoundProvider_Wave::~SoundProvider_Wave ()
 

Operations

virtual SoundProvider_Sessionclan::SoundProvider_Wave::begin_session () override
 Called by SoundBuffer when a new session starts. More...
 
virtual void clan::SoundProvider_Wave::end_session (SoundProvider_Session *session) override
 Called by SoundBuffer when a session has finished. After this call,. More...
 

Implementation

class clan::SoundProvider_Wave::SoundProvider_Wave_Session
 

Detailed Description

Function Documentation

◆ SoundProvider_Raw()

clan::SoundProvider_Raw::SoundProvider_Raw ( void *  sound_data,
int  num_samples,
int  bytes_per_sample,
bool  stereo,
int  frequency = 22050 
)

Constructs a sound provider based on some raw PCM data.

Parameters
sound_dataRaw PCM data.
num_samplesNumber of samples to be read out of sound_data.
bytes_per_sampleThe size of a sample in bytes. This is 2 for 16 bit (signed), and 1 for 8 bit (unsigned).
stereoTrue if sound is stereo (two channels).
frequencyPlayback frequency for sample data.

◆ SoundProvider_Wave() [1/3]

clan::SoundProvider_Wave::SoundProvider_Wave ( const std::string &  filename,
const FileSystem fs,
bool  stream = false 
)

Constructs a sound provider based on a Windows wave (.wav) file.

Parameters
filenameFilename of wave file.
providerInput source provider used to retrieve wave file.
streamIf true, will stream from disk. If false, will load it to memory.

◆ SoundProvider_Wave() [2/3]

clan::SoundProvider_Wave::SoundProvider_Wave ( const std::string &  fullname,
bool  stream = false 
)

◆ SoundProvider_Wave() [3/3]

clan::SoundProvider_Wave::SoundProvider_Wave ( IODevice file,
bool  stream = false 
)

◆ SoundProviderType()

clan::SoundProviderType::SoundProviderType ( const std::string &  type)

Registers a sound provider type in the SoundProviderFactory.

◆ SoundProviderType_Register()

template<class SoundProviderClass >
clan::SoundProviderType_Register< SoundProviderClass >::SoundProviderType_Register ( const std::string &  type)
inline

Registers sound provider type in the SoundProviderFactory.

◆ ~SoundProvider_Raw()

virtual clan::SoundProvider_Raw::~SoundProvider_Raw ( )
virtual

◆ ~SoundProvider_Wave()

virtual clan::SoundProvider_Wave::~SoundProvider_Wave ( )
virtual

◆ ~SoundProviderType()

virtual clan::SoundProviderType::~SoundProviderType ( )
virtual

Unregisters a sound provider type in the SoundProviderFactory.

◆ begin_session() [1/2]

virtual SoundProvider_Session* clan::SoundProvider_Raw::begin_session ( )
overridevirtual

Called by SoundBuffer when a new session starts.

Returns
The soundbuffer session to be attached to the newly started session.

Implements clan::SoundProvider.

◆ begin_session() [2/2]

virtual SoundProvider_Session* clan::SoundProvider_Wave::begin_session ( )
overridevirtual

Called by SoundBuffer when a new session starts.

Returns
The soundbuffer session to be attached to the newly started session.

Implements clan::SoundProvider.

◆ end_session() [1/2]

virtual void clan::SoundProvider_Raw::end_session ( SoundProvider_Session session)
overridevirtual

Called by SoundBuffer when a session has finished. After this call,.

SoundBuffer will not access the session anymore. It can safely be deleted here (and in most cases should be delete here).

Implements clan::SoundProvider.

◆ end_session() [2/2]

virtual void clan::SoundProvider_Wave::end_session ( SoundProvider_Session session)
overridevirtual

Called by SoundBuffer when a session has finished. After this call,.

SoundBuffer will not access the session anymore. It can safely be deleted here (and in most cases should be delete here).

Implements clan::SoundProvider.

◆ load() [1/7]

template<class SoundProviderClass >
virtual SoundProvider* clan::SoundProviderType_Register< SoundProviderClass >::load ( const std::string &  filename,
bool  stream,
const FileSystem fs 
)
inlineoverridevirtual

Called to load static with this sound provider type.

Implements clan::SoundProviderType.

◆ load() [2/7]

virtual SoundProvider* clan::SoundProviderType::load ( const std::string &  filename,
bool  streamed,
const FileSystem file_system 
)
pure virtual

Called to load with this sound provider type.

Implemented in clan::SoundProviderType_Register< SoundProviderClass >.

◆ load() [3/7]

static SoundProvider* clan::SoundProviderFactory::load ( const std::string &  filename,
bool  streamed,
const FileSystem fs,
const std::string &  type = std::string() 
)
static

Loads an sample file from 'filename', using the provider identified by 'type'.

If the type is an empty string, it uses the extension of the filename to determine what type it is.

The input provider will be used as a the source for filename, if specified.

◆ load() [4/7]

static SoundProvider* clan::SoundProviderFactory::load ( const std::string &  fullname,
bool  streamed,
const std::string &  type = std::string() 
)
static

Loads an sample file from 'filename', using the provider identified by 'type'.

◆ load() [5/7]

template<class SoundProviderClass >
virtual SoundProvider* clan::SoundProviderType_Register< SoundProviderClass >::load ( IODevice file,
bool  stream 
)
inlineoverridevirtual

Called to load static with this sound provider type.

Implements clan::SoundProviderType.

◆ load() [6/7]

virtual SoundProvider* clan::SoundProviderType::load ( IODevice file,
bool  streamed 
)
pure virtual

◆ load() [7/7]

static SoundProvider* clan::SoundProviderFactory::load ( IODevice file,
bool  streamed,
const std::string &  type 
)
static

Loads an sample file from 'file', using the provider identified by 'type'.

Friends

◆ SoundProvider_Raw_Session

friend class SoundProvider_Raw_Session
friend

◆ SoundProvider_Wave_Session

friend class SoundProvider_Wave_Session
friend