mdparker / Derelict3

A collection of dynamic D bindings to C libraries, useful for multimedia and game development.
169 stars 39 forks source link

OpenAL EFX #139

Open mleise opened 11 years ago

mleise commented 11 years ago

Is it possible to add the OpenAL Effects Extension to Derelict? The OpenAL core does not offer effects common to other sound libraries like FMOD or DirectSound3D. Most importantly reverb effects to simulate sound reflecting from walls around you.

mdparker commented 11 years ago

I'll look into it.

mleise commented 11 years ago

If you add it would that include the efx-utils header? I would use the presets defined there and the conversion routine from legacy EAX to OpenAL. :) Thanks for the good bindings collection at this point. I think it has a big influence on the D ecosystem.

mleise commented 11 years ago

I've read up a bit on extensions and they are generally either device or context specific, so you need to add a function pointer table to whatever wrapper you end up writing around devices and contexts. I don't say Derelict3 should provide such a wrapper, being low level and all, but I could imagine a struct that contains all the EFX function pointers and you could integrate with your own wrappers. The inconvenient part about it is that for everything else Derelict does the loading and binding, and here you are suddenly on your own. So thinking a bit further you might extend the DerelictAL loader with a method that assumes a current AL context (or takes a context pointer and makes it active) and an EFX function pointer struct: loadEfx(ALCcontext* ctx, ref EfxFuncs funcs).

Anyway I've decided to write my own wrapper. OpenAL is not too big, and then I can easily experiment with other extensions.

mdparker commented 11 years ago

The reload method in the OpenGL binding exists because a context needs to be created before functions 1.2+ and extensions can be loaded. It may be possible, and worthwhile, to add something similar here. Thanks for digging in to this.