aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guilib/GUIAudioManager.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/guilib/GUIAudioManager.cpp b/guilib/GUIAudioManager.cpp
index 7c9768dc93..e0e7e6fbb1 100644
--- a/guilib/GUIAudioManager.cpp
+++ b/guilib/GUIAudioManager.cpp
@@ -53,15 +53,16 @@ CGUIAudioManager::~CGUIAudioManager()
void CGUIAudioManager::Initialize(int iDevice)
{
- if (m_bInitialized)
- return;
-
if (g_guiSettings.GetString("lookandfeel.soundskin")=="OFF")
return;
if (iDevice==CAudioContext::DEFAULT_DEVICE)
{
CSingleLock lock(m_cs);
+
+ if (m_bInitialized)
+ return;
+
CLog::Log(LOGDEBUG, "CGUIAudioManager::Initialize");
#ifdef _WIN32
bool bAudioOnAllSpeakers=false;
@@ -81,10 +82,11 @@ void CGUIAudioManager::DeInitialize(int iDevice)
{
if (!(iDevice == CAudioContext::DIRECTSOUND_DEVICE || iDevice == CAudioContext::DEFAULT_DEVICE)) return;
+ CSingleLock lock(m_cs);
+
if (!m_bInitialized)
return;
- CSingleLock lock(m_cs);
CLog::Log(LOGDEBUG, "CGUIAudioManager::DeInitialize");
if (m_actionSound) // Wait for finish when an action sound is playing
@@ -169,12 +171,12 @@ void CGUIAudioManager::FreeUnused()
// \brief Play a sound associated with a CAction
void CGUIAudioManager::PlayActionSound(const CAction& action)
{
+ CSingleLock lock(m_cs);
+
// it's not possible to play gui sounds when passthrough is active
if (!m_bInitialized || g_audioContext.IsPassthroughActive())
return;
- CSingleLock lock(m_cs);
-
actionSoundMap::iterator it=m_actionSoundMap.find(action.GetID());
if (it==m_actionSoundMap.end())
return;
@@ -200,12 +202,12 @@ void CGUIAudioManager::PlayActionSound(const CAction& action)
// 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_bInitialized || g_audioContext.IsPassthroughActive())
return;
- CSingleLock lock(m_cs);
-
windowSoundMap::iterator it=m_windowSoundMap.find(id);
if (it==m_windowSoundMap.end())
return;
@@ -250,12 +252,12 @@ void CGUIAudioManager::PlayWindowSound(int id, WINDOW_SOUND event)
// \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_bInitialized || g_audioContext.IsPassthroughActive())
return;
- CSingleLock lock(m_cs);
-
// If we already loaded the sound, just play it
pythonSoundsMap::iterator itsb=m_pythonSounds.find(strFileName);
if (itsb!=m_pythonSounds.end())
@@ -286,6 +288,8 @@ void CGUIAudioManager::PlayPythonSound(const CStdString& strFileName)
// xbmc
bool CGUIAudioManager::Load()
{
+ CSingleLock lock(m_cs);
+
m_actionSoundMap.clear();
m_windowSoundMap.clear();