// \brief Play a sound associated with a window and its event // Events: SOUND_INIT, SOUND_DEINIT void CGUIAudioManager::PlayWindowSound(int id, WINDOW_SOUND event) { CSingleLock lock(m_cs); // it's not possible to play gui sounds when passthrough is active if (!m_bEnabled) return; windowSoundMap::iterator it=m_windowSoundMap.find(id); if (it==m_windowSoundMap.end()) return; CWindowSounds sounds=it->second; IAESound *sound = NULL; switch (event) { case SOUND_INIT: sound = sounds.initSound; break; case SOUND_DEINIT: sound = sounds.deInitSound; break; } if (!sound) return; sound->Play(); }
// \brief Play a sound given by filename void CGUIAudioManager::PlayPythonSound(const std::string& strFileName, bool useCached /*= true*/) { CSingleLock lock(m_cs); // it's not possible to play gui sounds when passthrough is active if (!m_bEnabled) return; // If we already loaded the sound, just play it pythonSoundsMap::iterator itsb=m_pythonSounds.find(strFileName); if (itsb != m_pythonSounds.end()) { IAESound* sound = itsb->second; if (useCached) { sound->Play(); return; } else { FreeSoundAllUsage(sound); m_pythonSounds.erase(itsb); } } IAESound *sound = LoadSound(strFileName); if (!sound) return; m_pythonSounds.insert(pair<const std::string, IAESound*>(strFileName, sound)); sound->Play(); }
void CGUIAudioManager::Stop() { CSingleLock lock(m_cs); for (windowSoundMap::iterator it = m_windowSoundMap.begin(); it != m_windowSoundMap.end(); ++it) { if (it->second.initSound ) it->second.initSound ->Stop(); if (it->second.deInitSound) it->second.deInitSound->Stop(); } for (pythonSoundsMap::iterator it = m_pythonSounds.begin(); it != m_pythonSounds.end(); ++it) { IAESound* sound = it->second; sound->Stop(); } }
// \brief Play a sound given by filename void CGUIAudioManager::PlayPythonSound(const CStdString& strFileName) { CSingleLock lock(m_cs); // it's not possible to play gui sounds when passthrough is active if (!m_bEnabled) return; // If we already loaded the sound, just play it pythonSoundsMap::iterator itsb=m_pythonSounds.find(strFileName); if (itsb != m_pythonSounds.end()) { IAESound* sound = itsb->second; sound->Play(); return; } IAESound *sound = LoadSound(strFileName); if (!sound) return; m_pythonSounds.insert(pair<const CStdString, IAESound*>(strFileName, sound)); sound->Play(); }