Grid::Cleanup::~Cleanup() { std::lock_guard<std::mutex> gaurd(Grid::s_mutex); delete Grid::s_instance; Grid::s_instance = nullptr; }
nuiSound* nuiSoundManager::GetSound(const nglPath& rPath, nuiSound::Type type) { nglCriticalSectionGuard gaurd(mCS); nglString ID = nuiSound::GetStringID(rPath, type); SoundMap::iterator it = mSounds.find(ID); if (it != mSounds.end()) { nuiSound* pSound = it->second; return pSound; } nuiSound* pSound = NULL; switch (type) { case nuiSound::eStream: pSound = new nuiFileSound(rPath); break; case nuiSound::eMemory: pSound = new nuiMemorySound(rPath); break; default: NGL_ASSERT(0); break; } mSounds[ID] = pSound; return pSound; }
nuiSynthSound* nuiSoundManager::GetSynthSound() { nglCriticalSectionGuard gaurd(mCS); nuiSynthSound* pSound = new nuiSynthSound(); nglString ID = pSound->GetID(); mSounds[ID] = pSound; return pSound; }
nuiSound* nuiSoundManager::GetSound(const nglString& rSoundID, nglIStream* pStream) { nglCriticalSectionGuard gaurd(mCS); nglString ID = rSoundID; SoundMap::iterator it = mSounds.find(ID); if (it != mSounds.end()) { nuiSound* pSound = it->second; delete pStream; return pSound; } nuiSound* pSound = NULL; pSound = new nuiMemorySound(rSoundID, pStream); mSounds[ID] = pSound; return pSound; }