Game Development Reference
In-Depth Information
while (!mDone) {
if (!mAudioLocked) {
// Read audio buffer from C
PaintAudio(audioBuffer);
// set the buffer position
audioBuffer.position(0);
// get bytes
audioBuffer.get(audioData8);
// Write the byte array to the track
mTrack.write(audioData8, 0, audioData8.length);
} else {
// sleep for a while if au locked
sleep(50);
}
}
// Audio thread loop done
mAudioRuning = false;
}
});
// start thread
t.start();
}
public static void stop(){
// signal stop
mDone = true;
// wait until au thread quits
while (mAudioRuning) {
Log.d(TAG, "Waiting for audio thread...");
sleep(200);
}
}
public static boolean isRunning(){
return mAudioRuning;
}
Search WWH ::




Custom Search