Answer the question
In order to leave comments, you need to log in
UPDATE! Loudness Leveling (WinAPI, ICodecAPI, DirectShow, Core Audio Interface, MMDevice API, DeviceTopology API)
In Windows, there is a "Volume equalization" (Sound - Playback - Select a device - Additional features).
When watching a video, the volume is at the same level (voice and effects sound equally loud), but listening to music is impossible - all the dynamics are killed.
Tired of opening the settings 50 times a day to turn on / off the checkbox. I decided to write a utility that hangs in the tray and does it in one click. But I ran into a problem :) All examples are in C ++, which I am not familiar with.
What we have:
1. There is an ICodecAPI interface (goo.gl/4Fb0WR)
2. Using the SetValue method, you can set the value for the CODECAPI_AVDSPLoudnessEqualization (goo.gl/eqzKfv) property, which turns alignment on/off.
What he wrote:
#include "stdafx.h"
#include <Dshow.h>
#pragma comment(lib, "strmiids")
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = CoInitialize(NULL);
ICodecAPI *myCodecAPI = NULL;
VARIANT VResult;
hr = CoCreateInstance(
CLSID_FilterGraph,
NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,
(void**)&myGraphBuilder
);
hr = myGraphBuilder->QueryInterface(IID_ICodecAPI, (void**)&myCodecAPI);
#include "stdafx.h"
#include "Mmdeviceapi.h"
#include "Functiondiscoverykeys_devpkey.h"
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr = CoInitialize(NULL);
if (SUCCEEDED(hr))
{
IMMDeviceEnumerator *pEnum = NULL;
hr = CoCreateInstance(
__uuidof(MMDeviceEnumerator),
NULL,
CLSCTX_ALL,
__uuidof(IMMDeviceEnumerator),
(void**)&pEnum);
if (SUCCEEDED(hr))
{
IMMDevice *pDevice;
hr = pEnum->GetDefaultAudioEndpoint(
eRender,
eMultimedia,
&pDevice);
if (SUCCEEDED(hr))
{
IPropertyStore *pStore;
hr = pDevice->OpenPropertyStore(STGM_READ, &pStore);
if (SUCCEEDED(hr))
{
PROPVARIANT friendlyName;
PropVariantInit(&friendlyName);
hr = pStore->GetValue(
PKEY_Device_DeviceDesc,
&friendlyName);
if (SUCCEEDED(hr))
{
printf("Audio Device: %i\n", friendlyName.pwszVal);
PropVariantClear(&friendlyName);
}
pStore->Release();
}
pDevice->Release();
}
pEnum->Release();
}
}
return hr;
}
Answer the question
In order to leave comments, you need to log in
Well, your requirement says one thing, that sucks sound or acoustics, or all together at once. Usually the problem is different, it's hard to listen to Russian dubbing, because for some reason ours have a mania for lowering the volume of the voice in comparison with the original.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question