From 34a2b12bdf9ce71f282d220a0ef9c8d6648a626f Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 5 Nov 2024 19:25:10 +0100 Subject: [PATCH] Minor refactor to cshock intensity --- ShockOsc/Services/ShockOsc.cs | 6 ++---- ShockOsc/ShockOsc.csproj | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ShockOsc/Services/ShockOsc.cs b/ShockOsc/Services/ShockOsc.cs index aadd986..4303cc7 100644 --- a/ShockOsc/Services/ShockOsc.cs +++ b/ShockOsc/Services/ShockOsc.cs @@ -333,10 +333,8 @@ private async Task ReceiveLogic() return; } - var scaledIntensity = intensity * 100f; - if(scaledIntensity > 127) break; - - programGroup.ConcurrentIntensity = Convert.ToByte(intensity * 100f); + var scaledIntensity = MathUtils.Saturate(intensity) * 100f; + programGroup.ConcurrentIntensity = Convert.ToByte(scaledIntensity); var ctype = action switch { diff --git a/ShockOsc/ShockOsc.csproj b/ShockOsc/ShockOsc.csproj index 1ddd75d..a201cf5 100644 --- a/ShockOsc/ShockOsc.csproj +++ b/ShockOsc/ShockOsc.csproj @@ -77,7 +77,7 @@ - + @@ -85,7 +85,7 @@ - +