50 for ( ; it != itend; ++it) {
51 totalSize += it->second->getSize();
62 for ( ; it != itend; ++it) {
76 for ( ; it != itend; ++it) {
96 FL_WARN(
_log,
LMsg(
"SoundClipManager::create(std::string, IResourceLoader* loader) - ") <<
"Resource name " << name <<
" was previously created. Returning original SoundClip...");
120 FL_WARN(
_log,
LMsg(
"SoundClipManager::load(std::string) - ") <<
"Resource name " << name <<
" was not found and could not be loaded.");
133 std::pair<SoundClipHandleMapIterator, bool> returnValue;
136 if (returnValue.second) {
140 FL_WARN(
_log,
LMsg(
"SoundClipManager::add(IResource*) - ") <<
"Resource " << res->
getName() <<
" already exists.... ignoring.");
143 return returnValue.first->second;
175 FL_WARN(
_log,
LMsg(
"SoundClipManager::reload(std::string) - ") <<
"Resource name " << name <<
" not found.");
189 FL_WARN(
_log,
LMsg(
"SoundClipManager::reload(ResourceHandle) - ") <<
"Resource handle " << handle <<
" not found.");
197 for ( ; it != itend; ++it) {
210 for ( ; it != itend; ++it) {
216 FL_DBG(
_log,
LMsg(
"SoundClipManager::loadUnreferenced() - ") <<
"Loaded " << count <<
" unreferenced resources.");
229 FL_WARN(
_log,
LMsg(
"SoundClipManager::free(std::string) - ") <<
"Resource name " << name <<
" not found.");
241 FL_WARN(
_log,
LMsg(
"SoundClipManager::free(ResourceHandle) - ") <<
"Resource handle " << handle <<
" not found.");
250 for ( ; it != itend; ++it) {
257 FL_DBG(
_log,
LMsg(
"SoundClipManager::freeAll() - ") <<
"Freed all " << count <<
" resources.");
265 for ( ; it != itend; ++it) {
272 FL_DBG(
_log,
LMsg(
"SoundClipManager::freeUnreferenced() - ") <<
"Freed " << count <<
" unreferenced resources.");
289 FL_WARN(
_log,
LMsg(
"SoundClipManager::remove(ResourcePtr&) - ") <<
"Resource " << resource->
getName() <<
" was not found.");
297 handle = nit->second->getHandle();
301 FL_WARN(
_log,
LMsg(
"SoundClipManager::remove(std::string) - ") <<
"Resource " << name <<
" was not found.");
320 name = it->second->getName();
324 FL_WARN(
_log,
LMsg(
"SoundClipManager::remove(ResourceHandle) - ") <<
"Resource handle " << handle <<
" was not found.");
346 FL_DBG(
_log,
LMsg(
"SoundClipManager::removeAll() - ") <<
"Removed all " << count <<
" resources.");
354 for ( ; it != itend; ++it) {
355 if ( it->second.useCount() == 2) {
356 remove(it->second->getHandle());
361 FL_DBG(
_log,
LMsg(
"SoundClipManager::removeUnreferenced() - ") <<
"Removed " << count <<
" unreferenced resources.");
390 FL_WARN(
_log,
LMsg(
"SoundClipManager::get(ResourceHandle) - ") <<
"Resource handle " << handle <<
" is undefined.");
398 return nit->second->getHandle();
401 FL_WARN(
_log,
LMsg(
"SoundClipManager::getResourceHandle(std::string) - ") <<
"Resource " << name <<
" is undefined.");
#define FL_WARN(logger, msg)
virtual ~SoundClipManager()
Destructor.
SharedPtr< SoundClip > SoundClipPtr
virtual ResourceState getState()
virtual size_t getTotalResources() const
Returns the number of defined resources.
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
std::pair< ResourceHandle, SoundClipPtr > SoundClipHandleMapPair
virtual SoundClipPtr load(const std::string &name, IResourceLoader *loader=0)
Creates a blank resource and loads it from disk.
virtual size_t getMemoryUsed() const
Gets the total amount of memory used by resources.
static Logger _log(LM_AUDIO)
virtual void freeAll()
Frees all SoundClips.
virtual void free(const std::string &name)
Frees a SoundClip from memory.
std::size_t ResourceHandle
virtual size_t getTotalResourcesLoaded() const
Returns the number of loaded resources.
std::map< std::string, SoundClipPtr >::iterator SoundClipNameMapIterator
virtual ResourceHandle getResourceHandle(const std::string &name)
Gets a SoundClip handle by name.
std::map< ResourceHandle, SoundClipPtr >::iterator SoundClipHandleMapIterator
virtual void removeAll()
Removes all SoundClips from the manager.
virtual SoundClipPtr create(IResourceLoader *loader=0)
Creates a blank SoundClip but does not load it immediately.
virtual void remove(SoundClipPtr &resource)
Removes a SoundClip from the manager.
virtual void loadUnreferenced()
Loads all unreferenced SoundClips.
virtual size_t getTotalResourcesCreated() const
Returns the number of unloaded resources.
SoundClipHandleMap m_sclipHandleMap
virtual void reload(const std::string &name)
Reloads a SoundClip.
virtual const std::string & getName()
virtual bool exists(const std::string &name)
Checks to see if a SoundClip exists.
virtual SoundClipPtr add(SoundClip *res)
Add an Image to the manager.
std::map< ResourceHandle, SoundClipPtr >::const_iterator SoundClipHandleMapConstIterator
virtual SoundClipPtr get(const std::string &name)
Gets a shared pointer to the SoundClip.
std::pair< std::string, SoundClipPtr > SoundClipNameMapPair
virtual void reloadAll()
Reloads all SoundClips.
SoundClipNameMap m_sclipNameMap
virtual void removeUnreferenced()
Removes all unreferenced SoundClips.
ResourceHandle getHandle()
virtual void freeUnreferenced()
Frees all unreferenced SoundClip.
#define FL_DBG(logger, msg)
Class to handle the buffers of an audio file.