[Openal] Reseting a source
Jason Daly
jdaly at ist.ucf.edu
Thu Aug 30 15:11:59 PDT 2007
Xavier Bouchoux wrote:
> hi,
>
> I have a pool of sources, which I use and reuse, depending on the
> ressource manager needs.
>
> But it occured to me that when I was reusing a source, I wasn't quite
> sure of it's attributes.
> So I have to reset all the attributes (or at leat the one I modify in
> my code) to the default values.
>
> So I'm wondering if there such a "alSourceResetToDefaults()" function
> or some standard way to do it - to be sure not to miss any attribute?
> (or if not, this is a suggestion for a revision of the API!)
No, there isn't. I've run into this before as well, and a reset to
defaults call might be nice. In practice, though, it's not that big a
deal to just make a function to do it for you.
I'm sure there's a better solution to be had. The object model that
exists right now probably isn't optimal. I had an idea based on what I
saw at the recent announcement of OpenGL 3. There should probably be a
division between sources and state. You generate all the sources you
need at first, then create source state objects as you need them. When
you're ready to render audio, you attach a buffer and source state to
the source itself before calling alSourcePlay(). This has advantages
for hardware implementations as well (from what I've heard, most
hardware implementations like all state changes to happen at once,
rather than getting each bit one by one in 9 separate function calls).
You could also do a similar thing for the listener, allowing you to
easily switch between listener states. This is probably less useful at
the moment, but would become more useful with the addition of, say, EFX
listener parameters, or with the addition of multiple listener support.
Maybe this could go on the list for OpenAL 2...
--"J"
>
> xavier.
>
> _______________________________________________
> Openal mailing list
> Openal at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal
--
--"J"
"I'm a castaway stranded in a desolate land,
I can see the footprints in the virtual sand."
--Neil Peart
More information about the Openal
mailing list