No problem. I solved it by using OpenLibrary() instead of Import. This way the BASS library can be loaded from a subfolder.
Example:
Code: Select all
PrototypeC BASS_SetConfig (option.l,value.l)
PrototypeC BASS_GetVersion()
PrototypeC BASS_ErrorGetCode()
PrototypeC BASS_Init(device.l,freq.l,flags.l,*win,*dsguid)
PrototypeC BASS_Free()
PrototypeC.f BASS_SetVolume(volume.f)
PrototypeC BASS_StreamCreateFile(mem.l,*file,offset.q,length.q,flags.l)
PrototypeC BASS_StreamFree(Handle.l)
PrototypeC.d BASS_ChannelBytes2Seconds(Handle.l,pos.q)
PrototypeC.q BASS_ChannelSeconds2Bytes(Handle.l,pos.d)
PrototypeC BASS_ChannelIsActive(Handle.l)
PrototypeC BASS_ChannelGetInfo(Handle.l,*info.BASS_CHANNELINFO)
PrototypeC BASS_ChannelGetTags(Handle.l,tags.l)
PrototypeC BASS_ChannelPlay(Handle.l,restart.l)
PrototypeC BASS_ChannelStop(Handle.l)
PrototypeC BASS_ChannelPause(Handle.l)
PrototypeC BASS_ChannelSetAttribute(Handle.l,attrib.l,value.f)
PrototypeC BASS_ChannelGetAttribute(Handle.l,attrib.l,*value)
PrototypeC.q BASS_ChannelGetLength(Handle.l,mode.l)
PrototypeC BASS_ChannelSetPosition(Handle.l,pos.q,mode.l)
PrototypeC.q BASS_ChannelGetPosition(Handle.l,mode.l)
PrototypeC BASS_ChannelGetData(Handle.l,*buffer,length.l)
PrototypeC BASS_ChannelSetSync(Handle.l,Type.l,param.q,*proc,*user)
PrototypeC BASS_ChannelRemoveSync(Handle.l,sync.l)
PrototypeC BASS_ChannelSetFX(Handle.l,type.l,priority.l)
PrototypeC BASS_ChannelRemoveFX(Handle.l,fx.l)
PrototypeC BASS_FXSetParameters(Handle.l,*params)
PrototypeC BASS_FXGetParameters(Handle.l,*params)
Global libBASS = OpenLibrary(#PB_Any, GetPathPart(ProgramFilename()) + "assets/bass/linux/libbass.so")
If Not libBASS
libBASS = OpenLibrary(#PB_Any, "/usr/lib/bass/linux/libbass.so")
If Not libBASS
MessageRequester("Library loading error", "Failed to load libbass.so" + Chr(13) + Chr(13) +
"To solve the problem, open the subfolder 'assets' in your terminal and enter this command:" + Chr(13)+ Chr(13) +
"sudo cp -avr bass /usr/lib/", #PB_MessageRequester_Error)
End
EndIf
EndIf
Global BASS_SetConfig.BASS_SetConfig = GetFunction(libBASS, "BASS_SetConfig")
Global BASS_GetVersion.BASS_GetVersion = GetFunction(libBASS, "BASS_GetVersion")
Global BASS_ErrorGetCode.BASS_ErrorGetCode = GetFunction(libBASS, "BASS_ErrorGetCode")
Global BASS_Init.BASS_Init = GetFunction(libBASS, "BASS_Init")
Global BASS_Free.BASS_Free = GetFunction(libBASS, "BASS_Free")
Global BASS_SetVolume.BASS_SetVolume = GetFunction(libBASS, "BASS_SetVolume")
Global BASS_StreamCreateFile.BASS_StreamCreateFile = GetFunction(libBASS, "BASS_StreamCreateFile")
Global BASS_StreamFree.BASS_StreamFree = GetFunction(libBASS, "BASS_StreamFree")
Global BASS_ChannelBytes2Seconds.BASS_ChannelBytes2Seconds = GetFunction(libBASS, "BASS_ChannelBytes2Seconds")
Global BASS_ChannelSeconds2Bytes.BASS_ChannelSeconds2Bytes = GetFunction(libBASS, "BASS_ChannelSeconds2Bytes")
Global BASS_ChannelIsActive.BASS_ChannelIsActive = GetFunction(libBASS, "BASS_ChannelIsActive")
Global BASS_ChannelGetInfo.BASS_ChannelGetInfo = GetFunction(libBASS, "BASS_ChannelGetInfo")
Global BASS_ChannelGetTags.BASS_ChannelGetTags = GetFunction(libBASS, "BASS_ChannelGetTags")
Global BASS_ChannelPlay.BASS_ChannelPlay = GetFunction(libBASS, "BASS_ChannelPlay")
Global BASS_ChannelStop.BASS_ChannelStop = GetFunction(libBASS, "BASS_ChannelStop")
Global BASS_ChannelPause.BASS_ChannelPause = GetFunction(libBASS, "BASS_ChannelPause")
Global BASS_ChannelSetAttribute.BASS_ChannelSetAttribute = GetFunction(libBASS, "BASS_ChannelSetAttribute")
Global BASS_ChannelGetAttribute.BASS_ChannelGetAttribute = GetFunction(libBASS, "BASS_ChannelGetAttribute")
Global BASS_ChannelGetLength.BASS_ChannelGetLength = GetFunction(libBASS, "BASS_ChannelGetLength")
Global BASS_ChannelSetPosition.BASS_ChannelSetPosition = GetFunction(libBASS, "BASS_ChannelSetPosition")
Global BASS_ChannelGetPosition.BASS_ChannelGetPosition = GetFunction(libBASS, "BASS_ChannelGetPosition")
Global BASS_ChannelGetData.BASS_ChannelGetData = GetFunction(libBASS, "BASS_ChannelGetData")
Global BASS_ChannelSetSync.BASS_ChannelSetSync = GetFunction(libBASS, "BASS_ChannelSetSync")
Global BASS_ChannelRemoveSync.BASS_ChannelRemoveSync = GetFunction(libBASS, "BASS_ChannelRemoveSync")
Global BASS_ChannelSetFX.BASS_ChannelSetFX = GetFunction(libBASS, "BASS_ChannelSetFX")
Global BASS_ChannelRemoveFX.BASS_ChannelRemoveFX = GetFunction(libBASS, "BASS_ChannelRemoveFX")
Global BASS_FXSetParameters.BASS_FXSetParameters = GetFunction(libBASS, "BASS_FXSetParameters")
Global BASS_FXGetParameters.BASS_FXGetParameters = GetFunction(libBASS, "BASS_FXGetParameters")
I didn't try ImportC "-lbass" yet. If that's a better or cleaner solution, I will use that in a next version. But I understood that BASS then should be already installed, to make it work.
Also, I removed a webgadget for showing documentation, because some Linux distro's (like Arch) does not have libwebkit2gtk installed by default. The "help" does now open directly in the installed browser, using this code:
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
RunProgram("xdg-open", "assets/doc/help.html", "")
CompilerElse
RunProgram("file://" + GetPathPart(ProgramFilename()) + "assets/doc/help.html")
CompilerEndIf
In the above code I used a relative path for linux, the strange thing is that the absolute path didn't work on some distro's, but the relative path worked on all.
B.t.w. my program failed on OpenSuse, some short named library was missing. Can't remember the name, and also couldn't find how to install it.