Thank you Ian.
I tried your code and I keep getting the same error (i'm testing in a Samsung Galaxy, SDK version 2.2 and in a Sony Ericsson Xperia, SDK version 2.3)
This is my entire code, url included:
String url= "http://ia700401.us.archive.org/33/items/another007/01-allthelivingandthedead-IntheMoon.ogg";
BASS.BASS_StreamFree(chan); // free old stream before opening new
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!=-1){
if (res>0)
track.write(buffer.array(), 0, res); // feed it to AudioTrack
else
try {
Thread.sleep(50);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // wait a bit for more data to arrive
res=BASS.BASS_ChannelGetData(chan, buffer, buffer.capacity()); // decode some data
}
Log.e("MidiTest", "finished");
}
}).start();
note that Log.e("MidiTest", "finished"); is never called nor the thread is interrupted.
The error occurs calling BASS.BASS_ChannelGetData(chan, buffer, buffer.capacity()); inside the loop.
That thread you see in the code is the only explicit thread i'm using.
I'm using the MidiTest modified with that code. If you want I can send you the .apk or even the source code.
It's weird that SIGBUS error happening...
Thank you.