I have a request to make for your OpenAL module. Currently, if OpenAL is not installed, the application crashes, even if no OpenAL commands are called. Could you please add a check, so that the sounds just doesn't work if OpenAL is not found, instead of crashing?
Redi: OpenAL.mod
BlitzMax Forums/BlitzMax Programming/Redi: OpenAL.mod Does it crash or do you get a window saying it cant find the dll?
That window is generated by OpenAL32.lib, I dont see how to get around that one.
Thinking...
That window is generated by OpenAL32.lib, I dont see how to get around that one.
Thinking...
I get an error notification with the following message:
"This application has failed to start because openal32.dll was not found. Re-installing the application may fix this problem."
"This application has failed to start because openal32.dll was not found. Re-installing the application may fix this problem."
Sorry, I think we're stuck with this one, even if I manage to get around the OpenAL error window (not that I know how), any calls to its functions will result in "undefined reference" errors.
But if anyone knows better...
But if anyone knows better...
There's a directsound wrapper in maxmod, if thats any help, I take it your after 3D sound?
Is there an OpenAL initialization function?
I use OpenAL because of the EAX effects.
I use OpenAL because of the EAX effects.
no, only alcOpenDevice.
EDIT - EAX can be done with directsound, but I havent tried that yet
There is also built in effects... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Standard_Effects.asp
EDIT - EAX can be done with directsound, but I havent tried that yet
There is also built in effects... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Standard_Effects.asp
AFAIK max wont allow us to check anything *before* an import :(
but that would still leave us with "undefined reference" error, and the only way around that would be to wrap every function with something like
*EDIT*
I think i've lost the plot... its good that max wont allow imports like that because it would make the app based on the machine its compiled on.
but that would still leave us with "undefined reference" error, and the only way around that would be to wrap every function with something like
If dll Then CallFunction
*EDIT*
I think i've lost the plot... its good that max wont allow imports like that because it would make the app based on the machine its compiled on.
Cant you dynamicly load the Lib with LoadLibary and GetProcAddress. The Lib is statically binding the DLL to your app thats gonna fail at load time. Its not Open AL that gives the Error thats the OS unable to load the DLL when the DLL loads.
Doug Stastny
Doug Stastny
Thanks Budman, my mistake I thought it was AL lib producing that, I'll have a go.
hmm, I dont know, that would completely ruin it from a cross-platform point of view.
I think its probably better to just ship with an openal installer.
I think its probably better to just ship with an openal installer.
Can you post the source?
click forum in my sig
Thanks.
So here's what I did (not tested yet, but should be easy to implement:
Global AL_MAINCONTEXT Global AL_MAINDEVICE Const AL_INVALID :Int = -1 Const AL_NONE :Int = 0 Const AL_FALSE :Int = 0 Const AL_TRUE :Int = 1 Const AL_SOURCE_RELATIVE :Int = $202 Const AL_CONE_INNER_ANGLE :Int = $1001 Const AL_CONE_OUTER_ANGLE :Int = $1002 Const AL_PITCH :Int = $1003 Const AL_POSITION :Int = $1004 Const AL_DIRECTION :Int = $1005 Const AL_VELOCITY :Int = $1006 Const AL_LOOPING :Int = $1007 Const AL_BUFFER :Int = $1009 Const AL_GAIN :Int = $100A Const AL_MIN_GAIN :Int = $100D Const AL_MAX_GAIN :Int = $100E Const AL_ORIENTATION :Int = $100F Const AL_CHANNEL_MASK :Int = $3000 Const AL_SOURCE_STATE :Int = $1010 Const AL_INITIAL :Int = $1011 Const AL_PLAYING :Int = $1012 Const AL_PAUSED :Int = $1013 Const AL_STOPPED :Int = $1014 Const AL_BUFFERS_QUEUED :Int = $1015 Const AL_BUFFERS_PROCESSED :Int = $1016 Const AL_SEC_OFFSET :Int = $1024 Const AL_SAMPLE_OFFSET :Int = $1025 Const AL_BYTE_OFFSET :Int = $1026 Const AL_SOURCE_TYPE :Int = $1027 Const AL_STATIC :Int = $1028 Const AL_STREAMING :Int = $1029 Const AL_UNDETERMINED :Int = $1030 Const AL_FORMAT_MONO8 :Int = $1100 Const AL_FORMAT_MONO16 :Int = $1101 Const AL_FORMAT_STEREO8 :Int = $1102 Const AL_FORMAT_STEREO16 :Int = $1103 Const AL_REFERENCE_DISTANCE :Int = $1020 Const AL_ROLLOFF_FACTOR :Int = $1021 Const AL_CONE_OUTER_GAIN :Int = $1022 Const AL_MAX_DISTANCE :Int = $1023 Const AL_FREQUENCY :Int = $2001 Const AL_BITS :Int = $2002 Const AL_CHANNELS :Int = $2003 Const AL_SIZE :Int = $2004 Const AL_UNUSED :Int = $2010 Const AL_PENDING :Int = $2011 Const AL_PROCESSED :Int = $2012 Const AL_NO_ERROR :Int = AL_FALSE Const AL_INVALID_NAME :Int = $A001 Const AL_ILLEGAL_ENUM :Int = $A002 Const AL_INVALID_ENUM :Int = $A002 Const AL_INVALID_VALUE :Int = $A003 Const AL_ILLEGAL_COMMAND :Int = $A004 Const AL_INVALID_OPERATION :Int = $A004 Const AL_OUT_OF_MEMORY :Int = $A005 Const AL_VENDOR :Int = $B001 Const AL_VERSION :Int = $B002 Const AL_RENDERER :Int = $B003 Const AL_EXTENSIONS :Int = $B004 Const AL_DOPPLER_FACTOR :Int = $C000 Const AL_DOPPLER_VELOCITY :Int = $C001 Const AL_SPEED_OF_SOUND :Int = $C003 Const AL_DISTANCE_MODEL :Int = $D000 Const AL_INVERSE_DISTANCE :Int = $D001 Const AL_INVERSE_DISTANCE_CLAMPED :Int = $D002 Const AL_LINEAR_DISTANCE :Int = $D003 Const AL_LINEAR_DISTANCE_CLAMPED :Int = $D004 Const AL_EXPONENT_DISTANCE :Int = $D005 Const AL_EXPONENT_DISTANCE_CLAMPED :Int = $D006 Const ALC_INVALID :Int = 0 Const ALC_FALSE :Int = 0 Const ALC_TRUE :Int = 1 Const ALC_FREQUENCY :Int = $1007 Const ALC_REFRESH :Int = $1008 Const ALC_SYNC :Int = $1009 Const ALC_NO_ERROR :Int = ALC_FALSE Const ALC_INVALID_DEVICE :Int = $A001 Const ALC_INVALID_CONTEXT :Int = $A002 Const ALC_INVALID_ENUM :Int = $A003 Const ALC_INVALID_VALUE :Int = $A004 Const ALC_OUT_OF_MEMORY :Int = $A005 Const ALC_DEFAULT_DEVICE_SPECIFIER :Int = $1004 Const ALC_DEVICE_SPECIFIER :Int = $1005 Const ALC_EXTENSIONS :Int = $1006 Const ALC_MAJOR_VERSION :Int = $1000 Const ALC_MINOR_VERSION :Int = $1001 Const ALC_ATTRIBUTES_SIZE :Int = $1002 Const ALC_ALL_ATTRIBUTES :Int = $1003 Global alGenBuffers%(n,buffers:Int Ptr) Global alBufferData(buffer:Int,format:Int,data:Int,size:Int,freq:Int) Global alGenSources(n:Int,sources:Byte Ptr) Global alSource3f(source:Int,pname:Int,v1:Float,v2:Float,v3:Float) Global alSourcei(Source:Int,pname:Int,value:Int) Global alSourcef(source:Int,pname:Int,value:Float) Global alSourcePlay(source:Int) Global alcCloseDevice (Dev:Int) Global alcDestroyContext(alcHandle:Int) Global alcCreateContext:Int(device:Int,attrlist:Byte Ptr) OnEnd EndOpenAL Function InitOpenAL:Int() Select OPENAL_HLIB Case -1 Return False Default Return True EndSelect OPENAL_HLIB=loadlibrary("OpenAL32.dll") If Not OPENAL_HLIB OPENAL_HLIB=-1 ProgramLog "Failed to load OpenAL32.dll.",1 Return False EndIf alcCreateContext=getprocaddress(OPENAL_HLIB,"alcCreateContext") alGenBuffers=getprocaddress(OPENAL_HLIB,"alGenBuffers") alBufferData=getprocaddress(OPENAL_HLIB,"alBufferData") alGenSources=getprocaddress(OPENAL_HLIB,"alGenSources") alSourcei=getprocaddress(OPENAL_HLIB,"alSourcei") alSourcef=getprocaddress(OPENAL_HLIB,"alSourcef") alSource3f=getprocaddress(OPENAL_HLIB,"alSource3f") alSourcePlay=getprocaddress(OPENAL_HLIB,"alSourcePlay") alcCloseDevice =getprocaddress(OPENAL_HLIB,"alcCloseDevice ") alcDestroyContext=getprocaddress(OPENAL_HLIB,"alcDestroyContext") AL_MAINDEVICE=alcOpenDevice(Null) AL_MAINCONTEXT=alcCreateContext(ALDevice,AL_MAINDEVICE) Return True EndFunction Function EndOpenAL() If OPENAL_HLIB alcDestroyContext AL_MAINCONTEXT alcCloseDevice AL_MAINDEVICE freelibrary OPENAL_HLIB OPENAL_HLIB=0 EndIf EndFunction
Sweet, should do the trick, but restricts it to windows.
Good luck mate.
Good luck mate.
Please see this forum thread:
http://redi.me.uk/forum/viewtopic.php?p=28&sid=d3b3845fd028e3ebbc22f1c06f770afe#28
http://redi.me.uk/forum/viewtopic.php?p=28&sid=d3b3845fd028e3ebbc22f1c06f770afe#28
If you still have questions after reading the sdk docs, I'll help out as much as I can, but as I said, I haven't played about with EAX much really.