Merge branch 'speakerDevice' into develop
This commit is contained in:
14
config.py
14
config.py
@@ -6,7 +6,7 @@ from json import dump as json_dump
|
|||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import font
|
from tkinter import font
|
||||||
from models.translation.translation_languages import translation_lang
|
from models.translation.translation_languages import translation_lang
|
||||||
from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice
|
from models.transcription.transcription_utils import getInputDevices, getDefaultInputDevice, getOutputDevices, getDefaultOutputDevice
|
||||||
from models.transcription.transcription_languages import transcription_lang
|
from models.transcription.transcription_languages import transcription_lang
|
||||||
from utils import generatePercentageStringsList, isUniqueStrings
|
from utils import generatePercentageStringsList, isUniqueStrings
|
||||||
|
|
||||||
@@ -537,6 +537,17 @@ class Config:
|
|||||||
self._INPUT_MIC_WORD_FILTER = sorted(set(value), key=value.index)
|
self._INPUT_MIC_WORD_FILTER = sorted(set(value), key=value.index)
|
||||||
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 value in [device["name"] for device in getOutputDevices()]:
|
||||||
|
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):
|
||||||
@@ -957,6 +968,7 @@ 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()["device"]["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
|
||||||
|
|||||||
@@ -704,6 +704,13 @@ def callbackDeleteMicWordFilter(value):
|
|||||||
print("There was no the target word in config.INPUT_MIC_WORD_FILTER")
|
print("There was no the target word in config.INPUT_MIC_WORD_FILTER")
|
||||||
|
|
||||||
# Transcription (Speaker)
|
# Transcription (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 == "":
|
if value == "":
|
||||||
@@ -1046,6 +1053,8 @@ def createMainWindow(splash):
|
|||||||
"callback_delete_mic_word_filter": callbackDeleteMicWordFilter,
|
"callback_delete_mic_word_filter": callbackDeleteMicWordFilter,
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
# Transcription Tab (Speaker)
|
||||||
|
"callback_set_speaker_device": callbackSetSpeakerDevice,
|
||||||
|
"list_speaker_device": model.getListOutputDevice(),
|
||||||
"callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold,
|
"callback_set_speaker_energy_threshold": callbackSetSpeakerEnergyThreshold,
|
||||||
"callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold,
|
"callback_set_speaker_dynamic_energy_threshold": callbackSetSpeakerDynamicEnergyThreshold,
|
||||||
"callback_check_speaker_threshold": callbackCheckSpeakerThreshold,
|
"callback_check_speaker_threshold": callbackCheckSpeakerThreshold,
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ config_window:
|
|||||||
count_desc: "Current registered word count: %{count}"
|
count_desc: "Current registered word count: %{count}"
|
||||||
|
|
||||||
|
|
||||||
|
speaker_device:
|
||||||
|
label: Speaker Device
|
||||||
|
|
||||||
speaker_dynamic_energy_threshold:
|
speaker_dynamic_energy_threshold:
|
||||||
label_for_automatic: "Speaker Energy Threshold (Current Setting: Automatic)"
|
label_for_automatic: "Speaker Energy Threshold (Current Setting: Automatic)"
|
||||||
desc_for_automatic: "Automatically determine speaker input sensitivity."
|
desc_for_automatic: "Automatically determine speaker input sensitivity."
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ config_window:
|
|||||||
count_desc: "現在登録されている単語数: %{count}"
|
count_desc: "現在登録されている単語数: %{count}"
|
||||||
|
|
||||||
|
|
||||||
|
speaker_device:
|
||||||
|
label: スピーカー (デバイス)
|
||||||
|
|
||||||
speaker_dynamic_energy_threshold:
|
speaker_dynamic_energy_threshold:
|
||||||
label_for_automatic: "スピーカー入力感度の調整 (現在の設定: 自動)"
|
label_for_automatic: "スピーカー入力感度の調整 (現在の設定: 自動)"
|
||||||
desc_for_automatic: スピーカーの入力感度を自動的に調節する。
|
desc_for_automatic: スピーカーの入力感度を自動的に調節する。
|
||||||
|
|||||||
34
model.py
34
model.py
@@ -16,7 +16,7 @@ import webbrowser
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
from flashtext import KeywordProcessor
|
from flashtext import KeywordProcessor
|
||||||
from models.translation.translation_translator import Translator
|
from models.translation.translation_translator import Translator
|
||||||
from models.transcription.transcription_utils import getInputDevices, getDefaultOutputDevice
|
from models.transcription.transcription_utils import getInputDevices, getOutputDevices
|
||||||
from models.osc.osc_tools import sendTyping, sendMessage, sendTestAction, receiveOscParameters
|
from models.osc.osc_tools import sendTyping, sendMessage, sendTestAction, receiveOscParameters
|
||||||
from models.transcription.transcription_recorder import SelectedMicEnergyAndAudioRecorder, SelectedSpeakerEnergyAndAudioRecorder
|
from models.transcription.transcription_recorder import SelectedMicEnergyAndAudioRecorder, SelectedSpeakerEnergyAndAudioRecorder
|
||||||
from models.transcription.transcription_recorder import SelectedMicEnergyRecorder, SelectedSpeakerEnergyRecorder
|
from models.transcription.transcription_recorder import SelectedMicEnergyRecorder, SelectedSpeakerEnergyRecorder
|
||||||
@@ -305,12 +305,8 @@ class Model:
|
|||||||
return [device["name"] for device in getInputDevices()[config.CHOICE_MIC_HOST]]
|
return [device["name"] for device in getInputDevices()[config.CHOICE_MIC_HOST]]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getInputDefaultDevice():
|
def getListOutputDevice():
|
||||||
return [device["name"] for device in getInputDevices()[config.CHOICE_MIC_HOST]][0]
|
return [device["name"] for device in getOutputDevices()]
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def getOutputDefaultDevice():
|
|
||||||
return getDefaultOutputDevice()["name"]
|
|
||||||
|
|
||||||
def startMicTranscript(self, fnc, error_fnc=None):
|
def startMicTranscript(self, fnc, error_fnc=None):
|
||||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||||
@@ -322,14 +318,14 @@ class Model:
|
|||||||
|
|
||||||
mic_audio_queue = Queue()
|
mic_audio_queue = Queue()
|
||||||
# mic_energy_queue = Queue()
|
# mic_energy_queue = Queue()
|
||||||
device = [device for device in getInputDevices()[config.CHOICE_MIC_HOST] if device["name"] == config.CHOICE_MIC_DEVICE][0]
|
mic_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
|
record_timeout = config.INPUT_MIC_RECORD_TIMEOUT
|
||||||
phase_timeout = config.INPUT_MIC_PHRASE_TIMEOUT
|
phase_timeout = config.INPUT_MIC_PHRASE_TIMEOUT
|
||||||
if record_timeout > phase_timeout:
|
if record_timeout > phase_timeout:
|
||||||
record_timeout = phase_timeout
|
record_timeout = phase_timeout
|
||||||
|
|
||||||
self.mic_audio_recorder = SelectedMicEnergyAndAudioRecorder(
|
self.mic_audio_recorder = SelectedMicEnergyAndAudioRecorder(
|
||||||
device=device,
|
device=mic_device,
|
||||||
energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD,
|
energy_threshold=config.INPUT_MIC_ENERGY_THRESHOLD,
|
||||||
dynamic_energy_threshold=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
dynamic_energy_threshold=config.INPUT_MIC_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
record_timeout=record_timeout,
|
record_timeout=record_timeout,
|
||||||
@@ -346,9 +342,9 @@ class Model:
|
|||||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||||
)
|
)
|
||||||
def sendMicTranscript():
|
def sendMicTranscript():
|
||||||
|
try:
|
||||||
self.mic_transcriber.transcribeAudioQueue(mic_audio_queue, config.SOURCE_LANGUAGE, config.SOURCE_COUNTRY)
|
self.mic_transcriber.transcribeAudioQueue(mic_audio_queue, config.SOURCE_LANGUAGE, config.SOURCE_COUNTRY)
|
||||||
message = self.mic_transcriber.getTranscript()
|
message = self.mic_transcriber.getTranscript()
|
||||||
try:
|
|
||||||
fnc(message)
|
fnc(message)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@@ -382,7 +378,7 @@ class Model:
|
|||||||
self.mic_print_transcript.stop()
|
self.mic_print_transcript.stop()
|
||||||
self.mic_print_transcript = None
|
self.mic_print_transcript = None
|
||||||
if isinstance(self.mic_audio_recorder, SelectedMicEnergyAndAudioRecorder):
|
if isinstance(self.mic_audio_recorder, SelectedMicEnergyAndAudioRecorder):
|
||||||
self.mic_audio_recorder.stop()
|
self.mic_audio_recorder.stop(wait_for_stop=False)
|
||||||
self.mic_audio_recorder = None
|
self.mic_audio_recorder = None
|
||||||
# if isinstance(self.mic_get_energy, threadFnc):
|
# if isinstance(self.mic_get_energy, threadFnc):
|
||||||
# self.mic_get_energy.stop()
|
# self.mic_get_energy.stop()
|
||||||
@@ -418,12 +414,11 @@ class Model:
|
|||||||
self.mic_energy_plot_progressbar.stop()
|
self.mic_energy_plot_progressbar.stop()
|
||||||
self.mic_energy_plot_progressbar = None
|
self.mic_energy_plot_progressbar = None
|
||||||
if isinstance(self.mic_energy_recorder, SelectedMicEnergyRecorder):
|
if isinstance(self.mic_energy_recorder, SelectedMicEnergyRecorder):
|
||||||
self.mic_energy_recorder.stop()
|
self.mic_energy_recorder.stop(wait_for_stop=False)
|
||||||
self.mic_energy_recorder = None
|
self.mic_energy_recorder = None
|
||||||
|
|
||||||
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
def startSpeakerTranscript(self, fnc, error_fnc=None):
|
||||||
speaker_device = getDefaultOutputDevice()
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
if speaker_device["name"] == "NoDevice":
|
|
||||||
try:
|
try:
|
||||||
error_fnc()
|
error_fnc()
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -432,6 +427,7 @@ class Model:
|
|||||||
|
|
||||||
speaker_audio_queue = Queue()
|
speaker_audio_queue = Queue()
|
||||||
# speaker_energy_queue = Queue()
|
# speaker_energy_queue = Queue()
|
||||||
|
speaker_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
||||||
record_timeout = config.INPUT_SPEAKER_RECORD_TIMEOUT
|
record_timeout = config.INPUT_SPEAKER_RECORD_TIMEOUT
|
||||||
phase_timeout = config.INPUT_SPEAKER_PHRASE_TIMEOUT
|
phase_timeout = config.INPUT_SPEAKER_PHRASE_TIMEOUT
|
||||||
if record_timeout > phase_timeout:
|
if record_timeout > phase_timeout:
|
||||||
@@ -455,9 +451,9 @@ class Model:
|
|||||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||||
)
|
)
|
||||||
def sendSpeakerTranscript():
|
def sendSpeakerTranscript():
|
||||||
|
try:
|
||||||
self.speaker_transcriber.transcribeAudioQueue(speaker_audio_queue, config.TARGET_LANGUAGE, config.TARGET_COUNTRY)
|
self.speaker_transcriber.transcribeAudioQueue(speaker_audio_queue, config.TARGET_LANGUAGE, config.TARGET_COUNTRY)
|
||||||
message = self.speaker_transcriber.getTranscript()
|
message = self.speaker_transcriber.getTranscript()
|
||||||
try:
|
|
||||||
fnc(message)
|
fnc(message)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@@ -491,15 +487,14 @@ class Model:
|
|||||||
self.speaker_print_transcript.stop()
|
self.speaker_print_transcript.stop()
|
||||||
self.speaker_print_transcript = None
|
self.speaker_print_transcript = None
|
||||||
if isinstance(self.speaker_audio_recorder, SelectedSpeakerEnergyAndAudioRecorder):
|
if isinstance(self.speaker_audio_recorder, SelectedSpeakerEnergyAndAudioRecorder):
|
||||||
self.speaker_audio_recorder.stop()
|
self.speaker_audio_recorder.stop(wait_for_stop=False)
|
||||||
self.speaker_audio_recorder = None
|
self.speaker_audio_recorder = None
|
||||||
# if isinstance(self.speaker_get_energy, threadFnc):
|
# if isinstance(self.speaker_get_energy, threadFnc):
|
||||||
# self.speaker_get_energy.stop()
|
# self.speaker_get_energy.stop()
|
||||||
# self.speaker_get_energy = None
|
# self.speaker_get_energy = None
|
||||||
|
|
||||||
def startCheckSpeakerEnergy(self, fnc, end_fnc, error_fnc=None):
|
def startCheckSpeakerEnergy(self, fnc, end_fnc, error_fnc=None):
|
||||||
speaker_device = getDefaultOutputDevice()
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
if speaker_device["name"] == "NoDevice":
|
|
||||||
try:
|
try:
|
||||||
error_fnc()
|
error_fnc()
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -516,6 +511,7 @@ class Model:
|
|||||||
sleep(0.01)
|
sleep(0.01)
|
||||||
|
|
||||||
speaker_energy_queue = Queue()
|
speaker_energy_queue = Queue()
|
||||||
|
speaker_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
||||||
self.speaker_energy_recorder = SelectedSpeakerEnergyRecorder(speaker_device)
|
self.speaker_energy_recorder = SelectedSpeakerEnergyRecorder(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)
|
||||||
@@ -527,7 +523,7 @@ class Model:
|
|||||||
self.speaker_energy_plot_progressbar.stop()
|
self.speaker_energy_plot_progressbar.stop()
|
||||||
self.speaker_energy_plot_progressbar = None
|
self.speaker_energy_plot_progressbar = None
|
||||||
if isinstance(self.speaker_energy_recorder, SelectedSpeakerEnergyRecorder):
|
if isinstance(self.speaker_energy_recorder, SelectedSpeakerEnergyRecorder):
|
||||||
self.speaker_energy_recorder.stop()
|
self.speaker_energy_recorder.stop(wait_for_stop=False)
|
||||||
self.speaker_energy_recorder = None
|
self.speaker_energy_recorder = None
|
||||||
|
|
||||||
def notificationXSOverlay(self, message):
|
def notificationXSOverlay(self, message):
|
||||||
|
|||||||
@@ -23,12 +23,32 @@ def getDefaultInputDevice():
|
|||||||
|
|
||||||
for host_index in range(0, p.get_host_api_count()):
|
for host_index in range(0, p.get_host_api_count()):
|
||||||
host = p.get_host_api_info_by_index(host_index)
|
host = p.get_host_api_info_by_index(host_index)
|
||||||
for device_index in range(0, p. get_host_api_info_by_index(host_index)['deviceCount']):
|
for device_index in range(0, p.get_host_api_info_by_index(host_index)['deviceCount']):
|
||||||
device = p.get_device_info_by_host_api_device_index(host_index, device_index)
|
device = p.get_device_info_by_host_api_device_index(host_index, device_index)
|
||||||
if device["index"] == defaultInputDevice:
|
if device["index"] == defaultInputDevice:
|
||||||
return {"host": host, "device": device}
|
return {"host": host, "device": device}
|
||||||
return {"host": {"name": "NoHost"}, "device": {"name": "NoDevice"}}
|
return {"host": {"name": "NoHost"}, "device": {"name": "NoDevice"}}
|
||||||
|
|
||||||
|
def getOutputDevices():
|
||||||
|
devices = []
|
||||||
|
with PyAudio() as p:
|
||||||
|
wasapi_info = p.get_host_api_info_by_type(paWASAPI)
|
||||||
|
for host_index in range(0, p.get_host_api_count()):
|
||||||
|
host = p.get_host_api_info_by_index(host_index)
|
||||||
|
if host["name"] == wasapi_info["name"]:
|
||||||
|
for device_index in range(0, p.get_host_api_info_by_index(host_index)['deviceCount']):
|
||||||
|
device = p.get_device_info_by_host_api_device_index(host_index, device_index)
|
||||||
|
if not device["isLoopbackDevice"]:
|
||||||
|
for loopback in p.get_loopback_device_info_generator():
|
||||||
|
if device["name"] in loopback["name"]:
|
||||||
|
devices.append(loopback)
|
||||||
|
|
||||||
|
if len(devices) == 0:
|
||||||
|
devices = [{"name": "NoDevice"}]
|
||||||
|
else:
|
||||||
|
devices = [dict(t) for t in {tuple(d.items()) for d in devices}]
|
||||||
|
return devices
|
||||||
|
|
||||||
def getDefaultOutputDevice():
|
def getDefaultOutputDevice():
|
||||||
with PyAudio() as p:
|
with PyAudio() as p:
|
||||||
wasapi_info = p.get_host_api_info_by_type(paWASAPI)
|
wasapi_info = p.get_host_api_info_by_type(paWASAPI)
|
||||||
@@ -42,6 +62,9 @@ def getDefaultOutputDevice():
|
|||||||
if not default_speakers["isLoopbackDevice"]:
|
if not default_speakers["isLoopbackDevice"]:
|
||||||
for loopback in p.get_loopback_device_info_generator():
|
for loopback in p.get_loopback_device_info_generator():
|
||||||
if default_speakers["name"] in loopback["name"]:
|
if default_speakers["name"] in loopback["name"]:
|
||||||
default_device = loopback
|
return {"device": loopback}
|
||||||
return default_device
|
return {"device": {"name": "NoDevice"}}
|
||||||
return {"name":"NoDevice"}
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print("getOutputDevices()", getOutputDevices())
|
||||||
|
print("getDefaultOutputDevice()", getDefaultOutputDevice())
|
||||||
30
view.py
30
view.py
@@ -363,6 +363,13 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
# Transcription Tab (Speaker)
|
||||||
|
VAR_LABEL_SPEAKER_DEVICE=StringVar(value=i18n.t("config_window.speaker_device.label")),
|
||||||
|
VAR_DESC_SPEAKER_DEVICE=None,
|
||||||
|
LIST_SPEAKER_DEVICE=[],
|
||||||
|
CALLBACK_SET_SPEAKER_DEVICE=None,
|
||||||
|
VAR_SPEAKER_DEVICE=StringVar(value=config.CHOICE_SPEAKER_DEVICE),
|
||||||
|
|
||||||
|
|
||||||
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
|
VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
|
||||||
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
|
VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=StringVar(value=""),
|
||||||
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
|
CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=None,
|
||||||
@@ -655,6 +662,9 @@ class View():
|
|||||||
self.view_variable.CALLBACK_DELETE_MIC_WORD_FILTER=config_window_registers.get("callback_delete_mic_word_filter", None)
|
self.view_variable.CALLBACK_DELETE_MIC_WORD_FILTER=config_window_registers.get("callback_delete_mic_word_filter", None)
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
# Transcription Tab (Speaker)
|
||||||
|
self.view_variable.CALLBACK_SET_SPEAKER_DEVICE = config_window_registers.get("callback_set_speaker_device", None)
|
||||||
|
config_window_registers.get("list_speaker_device", None) and self.updateList_SpeakerDevice(config_window_registers["list_speaker_device"])
|
||||||
|
|
||||||
self.view_variable.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD=config_window_registers.get("callback_set_speaker_energy_threshold", None)
|
self.view_variable.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD=config_window_registers.get("callback_set_speaker_energy_threshold", None)
|
||||||
self.view_variable.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=config_window_registers.get("callback_set_speaker_dynamic_energy_threshold", None)
|
self.view_variable.CALLBACK_SET_SPEAKER_DYNAMIC_ENERGY_THRESHOLD=config_window_registers.get("callback_set_speaker_dynamic_energy_threshold", None)
|
||||||
self.view_variable.CALLBACK_CHECK_SPEAKER_THRESHOLD=config_window_registers.get("callback_check_speaker_threshold", None)
|
self.view_variable.CALLBACK_CHECK_SPEAKER_THRESHOLD=config_window_registers.get("callback_check_speaker_threshold", None)
|
||||||
@@ -721,6 +731,16 @@ class View():
|
|||||||
)
|
)
|
||||||
self.replaceMicThresholdCheckButton_Disabled()
|
self.replaceMicThresholdCheckButton_Disabled()
|
||||||
|
|
||||||
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
|
self.view_variable.VAR_SPEAKER_DEVICE.set("No Speaker Device Detected")
|
||||||
|
vrct_gui._changeConfigWindowWidgetsStatus(
|
||||||
|
status="disabled",
|
||||||
|
target_names=[
|
||||||
|
"sb__optionmenu_speaker_device",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.replaceSpeakerThresholdCheckButton_Disabled()
|
||||||
|
|
||||||
if config.USE_WHISPER_FEATURE is True:
|
if config.USE_WHISPER_FEATURE is True:
|
||||||
self.openWhisperWeightTypeWidget()
|
self.openWhisperWeightTypeWidget()
|
||||||
else:
|
else:
|
||||||
@@ -1270,6 +1290,9 @@ class View():
|
|||||||
|
|
||||||
|
|
||||||
def initSpeakerThresholdCheckButton(self):
|
def initSpeakerThresholdCheckButton(self):
|
||||||
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
|
self.replaceSpeakerThresholdCheckButton_Disabled()
|
||||||
|
else:
|
||||||
self.replaceSpeakerThresholdCheckButton_Passive()
|
self.replaceSpeakerThresholdCheckButton_Passive()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -1328,6 +1351,13 @@ class View():
|
|||||||
vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold.set(0)
|
vrct_gui.config_window.sb__progressbar_x_slider__progressbar_mic_energy_threshold.set(0)
|
||||||
|
|
||||||
|
|
||||||
|
def updateList_SpeakerDevice(self, new_speaker_device_list:list):
|
||||||
|
self.view_variable.LIST_SPEAKER_DEVICE = new_speaker_device_list
|
||||||
|
vrct_gui.dropdown_menu_window.updateDropdownMenuValues(
|
||||||
|
dropdown_menu_widget_id="sb__optionmenu_speaker_device",
|
||||||
|
dropdown_menu_values=new_speaker_device_list,
|
||||||
|
)
|
||||||
|
|
||||||
def updateSetProgressBar_SpeakerEnergy(self, new_speaker_energy):
|
def updateSetProgressBar_SpeakerEnergy(self, new_speaker_energy):
|
||||||
self.updateProgressBar(
|
self.updateProgressBar(
|
||||||
target_progressbar_widget=vrct_gui.config_window.sb__progressbar_x_slider__progressbar_speaker_energy_threshold,
|
target_progressbar_widget=vrct_gui.config_window.sb__progressbar_x_slider__progressbar_speaker_energy_threshold,
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ def _changeConfigWindowWidgetsStatus(config_window, settings, view_variable, sta
|
|||||||
disableLabelsWidgets(target_widget)
|
disableLabelsWidgets(target_widget)
|
||||||
disableOptionmenuWidget(target_widget)
|
disableOptionmenuWidget(target_widget)
|
||||||
|
|
||||||
|
case "sb__optionmenu_speaker_device":
|
||||||
|
if status == "disabled":
|
||||||
|
target_widget = config_window.sb__widgets["sb__optionmenu_speaker_device"]
|
||||||
|
disableLabelsWidgets(target_widget)
|
||||||
|
disableOptionmenuWidget(target_widget)
|
||||||
|
|
||||||
case "sb__optionmenu_appearance_theme":
|
case "sb__optionmenu_appearance_theme":
|
||||||
if status == "disabled":
|
if status == "disabled":
|
||||||
target_widget = config_window.sb__widgets["sb__optionmenu_appearance_theme"]
|
target_widget = config_window.sb__widgets["sb__optionmenu_appearance_theme"]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from .._SettingBoxGenerator import _SettingBoxGenerator
|
|||||||
|
|
||||||
def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_variable):
|
def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_variable):
|
||||||
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
sbg = _SettingBoxGenerator(setting_box_wrapper, config_window, settings, view_variable)
|
||||||
|
createSettingBoxDropdownMenu = sbg.createSettingBoxDropdownMenu
|
||||||
createSettingBoxSwitch = sbg.createSettingBoxSwitch
|
createSettingBoxSwitch = sbg.createSettingBoxSwitch
|
||||||
createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider
|
createSettingBoxProgressbarXSlider = sbg.createSettingBoxProgressbarXSlider
|
||||||
createSettingBoxEntry = sbg.createSettingBoxEntry
|
createSettingBoxEntry = sbg.createSettingBoxEntry
|
||||||
@@ -13,6 +14,9 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_
|
|||||||
callFunctionIfCallable(view_variable.CALLBACK_CHECK_SPEAKER_THRESHOLD, is_turned_on)
|
callFunctionIfCallable(view_variable.CALLBACK_CHECK_SPEAKER_THRESHOLD, is_turned_on)
|
||||||
|
|
||||||
|
|
||||||
|
def optionmenuInputSpeakerDeviceCallback(value):
|
||||||
|
callFunctionIfCallable(view_variable.CALLBACK_SET_SPEAKER_DEVICE, value)
|
||||||
|
|
||||||
def sliderInputSpeakerEnergyThresholdCallback(value):
|
def sliderInputSpeakerEnergyThresholdCallback(value):
|
||||||
callFunctionIfCallable(view_variable.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD, value)
|
callFunctionIfCallable(view_variable.CALLBACK_SET_SPEAKER_ENERGY_THRESHOLD, value)
|
||||||
|
|
||||||
@@ -32,6 +36,17 @@ def createSettingBox_Speaker(setting_box_wrapper, config_window, settings, view_
|
|||||||
|
|
||||||
|
|
||||||
row=0
|
row=0
|
||||||
|
config_window.sb__speaker_device = createSettingBoxDropdownMenu(
|
||||||
|
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DEVICE,
|
||||||
|
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DEVICE,
|
||||||
|
optionmenu_attr_name="sb__optionmenu_speaker_device",
|
||||||
|
dropdown_menu_values=view_variable.LIST_SPEAKER_DEVICE,
|
||||||
|
command=lambda value: optionmenuInputSpeakerDeviceCallback(value),
|
||||||
|
variable=view_variable.VAR_SPEAKER_DEVICE,
|
||||||
|
)
|
||||||
|
config_window.sb__speaker_device.grid(row=row)
|
||||||
|
row+=1
|
||||||
|
|
||||||
config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxSwitch(
|
config_window.sb__speaker_dynamic_energy_threshold = createSettingBoxSwitch(
|
||||||
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
for_var_label_text=view_variable.VAR_LABEL_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
for_var_desc_text=view_variable.VAR_DESC_SPEAKER_DYNAMIC_ENERGY_THRESHOLD,
|
||||||
|
|||||||
Reference in New Issue
Block a user