Merge branch 'model' into UI_2.0
This commit is contained in:
10
config.py
10
config.py
@@ -388,6 +388,15 @@ class Config:
|
|||||||
if type(value) is bool:
|
if type(value) is bool:
|
||||||
self._ENABLE_OSC = value
|
self._ENABLE_OSC = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ENABLE_OSC_ERROR_LOG(self):
|
||||||
|
return self._ENABLE_OSC_ERROR_LOG
|
||||||
|
|
||||||
|
@ENABLE_OSC_ERROR_LOG.setter
|
||||||
|
def ENABLE_OSC_ERROR_LOG(self, value):
|
||||||
|
if type(value) is bool:
|
||||||
|
self._ENABLE_OSC_ERROR_LOG = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def UPDATE_FLAG(self):
|
def UPDATE_FLAG(self):
|
||||||
return self._UPDATE_FLAG
|
return self._UPDATE_FLAG
|
||||||
@@ -507,6 +516,7 @@ class Config:
|
|||||||
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False
|
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False
|
||||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||||
self._ENABLE_OSC = False
|
self._ENABLE_OSC = False
|
||||||
|
self._ENABLE_OSC_ERROR_LOG = True
|
||||||
self._UPDATE_FLAG = False
|
self._UPDATE_FLAG = False
|
||||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||||
# self._BREAK_KEYSYM_LIST = [
|
# self._BREAK_KEYSYM_LIST = [
|
||||||
|
|||||||
2
main.py
2
main.py
@@ -28,6 +28,7 @@ def sendMicMessage(message):
|
|||||||
osc_message = message
|
osc_message = message
|
||||||
model.oscSendMessage(osc_message)
|
model.oscSendMessage(osc_message)
|
||||||
else:
|
else:
|
||||||
|
if config.ENABLE_OSC_ERROR_LOG is True:
|
||||||
view.printToTextbox_OSCError()
|
view.printToTextbox_OSCError()
|
||||||
|
|
||||||
view.printToTextbox_SentMessage(message, translation)
|
view.printToTextbox_SentMessage(message, translation)
|
||||||
@@ -90,6 +91,7 @@ def sendChatMessage(message):
|
|||||||
osc_message = message
|
osc_message = message
|
||||||
model.oscSendMessage(osc_message)
|
model.oscSendMessage(osc_message)
|
||||||
else:
|
else:
|
||||||
|
if config.ENABLE_OSC_ERROR_LOG is True:
|
||||||
view.printToTextbox_OSCError()
|
view.printToTextbox_OSCError()
|
||||||
|
|
||||||
# update textbox message log
|
# update textbox message log
|
||||||
|
|||||||
32
model.py
32
model.py
@@ -215,17 +215,23 @@ class Model:
|
|||||||
|
|
||||||
def startMicTranscript(self, fnc):
|
def startMicTranscript(self, fnc):
|
||||||
mic_audio_queue = Queue()
|
mic_audio_queue = Queue()
|
||||||
|
device = [device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0]
|
||||||
|
record_timeout = config.INPUT_MIC_RECORD_TIMEOUT
|
||||||
|
phase_timeout = config.INPUT_MIC_PHRASE_TIMEOUT
|
||||||
|
if record_timeout > phase_timeout:
|
||||||
|
record_timeout = phase_timeout
|
||||||
|
|
||||||
self.mic_audio_recorder = SelectedMicRecorder(
|
self.mic_audio_recorder = SelectedMicRecorder(
|
||||||
[device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0],
|
device=device,
|
||||||
config.INPUT_MIC_ENERGY_THRESHOLD,
|
energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD,
|
||||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
dynamic_energy_threshold=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
config.INPUT_MIC_RECORD_TIMEOUT,
|
record_timeout=record_timeout,
|
||||||
)
|
)
|
||||||
self.mic_audio_recorder.recordIntoQueue(mic_audio_queue)
|
self.mic_audio_recorder.recordIntoQueue(mic_audio_queue)
|
||||||
mic_transcriber = AudioTranscriber(
|
mic_transcriber = AudioTranscriber(
|
||||||
speaker=False,
|
speaker=False,
|
||||||
source=self.mic_audio_recorder.source,
|
source=self.mic_audio_recorder.source,
|
||||||
phrase_timeout=config.INPUT_MIC_PHRASE_TIMEOUT,
|
phrase_timeout=phase_timeout,
|
||||||
max_phrases=config.INPUT_MIC_MAX_PHRASES,
|
max_phrases=config.INPUT_MIC_MAX_PHRASES,
|
||||||
)
|
)
|
||||||
def sendMicTranscript():
|
def sendMicTranscript():
|
||||||
@@ -274,17 +280,23 @@ class Model:
|
|||||||
def startSpeakerTranscript(self, fnc):
|
def startSpeakerTranscript(self, fnc):
|
||||||
spk_audio_queue = Queue()
|
spk_audio_queue = Queue()
|
||||||
spk_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
spk_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
||||||
|
|
||||||
|
record_timeout = config.INPUT_SPEAKER_RECORD_TIMEOUT
|
||||||
|
phase_timeout = config.INPUT_SPEAKER_PHRASE_TIMEOUT
|
||||||
|
if record_timeout > phase_timeout:
|
||||||
|
record_timeout = phase_timeout
|
||||||
|
|
||||||
self.spk_audio_recorder = SelectedSpeakerRecorder(
|
self.spk_audio_recorder = SelectedSpeakerRecorder(
|
||||||
spk_device,
|
device=spk_device,
|
||||||
config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
||||||
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
config.INPUT_SPEAKER_RECORD_TIMEOUT,
|
record_timeout=record_timeout,
|
||||||
)
|
)
|
||||||
self.spk_audio_recorder.recordIntoQueue(spk_audio_queue)
|
self.spk_audio_recorder.recordIntoQueue(spk_audio_queue)
|
||||||
spk_transcriber = AudioTranscriber(
|
spk_transcriber = AudioTranscriber(
|
||||||
speaker=True,
|
speaker=True,
|
||||||
source=self.spk_audio_recorder.source,
|
source=self.spk_audio_recorder.source,
|
||||||
phrase_timeout=config.INPUT_SPEAKER_PHRASE_TIMEOUT,
|
phrase_timeout=phase_timeout,
|
||||||
max_phrases=config.INPUT_SPEAKER_MAX_PHRASES,
|
max_phrases=config.INPUT_SPEAKER_MAX_PHRASES,
|
||||||
)
|
)
|
||||||
def sendSpkTranscript():
|
def sendSpkTranscript():
|
||||||
|
|||||||
@@ -30,8 +30,28 @@ def sendTestAction(ip_address="127.0.0.1", port=9000):
|
|||||||
sleep(0.01)
|
sleep(0.01)
|
||||||
client.send_message("/input/Vertical", False)
|
client.send_message("/input/Vertical", False)
|
||||||
|
|
||||||
|
# send Input Voice
|
||||||
|
def sendInputVoice(flag=False, ip_address="127.0.0.1", port=9000):
|
||||||
|
input_voice = osc_message_builder.OscMessageBuilder(address="/input/Voice")
|
||||||
|
input_voice.add_arg(flag)
|
||||||
|
b_input_voice = input_voice.build()
|
||||||
|
client = udp_client.SimpleUDPClient(ip_address, port)
|
||||||
|
client.send(b_input_voice)
|
||||||
|
|
||||||
|
def sendChangeVoice(ip_address="127.0.0.1", port=9000):
|
||||||
|
sendInputVoice(flag=0, ip_address=ip_address, port=port)
|
||||||
|
sleep(0.05)
|
||||||
|
sendInputVoice(flag=1, ip_address=ip_address, port=port)
|
||||||
|
sleep(0.05)
|
||||||
|
sendInputVoice(flag=0, ip_address=ip_address, port=port)
|
||||||
|
sleep(0.05)
|
||||||
|
|
||||||
def receiveOscParameters(target, filter="/*", ip_address="127.0.0.1", port=9001):
|
def receiveOscParameters(target, filter="/*", ip_address="127.0.0.1", port=9001):
|
||||||
_dispatcher = dispatcher.Dispatcher()
|
_dispatcher = dispatcher.Dispatcher()
|
||||||
_dispatcher.map(filter, target)
|
_dispatcher.map(filter, target)
|
||||||
server = osc_server.ThreadingOSCUDPServer((ip_address, port), _dispatcher)
|
server = osc_server.ThreadingOSCUDPServer((ip_address, port), _dispatcher)
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sendChangeVoice()
|
||||||
|
sendChangeVoice()
|
||||||
Reference in New Issue
Block a user