diff --git a/android/eSpeakTests/src/com/reecedunn/espeak/test/SpeechSynthesisTest.java b/android/eSpeakTests/src/com/reecedunn/espeak/test/SpeechSynthesisTest.java index e2cfbbde..b7aa89ad 100644 --- a/android/eSpeakTests/src/com/reecedunn/espeak/test/SpeechSynthesisTest.java +++ b/android/eSpeakTests/src/com/reecedunn/espeak/test/SpeechSynthesisTest.java @@ -163,7 +163,6 @@ public class SpeechSynthesisTest extends TextToSpeechTestCase assertThat(synth.getSampleRate(), is(22050)); assertThat(synth.getChannelCount(), is(1)); assertThat(synth.getAudioFormat(), is(AudioFormat.ENCODING_PCM_16BIT)); - assertThat(synth.getBufferSizeInBytes(), is(22050)); } public void testJavaToIanaLanguageCode() diff --git a/android/jni/jni/eSpeakService.cpp b/android/jni/jni/eSpeakService.cpp index f7391ab9..27fdb5c6 100644 --- a/android/jni/jni/eSpeakService.cpp +++ b/android/jni/jni/eSpeakService.cpp @@ -30,6 +30,8 @@ #include #include +#define BUFFER_SIZE_IN_MILLISECONDS 1000 + /** @name Java to Wide String Helpers * @brief These are helpers for converting a jstring to wchar_t*. * @@ -163,13 +165,13 @@ JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeClassInit( JNIEXPORT jint JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeCreate( - JNIEnv *env, jobject object, jstring path, jint bufferSizeInMillis) { + JNIEnv *env, jobject object, jstring path) { if (DEBUG) LOGV("%s [env=%p, object=%p]", __FUNCTION__, env, object); const char *c_path = path ? env->GetStringUTFChars(path, NULL) : NULL; if (DEBUG) LOGV("Initializing with path %s", c_path); - int sampleRate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, bufferSizeInMillis, c_path, 0); + int sampleRate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, BUFFER_SIZE_IN_MILLISECONDS, c_path, 0); if (c_path) env->ReleaseStringUTFChars(path, c_path); diff --git a/android/src/com/reecedunn/espeak/SpeechSynthesis.java b/android/src/com/reecedunn/espeak/SpeechSynthesis.java index 86c8959e..fa2b0814 100644 --- a/android/src/com/reecedunn/espeak/SpeechSynthesis.java +++ b/android/src/com/reecedunn/espeak/SpeechSynthesis.java @@ -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();