Use a dummy implementation of Narrator library
This commit is contained in:
1 parent
8309b43732
commit
3e425bbc36
6 files changed
+70
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public interface Narrator {
|
||||
void say(final String msg, final boolean interrupt);
|
||||
|
||||
void clear();
|
||||
|
||||
boolean active();
|
||||
|
||||
void destroy();
|
||||
|
||||
static Narrator getNarrator() {
|
||||
return new NarratorDummy();
|
||||
}
|
||||
|
||||
static void setJNAPath(String sep) {
|
||||
System.setProperty("jna.library.path", System.getProperty("jna.library.path") + sep + "./src/natives/resources/");
|
||||
System.setProperty("jna.library.path", System.getProperty("jna.library.path") + sep + System.getProperty("java.library.path"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public class NarratorDummy implements Narrator {
|
||||
@Override
|
||||
public void say(final String msg, final boolean interrupt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean active() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public class NarratorLinux extends NarratorDummy {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public class NarratorOSX extends NarratorDummy {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public class NarratorWindows extends NarratorDummy {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mojang.text2speech;
|
||||
|
||||
public class Text2Speech {
|
||||
public static void main(final String[] args) {
|
||||
System.setProperty("jna.library.path", "./src/natives/resources/");
|
||||
final Narrator narrator = Narrator.getNarrator();
|
||||
narrator.say("This is a test", false);
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (final InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user