Is there a way to set the volume of a sound played with PlaySound? Or any alternatives? Thx. :)
No.
Use directsound or the waveOut* stuff.
Browse for examples.
I think you'll have to use winmm to set the waveout volume, then play the sound, then put the volume back again.
Which isn't really a nice solution.
Hi,
I think you can use
mixerOpen
mixerGetControlDetails with MIXER_GETLINECONTROLSF_ONEBYTYPE and MIXER_GETCONTROLDETAILSF_VALUE
and
mixerSetControlDetails with MIXER_GETCONTROLDETAILSF_VALUE
mixerClose
Look it up in MSDN
Thomas :U
Mark,
I know it's not exactly what you wanted to do, but here is an example of setting the speaker volume.
[attachment deleted by admin]
Cool, thanks for the ideas guys. :)
Mark,
You can set the volume for other devices by changing the constant in this line in the program I posted:
mov eax, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS ; Set device to work with here
Constants for other devices:
MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = Speakers
MIXERLINE_COMPONENTTYPE_DST_LINE = Line Out
MIXERLINE_COMPONENTTYPE_SRC_LINE = Line In
MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = Mic In
MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = CD In
MIXERLINE_COMPONENTTYPE_DST_WAVEIN = Wave In (ADC)
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = Wave Out (DAC)
You can also set bass, treble, balance etc.
Audio Mixers (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_audio_mixers.asp)