Discussion:
control volume
(too old to reply)
loukia
2007-07-19 17:00:50 UTC
Permalink
hi,
i have a MediaPlayer playing some audio files using the Open() and Play()
functions. I am using bds2006. How can i increase decrease the volume of
the sound played?I would like to place a ProgressBar for this.
Is there some tutorial or web page article that can help me do this?

thanks
Remy Lebeau (TeamB)
2007-07-19 17:18:40 UTC
Permalink
Post by loukia
i have a MediaPlayer playing some audio files using the
Open() and Play() functions. I am using bds2006. How
can i increase decrease the volume of the sound played?
TMediaPlayer does not provide that functionality.

You can try calling the Win32 Multimedia API mciSendCommand() function
directly, using the MCI_SETAUDIO command with the MCI_DGV_SETAUDIO_VOLUME
flag. Pass the TMediaPlayer's DeviceID property as the first parameter to
mciSendCommand() after Open() has succeeded.

If that doesn't work, then try waveOutSetVolumn() instead.

If that still doesn't work, then you are out of luck. You will have to use
something other than TMediaPlayer, such as DirectX.


Gambit
Jonathan Benedicto
2007-07-19 18:46:32 UTC
Permalink
Post by Remy Lebeau (TeamB)
If that still doesn't work, then you are out of luck. You will have to use
something other than TMediaPlayer, such as DirectX.
Unless one uses DirectSound/DirectShow to play the audio, I don't think that
DiurectX will help here.

AFAIK, one would have to use the mixer API.

Jon
Remy Lebeau (TeamB)
2007-07-19 20:18:32 UTC
Permalink
Post by Jonathan Benedicto
Unless one uses DirectSound/DirectShow to play the
audio, I don't think that DiurectX will help here.
I wasn't suggesting to mix TMediaPlayer and DirectX together. I was
referring to getting rid of TMediaPlayer altogether and using DirectX to
play the file.


Gambit
JF Jolin
2007-07-19 18:02:23 UTC
Permalink
Hi loukia
Post by loukia
hi,
i have a MediaPlayer playing some audio files using the Open() and Play()
functions. I am using bds2006. How can i increase decrease the volume of
The MCIWndSetVolume macro sets the volume level of an MCI device.
Post by loukia
the sound played?I would like to place a ProgressBar for this.
A ProgressBar is usualy used to indicate the progress of a lengthy operation.
I think your talking of a slider control ?
Post by loukia
Is there some tutorial or web page article that can help me do this?
A good API programmer's reference under "MCI Devices" and "Sliders"
respectively might just be a good place where to start.


__
JF Jolin
loukia
2007-07-20 07:17:37 UTC
Permalink
thank you all for your answers the code that does the job is:
//TrackBar2->Max=0xFFFF;
// TrackBar2->Min=0;

int value =TrackBar2->Position;
waveOutSetVolume(0, MAKELONG(value, value));

for mute (on-off):

if (TrackBar2->Position!=0) {
TrackBar2->Position=0;
}
else{TrackBar2->Position=TrackBar2->Max;}
int value =TrackBar2->Position;
waveOutSetVolume(0, MAKELONG(value, value));
Post by JF Jolin
Hi loukia
Post by loukia
hi,
i have a MediaPlayer playing some audio files using the Open() and Play()
functions. I am using bds2006. How can i increase decrease the volume of
The MCIWndSetVolume macro sets the volume level of an MCI device.
Post by loukia
the sound played?I would like to place a ProgressBar for this.
A ProgressBar is usualy used to indicate the progress of a lengthy operation.
I think your talking of a slider control ?
Post by loukia
Is there some tutorial or web page article that can help me do this?
A good API programmer's reference under "MCI Devices" and "Sliders"
respectively might just be a good place where to start.
__
JF Jolin
Loading...