From c62a91fc0f9e93e1ec30bb393c6f56e576d9ccc5 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Wed, 7 Oct 2015 20:47:19 +0100 Subject: [PATCH] Implement SpeechSynthesis.getChannelCount in Java. --- android/jni/jni/eSpeakService.cpp | 16 ---------------- .../com/reecedunn/espeak/SpeechSynthesis.java | 6 +++--- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/android/jni/jni/eSpeakService.cpp b/android/jni/jni/eSpeakService.cpp index 8b0902a6..f00c17f2 100644 --- a/android/jni/jni/eSpeakService.cpp +++ b/android/jni/jni/eSpeakService.cpp @@ -104,11 +104,6 @@ unicode_string::~unicode_string() #define LOG_TAG "eSpeakService" #define DEBUG true -enum audio_channel_count { - CHANNEL_COUNT_MONO = 1, - CHANNEL_COUNT_STEREO = 2 -}; - enum audio_encoding { ENCODING_INVALID = 0x00, ENCODING_DEFAULT = 0x01, @@ -121,7 +116,6 @@ enum synthesis_result { SYNTH_ABORT = 1 }; -const int DEFAULT_CHANNEL_COUNT = CHANNEL_COUNT_MONO; const int DEFAULT_AUDIO_FORMAT = ENCODING_PCM_16BIT; const int DEFAULT_BUFFER_SIZE = 1000; @@ -129,7 +123,6 @@ struct native_data_t { JNIEnv *env; jobject object; int sampleRate; - int channelCount; int audioFormat; int bufferSizeInMillis; @@ -137,7 +130,6 @@ struct native_data_t { env = NULL; object = NULL; sampleRate = 0; - channelCount = DEFAULT_CHANNEL_COUNT; audioFormat = DEFAULT_AUDIO_FORMAT; bufferSizeInMillis = DEFAULT_BUFFER_SIZE; } @@ -247,14 +239,6 @@ JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetSampleRate( return (jint)(nat ? nat->sampleRate : 0); } -JNIEXPORT jint -JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetChannelCount( - JNIEnv *env, jobject object) { - if (DEBUG) LOGV("%s", __FUNCTION__); - const native_data_t *nat = getNativeData(env, object); - return (jint) nat->channelCount; -} - JNIEXPORT jint JNICALL Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetAudioFormat( JNIEnv *env, jobject object) { diff --git a/android/src/com/reecedunn/espeak/SpeechSynthesis.java b/android/src/com/reecedunn/espeak/SpeechSynthesis.java index e989073b..3901e486 100644 --- a/android/src/com/reecedunn/espeak/SpeechSynthesis.java +++ b/android/src/com/reecedunn/espeak/SpeechSynthesis.java @@ -49,6 +49,8 @@ public class SpeechSynthesis { public static final int AGE_YOUNG = 12; public static final int AGE_OLD = 60; + public static final int CHANNEL_COUNT_MONO = 1; + static { System.loadLibrary("ttsespeak"); @@ -96,7 +98,7 @@ public class SpeechSynthesis { } public int getChannelCount() { - return nativeGetChannelCount(); + return CHANNEL_COUNT_MONO; } public int getAudioFormat() { @@ -341,8 +343,6 @@ public class SpeechSynthesis { private native final int nativeGetSampleRate(); - private native final int nativeGetChannelCount(); - private native final int nativeGetAudioFormat(); private native final int nativeGetBufferSizeInMillis();