Solved

How to control sound's volume ??

Posted on 2007-04-08
3
285 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
3 Comments
 
LVL 18

Accepted Solution

by:
JoseParrot earned 125 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For those of you searching for a fun but also medium paced MMORPG game I would highly suggest Ragnarok Online. This MMORPG is a bit older than World of Warcraft and in a way is extremely different. Compared to WoW's 3D environment and massive wor…
As we all know Counter Strike is a very popular computer game. Usually it is played over a network for which people create a server and users join it but it is interesting to know that one can creates a dedicated server which not only hosts the game…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now