Ian, it is working but only for a few seconds. The music starts playing but after some seconds the app crashes with a SIGBUS in libbass.so:
01-03 16:19:55.304: I/DEBUG(25736): signal 7 (SIGBUS), fault addr 00000000
01-03 16:19:55.308: I/DEBUG(25736): scr 20000012
01-03 16:19:55.359: I/DEBUG(25736): #00 pc 0000adfc /data/data/com.example.miditest/lib/libbass.so
01-03 16:19:55.362: I/DEBUG(25736): #01 pc 00017f46 /data/data/com.example.miditest/lib/libbass.so
01-03 16:19:55.362: I/DEBUG(25736): #02 pc 00019260 /data/data/com.example.miditest/lib/libbass.so
the code that i'm using is the following:
chan=BASS.BASS_StreamCreateURL(url, 0, BASS.BASS_STREAM_DECODE, null, null)
track = new AudioTrack( AudioManager.STREAM_MUSIC, 44100,
AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT,
AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT), AudioTrack.MODE_STREAM);
track.play();
new Thread(new Runnable(){
public void run() {
ByteBuffer buffer = ByteBuffer.allocate(20000); // allocate buffer for decoded data
int res=BASS.BASS_ChannelGetData(chan, buffer, buffer.capacity()); // decode some data
while (res>0){
track.write(buffer.array(), 0, res); // feed it to AudioTrack
res=BASS.BASS_ChannelGetData(chan, buffer, buffer.capacity()); // decode some data
}
}
}).start();
The idea with the thread is to feed the audioTrack while there's data to decode...
do you have any idea why i'm getting the SIGBUS error inside libbass.so?