Ok, I will go on with that LoadLibrary-Stuff. It seems that this works fine.
But - of course - the next problem suddenly appeared :-)
The following sample source, loads the bass.dll and plays a shoutcast radio stream. In C++ I can define a CallBack Function, for example to display an FFT Analyzer. Is it possible to pass a BlitzMax Function as Callback?
Here is the sample source:
But - of course - the next problem suddenly appeared :-)
The following sample source, loads the bass.dll and plays a shoutcast radio stream. In C++ I can define a CallBack Function, for example to display an FFT Analyzer. Is it possible to pass a BlitzMax Function as Callback?
Here is the sample source:
Strict Const DllName:String = "bass.dll" Local DllHandle = LoadLibraryA(DllName) Global BASS_Init:Int(device:Int, freq:Int, flags:Int, win:Int, clsid:Int)"Win32" = GetProcAddress(DllHandle,"BASS_Init") Global BASS_GetVersion:Long()"Win32" = GetProcAddress(DllHandle,"BASS_GetVersion") Global BASS_Free:Int()"Win32" = GetProcAddress(DllHandle,"BASS_Free") Global BASS_MusicLoad:Int(mem:Int, file:Byte Ptr, offset:Int, length:Int, flags:Int, freq:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicLoad") Global BASS_ChannelPlay:Int(handle:Int,restart:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPlay") Global BASS_StreamCreateURL:Int(url:Byte Ptr, offset:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateURL") If Not Bass_Init(1,44100,0,0,0) Print "ERROR" Else Print "BASS_VERSION: "+BASS_GetVersion() Local MyUrl:String = "http://64.236.34.196:80/stream/1040" Print "Loading Stream...." Local Stream:Int = Bass_StreamCreateURL(MyURL.ToCString(),0,0,Null,0) BASS_ChannelPlay(Stream,0) Print "Playing Stream..." WaitKey Bass_FREE() End If Function CallBack(buffer:Byte Ptr, length:Int, user:Int) Print "called..." End Function