Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Morlunk/Jumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Comminos <andrewcomminos@gmail.com>2014-10-12 00:43:23 +0400
committerAndrew Comminos <andrewcomminos@gmail.com>2014-10-12 00:43:23 +0400
commita7b4b4e0a426a6617c8331de245e96a82cf03942 (patch)
tree6ae47ffe1c8df8bdbca52283c13cf5a56be561f2
parentb4c0a0af9b8204753df15e5793ecb361e7a85b37 (diff)
Use System.arraycopy for buffer shifts.
-rw-r--r--src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java b/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java
index cbbc70d..a9d3dac 100644
--- a/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java
+++ b/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java
@@ -152,8 +152,10 @@ public class AudioOutputSpeech implements Callable<AudioOutputSpeech.Result> {
@Override
public Result call() throws Exception {
- for(int i = mLastConsume; i < mBufferFilled; ++i)
- mBuffer[i-mLastConsume] = mBuffer[i];
+ if (mBufferFilled - mLastConsume > 0) {
+ // Shift over the remaining unconsumed data in the buffer.
+ System.arraycopy(mBuffer, mLastConsume, mBuffer, 0, mBufferFilled - mLastConsume);
+ }
mBufferFilled -= mLastConsume;
mLastConsume = mRequestedSamples;