From 6305227f6db276e26169f5dbd6e34a51dd57eaf3 Mon Sep 17 00:00:00 2001 From: CrystalPT Date: Sat, 21 Aug 2010 01:28:00 +0000 Subject: [WIN32] improve DirectSound device creation logging (cherry picked from commit fbfb9794a4763ca2a8b6bcece0cfe4c1ff71a09c) git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/Dharma@33000 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 --- guilib/AudioContext.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'guilib') diff --git a/guilib/AudioContext.cpp b/guilib/AudioContext.cpp index 1fd0e60de0..7334439dbd 100644 --- a/guilib/AudioContext.cpp +++ b/guilib/AudioContext.cpp @@ -76,6 +76,7 @@ void CAudioContext::SetActiveDevice(int iDevice) /* if device is the same, no need to bother */ #ifdef _WIN32 + HRESULT hr; int iPos = strAudioDev.Find(':'); if(iPos != CStdString::npos) strAudioDev.erase(0, iPos+1); @@ -109,8 +110,9 @@ void CAudioContext::SetActiveDevice(int iDevice) #ifdef HAS_AUDIO memset(&g_digitaldevice, 0, sizeof(GUID)); - if (FAILED(DirectSoundEnumerate(DSEnumCallback, this))) - CLog::Log(LOGERROR, "%s - failed to enumerate output devices", __FUNCTION__); + hr = DirectSoundEnumerate(DSEnumCallback, this); + if (FAILED(hr)) + CLog::Log(LOGERROR, "%s - failed to enumerate output devices (0x%08X)", __FUNCTION__, hr); if (iDevice==DIRECTSOUND_DEVICE || iDevice==DIRECTSOUND_DEVICE_DIGITAL) @@ -119,6 +121,9 @@ void CAudioContext::SetActiveDevice(int iDevice) #ifdef _WIN32 CWDSound p_dsound; std::vector deviceList = p_dsound.GetSoundDevices(); + if (deviceList.size() == 0) + CLog::Log(LOGDEBUG, "%s - no output devices found.", __FUNCTION__); + std::vector::const_iterator iter = deviceList.begin(); for (int i=0; iter != deviceList.end(); i++) { @@ -133,6 +138,8 @@ void CAudioContext::SetActiveDevice(int iDevice) ++iter; } + if (guid == NULL) + CLog::Log(LOGDEBUG, "%s - (default playback device).", __FUNCTION__); #else if(iDevice == DIRECTSOUND_DEVICE_DIGITAL && ( g_digitaldevice.Data1 || g_digitaldevice.Data2 @@ -141,14 +148,16 @@ void CAudioContext::SetActiveDevice(int iDevice) #endif // Create DirectSound - if (FAILED(DirectSoundCreate( guid, &m_pDirectSoundDevice, NULL ))) + hr = DirectSoundCreate( guid, &m_pDirectSoundDevice, NULL ); + if (FAILED(hr)) { - CLog::Log(LOGERROR, "DirectSoundCreate() Failed"); + CLog::Log(LOGERROR, "DirectSoundCreate() Failed (0x%08X)", hr); return; } - if (FAILED(m_pDirectSoundDevice->SetCooperativeLevel(g_hWnd, DSSCL_PRIORITY))) + hr = m_pDirectSoundDevice->SetCooperativeLevel(g_hWnd, DSSCL_PRIORITY); + if (FAILED(hr)) { - CLog::Log(LOGERROR, "DirectSoundDevice::SetCooperativeLevel() Failed"); + CLog::Log(LOGERROR, "DirectSoundDevice::SetCooperativeLevel() Failed (0x%08X)", hr); return; } } -- cgit v1.2.3