Trying to get a VU level from the sound card.
Posted on 1999-01-06
I'm trying to get a VU level from the sound card. I'm using the MCI (Media Control Interface) and programming in C++. I know how to start and stop recording or playing but I'm having trouble obtaining the level.
I open the MCI Device like this:
// open the wave device
open_parms.lpstrDeviceType = "waveaudio";
open_parms.lpstrElementName = "";
mciSendCommand( 0, MCI_OPEN, MCI_OPEN_TYPE |
// set PCM format of recording
set_parms.wFormatTag = WAVE_FORMAT_PCM;
set_parms.wBitsPerSample = 16;
set_parms.nChannels = 1;
set_parms.nSamplesPerSec = 22050;
set_parms.nAvgBytesPerSec = ((set_parms.wBitsPerSample)/8)
set_parms.nBlockAlign = ((set_parms.wBitsPerSample) /8)
mciSendCommand(wave_device_id,MCI_SET, MCI_WAIT |
(DWORD) (LPVOID) &set_parms);
I try to sample the Level like this:
status_parms.dwItem = MCI_WAVE_STATUS_LEVEL;
mciSendCommand( wave_device_id,MCI_STATUS , MCI_STATUS_ITEM, (DWORD) &status_parms);
From what I understand after this: stat_parms.dwReturn should contain the level from the MCI Device. Instead the value is 0.
This will not give me any errors and if I send the MCI device an MCI SAVE and close the device a file of nothing will be created. I don't know if I'm going about this in the wrong way or not but I need to obtain a level from the sound card. I will appreciate the help.