Skip to content

Commit

Permalink
Small tweaks to audio
Browse files Browse the repository at this point in the history
  • Loading branch information
pelya committed Aug 21, 2010
1 parent de1f89b commit 1770710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project/src/Audio.java
Expand Up @@ -50,7 +50,7 @@ public int initAudio(int rate, int channels, int encoding, int bufSize)
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];

Expand Down
6 changes: 4 additions & 2 deletions project/src/Video.java
Expand Up @@ -110,9 +110,11 @@ public void onDrawFrame(GL10 gl) {
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)
Expand Down

0 comments on commit 1770710

Please sign in to comment.