🐛[bugfix] Model : speaker_deviceの設定を間違えたので修正
This commit is contained in:
14
config.py
14
config.py
@@ -7,7 +7,7 @@ import tkinter as tk
|
|||||||
from tkinter import font
|
from tkinter import font
|
||||||
from languages import selectable_languages
|
from languages import selectable_languages
|
||||||
from models.translation.translation_languages import translatorEngine
|
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 = {}
|
json_serializable_vars = {}
|
||||||
def json_serializable(var_name):
|
def json_serializable(var_name):
|
||||||
@@ -337,17 +337,6 @@ class Config:
|
|||||||
self._INPUT_MIC_WORD_FILTER = value
|
self._INPUT_MIC_WORD_FILTER = value
|
||||||
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, 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
|
@property
|
||||||
@json_serializable('INPUT_SPEAKER_ENERGY_THRESHOLD')
|
@json_serializable('INPUT_SPEAKER_ENERGY_THRESHOLD')
|
||||||
def INPUT_SPEAKER_ENERGY_THRESHOLD(self):
|
def INPUT_SPEAKER_ENERGY_THRESHOLD(self):
|
||||||
@@ -553,7 +542,6 @@ class Config:
|
|||||||
self._INPUT_MIC_PHRASE_TIMEOUT = 3
|
self._INPUT_MIC_PHRASE_TIMEOUT = 3
|
||||||
self._INPUT_MIC_MAX_PHRASES = 10
|
self._INPUT_MIC_MAX_PHRASES = 10
|
||||||
self._INPUT_MIC_WORD_FILTER = []
|
self._INPUT_MIC_WORD_FILTER = []
|
||||||
self._CHOICE_SPEAKER_DEVICE = getDefaultOutputDevice()["name"]
|
|
||||||
self._INPUT_SPEAKER_ENERGY_THRESHOLD = 300
|
self._INPUT_SPEAKER_ENERGY_THRESHOLD = 300
|
||||||
self._INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = False
|
self._INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD = False
|
||||||
self._INPUT_SPEAKER_RECORD_TIMEOUT = 3
|
self._INPUT_SPEAKER_RECORD_TIMEOUT = 3
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ def receiveSpeakerMessage(message):
|
|||||||
model.logger.info(f"[RECEIVED] {message}{translation}")
|
model.logger.info(f"[RECEIVED] {message}{translation}")
|
||||||
|
|
||||||
def startTranscriptionReceiveMessage():
|
def startTranscriptionReceiveMessage():
|
||||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
|
||||||
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
||||||
view.setMainWindowAllWidgetsStatusToNormal()
|
view.setMainWindowAllWidgetsStatusToNormal()
|
||||||
|
|
||||||
@@ -129,7 +128,6 @@ def stopThreadingTranscriptionReceiveMessage():
|
|||||||
th_stopTranscriptionReceiveMessage.start()
|
th_stopTranscriptionReceiveMessage.start()
|
||||||
|
|
||||||
def startTranscriptionReceiveMessageOnCloseConfigWindow():
|
def startTranscriptionReceiveMessageOnCloseConfigWindow():
|
||||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
|
||||||
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
model.startSpeakerTranscript(receiveSpeakerMessage, view.printToTextbox_TranscriptionReceiveNoDeviceError)
|
||||||
|
|
||||||
|
|
||||||
@@ -474,14 +472,6 @@ def callbackSetMicWordFilter(value):
|
|||||||
model.resetKeywordProcessor()
|
model.resetKeywordProcessor()
|
||||||
model.addKeywords()
|
model.addKeywords()
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
|
||||||
# def callbackSetSpeakerDevice(value):
|
|
||||||
# print("callbackSetSpeakerDevice", value)
|
|
||||||
# config.CHOICE_SPEAKER_DEVICE = value
|
|
||||||
|
|
||||||
# model.stopCheckSpeakerEnergy()
|
|
||||||
# view.replaceSpeakerThresholdCheckButton_Passive()
|
|
||||||
|
|
||||||
def callbackSetSpeakerEnergyThreshold(value):
|
def callbackSetSpeakerEnergyThreshold(value):
|
||||||
print("callbackSetSpeakerEnergyThreshold", value)
|
print("callbackSetSpeakerEnergyThreshold", value)
|
||||||
if value == "": return
|
if value == "": return
|
||||||
@@ -512,7 +502,6 @@ def callbackCheckSpeakerThreshold(is_turned_on):
|
|||||||
print("callbackCheckSpeakerThreshold", is_turned_on)
|
print("callbackCheckSpeakerThreshold", is_turned_on)
|
||||||
if is_turned_on is True:
|
if is_turned_on is True:
|
||||||
view.replaceSpeakerThresholdCheckButton_Disabled()
|
view.replaceSpeakerThresholdCheckButton_Disabled()
|
||||||
config.CHOICE_SPEAKER_DEVICE = model.getOutputDefaultDevice()
|
|
||||||
model.startCheckSpeakerEnergy(
|
model.startCheckSpeakerEnergy(
|
||||||
setProgressBarSpeakerEnergy,
|
setProgressBarSpeakerEnergy,
|
||||||
view.initProgressBar_SpeakerEnergy,
|
view.initProgressBar_SpeakerEnergy,
|
||||||
|
|||||||
10
model.py
10
model.py
@@ -344,7 +344,8 @@ class Model:
|
|||||||
self.mic_energy_recorder = None
|
self.mic_energy_recorder = None
|
||||||
|
|
||||||
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
||||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
speaker_device = getDefaultOutputDevice()
|
||||||
|
if speaker_device["name"] == "NoDevice":
|
||||||
try:
|
try:
|
||||||
error_fnc()
|
error_fnc()
|
||||||
except:
|
except:
|
||||||
@@ -358,7 +359,7 @@ class Model:
|
|||||||
record_timeout = phase_timeout
|
record_timeout = phase_timeout
|
||||||
|
|
||||||
self.speaker_audio_recorder = SelectedSpeakerRecorder(
|
self.speaker_audio_recorder = SelectedSpeakerRecorder(
|
||||||
device=config.CHOICE_SPEAKER_DEVICE ,
|
device=speaker_device,
|
||||||
energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
energy_threshold=config.INPUT_SPEAKER_ENERGY_THRESHOLD,
|
||||||
dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
dynamic_energy_threshold=config.INPUT_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
record_timeout=record_timeout,
|
record_timeout=record_timeout,
|
||||||
@@ -391,7 +392,8 @@ class Model:
|
|||||||
self.speaker_audio_recorder = None
|
self.speaker_audio_recorder = None
|
||||||
|
|
||||||
def startCheckSpeakerEnergy(self, fnc, end_fnc, error_fnc=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:
|
try:
|
||||||
error_fnc()
|
error_fnc()
|
||||||
except:
|
except:
|
||||||
@@ -408,7 +410,7 @@ class Model:
|
|||||||
# sleep(0.01)
|
# sleep(0.01)
|
||||||
|
|
||||||
speaker_energy_queue = Queue()
|
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_recorder.recordIntoQueue(speaker_energy_queue)
|
||||||
self.speaker_energy_plot_progressbar = threadFnc(sendSpeakerEnergy, end_fnc=end_fnc)
|
self.speaker_energy_plot_progressbar = threadFnc(sendSpeakerEnergy, end_fnc=end_fnc)
|
||||||
self.speaker_energy_plot_progressbar.daemon = True
|
self.speaker_energy_plot_progressbar.daemon = True
|
||||||
|
|||||||
Reference in New Issue
Block a user