diff --git a/JapaneseTTS/.gitignore b/JapaneseTTS/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/JapaneseTTS/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/JapaneseTTS/.idea/compiler.xml b/JapaneseTTS/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/JapaneseTTS/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JapaneseTTS/.idea/copyright/profiles_settings.xml b/JapaneseTTS/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/JapaneseTTS/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/JapaneseTTS/.idea/gradle.xml b/JapaneseTTS/.idea/gradle.xml new file mode 100644 index 0000000..04242f1 --- /dev/null +++ b/JapaneseTTS/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/JapaneseTTS/.idea/misc.xml b/JapaneseTTS/.idea/misc.xml new file mode 100644 index 0000000..b0a270f --- /dev/null +++ b/JapaneseTTS/.idea/misc.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JapaneseTTS/.idea/modules.xml b/JapaneseTTS/.idea/modules.xml new file mode 100644 index 0000000..2582583 --- /dev/null +++ b/JapaneseTTS/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/JapaneseTTS/.idea/runConfigurations.xml b/JapaneseTTS/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/JapaneseTTS/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/JapaneseTTS/TTSLibrary/.gitignore b/JapaneseTTS/TTSLibrary/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/JapaneseTTS/TTSLibrary/.gitignore @@ -0,0 +1 @@ +/build diff --git a/JapaneseTTS/TTSLibrary/build.gradle b/JapaneseTTS/TTSLibrary/build.gradle new file mode 100644 index 0000000..05e2f88 --- /dev/null +++ b/JapaneseTTS/TTSLibrary/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 26 + + + + defaultConfig { + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' +} diff --git a/JapaneseTTS/TTSLibrary/proguard-rules.pro b/JapaneseTTS/TTSLibrary/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/JapaneseTTS/TTSLibrary/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/JapaneseTTS/TTSLibrary/src/main/AndroidManifest.xml b/JapaneseTTS/TTSLibrary/src/main/AndroidManifest.xml new file mode 100644 index 0000000..f45ef0e --- /dev/null +++ b/JapaneseTTS/TTSLibrary/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/JapaneseTTS/TTSLibrary/src/main/java/com/java/ttslibrary/TTSLib.java b/JapaneseTTS/TTSLibrary/src/main/java/com/java/ttslibrary/TTSLib.java new file mode 100644 index 0000000..9360af2 --- /dev/null +++ b/JapaneseTTS/TTSLibrary/src/main/java/com/java/ttslibrary/TTSLib.java @@ -0,0 +1,182 @@ +package com.java.ttslibrary; + +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.app.Activity; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Set; + +import android.speech.tts.TextToSpeech; +import android.util.Log; +import android.media.AudioManager; +import java.util.Locale; + +public class TTSLib { + static TextToSpeech tts; + static Locale _locale = Locale.JAPANESE; + static String packagetouse = "com.google.android.tts"; + + static Bundle bundle = null; + static HashMap param; + static Locale.Builder builder = new Locale.Builder(); + + public static boolean IsRunning(){ + return (tts!=null); + } + + public static void SetPitch(float pitch){ + if(tts!=null){ + tts.setPitch(pitch); + } + } + + public static void SetSpeedRate(float speechrate){ + if(tts!=null){ + tts.setSpeechRate(speechrate); + } + } + + public static boolean SetLocale(String locale, String script, String region){ + Locale locale_ = builder.setLanguage(locale).setScript(script).setRegion(region).build(); + if(tts==null){ + return false; + } + int result = tts.setLanguage(locale_); + if (result == TextToSpeech.LANG_MISSING_DATA|| result == TextToSpeech.LANG_NOT_SUPPORTED) { + return false; + } + _locale = locale_; + return true; + } + + public static String GetLocale(){ + return (tts!=null) ? tts.getLanguage().toString() : ""; + } + + public static String[] GetAvailableLocales(){ + + /*if(instance.tts!=null){ + Set locales = instance.tts.getAvailableLanguages(); + String[] temp = new String[locales.size()]; + Locale[] _locales = locales.toArray(new Locale[0]); + for(int i=0;i= Build.VERSION_CODES.LOLLIPOP) { + //Log.v("Change to new API", "Speak new API"); + if(bundle==null){ + Bundle bundle = new Bundle(); + bundle.putInt(TextToSpeech.Engine.KEY_PARAM_STREAM, AudioManager.STREAM_MUSIC); + } + tts.speak(s, TextToSpeech.QUEUE_FLUSH, bundle, null); + } else { + //Log.v(s, "Speak old API"); + if(param==null){ + param = new HashMap<>(); + param.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_MUSIC)); + } + + tts.speak(s, TextToSpeech.QUEUE_FLUSH, param); + } + } + + static protected void onDestroy() { + // Don't forget to shutdown tts! + if (tts != null) { + Log.v("onDestroy()","onDestroy: shutdown TTS"); + tts.stop(); + tts.shutdown(); + } + } + + public static void StopTTS() { + onDestroy(); + } +} diff --git a/JapaneseTTS/TTSLibrary/src/main/res/values/strings.xml b/JapaneseTTS/TTSLibrary/src/main/res/values/strings.xml new file mode 100644 index 0000000..33ccc1f --- /dev/null +++ b/JapaneseTTS/TTSLibrary/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + TTSLibrary + diff --git a/JapaneseTTS/app/.gitignore b/JapaneseTTS/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/JapaneseTTS/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/JapaneseTTS/app/build.gradle b/JapaneseTTS/app/build.gradle new file mode 100644 index 0000000..eea5123 --- /dev/null +++ b/JapaneseTTS/app/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.jongamedev.ttstest" + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' +} diff --git a/JapaneseTTS/app/proguard-rules.pro b/JapaneseTTS/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/JapaneseTTS/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/JapaneseTTS/app/src/main/AndroidManifest.xml b/JapaneseTTS/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..3f67692 --- /dev/null +++ b/JapaneseTTS/app/src/main/AndroidManifest.xml @@ -0,0 +1,11 @@ + + + + diff --git a/JapaneseTTS/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/JapaneseTTS/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/JapaneseTTS/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/JapaneseTTS/app/src/main/res/drawable/ic_launcher_background.xml b/JapaneseTTS/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/JapaneseTTS/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/JapaneseTTS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher.png b/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher.png b/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/JapaneseTTS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/JapaneseTTS/app/src/main/res/values/colors.xml b/JapaneseTTS/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/JapaneseTTS/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/JapaneseTTS/app/src/main/res/values/strings.xml b/JapaneseTTS/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..c891e9b --- /dev/null +++ b/JapaneseTTS/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + TTSTest + diff --git a/JapaneseTTS/app/src/main/res/values/styles.xml b/JapaneseTTS/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..5885930 --- /dev/null +++ b/JapaneseTTS/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/JapaneseTTS/build.gradle b/JapaneseTTS/build.gradle new file mode 100644 index 0000000..ac26844 --- /dev/null +++ b/JapaneseTTS/build.gradle @@ -0,0 +1,30 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} +allprojects { + repositories { + google() + jcenter() + } +} +task clean(type: Delete) { + delete rootProject.buildDir +} + +android { + compileSdkVersion 25 + buildToolsVersion '25.0.3' +} +dependencies { +} \ No newline at end of file diff --git a/JapaneseTTS/gradle.properties b/JapaneseTTS/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/JapaneseTTS/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/JapaneseTTS/gradle/wrapper/gradle-wrapper.jar b/JapaneseTTS/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/JapaneseTTS/gradle/wrapper/gradle-wrapper.jar differ diff --git a/JapaneseTTS/gradle/wrapper/gradle-wrapper.properties b/JapaneseTTS/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f78fd6d --- /dev/null +++ b/JapaneseTTS/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Aug 11 10:09:35 SGT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/JapaneseTTS/gradlew b/JapaneseTTS/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/JapaneseTTS/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/JapaneseTTS/gradlew.bat b/JapaneseTTS/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/JapaneseTTS/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/JapaneseTTS/mylibrary/.gitignore b/JapaneseTTS/mylibrary/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/JapaneseTTS/mylibrary/.gitignore @@ -0,0 +1 @@ +/build diff --git a/JapaneseTTS/mylibrary/build.gradle b/JapaneseTTS/mylibrary/build.gradle new file mode 100644 index 0000000..111132d --- /dev/null +++ b/JapaneseTTS/mylibrary/build.gradle @@ -0,0 +1,31 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 26 + buildToolsVersion "26.0.2" + + defaultConfig { + minSdkVersion 15 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:26.+' + testCompile 'junit:junit:4.12' +} diff --git a/JapaneseTTS/mylibrary/proguard-rules.pro b/JapaneseTTS/mylibrary/proguard-rules.pro new file mode 100644 index 0000000..81e7ec2 --- /dev/null +++ b/JapaneseTTS/mylibrary/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Jonathan\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/JapaneseTTS/mylibrary/src/androidTest/java/com/unityplugin/jongamedev/mylibrary/ExampleInstrumentedTest.java b/JapaneseTTS/mylibrary/src/androidTest/java/com/unityplugin/jongamedev/mylibrary/ExampleInstrumentedTest.java new file mode 100644 index 0000000..6d6a491 --- /dev/null +++ b/JapaneseTTS/mylibrary/src/androidTest/java/com/unityplugin/jongamedev/mylibrary/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.unityplugin.jongamedev.mylibrary; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.unityplugin.jongamedev.mylibrary.test", appContext.getPackageName()); + } +} diff --git a/JapaneseTTS/mylibrary/src/main/AndroidManifest.xml b/JapaneseTTS/mylibrary/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6aa4536 --- /dev/null +++ b/JapaneseTTS/mylibrary/src/main/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/JapaneseTTS/mylibrary/src/main/res/values/strings.xml b/JapaneseTTS/mylibrary/src/main/res/values/strings.xml new file mode 100644 index 0000000..e3a7072 --- /dev/null +++ b/JapaneseTTS/mylibrary/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + My Library + diff --git a/JapaneseTTS/mylibrary/src/test/java/com/unityplugin/jongamedev/mylibrary/ExampleUnitTest.java b/JapaneseTTS/mylibrary/src/test/java/com/unityplugin/jongamedev/mylibrary/ExampleUnitTest.java new file mode 100644 index 0000000..487e82c --- /dev/null +++ b/JapaneseTTS/mylibrary/src/test/java/com/unityplugin/jongamedev/mylibrary/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.unityplugin.jongamedev.mylibrary; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/JapaneseTTS/settings.gradle b/JapaneseTTS/settings.gradle new file mode 100644 index 0000000..e4e30d0 --- /dev/null +++ b/JapaneseTTS/settings.gradle @@ -0,0 +1 @@ +include ':app', ':ttslibrary', ':mylibrary' diff --git a/TTSEngine/Assets/AssetStoreTools.meta b/TTSEngine/Assets/AssetStoreTools.meta new file mode 100644 index 0000000..9de0c7a --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29a94c7e2dc463d4491f3650551ecaef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Editor.meta b/TTSEngine/Assets/AssetStoreTools/Editor.meta new file mode 100644 index 0000000..6d04c3b --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 590fc2adba0c40942944f03ed1366972 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll new file mode 100644 index 0000000..baeea8f Binary files /dev/null and b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll differ diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll.meta b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll.meta new file mode 100644 index 0000000..9aa5e7f --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreTools.dll.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: d95747ad7660f1547be5178703805664 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll new file mode 100644 index 0000000..f3e3ad1 Binary files /dev/null and b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll differ diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll.meta b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll.meta new file mode 100644 index 0000000..044f71d --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 9cdffcb52b712d04893eb52a8eec4438 +timeCreated: 1531731010 +licenseType: Store +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf b/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf new file mode 100644 index 0000000..6e79dad Binary files /dev/null and b/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf differ diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf.meta b/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf.meta new file mode 100644 index 0000000..f9a4a0d --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Editor/DroidSansMono.ttf.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 418e5ee9e6a59d94fae09a3d0e50ee6c +timeCreated: 1531731014 +licenseType: Store +TrueTypeFontImporter: + serializedVersion: 2 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 1 + characterPadding: 0 + includeFontData: 1 + use2xBehaviour: 0 + fontNames: [] + customCharacters: + fontRenderingMode: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/icon.png b/TTSEngine/Assets/AssetStoreTools/Editor/icon.png new file mode 100644 index 0000000..0269610 Binary files /dev/null and b/TTSEngine/Assets/AssetStoreTools/Editor/icon.png differ diff --git a/TTSEngine/Assets/AssetStoreTools/Editor/icon.png.meta b/TTSEngine/Assets/AssetStoreTools/Editor/icon.png.meta new file mode 100644 index 0000000..77a1f4e --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Editor/icon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: ce402b1b0b1c64447b24ee3b6306f9ce +timeCreated: 1531731014 +licenseType: Store +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/AssetStoreTools/Labels.asset b/TTSEngine/Assets/AssetStoreTools/Labels.asset new file mode 100644 index 0000000..9dddcb3 --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Labels.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -547254688, guid: d95747ad7660f1547be5178703805664, type: 3} + m_Name: Labels + m_EditorClassIdentifier: + m_Labels: + - diff --git a/TTSEngine/Assets/AssetStoreTools/Labels.asset.meta b/TTSEngine/Assets/AssetStoreTools/Labels.asset.meta new file mode 100644 index 0000000..329c282 --- /dev/null +++ b/TTSEngine/Assets/AssetStoreTools/Labels.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eab6c1c381a293048a79ee3742e57888 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/Button.prefab b/TTSEngine/Assets/Button.prefab new file mode 100644 index 0000000..d242a71 --- /dev/null +++ b/TTSEngine/Assets/Button.prefab @@ -0,0 +1,218 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1397095961924442} + m_IsPrefabParent: 1 +--- !u!1 &1397095961924442 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224236134800914788} + - component: {fileID: 222724638199945802} + - component: {fileID: 114512427668251290} + - component: {fileID: 114414944961953288} + - component: {fileID: 114130375690522060} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1955599939643950 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224011510677596278} + - component: {fileID: 222227123987601150} + - component: {fileID: 114347909300876474} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &114130375690522060 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1397095961924442} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 0 + m_MinHeight: 0 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &114347909300876474 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1955599939643950} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 45 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 4 + m_MaxSize: 60 + m_Alignment: 4 + m_AlignByGeometry: 1 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!114 &114414944961953288 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1397095961924442} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 114512427668251290} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &114512427668251290 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1397095961924442} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &222227123987601150 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1955599939643950} +--- !u!222 &222724638199945802 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1397095961924442} +--- !u!224 &224011510677596278 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1955599939643950} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 224236134800914788} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224236134800914788 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1397095961924442} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 224011510677596278} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 400, y: 200} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/TTSEngine/Assets/Button.prefab.meta b/TTSEngine/Assets/Button.prefab.meta new file mode 100644 index 0000000..6b58858 --- /dev/null +++ b/TTSEngine/Assets/Button.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8270dd073123b734780e185ad0de0dcc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/C# TTSManager Script.meta b/TTSEngine/Assets/C# TTSManager Script.meta new file mode 100644 index 0000000..96acb4f --- /dev/null +++ b/TTSEngine/Assets/C# TTSManager Script.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b76634ae31251a2499c484acd841787a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs b/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs new file mode 100644 index 0000000..2edd912 --- /dev/null +++ b/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs @@ -0,0 +1,157 @@ +using UnityEngine; + +public static class TTSManager { + + private static AndroidJavaClass _mainactivity = null; + private static AndroidJavaClass _libraryclass = null; + + const string _MainActivity = "com.unity3d.player.UnityPlayer"; + const string _LibraryClass = "com.java.ttslibrary.TTSLib"; + const string _MethodName = "Speak"; + const string _CheckAvailability = "GetLanguageAvailability"; + const string _getlocale = "GetLocale"; + const string _getavailablelocales = "GetAvailableLocales"; + const string _setlocale = "SetLocale"; + const string _setEngineByPackageName = "setEngineByPackageName"; + const string _downloadttsdata = "DownloadTTSData"; + const string _shutdowntts = "StopTTS"; + const string _uttering = "IsUttering"; + const string _setpitch = "SetPitch"; + const string _setspeed = "SetSpeedRate"; + const string _isbootedup = "IsRunning"; + const string _stopspeaking = "StopUtterance"; + const string _starttts = "StartTTS"; + + public static void BootUpTTS() { + #if UNITY_ANDROID && !UNITY_EDITOR + _mainactivity = new AndroidJavaClass(_MainActivity); + _libraryclass = new AndroidJavaClass(_LibraryClass); + _libraryclass.CallStatic(_starttts, _mainactivity.GetStatic("currentActivity")); + SetSpeechRate(0.8f); + #endif + } + + public static void SetSpeechRate(float value) { // Sets the rate at which the TTS Engine speaks the words + #if UNITY_ANDROID && !UNITY_EDITOR + if (_libraryclass!=null) { + _libraryclass.CallStatic(_setspeed, value); + } + #endif + } + + public static void SetPitch(float value) { // Sets the pitch of the TTS Engine + #if UNITY_ANDROID && !UNITY_EDITOR + if (_libraryclass!=null) { + _libraryclass.CallStatic(_setpitch, value); + } + #endif + } + + public static bool GetLanguageAvailability(string locale) { //Java method call that checks to see whether or not the users phone has a particular language's TTS Support + + if (Application.internetReachability == NetworkReachability.NotReachable) { + return false; + } + + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null)?_libraryclass.CallStatic(_CheckAvailability,_mainactivity.GetStatic("currentActivity"), locale):false; + #else + return false; + #endif + } + + public static void Speak(string sentence) { // A Generic method for accessing TTS engine to play words + + if (Application.internetReachability == NetworkReachability.NotReachable) { + return; + } + + #if UNITY_ANDROID && !UNITY_EDITOR + if(_libraryclass==null){ + BootUpTTS(); + } + if(_libraryclass!= null && !_libraryclass.CallStatic(_uttering)) { + _libraryclass.CallStatic(_MethodName,sentence); + } + #endif + } + + public static void DownloadTTSData() { // Creates an Intent which allows users to download TTS languages + + if (Application.internetReachability == NetworkReachability.NotReachable) { + return; + } + #if UNITY_ANDROID && !UNITY_EDITOR + if (_libraryclass!=null) { + _libraryclass.CallStatic(_downloadttsdata, _mainactivity.GetStatic("currentActivity")); + } + #endif + } + + public static void StopTTS() { //Stop Running the TTS and free up resources + #if UNITY_ANDROID && !UNITY_EDITOR + if (_libraryclass!=null) { + _libraryclass.CallStatic(_shutdowntts); + } + #endif + _mainactivity = null; + _libraryclass = null; + } + + public static string[] GetAvailableLocales() { // Returns a list of all the available locales/languages as a string array + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null)?_libraryclass.CallStatic(_getavailablelocales):null; + #else + return null; + #endif + } + + public static bool SetLocale(string locale, string script = "", string region = "") { //Refer to Documentation for more details on this method + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null) ? _libraryclass.CallStatic(_setlocale, locale,script,region) : false; + #else + return false; + #endif + } + + public static string GetLocale() { + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null) ? _libraryclass.CallStatic(_getlocale) : "TTS Has not been initialized!"; + #else + return ""; + #endif + } + + public static bool IsBootedUp() { + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null) ? _libraryclass.CallStatic(_isbootedup) : false; + #else + return false; + #endif + } + + public static bool IsUttering() { + + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass!=null)?_libraryclass.CallStatic(_uttering) : false; + #else + return false; + #endif + } + + public static bool SetEngineByPackageName(string packagename) { // The Default TTS Engine used is com.google.android.tts. + #if UNITY_ANDROID && !UNITY_EDITOR + return (_libraryclass != null) ? _libraryclass.CallStatic(_setEngineByPackageName, packagename) : false; + #else + return false; + #endif + } + + public static void StopSpeaking() { //Stops the current running utternance. Can be used to stop a sentence that has been spoken midway + #if UNITY_ANDROID && !UNITY_EDITOR + if(_libraryclass != null) { + _libraryclass.CallStatic(_stopspeaking); + } + #endif + } +} diff --git a/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs.meta b/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs.meta new file mode 100644 index 0000000..bab9485 --- /dev/null +++ b/TTSEngine/Assets/C# TTSManager Script/TTSManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c7dac94230d26349ba488f1d669e7f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/CanvasController.prefab b/TTSEngine/Assets/CanvasController.prefab new file mode 100644 index 0000000..d31e921 --- /dev/null +++ b/TTSEngine/Assets/CanvasController.prefab @@ -0,0 +1,53 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1380239577906684} + m_IsPrefabParent: 1 +--- !u!1 &1380239577906684 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4201340796365306} + - component: {fileID: 114795354551982730} + m_Layer: 0 + m_Name: CanvasController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4201340796365306 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1380239577906684} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114795354551982730 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1380239577906684} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 110a1c5a211364842bbfe58f82d81b65, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/TTSEngine/Assets/CanvasController.prefab.meta b/TTSEngine/Assets/CanvasController.prefab.meta new file mode 100644 index 0000000..3d0dcc3 --- /dev/null +++ b/TTSEngine/Assets/CanvasController.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e978a2b128becc541a32277aa9048bf6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/ExampleScripts.meta b/TTSEngine/Assets/ExampleScripts.meta new file mode 100644 index 0000000..13f293e --- /dev/null +++ b/TTSEngine/Assets/ExampleScripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eeb9beabb7ce7f14fa92a7c9403d8593 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs b/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs new file mode 100644 index 0000000..a591fe0 --- /dev/null +++ b/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs @@ -0,0 +1,145 @@ +using UnityEngine; +using UnityEngine.UI; + +public class BoundaryClass : MonoBehaviour { + + private static BoundaryClass instance; + + public GameObject scrollview_content; //This is where we attach the Scroll Views child content GameObject. + + public GameObject scrollview_buttons; + + public GameObject PlayTextButton; //Attach the Button that plays the TTSManager.Speak() Method + public GameObject _InputField; + + private InputField _InputFieldComponent; + private static Text _InputFieldText; + + public Slider PitchSlider; + public Slider SpeedSlider; + + public Text DisplayLocale; + public Text DisplayLocalAvailaibility; + + public GameObject[] Buttons; //JapaneseButton, GermanButton, EnglishButton, ThaiButton + + static ScrollViewHandler sv_handler; + + static readonly string[] languagebuttons = new string[] { "Canvas/Japanese", + "Canvas/German", + "Canvas/Thai", + "Canvas/English" }; + + + void Awake () { + + instance = this; + + if (Buttons==null || Buttons.Length < languagebuttons.Length) { + Buttons = new GameObject[languagebuttons.Length]; + + for (var i =0;i(); + + + instance.SpeedSlider = GameObject.Find("Canvas/SpeechSpeed").GetComponent(); + + + + instance.DisplayLocale = GameObject.Find("Canvas/DisplayLocale").GetComponent(); + + + instance.DisplayLocalAvailaibility = GameObject.Find("Canvas/DisplayLocaleAvailability").GetComponent(); + + instance._InputField = GameObject.Find("Canvas/InputField"); + + instance._InputFieldComponent = _InputField.GetComponent(); + + _InputFieldText = GameObject.Find("Canvas/InputField/Text").GetComponent(); + + sv_handler = new ScrollViewHandler(scrollview_buttons,ref scrollview_content,new ButtonMethod(_ButtonMethod)); + } + + public static void _ButtonMethod(string _param) { + instance._InputFieldComponent.text = _param; + } + + public static void PopulateScrollView(string type) { + + if (sv_handler.IsPopulated()) { + sv_handler.DepopulateScrollView(); + } + + switch (type.ToLower()) { + case "ja": + sv_handler.PopulateScrollView(ExampleText.Japanese); + _InputFieldText.fontSize = 80; + break; + case "de": + sv_handler.PopulateScrollView(ExampleText.German); + _InputFieldText.fontSize = 40; + break; + case "th": + sv_handler.PopulateScrollView(ExampleText.Thai); + _InputFieldText.fontSize = 80; + break; + case "en": + default: + sv_handler.PopulateScrollView(ExampleText.English); + _InputFieldText.fontSize = 40; + break; + } + } + + public static InputField ReturnInputFieldComponent() + { + return instance._InputFieldComponent; + } + + public static Slider ReturnBoundarySlider(string slidername) { + + var temp = slidername.ToLower(); + + if (temp.Contains("pitch")) { + + return instance.PitchSlider; + } + else if(temp.Contains("speed")){ + + return instance.SpeedSlider; + } + else { + + throw new System.NullReferenceException("The Referenced Slider Object does not exist!"); + } + } + + public static void SetTextComponent(string TextObjectName, string text) { + + var temp = TextObjectName.ToLower(); + + if (temp == "displaylocale") { + instance.DisplayLocale.text = text; + } + else if (temp == "displaylocaleavailability") { + instance.DisplayLocalAvailaibility.text = text; + } + else { + + throw new System.NullReferenceException("The Referenced Text Object does not exist!"); + } + } +} diff --git a/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs.meta b/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs.meta new file mode 100644 index 0000000..cecb6e6 --- /dev/null +++ b/TTSEngine/Assets/ExampleScripts/BoundaryClass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 180445cd4ad091141bf5a3cb0578a725 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TTSEngine/Assets/ExampleScripts/CanvasController.cs b/TTSEngine/Assets/ExampleScripts/CanvasController.cs new file mode 100644 index 0000000..f6921b8 --- /dev/null +++ b/TTSEngine/Assets/ExampleScripts/CanvasController.cs @@ -0,0 +1,108 @@ +using UnityEngine; +using System.Threading.Tasks; +using System.Text; + +public class CanvasController : MonoBehaviour { + + public static CanvasController instance; + + static StringBuilder sb = new StringBuilder(); + + static readonly string[,] languagelocaledict = new string[4,2] { { "japanese", "ja" }, + {"english", "en" }, + {"thai","th" }, + {"german","de" } + }; + + public async void ChangeTTSLanguage(string language) { + + if (!TTSManager.IsBootedUp()) { + TTSManager.BootUpTTS(); + } + else if (TTSManager.IsUttering()) + { + TTSManager.StopSpeaking(); + } + + string locale = null; + + for (var i=0;i buttonsused; + + ButtonMethod _methodadd_tobuttons; + + public ScrollViewHandler(GameObject button, ref GameObject _content, ButtonMethod methodadd_tobuttons) { + + if (buttonpool == null) { + buttonpool = new SpawnerScript(button, 5); + } + + _contentobject = _content; + buttonsused = new List(); + _methodadd_tobuttons = methodadd_tobuttons; + } + + public bool IsPopulated() { + return (buttonsused.Count > 0) ? true : false; + } + + public void PopulateScrollView(string[] contentstoadd) { + + for (var i =0;i().text = contentstoadd[i]; + int k = i; + + button.GetComponent