Skip to content

Commit 1ee8b85

Browse files
committed
Add option to disable legacy OSC support in PulsoidModule
Added a new `disableLegacySupport` property to the `PulsoidModule` class to toggle legacy OSC support. Updated `SendHRToOSC` method to conditionally send additional OSC parameters based on this property. Introduced a new checkbox in `MainWindow.xaml` to allow users to enable or disable legacy OSC support through the UI.
1 parent 55d3a81 commit 1ee8b85

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

vrcosc-magicchatbox/Classes/Modules/PulsoidModule.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public partial class PulsoidModuleSettings : ObservableObject
4040
[ObservableProperty]
4141
private bool enableHeartRateOfflineCheck = true;
4242

43+
[ObservableProperty]
44+
private bool disableLegacySupport = false;
45+
4346
[ObservableProperty]
4447
private int unchangedHeartRateTimeoutInSec = 30;
4548

@@ -911,14 +914,12 @@ private void HandleHeartRateMessage(string message)
911914
SendHRToOSC(true);
912915
}
913916
}
914-
915-
// Send OSC parameters method
916917
private void SendHRToOSC(bool isHRBeat)
917918
{
918-
if (!ViewModel.Instance.IntgrHeartRate_OSC) return; // Only send if enabled
919+
if (!ViewModel.Instance.IntgrHeartRate_OSC) return;
919920

920-
bool isHRConnected = ViewModel.Instance.PulsoidAuthConnected; // Authenticated and token valid
921-
bool isHRActive = PulsoidDeviceOnline; // Device considered online
921+
bool isHRConnected = ViewModel.Instance.PulsoidAuthConnected;
922+
bool isHRActive = PulsoidDeviceOnline;
922923

923924
int hrValueForOSC = GetOSCHeartRate();
924925
if (hrValueForOSC <= 0) return;
@@ -935,6 +936,17 @@ private void SendHRToOSC(bool isHRBeat)
935936
OSCSender.SendOscParam("/avatar/parameters/HRPercent", hrPercent);
936937
OSCSender.SendOscParam("/avatar/parameters/FullHRPercent", fullHRPercent);
937938
OSCSender.SendOscParam("/avatar/parameters/HR", hrValueForOSC);
939+
940+
if (!Settings.DisableLegacySupport)
941+
{
942+
int ones = hrValueForOSC % 10;
943+
int tens = (hrValueForOSC / 10) % 10;
944+
int hundreds = hrValueForOSC / 100;
945+
946+
OSCSender.SendOscParam("/avatar/parameters/onesHR", ones);
947+
OSCSender.SendOscParam("/avatar/parameters/tensHR", tens);
948+
OSCSender.SendOscParam("/avatar/parameters/hundredsHR", hundreds);
949+
}
938950
}
939951
}
940952

vrcosc-magicchatbox/MainWindow.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,27 @@
24472447
</CheckBox>
24482448
</StackPanel>
24492449
</Border>
2450+
<Border
2451+
Margin="0,0,0,5"
2452+
Background="#FF3B3054"
2453+
CornerRadius="5,0,0,5">
2454+
<StackPanel Margin="5">
2455+
<CheckBox
2456+
x:Name="DisableLegacyOSCSupport_checkbox"
2457+
Height="20"
2458+
Margin="4,2"
2459+
BorderBrush="#FF2D1265"
2460+
Checked="Update_Click"
2461+
FontFamily="Comfortaa Light"
2462+
FontSize="18"
2463+
Foreground="#FFB9B5C1"
2464+
IsChecked="{Binding HeartRateConnector.Settings.DisableLegacySupport, Mode=TwoWay}"
2465+
Style="{DynamicResource SettingsCheckbox}"
2466+
Unchecked="Update_Click">
2467+
disable legacy OSC support (improved performance)
2468+
</CheckBox>
2469+
</StackPanel>
2470+
</Border>
24502471
<Border
24512472
Margin="0,0,0,5"
24522473
Background="#FF3B3054"

0 commit comments

Comments
 (0)