1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Remove unused AudioDriverAndroid from Android

This commit is contained in:
Marcel Admiraal
2021-06-09 17:45:51 +01:00
parent fbe53a7064
commit 4ba2ed332e
8 changed files with 0 additions and 368 deletions

View File

@@ -327,95 +327,6 @@ public class GodotIO {
dirs = new SparseArray<AssetDir>();
}
/////////////////////////
// AUDIO
/////////////////////////
private Object buf;
private Thread mAudioThread;
private AudioTrack mAudioTrack;
public Object audioInit(int sampleRate, int desiredFrames) {
int channelConfig = AudioFormat.CHANNEL_OUT_STEREO;
int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
int frameSize = 4;
System.out.printf("audioInit: initializing audio:\n");
//Log.v("Godot", "Godot audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
// Let the user pick a larger buffer if they really want -- but ye
// gods they probably shouldn't, the minimums are horrifyingly high
// latency already
desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize);
mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate,
channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM);
audioStartThread();
//Log.v("Godot", "Godot audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer");
buf = new short[desiredFrames * 2];
return buf;
}
public void audioStartThread() {
mAudioThread = new Thread(new Runnable() {
public void run() {
mAudioTrack.play();
GodotLib.audio();
}
});
// I'd take REALTIME if I could get it!
mAudioThread.setPriority(Thread.MAX_PRIORITY);
mAudioThread.start();
}
public void audioWriteShortBuffer(short[] buffer) {
for (int i = 0; i < buffer.length;) {
int result = mAudioTrack.write(buffer, i, buffer.length - i);
if (result > 0) {
i += result;
} else if (result == 0) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// Nom nom
}
} else {
Log.w("Godot", "Godot audio: error return from write(short)");
return;
}
}
}
public void audioQuit() {
if (mAudioThread != null) {
try {
mAudioThread.join();
} catch (Exception e) {
Log.v("Godot", "Problem stopping audio thread: " + e);
}
mAudioThread = null;
//Log.v("Godot", "Finished waiting for audio thread");
}
if (mAudioTrack != null) {
mAudioTrack.stop();
mAudioTrack = null;
}
}
public void audioPause(boolean p_pause) {
if (p_pause)
mAudioTrack.pause();
else
mAudioTrack.play();
}
/////////////////////////
// MISCELLANEOUS OS IO
/////////////////////////

View File

@@ -174,11 +174,6 @@ public class GodotLib {
*/
public static native void focusout();
/**
* Invoked when the audio thread is started.
*/
public static native void audio();
/**
* Used to access Godot global properties.
* @param p_key Property key