Volume Control

E037d62d69a0f0932dbcb47ed6e130bb
0
pisces 101 Mar 02, 2004 at 19:10

Hiya all… I am quite new to OpenAL, I’ve been through the tutorials but havent noticed any way to control the volume of the source without having to use the fading effect.
Is there any way to control volume per source in OpenAL at all?

Thanks.

3 Replies

Please log in or register to post a reply.

E05263ec846eb85da803f56e2917962d
0
Noor 101 Mar 02, 2004 at 23:12

I’m not the person to ask, but in the meanwhile, I found this site for you:

http://www.jcabs-rumblings.com/OpenALFeatures.html

It talks about the volume control issue.

I hope it helps

F3ff2088fe22d64396b949f149628107
0
SpreeTree 101 Mar 03, 2004 at 20:18

In OpenAL gain means volume. So you have to change the AL_GAIN state to change the volume of a source (you can’t change the volume of a buffer as far as I have seen, and it seems strange why you would).

So

// To set the volume of the source to max
alSourcef(sourceID, AL_GAIN, 1.0f);

// To set it to min
alSourcef(sourceID, AL_GAIN, 0.0f);

// And halfway 
alSourcef(sourceID, AL_GAIN, 0.5f);

etc etc.

You can set a value of higher than 1.0f, which will (on some cards i think) increase the volume of the source past the volume of the buffer applied to it.

Hope that helps
Spree

E037d62d69a0f0932dbcb47ed6e130bb
0
pisces 101 Mar 04, 2004 at 03:53

Ok thanks alot for the replies…
I was kinda expecting something like
alSetVolume(Source, Volume level) or something ;)