From 349eaf941b223cf52aadfa4bb5aaa0f1b4239d93 Mon Sep 17 00:00:00 2001 From: Scott Doxey Date: Thu, 24 Oct 2024 23:38:51 -0400 Subject: [PATCH] Changed method param type. --- RhythmGameUtilities/Scripts/Utilities.cs | 8 ++++---- UnityPackage/Scripts/Utilities.cs | 8 ++++---- include/RhythmGameUtilities/Utilities.hpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/RhythmGameUtilities/Scripts/Utilities.cs b/RhythmGameUtilities/Scripts/Utilities.cs index 827072c..316138e 100644 --- a/RhythmGameUtilities/Scripts/Utilities.cs +++ b/RhythmGameUtilities/Scripts/Utilities.cs @@ -16,7 +16,7 @@ internal static class UtilitiesInternal #elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] #endif - public static extern float ConvertTickToPosition(float tick, int resolution); + public static extern float ConvertTickToPosition(int tick, int resolution); #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] @@ -35,7 +35,7 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu #elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] #endif - public static extern bool IsOnTheBeat(float bpm, float currentTime); + public static extern bool IsOnTheBeat(int bpm, float currentTime); #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] @@ -79,7 +79,7 @@ public static class Utilities /// /// The tick. /// The resolution of the song. - public static float ConvertTickToPosition(float tick, int resolution) + public static float ConvertTickToPosition(int tick, int resolution) { return UtilitiesInternal.ConvertTickToPosition(tick, resolution); } @@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar /// /// The base BPM for a song. /// A timestamp to compare to the BPM. - public static bool IsOnTheBeat(float bpm, float currentTime) + public static bool IsOnTheBeat(int bpm, float currentTime) { return UtilitiesInternal.IsOnTheBeat(bpm, currentTime); } diff --git a/UnityPackage/Scripts/Utilities.cs b/UnityPackage/Scripts/Utilities.cs index 827072c..316138e 100644 --- a/UnityPackage/Scripts/Utilities.cs +++ b/UnityPackage/Scripts/Utilities.cs @@ -16,7 +16,7 @@ internal static class UtilitiesInternal #elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] #endif - public static extern float ConvertTickToPosition(float tick, int resolution); + public static extern float ConvertTickToPosition(int tick, int resolution); #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] @@ -35,7 +35,7 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu #elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX [DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)] #endif - public static extern bool IsOnTheBeat(float bpm, float currentTime); + public static extern bool IsOnTheBeat(int bpm, float currentTime); #if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN [DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)] @@ -79,7 +79,7 @@ public static class Utilities /// /// The tick. /// The resolution of the song. - public static float ConvertTickToPosition(float tick, int resolution) + public static float ConvertTickToPosition(int tick, int resolution) { return UtilitiesInternal.ConvertTickToPosition(tick, resolution); } @@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar /// /// The base BPM for a song. /// A timestamp to compare to the BPM. - public static bool IsOnTheBeat(float bpm, float currentTime) + public static bool IsOnTheBeat(int bpm, float currentTime) { return UtilitiesInternal.IsOnTheBeat(bpm, currentTime); } diff --git a/include/RhythmGameUtilities/Utilities.hpp b/include/RhythmGameUtilities/Utilities.hpp index 959de04..885049d 100644 --- a/include/RhythmGameUtilities/Utilities.hpp +++ b/include/RhythmGameUtilities/Utilities.hpp @@ -159,9 +159,9 @@ extern "C" * @public */ - PACKAGE_API float ConvertTickToPosition(float tick, int resolution) + PACKAGE_API float ConvertTickToPosition(int tick, int resolution) { - return tick / resolution; + return tick / (float)resolution; } /** @@ -172,9 +172,9 @@ extern "C" * @public */ - PACKAGE_API bool IsOnTheBeat(float bpm, float currentTime) + PACKAGE_API bool IsOnTheBeat(int bpm, float currentTime) { - auto beatInterval = SECONDS_PER_MINUTE / bpm; + auto beatInterval = SECONDS_PER_MINUTE / (float)bpm; auto beatFraction = currentTime / beatInterval;