👍️[Update] Controller : 文言を修正

ENERGYを削除
This commit is contained in:
misyaguziya
2024-09-25 16:13:23 +09:00
parent 53a3d8c3d6
commit 6367c43cce
6 changed files with 29 additions and 29 deletions

View File

@@ -103,8 +103,8 @@ class Config:
return self._MAX_MIC_THRESHOLD
@property
def MAX_SPEAKER_ENERGY_THRESHOLD(self):
return self._MAX_SPEAKER_ENERGY_THRESHOLD
def MAX_SPEAKER_THRESHOLD(self):
return self._MAX_SPEAKER_THRESHOLD
# Read Write
@property
@@ -585,14 +585,14 @@ class Config:
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property
@json_serializable('SPEAKER_ENERGY_THRESHOLD')
def SPEAKER_ENERGY_THRESHOLD(self):
return self._SPEAKER_ENERGY_THRESHOLD
@json_serializable('SPEAKER_THRESHOLD')
def SPEAKER_THRESHOLD(self):
return self._SPEAKER_THRESHOLD
@SPEAKER_ENERGY_THRESHOLD.setter
def SPEAKER_ENERGY_THRESHOLD(self, value):
@SPEAKER_THRESHOLD.setter
def SPEAKER_THRESHOLD(self, value):
if isinstance(value, int):
self._SPEAKER_ENERGY_THRESHOLD = value
self._SPEAKER_THRESHOLD = value
saveJson(self.PATH_CONFIG, inspect.currentframe().f_code.co_name, value)
@property
@@ -991,7 +991,7 @@ class Config:
}
self._MAX_MIC_THRESHOLD = 2000
self._MAX_SPEAKER_ENERGY_THRESHOLD = 4000
self._MAX_SPEAKER_THRESHOLD = 4000
# Read Write
self._ENABLE_TRANSLATION = False
@@ -1113,7 +1113,7 @@ class Config:
self._MIC_NO_SPEECH_PROB=0.6
self._AUTO_SPEAKER_SELECT = True
self._SELECTED_SPEAKER_DEVICE = device_manager.getDefaultSpeakerDevice()["device"]["name"]
self._SPEAKER_ENERGY_THRESHOLD = 300
self._SPEAKER_THRESHOLD = 300
self._SPEAKER_AUTOMATIC_THRESHOLD = False
self._SPEAKER_RECORD_TIMEOUT = 3
self._SPEAKER_PHRASE_TIMEOUT = 3

View File

@@ -622,7 +622,7 @@ class Model:
self.speaker_audio_recorder = SelectedSpeakerEnergyAndAudioRecorder(
device=speaker_device,
energy_threshold=config.SPEAKER_ENERGY_THRESHOLD,
energy_threshold=config.SPEAKER_THRESHOLD,
dynamic_energy_threshold=config.SPEAKER_AUTOMATIC_THRESHOLD,
record_timeout=record_timeout,
)

View File

@@ -338,12 +338,12 @@ class Controller:
return {"status":200, "result":config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT}
@staticmethod
def getMaxMicEnergyThreshold(*args, **kwargs) -> dict:
def getMaxMicThreshold(*args, **kwargs) -> dict:
return {"status":200, "result":config.MAX_MIC_THRESHOLD}
@staticmethod
def getMaxSpeakerEnergyThreshold(*args, **kwargs) -> dict:
return {"status":200, "result":config.MAX_SPEAKER_ENERGY_THRESHOLD}
def getMaxSpeakerThreshold(*args, **kwargs) -> dict:
return {"status":200, "result":config.MAX_SPEAKER_THRESHOLD}
@staticmethod
def setEnableTranslation(*args, **kwargs) -> dict:
@@ -806,22 +806,22 @@ class Controller:
return {"status":200, "result":config.SELECTED_SPEAKER_DEVICE}
@staticmethod
def getSpeakerEnergyThreshold(*args, **kwargs) -> dict:
return {"status":200, "result":config.SPEAKER_ENERGY_THRESHOLD}
def getSpeakerThreshold(*args, **kwargs) -> dict:
return {"status":200, "result":config.SPEAKER_THRESHOLD}
@staticmethod
def setSpeakerEnergyThreshold(data, *args, **kwargs) -> dict:
def setSpeakerThreshold(data, *args, **kwargs) -> dict:
printLog("Set Speaker Energy Threshold", data)
try:
data = int(data)
if 0 <= data <= config.MAX_SPEAKER_ENERGY_THRESHOLD:
config.SPEAKER_ENERGY_THRESHOLD = data
if 0 <= data <= config.MAX_SPEAKER_THRESHOLD:
config.SPEAKER_THRESHOLD = data
else:
raise ValueError()
except Exception:
response = {"status":400, "result":{"message":"Error Set Speaker Energy Threshold"}}
else:
response = {"status":200, "result":config.SPEAKER_ENERGY_THRESHOLD}
response = {"status":200, "result":config.SPEAKER_THRESHOLD}
return response
@staticmethod

View File

@@ -158,8 +158,8 @@ mapping = {
"/get/data/mic_device_list": {"status": True, "variable":controller.getMicDeviceList},
"/get/data/speaker_device_list": {"status": True, "variable":controller.getSpeakerDeviceList},
"/get/data/max_mic_energy_threshold": {"status": True, "variable":controller.getMaxMicEnergyThreshold},
"/get/data/max_speaker_energy_threshold": {"status": True, "variable":controller.getMaxSpeakerEnergyThreshold},
"/get/data/max_mic_threshold": {"status": True, "variable":controller.getMaxMicThreshold},
"/get/data/max_speaker_threshold": {"status": True, "variable":controller.getMaxSpeakerThreshold},
"/get/data/auto_mic_select": {"status": True, "variable":controller.getAutoMicSelect},
"/set/enable/auto_mic_select": {"status": True, "variable":controller.setEnableAutoMicSelect},
@@ -207,8 +207,8 @@ mapping = {
"/get/data/selected_speaker_device": {"status": True, "variable":controller.getSelectedSpeakerDevice},
"/set/data/selected_speaker_device": {"status": True, "variable":controller.setSelectedSpeakerDevice},
"/get/data/speaker_energy_threshold": {"status": True, "variable":controller.getSpeakerEnergyThreshold},
"/set/data/speaker_energy_threshold": {"status": True, "variable":controller.setSpeakerEnergyThreshold},
"/get/data/speaker_threshold": {"status": True, "variable":controller.getSpeakerThreshold},
"/set/data/speaker_threshold": {"status": True, "variable":controller.setSpeakerThreshold},
"/get/data/speaker_automatic_threshold": {"status": True, "variable":controller.getSpeakerAutomaticThreshold},
"/set/enable/speaker_automatic_threshold": {"status": True, "variable":controller.setEnableSpeakerAutomaticThreshold},
@@ -523,7 +523,7 @@ if __name__ == "__main__":
data = "test1"
case "/set/data/selected_speaker_device":
data = "スピーカー (Realtek High Definition Audio)"
case "/set/data/speaker_energy_threshold":
case "/set/data/speaker_threshold":
data = 0.5
case "/set/data/speaker_record_timeout":
data = 5