Leadwerks.OpenALEx

BlitzMax Forums/BlitzMax Module Tweaks/Leadwerks.OpenALEx

JoshK(Posted 2007) [#1]
I rewrote BRL's OpenAL audio driver to create an *enhanced* driver with support for 3D spatialization, EAX effects, and sound falloff:
http://www.leadwerks.com/post/OpenALAudioEx.zip

The best part about this is you get advanced audio effects, but you can still use the nice standard Blitz commands. Here's what the sample program looks like:
Import Leadwerks.OpenALAudioEx

If Not OpenALInstalled()
	Notify "OpenAL32.dll not found.",1
	End
EndIf

SetAudioDriver "OpenALEx"
EnableEAX()

Graphics 640,480,0,0,2

'3D sound/EAX sounds must be mono
sound:TSound=LoadSound("pipe4.wav")
LoopSound sound

channel:TChannel=CueSound(sound)
SetChannelRange channel,100
PositionChannel channel,0,0,1
ResumeChannel channel

effect=EAX_DRUGGED
EAXEffect effect

While Not KeyHit(KEY_ESCAPE)
	
	x#:+(KeyDown(KEY_RIGHT)-KeyDown(KEY_LEFT))
	z#:+(KeyDown(KEY_UP)-KeyDown(KEY_DOWN))
	PositionListener x,0,z
	
	DrawText "Position: "+x+", "+y+", "+z,0,0
	
	If EAXSupported()
		
		If KeyHit(KEY_SPACE)
			effect:+1
			If effect>26 effect=0
			EAXEffect effect
		EndIf
	
		DrawText "EAXEffect: "+effect+" (Press space to change.)",0,20
	Else
		DrawText "EAX is not supported.",0,20
	EndIf
	

	Flip 1
	Cls()
Wend
End



tonyg(Posted 2007) [#2]
You need to change the mod subdir to OpenALAudioEx.mod rather than OpenALEx.mod.
The positioning is good and the effect seems to work but doesn't change with spacebar.
Am I missing something?


JoshK(Posted 2007) [#3]
Does your screen say EAX is supported or not?


tonyg(Posted 2007) [#4]
Sorry, it was me being a muppet. EAX supported but not switched on.


JoshK(Posted 2007) [#5]
I made a few changes and uploaded a new one at the above link. ChannelRange() is now SetChannelRange().


Filax(Posted 2007) [#6]
Hi leadwerks :)

I have try the module but i get an error during compilation
(my blitzmax is fresh)

Blitzmax 1.24 without exotic modules
Windows XP Pro + SP2
1 Go Ram + Athlon XP 2600

In debug mode the program crash on : EnableEAX()

Stupid question but i need an EAX compatible Card ?
or the module can do spacialization with motherboard
sound card like nvidia ?


Debug log
------------------------------------------------------------
Building Example
Compiling:Example.bmx
flat assembler version 1.66
3 passes, 4734 bytes.
Linking:Example.exe
Executing:Example.exe
Attempt to call uninitialized function pointer
Process complete


JoshK(Posted 2007) [#7]
You have to set the audio driver before you attempt to initialize EAX.

I made a change that could fix a potential crash and re-uploaded. I included the source. If you make any improvements, please let us know.


Filax(Posted 2007) [#8]
I just compile the previous package example :) ok i'll try to
re download :) So, any news about my mesh under the engine ?
do you find a way ? :)

Cheers josh


JoshK(Posted 2007) [#9]
The lighting is done. It's nearly ready to release.

See the dev log in my forum.


Russell(Posted 2007) [#10]
lighting?

Is this an audio engine or a render engine? ;)

Russell