I'm trying to connect Delphi to Windows VolumeControl API to display WaveOut sound. I found the following code, but it doesn't work:
function Wave_SuportaControleVolume: boolean;
var
Caps: TWaveOutCaps;
begin
if WaveOutGetDevCaps(WAVE_MAPPER, @Caps,
SizeOf(Caps)) = MMSYSERR_NOERROR then
Result := Caps.dwSupport and WAVECAPS_VOLUME <> 0
else
Result := false;
end;
type
TVolume = record
Esquerdo: Word;
Direito: Word;
end;
function Wave_ObterVolume: TVolume;
begin
waveOutGetVolume(integer(WAVE_MAPPER), @Result);
end;
procedure Wave_DefinirVolume(Volume: TVolume);
begin
waveOutSetVolume(integer(WAVE_MAPPER), LongWord(Volume));
end;
When I use this code, the value of Wave_ObterVolume is always 65535, no matter what I do.
My goal is very simple: I'd like to see the sound value as a progress bar when I play some MP4 or MP3 file. I already have the layout and timer component connected as it should be to display the sound on the progress bar. In fact, I'd use a kind of VUMeter component to do this.
Detail: Using Delphi 7. I know, it's very old, but it's my available tool.
So, the question is what code I use to reach WaveOut Windows VolumeControl?