Solved

How to control sound's volume ??

Posted on 2007-04-08
3
296 Views
Last Modified: 2013-12-26
Hi to all experts:

i'm using   waveOutOpen() ,  waveOutWrite() , waveOutClose() , ....
to play some wave sounds in my own game , and it works fine.
my problem is to control the volume for these sounds,
if i'm using  waveOutSetVolume function ,  it changes the wave master volume
and it also change the music volume at the background ( which is not good ).
so my question is how can i change a specific sound's volume without changing
the wave master volume and without effecting any thing else.

thanks alot
kobkob.
0
Comment
Question by:kob_kob
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 18

Accepted Solution

by:
Jose Parrot earned 125 total points
ID: 18950894
Hi,

waveOutxxxx() reffers to the output device, so the command is always a "master" command to any wave send to it. To circumvect the problem, you can try to check if the system has more than one wave output device capable of running your wave files (game sounds and background music). This can be cheched with    WAVE_FORMAT_QUERY   and    WAVE_MAPPED . Take a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveoutopen.asp
for a MS help on that.

Another approach is to use different sound formats, say, MIDI for the music and WAVE for the sounds.
The noises and other game sounds remain using waveOutxxx() and the music uses
midiOutSetVolume() as described in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveoutopen.asp

A third ioption is to use wave for both sounds, with pre-recoderd music and noises at selected volumes, say:
MUSIC#1:  music1volume1.wav,  music1volume2.wav, music1volume3.wav
MUSIC#2: m2v1.wav, m2v2.wv
NOISE#1: n1v1.wav, etc. etc.
where v1, is lower and v3 is higher.
And programaticaly you can chose the desired combinations

Jose
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

See the related links at the bottom of the tutorial for downloads and supplemental information. Introduction The Nvidia 3D Vision Kit is a [not so] new gaming technology which allows you to play the newest computer games in "Stereo 3D" (like …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question