[openal] Trying to implement a linear 1D (left/right) audio balance

Ethan Lee flibitijibibo at flibitijibibo.com
Sun Apr 20 20:52:45 EDT 2014


In FNA we do something like this, but it's probably not ideal (if not 
just incorrect):

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Audio/SoundEffectInstance.cs#L58

I know for sure that this doesn't provide hard panning, but you probably 
didn't _really_ want to do hard pans anyway. We do that work to keep 
things at the 1.0f distance, but if attenuation isn't required for your 
project, you can turn that off and possibly save some time/effort:

https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Audio/OpenALDevice.cs#L102

-Ethan

On 04/20/2014 08:44 PM, Villermen wrote:
> Hey there,
>
> After not being able to figure this one out myself I've posted my 
> question on the OpenTK forums and StackOverflow, where I was suggested 
> by the OpenTK dev to ask you about it =)
>
> Basically I'd like to have a balance value of -1f (left channel only) 
> to 1f (right channel only) be converted into a position for an OpenAL 
> source where it will act as such:
> When having 0f (default value) as balance value both sides (left/right 
> ear) should be at 100% gain.
> When 1f 100% for the right ear and 0% for the left ear and the 
> opposite for -1f.
> They should attenuate in a linear way.
>
> For what I've tried so far please read my post on StackOverflow 
> <http://stackoverflow.com/questions/23154049/linear-1d-audio-balance-with-openal>. 
> I'm working with the OpenTK library but I am pretty sure I can convert 
> any OpenAL related answer to it, just as long as I can understand it 
> in general.
>
> I would really like to know if and how this is possible, and any 
> thoughts on this are welcome!
>
> Gr.Villermen
>
>
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openal.org/pipermail/openal/attachments/20140420/c5e08da1/attachment.html>


More information about the openal mailing list