Tweak buffer size

Empirical testing reveals that a smaller buffer size improves two
separate issues. First, it gives much better results on devices that
misreport their buffer size (Moto X is one, and it avoids a crash given
that the reported buffer size was larger than the static allocation for
the synth internal buffer). Second, even on devices that correctly
report the buffer size, it reduces internal buffering in the OpenSL ES
implementation, so this change reduces latency without impacting
robustness.
master
Raph Levien 11 years ago
parent 838535ec9c
commit 85f4bc7512
  1. 3
      android/src/com/levien/synthesizer/android/ui/PianoActivity2.java

@ -80,6 +80,9 @@ public class PianoActivity2 extends Activity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
getJbMr1Params(params);
}
// Empirical testing shows better performance with small buffer size
// than actually matching the media server's reported buffer size.
params.bufferSize = 64;
androidGlue_ = new AndroidGlue();
androidGlue_.start(params.sampleRate, params.bufferSize);

Loading…
Cancel
Save