Using IAudioEndpointVolume in IsSpeakerMuteAvailable and IsMicrophoneMuteAvailable to be consistent with SpeakerMute and MicrophoneMute APIs.
Review URL: http://webrtc-codereview.appspot.com/112007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@458 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
4fcb0caf78
commit
c57f9c38ad
@ -1079,31 +1079,26 @@ WebRtc_Word32 AudioDeviceWindowsCore::SpeakerMuteIsAvailable(bool& available)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioSessionManager* pManager = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
ISimpleAudioVolume* pVolume = NULL;
|
|
||||||
|
|
||||||
hr = _ptrDeviceOut->Activate(__uuidof(IAudioSessionManager), CLSCTX_ALL,NULL, (void**)&pManager);
|
// Query the speaker system mute state.
|
||||||
EXIT_ON_ERROR(hr);
|
hr = _ptrDeviceOut->Activate(__uuidof(IAudioEndpointVolume),
|
||||||
|
CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
hr = pManager->GetSimpleAudioVolume(NULL, FALSE, &pVolume);
|
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
BOOL mute;
|
BOOL mute;
|
||||||
hr = pVolume->GetMute(&mute);
|
hr = pVolume->GetMute(&mute);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
|
||||||
available = false;
|
available = false;
|
||||||
}
|
else
|
||||||
available = true;
|
available = true;
|
||||||
|
|
||||||
SAFE_RELEASE(pManager);
|
|
||||||
SAFE_RELEASE(pVolume);
|
SAFE_RELEASE(pVolume);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
_TraceCOMError(hr);
|
_TraceCOMError(hr);
|
||||||
SAFE_RELEASE(pManager);
|
|
||||||
SAFE_RELEASE(pVolume);
|
SAFE_RELEASE(pVolume);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1131,6 +1126,7 @@ WebRtc_Word32 AudioDeviceWindowsCore::SetSpeakerMute(bool enable)
|
|||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioEndpointVolume* pVolume = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
|
|
||||||
|
// Set the speaker system mute state.
|
||||||
hr = _ptrDeviceOut->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
hr = _ptrDeviceOut->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
@ -1169,6 +1165,7 @@ WebRtc_Word32 AudioDeviceWindowsCore::SpeakerMute(bool& enabled) const
|
|||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioEndpointVolume* pVolume = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
|
|
||||||
|
// Query the speaker system mute state.
|
||||||
hr = _ptrDeviceOut->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
hr = _ptrDeviceOut->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
@ -1206,16 +1203,16 @@ WebRtc_Word32 AudioDeviceWindowsCore::MicrophoneMuteIsAvailable(bool& available)
|
|||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioEndpointVolume* pVolume = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
|
|
||||||
|
// Query the microphone system mute state.
|
||||||
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
BOOL mute;
|
BOOL mute;
|
||||||
hr = pVolume->GetMute(&mute);
|
hr = pVolume->GetMute(&mute);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
|
||||||
available = false;
|
available = false;
|
||||||
}
|
else
|
||||||
available = true;
|
available = true;
|
||||||
|
|
||||||
SAFE_RELEASE(pVolume);
|
SAFE_RELEASE(pVolume);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1247,6 +1244,7 @@ WebRtc_Word32 AudioDeviceWindowsCore::SetMicrophoneMute(bool enable)
|
|||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioEndpointVolume* pVolume = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
|
|
||||||
|
// Set the microphone system mute state.
|
||||||
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
@ -1279,6 +1277,7 @@ WebRtc_Word32 AudioDeviceWindowsCore::MicrophoneMute(bool& enabled) const
|
|||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IAudioEndpointVolume* pVolume = NULL;
|
IAudioEndpointVolume* pVolume = NULL;
|
||||||
|
|
||||||
|
// Query the microphone system mute state.
|
||||||
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
hr = _ptrDeviceIn->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, reinterpret_cast<void**>(&pVolume));
|
||||||
EXIT_ON_ERROR(hr);
|
EXIT_ON_ERROR(hr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user