mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-01-19 18:41:52 +00:00
Add device reload button (#778)
This commit is contained in:
19
gui_v1.py
19
gui_v1.py
@@ -77,6 +77,8 @@ if __name__ == "__main__":
|
||||
self.index_rate = 0.3
|
||||
self.n_cpu = min(n_cpu, 8)
|
||||
self.f0method = "harvest"
|
||||
self.sg_input_device = ""
|
||||
self.sg_output_device = ""
|
||||
|
||||
class GUI:
|
||||
def __init__(self) -> None:
|
||||
@@ -164,6 +166,7 @@ if __name__ == "__main__":
|
||||
default_value=data.get("sg_output_device", ""),
|
||||
),
|
||||
],
|
||||
[sg.Button(i18n("重载设备列表"), key="reload_devices")],
|
||||
],
|
||||
title=i18n("音频设备(请使用同种类驱动)"),
|
||||
)
|
||||
@@ -299,6 +302,22 @@ if __name__ == "__main__":
|
||||
if event == sg.WINDOW_CLOSED:
|
||||
self.flag_vc = False
|
||||
exit()
|
||||
if event == 'reload_devices':
|
||||
prev_input = self.window['sg_input_device'].get()
|
||||
prev_output = self.window['sg_output_device'].get()
|
||||
input_devices, output_devices, _, _ = self.get_devices(update=True)
|
||||
if prev_input not in input_devices:
|
||||
self.config.sg_input_device = input_devices[0]
|
||||
else:
|
||||
self.config.sg_input_device = prev_input
|
||||
self.window['sg_input_device'].Update(values=input_devices)
|
||||
self.window['sg_input_device'].Update(value=self.config.sg_input_device)
|
||||
if prev_output not in output_devices:
|
||||
self.config.sg_output_device = output_devices[0]
|
||||
else:
|
||||
self.config.sg_output_device = prev_output
|
||||
self.window['sg_output_device'].Update(values=output_devices)
|
||||
self.window['sg_output_device'].Update(value=self.config.sg_output_device)
|
||||
if event == "start_vc" and self.flag_vc == False:
|
||||
if self.set_values(values) == True:
|
||||
print("using_cuda:" + str(torch.cuda.is_available()))
|
||||
|
||||
Reference in New Issue
Block a user