Replace SpeechSynthesis.getBufferSizeInBytes with a constant in the C++ source, specified in the correct units (milliseconds).

This commit is contained in:
Reece H. Dunn
2015-10-12 19:02:16 +01:00
parent 633b7a5673
commit 3b6c327756
3 changed files with 6 additions and 10 deletions
@@ -51,7 +51,6 @@ public class SpeechSynthesis {
public static final int CHANNEL_COUNT_MONO = 1;
public static final int FORMAT_PCM_S16 = 2;
public static final int BUFFER_SIZE_IN_MILLIS = 1000;
static {
System.loadLibrary("ttsespeak");
@@ -103,10 +102,6 @@ public class SpeechSynthesis {
return FORMAT_PCM_S16;
}
public int getBufferSizeInBytes() {
return (BUFFER_SIZE_IN_MILLIS * mSampleRate) / 1000;
}
private Locale getLocaleFromLanguageName(String name) {
if (mLocaleFixes.containsKey(name)) {
return mLocaleFixes.get(name);
@@ -287,7 +282,7 @@ public class SpeechSynthesis {
return;
}
mSampleRate = nativeCreate(mDatapath, BUFFER_SIZE_IN_MILLIS);
mSampleRate = nativeCreate(mDatapath);
if (mSampleRate == 0) {
Log.e(TAG, "Failed to initialize speech synthesis library");
return;
@@ -312,7 +307,7 @@ public class SpeechSynthesis {
private static native final boolean nativeClassInit();
private native final int nativeCreate(String path, int bufferSizeInMillis);
private native final int nativeCreate(String path);
private native final static String nativeGetVersion();