The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Mark Jones on July 31, 2005, 04:23:14 PM

Title: PlaySound volume?
Post by: Mark Jones on July 31, 2005, 04:23:14 PM
Is there a way to set the volume of a sound played with PlaySound? Or any alternatives? Thx. :)
Title: Re: PlaySound volume?
Post by: hitchhikr on August 01, 2005, 11:51:02 AM
No.
Use directsound or the waveOut* stuff.
Browse for examples.
Title: Re: PlaySound volume?
Post by: Tedd on August 01, 2005, 12:31:38 PM
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.
Title: Re: PlaySound volume?
Post by: thomasantony on August 08, 2005, 02:29:11 PM
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
Title: Re: PlaySound volume?
Post by: GregL on August 08, 2005, 08:22:51 PM
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]
Title: Re: PlaySound volume?
Post by: Mark Jones on August 09, 2005, 06:03:15 AM
Cool, thanks for the ideas guys. :)
Title: Re: PlaySound volume?
Post by: GregL on August 09, 2005, 11:25:45 PM
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)