debug, threading, etc

This commit is contained in:
gauthiier
2022-03-20 16:06:57 +01:00
parent e91d3012cb
commit c33d577bb6
3 changed files with 57 additions and 17 deletions
+8 -3
View File
@@ -1,5 +1,8 @@
from osc4py3.as_eventloop import *
from osc4py3 import oscbuildparse
from threading import Lock
mutex = Lock()
def start_osc():
osc_startup()
@@ -11,7 +14,9 @@ def temperature(temp, name):
print(f'{temp} - {name}')
def update():
osc_process()
global mutex
with mutex:
osc_process()
class OscBroadcaster:
@@ -25,12 +30,12 @@ class OscBroadcaster:
def utterance(self, utterance: str, channel: str):
msg = oscbuildparse.OSCMessage(channel, None, [utterance])
osc_send(msg, self.name)
osc_process()
update()
def command(self, command: str):
msg = oscbuildparse.OSCMessage(self.cmd, None, [command])
osc_send(msg, self.name)
osc_process()
update()
class OscReceiver:
+2 -2
View File
@@ -1,6 +1,6 @@
from aitextgen import aitextgen
import utterance.utils
import regex, string
import regex, string, time
class Voice:
@@ -13,7 +13,7 @@ class Voice:
def utter_n(self, n: int, temp: float = None, lenght: int = None):
t = self.temp if temp == None else temp
l = self.lenght if lenght == None else lenght
return self.v.generate(n=n, max_lenght=l, temperature=t, return_as_list=True)
return self.v.generate(n=n, max_lenght=l, temperature=t, seed=int(time.time()), return_as_list=True)
def utter_one(self, temp: int = None, lenght: float = None) -> str:
t = self.temp if temp == None else temp