Merge branch 'bugfix_NoDevice' into UI_2.0
This commit is contained in:
8
model.py
8
model.py
@@ -280,7 +280,7 @@ class Model:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def startMicTranscript(self, fnc):
|
def startMicTranscript(self, fnc):
|
||||||
if config.CHOICE_MIC_HOST == "None" or config.CHOICE_MIC_DEVICE == "None":
|
if config.CHOICE_MIC_HOST == "NoDevice" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
|
|
||||||
mic_audio_queue = Queue()
|
mic_audio_queue = Queue()
|
||||||
@@ -324,7 +324,7 @@ class Model:
|
|||||||
self.mic_audio_recorder = None
|
self.mic_audio_recorder = None
|
||||||
|
|
||||||
def startCheckMicEnergy(self, fnc):
|
def startCheckMicEnergy(self, fnc):
|
||||||
if config.CHOICE_MIC_HOST == "None" or config.CHOICE_MIC_DEVICE == "None":
|
if config.CHOICE_MIC_HOST == "NoDevice" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
|
|
||||||
def sendMicEnergy():
|
def sendMicEnergy():
|
||||||
@@ -353,7 +353,7 @@ class Model:
|
|||||||
self.mic_energy_recorder = None
|
self.mic_energy_recorder = None
|
||||||
|
|
||||||
def startSpeakerTranscript(self, fnc):
|
def startSpeakerTranscript(self, fnc):
|
||||||
if config.CHOICE_SPEAKER_DEVICE == "None":
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
spk_audio_queue = Queue()
|
spk_audio_queue = Queue()
|
||||||
spk_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
spk_device = [device for device in getOutputDevices() if device["name"] == config.CHOICE_SPEAKER_DEVICE][0]
|
||||||
@@ -397,7 +397,7 @@ class Model:
|
|||||||
self.spk_audio_recorder = None
|
self.spk_audio_recorder = None
|
||||||
|
|
||||||
def startCheckSpeakerEnergy(self, fnc):
|
def startCheckSpeakerEnergy(self, fnc):
|
||||||
if config.CHOICE_SPEAKER_DEVICE == "None":
|
if config.CHOICE_SPEAKER_DEVICE == "NoDevice":
|
||||||
return
|
return
|
||||||
|
|
||||||
def sendSpeakerEnergy():
|
def sendSpeakerEnergy():
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def getInputDevices():
|
|||||||
else:
|
else:
|
||||||
devices[host["name"]] = [device]
|
devices[host["name"]] = [device]
|
||||||
if len(devices) == 0:
|
if len(devices) == 0:
|
||||||
devices = {"None": [{"name": "None"}]}
|
devices = {"NoHost": [{"name": "NoDevice"}]}
|
||||||
return devices
|
return devices
|
||||||
|
|
||||||
def getOutputDevices():
|
def getOutputDevices():
|
||||||
@@ -24,7 +24,7 @@ def getOutputDevices():
|
|||||||
if device["hostApi"] == wasapi_info["index"] and device["isLoopbackDevice"] is True:
|
if device["hostApi"] == wasapi_info["index"] and device["isLoopbackDevice"] is True:
|
||||||
devices.append(device)
|
devices.append(device)
|
||||||
if len(devices) == 0:
|
if len(devices) == 0:
|
||||||
devices = [{'name':"None"}]
|
devices = [{'name':"NoDevice"}]
|
||||||
return devices
|
return devices
|
||||||
|
|
||||||
def getDefaultInputDevice():
|
def getDefaultInputDevice():
|
||||||
@@ -38,7 +38,7 @@ def getDefaultInputDevice():
|
|||||||
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": "None"}, "device": {"name": "None"}}
|
return {"host": {"name": "NoHost"}, "device": {"name": "NoDevice"}}
|
||||||
|
|
||||||
def getDefaultOutputDevice():
|
def getDefaultOutputDevice():
|
||||||
with PyAudio() as p:
|
with PyAudio() as p:
|
||||||
@@ -55,4 +55,4 @@ def getDefaultOutputDevice():
|
|||||||
if default_speakers["name"] in loopback["name"]:
|
if default_speakers["name"] in loopback["name"]:
|
||||||
default_device = loopback
|
default_device = loopback
|
||||||
return default_device
|
return default_device
|
||||||
return {"name":"None"}
|
return {"name":"NoDevice"}
|
||||||
Reference in New Issue
Block a user