# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLSOUND::CSampleBank Class Reference

A set of samples. More...

#include <sample_bank.h>

Inheritance diagram for NLSOUND::CSampleBank:

NLSOUND::CAudioMixerUser::IMixerUpdate List of all members.

Public Methods

 CSampleBank (const std::string &path, ISoundDriver *sd)
 Constructor. More...

virtual ~CSampleBank ()
 Destructor. More...

void load (bool async)
 Load all the samples. More...

bool unload ()
 Unload all the samples in this bank. More...

bool isLoaded ()
 Returns true if the samples in this bank have been loaded. More...

IBuffergetSample (const std::string &name)
 Return a samples corresponding to a name. More...

uint countSamples ()
 Return the number of samples in this bank. More...

uint getSize ()
 Return the size of this bank in bytes. More...

const std::string & getPath () const
 Return the filename. More...

const std::string & getName () const
 Return the name (must be unique). More...


Static Public Methods

CSampleBank * findSampleBank (const std::string &filename)
 Return an existing bank for the given file name, NULL if no bank for this file. More...

IBufferget (const std::string &name)
 Return the name corresponding to a name. The sample is searched. More...

void reload (bool async)
 Reload all the sample bank. More...

uint getTotalByteSize ()
 Return the total loaded samples size. More...

void releaseAll ()
 Delete all the loaded banks. More...


Private Types

typedef std::hash_map< std::string,
CSampleBank * > 
TSampleBankContainer

Private Methods

void onUpdate ()
 The update method. Used when waiting for async sample loading. More...


Private Attributes

ISoundDriver_SoundDriver
TSampleTable _Samples
std::string _Path
std::string _Name
bool _Loaded
bool _LoadingDone
uint _ByteSize
bool _SplitLoadDone
 Flag for splitted load. More...

std::list< std::pair< IBuffer *,
std::string > > 
_LoadList
 List of sample that need to be loaded asynchronously. More...


Static Private Attributes

TSampleBankContainer _Banks
uint _LoadedSize = 0

Detailed Description

A set of samples.

Author:
Peter Hanappe , Nevrax France
Date:
2001

Definition at line 64 of file sample_bank.h.


Member Typedef Documentation

typedef std::hash_map<std::string, CSampleBank*> NLSOUND::CSampleBank::TSampleBankContainer [private]
 

Definition at line 126 of file sample_bank.h.


Constructor & Destructor Documentation

NLSOUND::CSampleBank::CSampleBank const std::string &    path,
ISoundDriver   sd
 

Constructor.

Definition at line 97 of file sample_bank.cpp.

References _Banks, _Name, and _Path.

NLSOUND::CSampleBank::~CSampleBank   [virtual]
 

Destructor.

Definition at line 109 of file sample_bank.cpp.

References _Banks, _LoadingDone, _Samples, and NLMISC::nlSleep.


Member Function Documentation

uint NLSOUND::CSampleBank::countSamples  
 

Return the number of samples in this bank.

Definition at line 358 of file sample_bank.cpp.

References _Samples.

CSampleBank * NLSOUND::CSampleBank::findSampleBank const std::string &    filename [static]
 

Return an existing bank for the given file name, NULL if no bank for this file.

Definition at line 52 of file sample_bank.cpp.

References _Banks.

IBuffer * NLSOUND::CSampleBank::get const std::string &    name [static]
 

Return the name corresponding to a name. The sample is searched.

Definition at line 64 of file sample_bank.cpp.

References _Banks.

const std::string& NLSOUND::CSampleBank::getName void    const [inline]
 

Return the name (must be unique).

Definition at line 116 of file sample_bank.h.

References _Name.

const std::string& NLSOUND::CSampleBank::getPath   const [inline]
 

Return the filename.

Definition at line 113 of file sample_bank.h.

References _Path.

IBuffer * NLSOUND::CSampleBank::getSample const std::string &    name
 

Return a samples corresponding to a name.

Definition at line 326 of file sample_bank.cpp.

References _Samples.

uint NLSOUND::CSampleBank::getSize  
 

Return the size of this bank in bytes.

Definition at line 365 of file sample_bank.cpp.

References _Samples.

uint NLSOUND::CSampleBank::getTotalByteSize   [inline, static]
 

Return the total loaded samples size.

Definition at line 79 of file sample_bank.h.

References _LoadedSize.

bool NLSOUND::CSampleBank::isLoaded  
 

Returns true if the samples in this bank have been loaded.

Definition at line 319 of file sample_bank.cpp.

References _Loaded.

void NLSOUND::CSampleBank::load bool    async
 

Load all the samples.

Can throw EPathNotFound or ESoundFileNotFound (check Exception)

Parameters:
async  If true, the samples are loaded in background.

Definition at line 147 of file sample_bank.cpp.

References _ByteSize, _Loaded, _LoadedSize, _LoadingDone, _LoadList, _Name, _Path, _Samples, _SoundDriver, _SplitLoadDone, NLSOUND::ASYNC_LOADING_SPLIT, nlassert, nldebug, and nlwarning.

void NLSOUND::CSampleBank::onUpdate   [private, virtual]
 

The update method. Used when waiting for async sample loading.

Implements NLSOUND::CAudioMixerUser::IMixerUpdate.

Definition at line 230 of file sample_bank.cpp.

References _ByteSize, _LoadedSize, _LoadingDone, _LoadList, _Name, _Path, _Samples, _SplitLoadDone, NLSOUND::ASYNC_LOADING_SPLIT, and nldebug.

void NLSOUND::CSampleBank::releaseAll   [static]
 

Delete all the loaded banks.

Definition at line 378 of file sample_bank.cpp.

References _Banks, and nldebug.

void NLSOUND::CSampleBank::reload bool    async [static]
 

Reload all the sample bank.

Definition at line 82 of file sample_bank.cpp.

References _Banks.

bool NLSOUND::CSampleBank::unload  
 

Unload all the samples in this bank.

Return false is unload can't be done (if an async loading is not terminated.

Definition at line 273 of file sample_bank.cpp.

References _ByteSize, _Loaded, _LoadedSize, _LoadingDone, _Name, _Path, _Samples, nldebug, and nlwarning.


Member Data Documentation

CSampleBank::TSampleBankContainer NLSOUND::CSampleBank::_Banks [static, private]
 

Definition at line 46 of file sample_bank.cpp.

Referenced by CSampleBank, findSampleBank, get, releaseAll, reload, and ~CSampleBank.

uint NLSOUND::CSampleBank::_ByteSize [private]
 

Definition at line 148 of file sample_bank.h.

Referenced by load, onUpdate, and unload.

bool NLSOUND::CSampleBank::_Loaded [private]
 

Definition at line 144 of file sample_bank.h.

Referenced by isLoaded, load, and unload.

uint NLSOUND::CSampleBank::_LoadedSize = 0 [static, private]
 

Definition at line 47 of file sample_bank.cpp.

Referenced by getTotalByteSize, load, onUpdate, and unload.

bool NLSOUND::CSampleBank::_LoadingDone [private]
 

Definition at line 146 of file sample_bank.h.

Referenced by load, onUpdate, unload, and ~CSampleBank.

std::list<std::pair<IBuffer *, std::string> > NLSOUND::CSampleBank::_LoadList [private]
 

List of sample that need to be loaded asynchronously.

Definition at line 154 of file sample_bank.h.

Referenced by load, and onUpdate.

std::string NLSOUND::CSampleBank::_Name [private]
 

Definition at line 141 of file sample_bank.h.

Referenced by CSampleBank, getName, load, onUpdate, and unload.

std::string NLSOUND::CSampleBank::_Path [private]
 

Definition at line 140 of file sample_bank.h.

Referenced by CSampleBank, getPath, load, onUpdate, and unload.

TSampleTable NLSOUND::CSampleBank::_Samples [private]
 

Definition at line 137 of file sample_bank.h.

Referenced by countSamples, getSample, getSize, load, onUpdate, unload, and ~CSampleBank.

ISoundDriver* NLSOUND::CSampleBank::_SoundDriver [private]
 

Definition at line 134 of file sample_bank.h.

Referenced by load.

bool NLSOUND::CSampleBank::_SplitLoadDone [private]
 

Flag for splitted load.

Definition at line 151 of file sample_bank.h.

Referenced by load, and onUpdate.


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