From 17707104f7af52ad862dc9911be6a03b6b80cfe8 Mon Sep 17 00:00:00 2001 From: pelya Date: Sat, 21 Aug 2010 12:29:55 +0300 Subject: [PATCH] Small tweaks to audio --- project/src/Audio.java | 2 +- project/src/Video.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/project/src/Audio.java b/project/src/Audio.java index dfe84a384..72136aa04 100644 --- a/project/src/Audio.java +++ b/project/src/Audio.java @@ -50,7 +50,7 @@ class AudioThread { if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize ) bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding ); - bufSize = bufSize * (Globals.AudioBufferConfig * 2 + 1); + bufSize = bufSize * ((Globals.AudioBufferConfig * 2.5f) + 1.0f); mAudioBuffer = new byte[bufSize]; diff --git a/project/src/Video.java b/project/src/Video.java index a9c99953f..ea81d4b79 100644 --- a/project/src/Video.java +++ b/project/src/Video.java @@ -110,9 +110,11 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer { System.loadLibrary("application"); System.loadLibrary("sdl_main"); Settings.Apply(); - Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); + // Tweak video thread priority, if user selected big audio buffer + if(Globals.AudioBufferConfig >= 2) + Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal nativeInit(); // Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code - System.exit(0); + System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process } public int swapBuffers() // Called from native code, returns 1 on success, 0 when GL context lost (user put app to background)