Added functions in the python wrapper for speechd
This commit is contained in:
		
							
								
								
									
										0
									
								
								stardew-access/LinuxSpeech/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								stardew-access/LinuxSpeech/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										9
									
								
								stardew-access/LinuxSpeech/_test.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								stardew-access/LinuxSpeech/_test.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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) | ||||
							
								
								
									
										14
									
								
								stardew-access/LinuxSpeech/_test_interrupt.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								stardew-access/LinuxSpeech/_test_interrupt.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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) | ||||
| @@ -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() | ||||
| 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() | ||||
| @@ -13,6 +13,7 @@ | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="AccessibleOutput" Version="1.0.0" /> | ||||
|     <PackageReference Include="AutoHotkey.Interop" Version="1.0.0.1" /> | ||||
|     <PackageReference Include="IronPython" Version="2.7.12" /> | ||||
|     <PackageReference Include="Lib.Harmony" Version="2.2.0" /> | ||||
|     <PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" /> | ||||
|   </ItemGroup> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user