mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-12-27 03:15:57 +00:00
Changes necessary to get working on Android.
This commit is contained in:
parent
c5f8e28028
commit
f0834feea5
4
TTS.gd
4
TTS.gd
|
@ -10,8 +10,8 @@ signal done
|
||||||
func _init():
|
func _init():
|
||||||
if OS.get_name() == "Server" or OS.has_feature("JavaScript"):
|
if OS.get_name() == "Server" or OS.has_feature("JavaScript"):
|
||||||
return
|
return
|
||||||
elif Engine.has_singleton("AndroidTTS"):
|
elif Engine.has_singleton("GodotTTS"):
|
||||||
tts = Engine.get_singleton("AndroidTTS")
|
tts = Engine.get_singleton("GodotTTS")
|
||||||
else:
|
else:
|
||||||
TTS = preload("godot-tts.gdns")
|
TTS = preload("godot-tts.gdns")
|
||||||
if TTS and (TTS.can_instance() or Engine.editor_hint):
|
if TTS and (TTS.can_instance() or Engine.editor_hint):
|
||||||
|
|
|
@ -23,7 +23,7 @@ android {
|
||||||
buildToolsVersion "29.0.3"
|
buildToolsVersion "29.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode pluginVersionCode
|
versionCode pluginVersionCode
|
||||||
versionName pluginVersionName
|
versionName pluginVersionName
|
||||||
|
|
|
@ -3,6 +3,3 @@
|
||||||
name="GodotTTS"
|
name="GodotTTS"
|
||||||
binary_type="local"
|
binary_type="local"
|
||||||
binary="godot-tts.aar"
|
binary="godot-tts.aar"
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
remote=[]
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package games.lightsout.godot.tts;
|
package games.lightsout.godot.tts;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.godotengine.godot.Godot;
|
import org.godotengine.godot.Godot;
|
||||||
import org.godotengine.godot.plugin.GodotPlugin;
|
import org.godotengine.godot.plugin.GodotPlugin;
|
||||||
|
|
||||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.speech.tts.TextToSpeech;
|
import android.speech.tts.TextToSpeech;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
@ -18,15 +16,14 @@ public class TTS extends GodotPlugin implements TextToSpeech.OnInitListener {
|
||||||
|
|
||||||
private float rate = 1f;
|
private float rate = 1f;
|
||||||
|
|
||||||
// private Integer utteranceId = 0;
|
private Integer utteranceId = 0;
|
||||||
|
|
||||||
public void speak(String text, boolean interrupt) {
|
public void speak(String text, boolean interrupt) {
|
||||||
int mode = TextToSpeech.QUEUE_ADD;
|
int mode = TextToSpeech.QUEUE_ADD;
|
||||||
if (interrupt)
|
if (interrupt)
|
||||||
mode = TextToSpeech.QUEUE_FLUSH;
|
mode = TextToSpeech.QUEUE_FLUSH;
|
||||||
HashMap<String, String> params = new HashMap();
|
tts.speak(text, mode, null, this.utteranceId.toString());
|
||||||
tts.speak(text, mode, params);
|
this.utteranceId++;
|
||||||
// this.utteranceId++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user