Sources represent the parameters how a Buffer Object is played back. These parameters include the Source's Position, Velocity, Gain (Volume amplification) and more. The settings can be set/get by using AL.Source and AL.GetSource functions.
Continuation of the sourcecode from previous page:
uint MySources = new uint; AL.GenSources( 2, out MySources ); // gen 2 Source Handles AL.Source( TestSources, ALSourcei.Buffer, (int)MyBuffers ); // attach the buffer to a source AL.SourcePlay( MySources); // start playback AL.Source( MySources, ALSourceb.Looping, true ); // source loops infinitely AL.Source( MySources, ALSourcei.Buffer, (int)MyBuffers ); Vector3 Position = new Vector3( 1f, 2f, 3f ); AL.Source( MySources, ALSource3f.Position, ref Position ); AL.Source( MySources, ALSourcef.Gain, 0.85f ); AL.SourcePlay( MySources ); Console.ReadLine(); // wait for keystroke before exiting AL.SourceStop( MySources ); // halt playback AL.SourceStop( MySources ); AL.DeleteSources( 2, ref MySources ); // free Handles // now delete Buffer Objects and dispose the AudioContext
I'm sorry to do this, but if you want to work with EFX there is no other way. All I can give here is a brief overview that might help you make the decision if EFX is what you need. You will have to download the OpenAL SDK to get a copy of "Effects Extension Guide.pdf" from Creative labs, for in-depth information about programming with DSPs.
My advice is ignoring EFX, unless your game project is in 1st Person 3D. Environmental effects might look nice as a "selling point" on paper, but do not add any gameplay value to a Strategy game, or a 2D platform game.
The addition to OpenAL with EFX Extension is the rerouting of output signals.
The new OpenAL Objects that come with EFX are "Effect", "Auxiliary Effect Slot" and "Filter".
An Effect Object stores the type of effect and the values for parameters of that effect. Types of Effects are for example Echo, Distortion, Chorus, Flanger, etc.
Auxiliary Effect Slots are containers for Effect Objects, whose output goes directly into the final output mix. The Slots are only used if there is a valid Effect Object attached to them, binding the reserved Handle 0 to a Slot will detach the previously bound Effect Object from it.
A Filter can be attached to a source, and either filter the "dry signal" that goes directly into the output mixer, or filter the "wet signal" that is forwarded to an Auxiliary Effect Slot.