Solved

How to control sound's volume ??

Posted on 2007-04-08
3
287 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 …
Author Cited: Konstantinos Dimopoulos URL Cited From: Article from Indie Games: http://indiegames.com/2012/07/browser_game_pick_the_grid.html The Grid (http://codeelf.com/games/grid/) is the sort of game I haven't played in over 10 years. It is …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

947 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

21 Experts available now in Live!

Get 1:1 Help Now