aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUIAudioManager.cpp
diff options
context:
space:
mode:
authoralthekiller <althekiller@svn>2010-06-19 20:55:00 +0000
committeralthekiller <althekiller@svn>2010-06-19 20:55:00 +0000
commit535d18fb36f102a65daf9b95784678bb54d5ce20 (patch)
tree3c484c463cde3fc41c4d1590dda28f5635ba30bb /guilib/GUIAudioManager.cpp
parentfabe79ab868dd97c4d67da7cccf3f7f3e551a117 (diff)
fixed: Make sure we hold our critical section when accessing all AudioManger members.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31210 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUIAudioManager.cpp')
-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();