status_t AudioHardwareWrapper::initCheck()
{
	status_t s = mHardware->initCheck();
	LOGV("AudioHardwareWrapper::initCheck() = %d", s);

	setMasterMute(false);
	setMode(AudioSystem::MODE_NORMAL);

	return s;
}
Exemple #2
0
/**
 Mutes/Unmutes a session. If sessionId=-1, info about master
 */
bool setSessionMute(const int sessionId, const bool mute){
	int sessionCount = getSessionID();
	if (sessionId == -1)
		return setMasterMute(mute);
	if (sessionId >= sessionCount || sessionId < 0) {
		errorMessage = ERRMSG_UNDEFINEDSESSIONID;
		return false;
	}
	CComPtr<IAudioSessionControl> pSessionControl;
	CComPtr<ISimpleAudioVolume> pSAV;
	// Get SessionControl
	if (FAILED(pAudioSessionEnumerator->GetSession(sessionId, &pSessionControl))){
		errorMessage = ERRMSG_SESSIONCONTROL_INIT_FAILED;
		return false;
	}
	// Ask for SimpleAudioVolume
	if (FAILED(pSessionControl->QueryInterface(__uuidof(ISimpleAudioVolume), (VOID**)&pSAV))){
		errorMessage = ERRMSG_AUDIOVOLUME_INIT_FAILED;
		return false;
	}

	errorMessage = ERRMSG_OK;
	return S_OK == pSAV->SetMute(mute, NULL);
}