🐛[bugfix] Model : スピーカーデバイスの取得タイミングを変更
config windowでのデバイス選択が不要になりました
This commit is contained in:
@@ -491,12 +491,12 @@ def callbackSetMicWordFilter(value):
|
|||||||
model.addKeywords()
|
model.addKeywords()
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
# Transcription Tab (Speaker)
|
||||||
def callbackSetSpeakerDevice(value):
|
# def callbackSetSpeakerDevice(value):
|
||||||
print("callbackSetSpeakerDevice", value)
|
# print("callbackSetSpeakerDevice", value)
|
||||||
config.CHOICE_SPEAKER_DEVICE = value
|
# config.CHOICE_SPEAKER_DEVICE = value
|
||||||
|
|
||||||
model.stopCheckSpeakerEnergy()
|
# model.stopCheckSpeakerEnergy()
|
||||||
view.replaceSpeakerThresholdCheckButton_Passive()
|
# view.replaceSpeakerThresholdCheckButton_Passive()
|
||||||
|
|
||||||
def callbackSetSpeakerEnergyThreshold(value):
|
def callbackSetSpeakerEnergyThreshold(value):
|
||||||
print("callbackSetSpeakerEnergyThreshold", value)
|
print("callbackSetSpeakerEnergyThreshold", value)
|
||||||
@@ -708,7 +708,7 @@ def createMainWindow():
|
|||||||
"callback_set_mic_word_filter": callbackSetMicWordFilter,
|
"callback_set_mic_word_filter": callbackSetMicWordFilter,
|
||||||
|
|
||||||
# Transcription Tab (Speaker)
|
# Transcription Tab (Speaker)
|
||||||
"callback_set_speaker_device": callbackSetSpeakerDevice,
|
# "callback_set_speaker_device": callbackSetSpeakerDevice,
|
||||||
"list_speaker_device": model.getListOutputDevice(),
|
"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,
|
||||||
|
|||||||
14
model.py
14
model.py
@@ -13,6 +13,7 @@ from requests import get as requests_get
|
|||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
from flashtext import KeywordProcessor
|
from flashtext import KeywordProcessor
|
||||||
|
import pyaudiowpatch
|
||||||
from models.translation.translation_translator import Translator
|
from models.translation.translation_translator import Translator
|
||||||
from models.transcription.transcription_utils import getInputDevices, getOutputDevices, getDefaultInputDevice, getDefaultOutputDevice
|
from models.transcription.transcription_utils import getInputDevices, getOutputDevices, getDefaultInputDevice, getDefaultOutputDevice
|
||||||
from models.osc.osc_tools import sendTyping, sendMessage, sendTestAction, receiveOscParameters
|
from models.osc.osc_tools import sendTyping, sendMessage, sendTestAction, receiveOscParameters
|
||||||
@@ -311,13 +312,6 @@ class Model:
|
|||||||
def getListOutputDevice():
|
def getListOutputDevice():
|
||||||
return [device["name"] for device in getOutputDevices()]
|
return [device["name"] for device in getOutputDevices()]
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def checkSpeakerStatus(choice=config.CHOICE_SPEAKER_DEVICE):
|
|
||||||
speaker_device = [device for device in getOutputDevices() if device["name"] == choice][0]
|
|
||||||
if getDefaultOutputDevice()["index"] == speaker_device["index"]:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def startMicTranscript(self, fnc):
|
def startMicTranscript(self, fnc):
|
||||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
@@ -392,10 +386,11 @@ class Model:
|
|||||||
self.mic_energy_recorder = None
|
self.mic_energy_recorder = None
|
||||||
|
|
||||||
def startSpeakerTranscript(self, fnc):
|
def startSpeakerTranscript(self, fnc):
|
||||||
|
speaker_device = getDefaultOutputDevice()
|
||||||
|
config.CHOICE_SPEAKER_DEVICE = speaker_device["name"]
|
||||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
speaker_audio_queue = Queue()
|
speaker_audio_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
|
||||||
@@ -436,6 +431,8 @@ class Model:
|
|||||||
self.speaker_audio_recorder = None
|
self.speaker_audio_recorder = None
|
||||||
|
|
||||||
def startCheckSpeakerEnergy(self, fnc, end_fnc):
|
def startCheckSpeakerEnergy(self, fnc, end_fnc):
|
||||||
|
speaker_device = getDefaultOutputDevice()
|
||||||
|
config.CHOICE_SPEAKER_DEVICE = speaker_device["name"]
|
||||||
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -448,7 +445,6 @@ class Model:
|
|||||||
pass
|
pass
|
||||||
# sleep(0.01)
|
# sleep(0.01)
|
||||||
|
|
||||||
speaker_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
|
||||||
speaker_energy_queue = Queue()
|
speaker_energy_queue = Queue()
|
||||||
self.speaker_energy_recorder = SelectedSpeakeEnergyRecorder(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)
|
||||||
|
|||||||
Reference in New Issue
Block a user