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:
|
||||
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
|
||||
def UPDATE_FLAG(self):
|
||||
return self._UPDATE_FLAG
|
||||
@@ -507,6 +516,7 @@ class Config:
|
||||
self._ENABLE_AUTO_CLEAR_MESSAGE_BOX = False
|
||||
self._ENABLE_NOTICE_XSOVERLAY = False
|
||||
self._ENABLE_OSC = False
|
||||
self._ENABLE_OSC_ERROR_LOG = True
|
||||
self._UPDATE_FLAG = False
|
||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||
# self._BREAK_KEYSYM_LIST = [
|
||||
|
||||
6
main.py
6
main.py
@@ -28,7 +28,8 @@ def sendMicMessage(message):
|
||||
osc_message = message
|
||||
model.oscSendMessage(osc_message)
|
||||
else:
|
||||
view.printToTextbox_OSCError()
|
||||
if config.ENABLE_OSC_ERROR_LOG is True:
|
||||
view.printToTextbox_OSCError()
|
||||
|
||||
view.printToTextbox_SentMessage(message, translation)
|
||||
if config.ENABLE_LOGGER is True:
|
||||
@@ -90,7 +91,8 @@ def sendChatMessage(message):
|
||||
osc_message = message
|
||||
model.oscSendMessage(osc_message)
|
||||
else:
|
||||
view.printToTextbox_OSCError()
|
||||
if config.ENABLE_OSC_ERROR_LOG is True:
|
||||
view.printToTextbox_OSCError()
|
||||
|
||||
# update textbox message log
|
||||
view.printToTextbox_SentMessage(message, translation)
|
||||
|
||||
32
model.py
32
model.py
@@ -215,17 +215,23 @@ class Model:
|
||||
|
||||
def startMicTranscript(self, fnc):
|
||||
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(
|
||||
[device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0],
|
||||
config.INPUT_MIC_ENERGY_THRESHOLD,
|
||||
config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
config.INPUT_MIC_RECORD_TIMEOUT,
|
||||
device=device,
|
||||
energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD,
|
||||
dynamic_energy_threshold=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||
record_timeout=record_timeout,
|
||||
)
|
||||
self.mic_audio_recorder.recordIntoQueue(mic_audio_queue)
|
||||
mic_transcriber = AudioTranscriber(
|
||||
speaker=False,
|
||||
source=self.mic_audio_recorder.source,
|
||||
phrase_timeout=config.INPUT_MIC_PHRASE_TIMEOUT,
|
||||
phrase_timeout=phase_timeout,
|
||||
max_phrases=config.INPUT_MIC_MAX_PHRASES,
|
||||
)
|
||||
def sendMicTranscript():
|
||||
@@ -274,17 +280,23 @@ class Model:
|
||||
def startSpeakerTranscript(self, fnc):
|
||||
spk_audio_queue = Queue()
|
||||
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(
|
||||
spk_device,
|
||||
config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
||||
config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
config.INPUT_SPEAKER_RECORD_TIMEOUT,
|
||||
device=spk_device,
|
||||
energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
||||
dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
record_timeout=record_timeout,
|
||||
)
|
||||
self.spk_audio_recorder.recordIntoQueue(spk_audio_queue)
|
||||
spk_transcriber = AudioTranscriber(
|
||||
speaker=True,
|
||||
source=self.spk_audio_recorder.source,
|
||||
phrase_timeout=config.INPUT_SPEAKER_PHRASE_TIMEOUT,
|
||||
phrase_timeout=phase_timeout,
|
||||
max_phrases=config.INPUT_SPEAKER_MAX_PHRASES,
|
||||
)
|
||||
def sendSpkTranscript():
|
||||
|
||||
@@ -30,8 +30,28 @@ def sendTestAction(ip_address="127.0.0.1", port=9000):
|
||||
sleep(0.01)
|
||||
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):
|
||||
_dispatcher = dispatcher.Dispatcher()
|
||||
_dispatcher.map(filter, target)
|
||||
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