Merge branch 'model' into UI_2.0
This commit is contained in:
16
config.py
16
config.py
@@ -7,7 +7,7 @@ import tkinter as tk
|
||||
from tkinter import font
|
||||
from languages import selectable_languages
|
||||
from models.translation.translation_languages import translatorEngine
|
||||
from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice, getDefaultOutputDevice
|
||||
from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice
|
||||
|
||||
json_serializable_vars = {}
|
||||
def json_serializable(var_name):
|
||||
@@ -337,17 +337,6 @@ class Config:
|
||||
self._INPUT_MIC_WORD_FILTER = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('CHOICE_SPEAKER_DEVICE')
|
||||
def CHOICE_SPEAKER_DEVICE(self):
|
||||
return self._CHOICE_SPEAKER_DEVICE
|
||||
|
||||
@CHOICE_SPEAKER_DEVICE.setter
|
||||
def CHOICE_SPEAKER_DEVICE(self, value):
|
||||
if getDefaultOutputDevice()["name"] == value:
|
||||
self._CHOICE_SPEAKER_DEVICE = value
|
||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('INPUT_SPEAKER_ENERGY_THRESHOLD')
|
||||
def INPUT_SPEAKER_ENERGY_THRESHOLD(self):
|
||||
@@ -505,7 +494,7 @@ class Config:
|
||||
|
||||
def init_config(self):
|
||||
# Read Only
|
||||
self._VERSION = "2.0.0 alpha 4"
|
||||
self._VERSION = "2.0.0 alpha 4.1"
|
||||
self._PATH_CONFIG = os_path.join(os_path.dirname(sys.argv[0]), "config.json")
|
||||
self._GITHUB_URL = "https://api.github.com/repos/misyaguziya/VRCT/releases/latest"
|
||||
self._BOOTH_URL = "https://misyaguziya.booth.pm/"
|
||||
@@ -553,7 +542,6 @@ class Config:
|
||||
self._INPUT_MIC_PHRASE_TIMEOUT = 3
|
||||
self._INPUT_MIC_MAX_PHRASES = 10
|
||||
self._INPUT_MIC_WORD_FILTER = []
|
||||
self._CHOICE_SPEAKER_DEVICE = getDefaultOutputDevice()["name"]
|
||||
self._INPUT_SPEAKER_ENERGY_THRESHOLD = 300
|
||||
self._INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = False
|
||||
self._INPUT_SPEAKER_RECORD_TIMEOUT = 3
|
||||
|
||||
@@ -108,7 +108,6 @@ def receiveSpeakerMessage(message):
|
||||
model.logger.info(f"[RECEIVED] {message}{translation}")
|
||||
|
||||
def startTranscriptionReceiveMessage():
|
||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
||||
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
||||
view.setMainWindowAllWidgetsStatusToNormal()
|
||||
|
||||
@@ -129,7 +128,6 @@ def stopThreadingTranscriptionReceiveMessage():
|
||||
th_stopTranscriptionReceiveMessage.start()
|
||||
|
||||
def startTranscriptionReceiveMessageOnCloseConfigWindow():
|
||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
||||
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
||||
|
||||
|
||||
@@ -474,14 +472,6 @@ def callbackSetMicWordFilter(value):
|
||||
model.resetKeywordProcessor()
|
||||
model.addKeywords()
|
||||
|
||||
# Transcription Tab (Speaker)
|
||||
# def callbackSetSpeakerDevice(value):
|
||||
# print("callbackSetSpeakerDevice", value)
|
||||
# config.CHOICE_SPEAKER_DEVICE = value
|
||||
|
||||
# model.stopCheckSpeakerEnergy()
|
||||
# view.replaceSpeakerThresholdCheckButton_Passive()
|
||||
|
||||
def callbackSetSpeakerEnergyThreshold(value):
|
||||
print("callbackSetSpeakerEnergyThreshold", value)
|
||||
if value == "": return
|
||||
@@ -512,7 +502,6 @@ def callbackCheckSpeakerThreshold(is_turned_on):
|
||||
print("callbackCheckSpeakerThreshold", is_turned_on)
|
||||
if is_turned_on is True:
|
||||
view.replaceSpeakerThresholdCheckButton_Disabled()
|
||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
||||
model.startCheckSpeakerEnergy(
|
||||
setProgressBarSpeakerEnergy,
|
||||
view.initProgressBar_SpeakerEnergy,
|
||||
|
||||
10
model.py
10
model.py
@@ -344,7 +344,8 @@ class Model:
|
||||
self.mic_energy_recorder = None
|
||||
|
||||
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||
speaker_device = getDefaultOutputDevice()
|
||||
if speaker_device["name"] == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
@@ -358,7 +359,7 @@ class Model:
|
||||
record_timeout = phase_timeout
|
||||
|
||||
self.speaker_audio_recorder = SelectedSpeakerRecorder(
|
||||
device=config.CHOICE_SPEAKER_DEVICE ,
|
||||
device=speaker_device,
|
||||
energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
||||
dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||
record_timeout=record_timeout,
|
||||
@@ -391,7 +392,8 @@ class Model:
|
||||
self.speaker_audio_recorder = None
|
||||
|
||||
def startCheckSpeakerEnergy(self, fnc, end_fnc, error_fnc=None):
|
||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||
speaker_device = getDefaultOutputDevice()
|
||||
if speaker_device["name"] == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
@@ -408,7 +410,7 @@ class Model:
|
||||
# sleep(0.01)
|
||||
|
||||
speaker_energy_queue = Queue()
|
||||
self.speaker_energy_recorder = SelectedSpeakeEnergyRecorder(config.CHOICE_SPEAKER_DEVICE)
|
||||
self.speaker_energy_recorder = SelectedSpeakeEnergyRecorder(speaker_device)
|
||||
self.speaker_energy_recorder.recordIntoQueue(speaker_energy_queue)
|
||||
self.speaker_energy_plot_progressbar = threadFnc(sendSpeakerEnergy, end_fnc=end_fnc)
|
||||
self.speaker_energy_plot_progressbar.daemon = True
|
||||
|
||||
Reference in New Issue
Block a user