mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-12-04 15:52:21 -08:00
Added a delay options for OSC output.
Includes the option to enable OSC delay - potential use cases for users who use voicechangers or have delays in their audio stream.
This commit is contained in:
1 parent
3f38b63fde
commit
aeacf721f4
4 files changed
+57
-1
No files matched your search
@@ -9,6 +9,8 @@
|
||||
"general.addressTooltip": "IP address we send OSC data to",
|
||||
"general.port": "Port",
|
||||
"general.portTooltip": "OSC port we send data to",
|
||||
"general.osc_delay_enable": "Enable the OSC frame delay",
|
||||
"general.osc_delay_seconds": "The OSC delay in seconds:",
|
||||
"general.receiver": "Receive functions",
|
||||
"general.receiverTooltip": "Toggle OSC receive functions",
|
||||
"general.receiverPort": "Receiver Port",
|
||||
|
||||
@@ -31,6 +31,8 @@ class BabbleSettingsConfig(BaseModel):
|
||||
gui_osc_port: int = 8888
|
||||
gui_osc_receiver_port: int = 9001
|
||||
gui_osc_recalibrate_address: str = "/avatar/parameters/babble_recalibrate"
|
||||
gui_osc_delay_enable: bool = False
|
||||
gui_osc_delay_seconds: float = 0.01
|
||||
gui_update_check: bool = True
|
||||
gui_ROSC: bool = False
|
||||
gui_osc_location: str = ""
|
||||
|
||||
@@ -15,6 +15,8 @@ class SettingsWidget:
|
||||
self.gui_osc_port = f"-OSCPORT{widget_id}-"
|
||||
self.gui_osc_receiver_port = f"OSCRECEIVERPORT{widget_id}-"
|
||||
self.gui_osc_recalibrate_address = f"OSCRECALIBRATEADDRESS{widget_id}-"
|
||||
self.gui_osc_delay_enable = f"OSCDELAYENABLE{widget_id}-"
|
||||
self.gui_osc_delay_seconds = f"OSCDELAYSECONDS{widget_id}-"
|
||||
self.gui_speed_coefficient = f"-SPEEDCOEFFICIENT{widget_id}-"
|
||||
self.gui_min_cutoff = f"-MINCUTOFF{widget_id}-"
|
||||
self.gui_ROSC = f"-ROSC{widget_id}-"
|
||||
@@ -125,6 +127,32 @@ class SettingsWidget:
|
||||
tooltip=f'{lang._instance.get_string("general.recalibrateTooltip")}.',
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text(
|
||||
f'{lang._instance.get_string("general.osc_delay_enable")}',
|
||||
background_color=bg_color_highlight,
|
||||
),
|
||||
sg.Checkbox(
|
||||
"",
|
||||
default=self.config.gui_osc_delay_enable,
|
||||
key=self.gui_osc_delay_enable,
|
||||
background_color=bg_color_highlight,
|
||||
size=(0, 10),
|
||||
tooltip=f'{lang._instance.get_string("general.osc_delay_enable")}.',
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text(
|
||||
f'{lang._instance.get_string("general.osc_delay_seconds")}:',
|
||||
background_color=bg_color_highlight,
|
||||
),
|
||||
sg.InputText(
|
||||
self.config.gui_osc_delay_seconds,
|
||||
key=self.gui_osc_delay_seconds,
|
||||
size=(0, 10),
|
||||
tooltip=f'{lang._instance.get_string("general.osc_delay_seconds")}.',
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text(
|
||||
f'{lang._instance.get_string("general.uvcCameraSettings")}:',
|
||||
@@ -284,6 +312,19 @@ class SettingsWidget:
|
||||
self.config.gui_update_check = values[self.gui_update_check]
|
||||
changed = True
|
||||
|
||||
|
||||
# Update frame delay enable option
|
||||
value = values[self.gui_osc_delay_enable]
|
||||
if self.config.gui_osc_delay_enable != values[self.gui_osc_delay_enable]:
|
||||
self.config.gui_osc_delay_enable = bool(values[self.gui_osc_delay_enable])
|
||||
changed = True
|
||||
|
||||
# Update frame delay option
|
||||
value = values[self.gui_osc_delay_seconds]
|
||||
if self.config.gui_osc_delay_seconds != values[self.gui_osc_delay_seconds]:
|
||||
self.config.gui_osc_delay_seconds = float(values[self.gui_osc_delay_seconds])
|
||||
changed = True
|
||||
|
||||
# Update ROSC option
|
||||
if self.config.gui_ROSC != values[self.gui_ROSC]:
|
||||
self.config.gui_ROSC = values[self.gui_ROSC]
|
||||
|
||||
+12
-1
@@ -20,6 +20,10 @@ class Tab(IntEnum):
|
||||
import numpy as np
|
||||
|
||||
|
||||
def delay_output_osc(array, delay_seconds, self):
|
||||
time.sleep(delay_seconds)
|
||||
output_osc(array, self)
|
||||
|
||||
def output_osc(array, self):
|
||||
location = self.config.gui_osc_location
|
||||
multi = self.config.gui_multiply
|
||||
@@ -104,7 +108,14 @@ class VRChatOSC:
|
||||
continue
|
||||
except queue.Empty:
|
||||
continue
|
||||
output_osc(cam_info.output, self)
|
||||
|
||||
# If the delay setting is enabled, make a new thread and delay the outputs.
|
||||
delay_enable = self.config.general.osc_delay_enable
|
||||
delay_seconds = self.config.general.osc_delay_seconds
|
||||
if delay_enable:
|
||||
threading.Thread(target=delay_output_osc, args=(cam_info.output, delay_seconds, self))
|
||||
else:
|
||||
output_osc(cam_info.output, self)
|
||||
|
||||
|
||||
class VRChatOSCReceiver:
|
||||
|
||||
Reference in new issue
Block a user