temp commit
This commit is contained in:
parent
064c16d9e7
commit
574c6f039e
7 changed files with 99 additions and 11 deletions
|
|
@ -71,6 +71,11 @@ HRESULT SessionStateCallback::OnGroupingParamChanged(LPCGUID NewGroupingParam, L
|
|||
}
|
||||
|
||||
HRESULT SessionStateCallback::OnStateChanged(AudioSessionState NewState) {
|
||||
/* enum _AudioSessionState {
|
||||
* AudioSessionStateInactive,
|
||||
* AudioSessionStateActive,
|
||||
* AudioSessionStateExpired
|
||||
* } AudioSessionState; */
|
||||
/*
|
||||
* char *pszState = "?????";
|
||||
*
|
||||
|
|
@ -85,7 +90,6 @@ HRESULT SessionStateCallback::OnStateChanged(AudioSessionState NewState) {
|
|||
* }
|
||||
* printf("New session state = %s\n", pszState);
|
||||
*/
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +130,20 @@ Session::Session(Endpoint* ep, IAudioSessionControl2* sessionControl, size_t idx
|
|||
this->sessionControl = sessionControl;
|
||||
this->idx = idx;
|
||||
|
||||
AudioSessionState msState;
|
||||
sessionControl->GetState(&msState);
|
||||
switch (msState) {
|
||||
case AudioSessionState::AudioSessionStateActive:
|
||||
this->sessionState = SessionState::ACTIVE;
|
||||
break;
|
||||
case AudioSessionState::AudioSessionStateInactive:
|
||||
this->sessionState = SessionState::INACTIVE;
|
||||
break;
|
||||
case AudioSessionState::AudioSessionStateExpired:
|
||||
this->sessionState = SessionState::EXPIRED;
|
||||
break;
|
||||
}
|
||||
|
||||
sessionControl->QueryInterface(__uuidof(ISimpleAudioVolume), (void**)&sessionVolume);
|
||||
DWORD pid;
|
||||
sessionControl->GetProcessId(&pid);
|
||||
|
|
@ -180,6 +198,10 @@ void Session::setVolume(NGuid guid, int channel, float volume) {
|
|||
}
|
||||
}
|
||||
|
||||
void Session::setIndex(size_t idx) {
|
||||
this->idx = idx;
|
||||
}
|
||||
|
||||
void Session::setMute(NGuid guid, bool muted) {
|
||||
GUID tempMsGuid = NGuidToGUID(guid);
|
||||
if(FAILED(sessionVolume->SetMute(muted, &tempMsGuid))) { log_wdebugcpp(std::wstring(L"SessionVolume null?")); };
|
||||
|
|
@ -268,6 +290,15 @@ wchar_t* fileDescription = NULL;
|
|||
return exePath;
|
||||
}
|
||||
|
||||
//todo: conflicting names. change callback name
|
||||
void Session::setState(SessionState state) {
|
||||
sessionState = state;
|
||||
}
|
||||
|
||||
SessionState Session::getState() {
|
||||
return sessionState;
|
||||
}
|
||||
|
||||
void Session::setStateCallback(SessionStateCallback *ssc){
|
||||
sessionControl->RegisterAudioSessionNotification((IAudioSessionEvents*) ssc);
|
||||
}
|
||||
|
|
@ -275,3 +306,8 @@ void Session::setStateCallback(SessionStateCallback *ssc){
|
|||
void Session::removeStateCallback(SessionStateCallback *ssc){
|
||||
sessionControl->UnregisterAudioSessionNotification((IAudioSessionEvents*) ssc);
|
||||
}
|
||||
|
||||
Session::~Session() {
|
||||
sessionControl->Release();
|
||||
sessionVolume->Release();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue