This topic is now archived and is closed to further replies.


DSHOW reading volume levels

Recommended Posts

Using Dshow: Is there any way I can read the amplitude of the sound being rendered? This data is ment to be used to create a vu-meter, EQ visual render etc etc. I''ve been looking for this but cant seem to find any source of information about it. If anyone just can point me out to a source I would appreciate it very much. Many thanks in advance. Mvh Mario.. Mvh Mario..

Share this post

Link to post
Share on other sites
You _would use the IAMDirectSound interface on the DSound Audio Render filter to get access to the audio stream, expect they dropped the ball and didn't fully implement this interface.

In order to get access to the data stream I think you need to make a transform filter.

Magmai Kai Holmlor
- Not For Rent

If you're playing mp3's, you can use DirectMusic - I haven't used that yet, so I don't know if you can access the sound buffer or not...

Edited by - Magmai Kai Holmlor on November 7, 2001 10:31:41 PM

Share this post

Link to post
Share on other sites
I found this below on the subject.. But I cant make it work.


#include <windows.h>
#include <mmsystem.h>

MMRESULT rc; // Return code.

HMIXER hMixer; // Mixer handle used in mixer API calls.

MIXERCONTROL mxc; // Holds the mixer control data.

MIXERLINE mxl; // Holds the mixer line data.

MIXERLINECONTROLS mxlc; // Obtains the mixer control.

// Open the mixer. This opens the mixer with a deviceID of 0. If you

// have a single sound card/mixer, then this will open it. If you have

// multiple sound cards/mixers, the deviceIDs will be 0, 1, 2, and

// so on.

rc = mixerOpen(&hMixer, 0,0,0,0);
// Couldn''t open the mixer.


// Initialize MIXERLINE structure.

mxl.cbStruct = sizeof(mxl);

// Specify the line you want to get. You are getting the input line

// here. If you want to get the output line, you need to use



rc = mixerGetLineInfo((HMIXEROBJ)hMixer, &mxl,
// Couldn''t get the mixer line.


// Get the control.

ZeroMemory(&mxlc, sizeof(mxlc));
mxlc.cbStruct = sizeof(mxlc);
mxlc.dwLineID = mxl.dwLineID;
mxlc.cControls = 1;
mxlc.cbmxctrl = sizeof(mxc);
mxlc.pamxctrl = &mxc;
ZeroMemory(&mxc, sizeof(mxc));
mxc.cbStruct = sizeof(mxc);
rc = mixerGetLineControls((HMIXEROBJ)hMixer,&mxlc,
// Couldn''t get the control.


// After successfully getting the peakmeter control, the volume range

// will be specified by mxc.Bounds.lMinimum to mxc.Bounds.lMaximum.

MIXERCONTROLDETAILS mxcd; // Gets the control values.

MIXERCONTROLDETAILS_SIGNED volStruct; // Gets the control values.

long volume; // Holds the final volume value.

// Initialize the MIXERCONTROLDETAILS structure

ZeroMemory(&mxcd, sizeof(mxcd));
mxcd.cbStruct = sizeof(mxcd);
mxcd.cbDetails = sizeof(volStruct);
mxcd.dwControlID = mxc.dwControlID;
mxcd.paDetails = &volStruct;
mxcd.cChannels = 1;

// Get the current value of the peakmeter control. Typically, you

// would set a timer in your program to query the volume every 10th

// of a second or so.

rc = mixerGetControlDetails((HMIXEROBJ)hMixer, &mxcd,
// Couldn''t get the current volume.

volume = volStruct.lValue;

// Get the absolute value of the volume.

if (volume < 0)
volume = -volume;;en-us;Q181550

It simply fails when I get the mixerline.
rc = mixerGetLineInfo((HMIXEROBJ)hMixer, &mxl,

any help out there ?

Mvh Mario..

Share this post

Link to post
Share on other sites
Can someone please give me a hint or link to something in the right direction here ?

I''m making an audio player and almost everything finished including playilist etc. Just this annoying thing aint sovled. I dont like to use a lib like bass. This is mostly for learning.

Thanks in advance.

Mvh Mario..

Share this post

Link to post
Share on other sites
Sorry to bump this one like this.

If i understand your question correctly you're really only wanting the pan and volume ?????

if so, QI the IFilterGraph( or IGraphBuilder ) for IBasicAudio.

The docs explain it quite well.

Bobby Ward
Dysprosium Software

Edited by - KlePt0 on February 4, 2002 12:21:37 AM

Share this post

Link to post
Share on other sites