diff --git a/stardew-access/LinuxSpeech/__init__.py b/stardew-access/LinuxSpeech/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stardew-access/LinuxSpeech/_test.py b/stardew-access/LinuxSpeech/_test.py new file mode 100644 index 0000000..2e1d26c --- /dev/null +++ b/stardew-access/LinuxSpeech/_test.py @@ -0,0 +1,9 @@ +import libspeechd + +speech = libspeechd.Speech + +speech.Initialize(self=speech) + +speech.Say(self=speech, text="hello", interrupt=False) + +speech.Close(self=speech) \ No newline at end of file diff --git a/stardew-access/LinuxSpeech/_test_interrupt.py b/stardew-access/LinuxSpeech/_test_interrupt.py new file mode 100644 index 0000000..420cfb5 --- /dev/null +++ b/stardew-access/LinuxSpeech/_test_interrupt.py @@ -0,0 +1,14 @@ +import libspeechd +import time + +speech = libspeechd.Speech + +speech.Initialize(self=speech) + +speech.Say(self=speech, text="This is a very very very long string.", interrupt=False) + +time.sleep(1) + +speech.Say(self=speech, text="I interrupted :)", interrupt=True) + +speech.Close(self=speech) \ No newline at end of file diff --git a/stardew-access/LinuxSpeech/libspeechd.py b/stardew-access/LinuxSpeech/libspeechd.py index 048a5f8..6b53f61 100644 --- a/stardew-access/LinuxSpeech/libspeechd.py +++ b/stardew-access/LinuxSpeech/libspeechd.py @@ -1,12 +1,18 @@ -from multiprocessing.connection import wait -from threading import Thread -from time import time import speechd -import time -client = speechd.SSIPClient('test') -client.speak("Hello World! this is yusuf") -time.sleep(1) -client.stop() -client.speak("No this is shoaib") -client.close() \ No newline at end of file +class Speech: + client = None + + def Initialize(self): + self.client = speechd.SSIPClient('stardew-access') + + def Say(self, text, interrupt): + if(self.client is not None): + if(interrupt): + self.client.stop() + + self.client.speak(text) + + def Close(self): + if(self.client is not None): + self.client.close() \ No newline at end of file diff --git a/stardew-access/stardew-access.csproj b/stardew-access/stardew-access.csproj index a024c46..219531e 100644 --- a/stardew-access/stardew-access.csproj +++ b/stardew-access/stardew-access.csproj @@ -13,6 +13,7 @@ +