wip: session meter
This commit is contained in:
parent
6bda4702df
commit
dc8951776f
7 changed files with 30 additions and 5 deletions
|
|
@ -100,7 +100,11 @@ Session::Session(Endpoint* ep, IAudioSessionControl2* sessionControl, size_t idx
|
|||
this->ep = ep;
|
||||
this->sessionControl = sessionControl;
|
||||
this->idx = idx;
|
||||
|
||||
//https://matthewvaneerde.wordpress.com/2012/06/08/getting-audio-peak-meter-values-for-all-active-audio-sessions/
|
||||
if (FAILED(sessionControl->QueryInterface(__uuidof(IAudioMeterInformation), (void**)&meterInformation))) { log_wdebugcpp(L"sPeakbros......"); };
|
||||
//meterInformation = (IAudioMeterInformation*)sessionControl;
|
||||
|
||||
|
||||
AudioSessionState msState;
|
||||
sessionControl->GetState(&msState);
|
||||
switch (msState) {
|
||||
|
|
@ -142,6 +146,13 @@ float Session::getVolume(int channel){
|
|||
return volume;
|
||||
}
|
||||
|
||||
float Session::getPeakVolume() {
|
||||
float peakVol;
|
||||
if(meterInformation) meterInformation->GetPeakValue(&peakVol);
|
||||
else return 0;
|
||||
return peakVol;
|
||||
}
|
||||
|
||||
/*
|
||||
* uint32_t Endpoint::getChannelCount(){
|
||||
* return (uint32_t)channelCount;
|
||||
|
|
@ -283,6 +294,7 @@ void Session::removeStateCallback(SessionStateCallback *ssc){
|
|||
}
|
||||
|
||||
Session::~Session() {
|
||||
meterInformation->Release();
|
||||
sessionControl->Release();
|
||||
sessionVolume->Release();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue