Good Morning, I tried your suggestion on java.library.path .
Using latest bass and bassenc library
Java Code :
public static void setJavaLibPath(String value) {
if (value instanceof String) {
if (!value.isEmpty()) {
if (!value.equals(javaLibPath)) {
String prev = System.setProperty("java.library.path", value);
javaLibPath = value;
if (prev instanceof String) {
BA.Log("java.library.path changed from "+prev+" to "+value);
} else {
BA.Log("New value for java.library.path to "+value);
}
}
}
}
}
Called on class BASS.java
static {
if (Platform.isAndroid()) {
Native.register(BASS.class, BassLibrary.lib_bass);
lib_is_loaded = true;
//System.loadLibrary(BassLibrary.lib_bass);
} else {
if (!BassLibrary.IsInitialized()) BassLibrary.DetectOS();
String _libpath = BassLibrary.Extract_Library(BassLibrary.lib_bass);
if (!_libpath.isEmpty()) {
BassLibrary.setJavaLibPath(BassLibrary.rundir);
Native.register(_libpath);
lib_is_loaded = true;
}
}
}
Called in my B4X java wrapper
bass = new BASS();
bassfx = new BASS_FX();
bassmix = new BASSmix();
bassenc = new BASSenc();
bassenc_mp3 = new BASSenc_MP3();
BA.Log("BASS version="+Bit.ToHexString(bass.BASS_GetVersion()));
BA.Log("BASS_FX version="+Bit.ToHexString(bassfx.BASS_FX_GetVersion()));
BA.Log("BASSENC version="+Bit.ToHexString(bassenc.BASS_Encode_GetVersion()));
BA.Log("BASSMIX version="+Bit.ToHexString(bassmix.BASS_Mixer_GetVersion()));
BA.Log("BASSENC MP3 version="+Bit.ToHexString(bassenc_mp3.BASS_Encode_MP3_GetVersion()));
Log in B4J test app
Waiting for debugger to connect...
Program started.
OS Name : Linux
OS Architecture : arm
OS Version : 5.10.52-v7+
JVM Name : Java HotSpot(TM) Client VM
Java Lib path : /usr/java/packages/lib/arm:/lib:/usr/lib
Path Separator : [:]
Run Directory : /home/pi/tempjars
User Home : /root
User Directory : /home/pi/tempjars
Raspberry
Copied libbass.so to /home/pi/tempjars
libbass.so copied to /home/pi/tempjars
java.library.path changed from /usr/java/packages/lib/arm:/lib:/usr/lib to /home/pi/tempjars
Copied libbass_fx.so to /home/pi/tempjars
libbass_fx.so copied to /home/pi/tempjars
Copied libbassmix.so to /home/pi/tempjars
libbassmix.so copied to /home/pi/tempjars
Copied libbassenc.so to /home/pi/tempjars
libbassenc.so copied to /home/pi/tempjars
java.lang.UnsatisfiedLinkError: Unable to load library '/home/pi/tempjars/libbassenc.so':
libbass.so: cannot open shared object file: No such file or directory
libbass.so: cannot open shared object file: No such file or directory
Native library (home/pi/tempjars/libbassenc.so) not found in resource path ([file:/home/pi/tempjars/AsyncInput2])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
based on this sequence :
bass = new BASS();
bassfx = new BASS_FX();
bassmix = new BASSmix();
bassenc = new BASSenc();
bassenc_mp3 = new BASSenc_MP3();
So actually bass , bassfx, and bassmix can be loaded succesfully.
Test app began to crash at loading bassenc.
So, once more, I revert back to old bass libraries, recompile again, and run the same codes and test app again, showing success
Waiting for debugger to connect...
Program started.
OS Name : Linux
OS Architecture : arm
OS Version : 5.10.52-v7+
JVM Name : Java HotSpot(TM) Client VM
Java Lib path : /usr/java/packages/lib/arm:/lib:/usr/lib
Path Separator : [:]
Run Directory : /home/pi/tempjars
User Home : /root
User Directory : /home/pi/tempjars
Raspberry
Copied libbass.so to /home/pi/tempjars
libbass.so copied to /home/pi/tempjars
java.library.path changed from /usr/java/packages/lib/arm:/lib:/usr/lib to /home/pi/tempjars
Copied libbass_fx.so to /home/pi/tempjars
libbass_fx.so copied to /home/pi/tempjars
Copied libbassmix.so to /home/pi/tempjars
libbassmix.so copied to /home/pi/tempjars
Copied libbassenc.so to /home/pi/tempjars
libbassenc.so copied to /home/pi/tempjars
Copied libbassenc_mp3.so to /home/pi/tempjars
libbassenc_mp3.so copied to /home/pi/tempjars
BASS version=2040e00
BASS_FX version=2040c01
BASSENC version=2040e00
BASSMIX version=2040902
BASSENC MP3 version=2040100
index=0, Name=No sound, Driver=, Enabled=true
index=1, Name=Default, Driver=default, Enabled=true
index=2, Name=bcm2835 Headphones: bcm2835 Headphones, Driver=hw:0,0, Enabled=true
Bass inited
Bass Playfile success
Play Start = File = /home/pi/Channel_1_20210819100156.wav, Device=Default
Play Stop = File = /home/pi/Channel_1_20210819100156.wav, Device=Default
However , at Raspbian Buster, audio output was garbled and incorrect
Update 23/08/2021 11:35 :
About your suggestion on running Linux Bassenc example , while I am no expert in C programming,
I compiled "convert" example on bassenc using "make convert",
then run it . Here is the result
./convert ~/Channel_1_20210819100156.wav
BASSenc transcoding example
---------------------------
output: bass.wav
done: 1155956 / 1155956