Win7Audio: Remove try/catch blocks

This commit is contained in:
Birunthan Mohanathas 2013-12-24 11:45:25 +00:00
parent da92def9fc
commit 0136f81163

View File

@ -104,8 +104,7 @@ void UnInitCom()
HRESULT RegisterDevice(PCWSTR devID)
{
HRESULT hr = S_FALSE;
try
{
InitCom();
IPolicyConfig *pPolicyConfig;
@ -121,12 +120,7 @@ HRESULT RegisterDevice(PCWSTR devID)
}
SAFE_RELEASE(pPolicyConfig);
}
}
catch (...)
{
RmLog(LOG_WARNING, L"Win7AudioPlugin.dll: RegisterDevice exception");
hr = S_FALSE;
}
UnInitCom();
return hr;
}
@ -135,8 +129,6 @@ std::wstring GetDefaultID()
{
std::wstring id_default;
IMMDevice * pEndpoint = 0;
try
{
if (pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pEndpoint) == S_OK)
{
LPWSTR pwszID = 0;
@ -146,12 +138,7 @@ std::wstring GetDefaultID()
}
CoTaskMemFree(pwszID);
}
}
catch (...)
{
RmLog(LOG_WARNING, L"Win7AudioPlugin.dll: GetDefaultID exception");
id_default = L"Exception";
}
SAFE_RELEASE(pEndpoint)
return id_default;
}
@ -162,8 +149,6 @@ bool GetWin7AudioState(const VolumeAction action)
IAudioEndpointVolume * pEndptVol = 0;
bool success = false;
try
{
if (InitCom())
{
if (pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pEndpoint) == S_OK)
@ -183,11 +168,7 @@ bool GetWin7AudioState(const VolumeAction action)
}
}
}
}
catch (...)
{
RmLog(LOG_WARNING, L"Win7AudioPlugin.dll: ToggleMute exception");
}
SAFE_RELEASE(pEndptVol)
SAFE_RELEASE(pEndpoint)
UnInitCom();
@ -213,8 +194,6 @@ bool SetWin7Volume(UINT volume, int offset = 0)
IAudioEndpointVolume * pEndptVol = 0;
bool success = false;
try
{
if (InitCom())
{
if (pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pEndpoint) == S_OK)
@ -241,11 +220,6 @@ bool SetWin7Volume(UINT volume, int offset = 0)
}
}
}
catch (...)
{
RmLog(LOG_WARNING, L"Win7AudioPlugin.dll: SetVolume exception");
}
SAFE_RELEASE(pEndptVol)
SAFE_RELEASE(pEndpoint)
UnInitCom();
@ -305,7 +279,6 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
{
static WCHAR result[256];
wsprintf(result, L"ERROR");
try {
if (!InitCom() || !pEnumerator)
{
UnInitCom();
@ -350,11 +323,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
SAFE_RELEASE(pEndpoint)
wsprintf(result, L"ERROR - Getting Default Device");
}
} catch (...)
{
RmLog(LOG_WARNING, L"Win7AudioPlugin.dll: GetString exception");
wsprintf(result, L"Exception");
}
UnInitCom();
return result;
}