Hi,
I hope I've posted in the right forum and I hope there is someone who knows what I am talking about.
Simple question: How can I change the volume of a 3D Sound?
A soundengine should be capable of doing so, in fact I have searched for hours, found API-Documentations, people with same problems, but no solution. Gain and Pitch were mentioned several times. This is NOT what I want. Since pitch alters the "speed" of replay and Gain the range of the sound. Not the final or maximum volume.
If I wanted to change a 2D sound, that would be no problem. There I could do it with gain, but not in 3D space.
So in conclusion, i think i have to access and change a source's buffer directly in order to change it's volume. But how do I do that?
hope for help
greetings
FTC
OpenAL - 3D Sound's Volume Problem
-
- Posts: 226
- Joined: Fri Aug 22, 2008 8:50 pm
- Contact:
Gain defines an amplitude multiplier, thus representing volume. The valid values for the gain are [0.0,inf] with 1.0 being the default. If you modify the listener's gain, then that will change the global volume, but if you modify a source's gain that will change that respective source's volume.
(By the way, note that an OpenAL implementation can clamp the value you provide to gain to any arbitrary number it chooses.)
(By the way, note that an OpenAL implementation can clamp the value you provide to gain to any arbitrary number it chooses.)
TheQuestion = 2B || !2B
-
- Posts: 226
- Joined: Fri Aug 22, 2008 8:50 pm
- Contact:
And thats exactly what it is not. Thanks anyway.Halifax wrote: but if you modify a source's gain that will change that respective source's volume.
Setting the Listener's gain, works for global. But alSourcef(Source,AL_GAIN,Gain) with range[0,inf] changes just how far a sound can be heard. Testing different gains when placing the listener besides the source makes no differences in the volume.
greetings
-
- Posts: 914
- Joined: Fri Aug 03, 2007 12:43 pm
- Location: South Africa
- Contact:
This is something we noticed as well, sometimes a sound will get a value for its gain and internally it got clamped, or cut off and popped back to full gain its weird.OpenAL implementation can clamp the value you provide to gain to any arbitrary number it chooses.
Err, that is gain. If you play the sound in an external media player (lets say audacity) and it sounds X volume, you can never get it louder than X volume in game. You have to modify the actual audio file if you want it louder.changes just how far a sound can be heard
Its like, max gain + 20, i think. it wont work, because its max gain is determined by the audio itself, as well as the gain in the engine. If the gain is max in the engine, and the sound is not loud enough, use audacity to make it louder.
Hey if you want to free yourself from the burden of using raw openal. You can use my wrapper cAudio can be found at http://www.deathtouchstudios.com
http://wild.deathtouchstudios.com << My gamedev blog
<Programming is a way of life>
If at first you don't succeed press the delete key till you do
<Programming is a way of life>
If at first you don't succeed press the delete key till you do
-
- Posts: 226
- Joined: Fri Aug 22, 2008 8:50 pm
- Contact:
Thats indeed weird. Is OpenAL really that bad?FuzzYspo0N wrote:internally it got clamped, or cut off and popped back to full gain its weird.
So there is also absoulutley no way to seperate the volume from the maximal distance you can hear it?
(ok execpt I would make all sources relative and set them like i want them)
Thanks, but I already got most of openal wrapped. Additionally, when I tried your wrapper and loaded a wav (which worked with raw openal), it played to fast (with setPitch I was not able to change anything) Also, since your setVolume uses the Gain aswell, this provides no real solution for my problem.wildrj wrote:You can use my wrapper cAudio
greetings