summaryrefslogtreecommitdiffstats
path: root/pico/src
diff options
context:
space:
mode:
authorCharles Chen <clchen@google.com>2009-06-22 16:25:25 -0700
committerCharles Chen <clchen@google.com>2009-06-22 17:14:37 -0700
commit1284d937084a20b457c280259fff59391129509a (patch)
tree5630028284c450b56a56b187d9c99cf7ebcee9cc /pico/src
parentf605ee98e5e03144c25a92af7e5d2a3ec33d375f (diff)
downloadexternal_svox-1284d937084a20b457c280259fff59391129509a.zip
external_svox-1284d937084a20b457c280259fff59391129509a.tar.gz
external_svox-1284d937084a20b457c280259fff59391129509a.tar.bz2
Moving PicoTts plugin under the pico directory of external/svox
Diffstat (limited to 'pico/src')
-rwxr-xr-xpico/src/com/svox/pico/CheckVoiceData.java60
-rwxr-xr-xpico/src/com/svox/pico/DownloadVoiceData.java37
-rwxr-xr-xpico/src/com/svox/pico/Pico.java42
3 files changed, 139 insertions, 0 deletions
diff --git a/pico/src/com/svox/pico/CheckVoiceData.java b/pico/src/com/svox/pico/CheckVoiceData.java
new file mode 100755
index 0000000..66e6833
--- /dev/null
+++ b/pico/src/com/svox/pico/CheckVoiceData.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.svox.pico;
+
+import java.io.File;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
+
+/*
+ * Checks if the voice data for the SVOX Pico Engine is present on the
+ * sd card.
+ */
+public class CheckVoiceData extends Activity {
+ private final static String dataDir = "/sdcard/svox/";
+
+ private final static String[] datafiles = {
+ "de-DE_gl0_sg.bin", "de-DE_ta.bin", "en-GB_kh0_sg.bin", "en-GB_ta.bin",
+ "en-US_lh0_sg.bin", "en-US_ta.bin", "es-ES_ta.bin", "es-ES_zl0_sg.bin",
+ "fr-FR_nk0_sg.bin", "fr-FR_ta.bin", "it-IT_cm0_sg.bin", "it-IT_ta.bin"
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_PASS);
+
+ // Make sure the SD card is accessible
+ if (!new File("/sdcard/").canRead()) {
+ setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA_NO_SDCARD);
+ }
+
+ // Check for files
+ for (int i = 0; i < datafiles.length; i++) {
+ File tempFile = new File(dataDir + datafiles[i]);
+ if (!tempFile.exists()) {
+ setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA);
+ }
+ }
+
+ finish();
+ }
+
+}
diff --git a/pico/src/com/svox/pico/DownloadVoiceData.java b/pico/src/com/svox/pico/DownloadVoiceData.java
new file mode 100755
index 0000000..02638bb
--- /dev/null
+++ b/pico/src/com/svox/pico/DownloadVoiceData.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.svox.pico;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+
+/*
+ * Downloads the voice data for the SVOX Pico Engine by getting the language
+ * pack from the Android Market.
+ */
+public class DownloadVoiceData extends Activity {
+ private final static String MARKET_URI = "market://search?q=pname:com.svox.langpack.installer";
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Uri marketUri = Uri.parse(MARKET_URI);
+ Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
+ startActivityForResult(marketIntent, 0);
+ finish();
+ }
+}
diff --git a/pico/src/com/svox/pico/Pico.java b/pico/src/com/svox/pico/Pico.java
new file mode 100755
index 0000000..b8ab7d1
--- /dev/null
+++ b/pico/src/com/svox/pico/Pico.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.svox.pico;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/*
+ * The Java portion of this TTS plugin engine app does nothing.
+ * This activity is only here so that the native code can be
+ * wrapped up inside an apk file.
+ *
+ * The file path structure convention is that the native library
+ * implementing TTS must be a file placed here:
+ * /data/data/<PACKAGE_NAME>/lib/libtts<ACTIVITY_NAME_LOWERCASED>.so
+ * Example:
+ * /data/data/com.svox.pico/lib/libttspico.so
+ */
+
+public class Pico extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // The Java portion of this does nothing.
+ // This activity is only here so that everything
+ // can be wrapped up inside an apk file.
+ finish();
+ }
+}