mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
audio: Remove unneeded padding
This commit is contained in:
parent
3ce8122557
commit
a95edaceba
@ -102,20 +102,6 @@ static char* initAudioTrack(uintptr_t java_vm, uintptr_t jni_env,
|
|||||||
// Note that *audioTrack will never be released.
|
// Note that *audioTrack will never be released.
|
||||||
*audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack);
|
*audioTrack = (*env)->NewGlobalRef(env, tmpAudioTrack);
|
||||||
|
|
||||||
// Enqueue empty bytes before playing to avoid underrunning.
|
|
||||||
// TODO: Is this really needed? At least, SDL doesn't do the same thing.
|
|
||||||
jint writtenBytes = 0;
|
|
||||||
do {
|
|
||||||
const int length = 1024;
|
|
||||||
jbyteArray arr = (*env)->NewByteArray(env, length);
|
|
||||||
writtenBytes =
|
|
||||||
(*env)->CallIntMethod(
|
|
||||||
env, *audioTrack,
|
|
||||||
(*env)->GetMethodID(env, android_media_AudioTrack, "write", "([BII)I"),
|
|
||||||
arr, 0, length);
|
|
||||||
} while (writtenBytes != 0);
|
|
||||||
// TODO: Check if writtenBytes < 0
|
|
||||||
|
|
||||||
(*env)->CallVoidMethod(
|
(*env)->CallVoidMethod(
|
||||||
env, *audioTrack,
|
env, *audioTrack,
|
||||||
(*env)->GetMethodID(env, android_media_AudioTrack, "play", "()V"));
|
(*env)->GetMethodID(env, android_media_AudioTrack, "play", "()V"));
|
||||||
|
Loading…
Reference in New Issue
Block a user