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
|