Skip to content

Commit 5880814

Browse files
authored
Merge pull request #79 from neogeek/hotfix/change-method-param-type
[hotfix] Changed method param type.
2 parents e23bfcb + 349eaf9 commit 5880814

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

RhythmGameUtilities/Scripts/Utilities.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static class UtilitiesInternal
1616
#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
1717
[DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)]
1818
#endif
19-
public static extern float ConvertTickToPosition(float tick, int resolution);
19+
public static extern float ConvertTickToPosition(int tick, int resolution);
2020

2121
#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
2222
[DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -35,7 +35,7 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu
3535
#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
3636
[DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)]
3737
#endif
38-
public static extern bool IsOnTheBeat(float bpm, float currentTime);
38+
public static extern bool IsOnTheBeat(int bpm, float currentTime);
3939

4040
#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
4141
[DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -79,7 +79,7 @@ public static class Utilities
7979
///
8080
/// <param name="tick">The tick.</param>
8181
/// <param name="resolution">The resolution of the song.</param>
82-
public static float ConvertTickToPosition(float tick, int resolution)
82+
public static float ConvertTickToPosition(int tick, int resolution)
8383
{
8484
return UtilitiesInternal.ConvertTickToPosition(tick, resolution);
8585
}
@@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar
103103
///
104104
/// <param name="bpm">The base BPM for a song.</param>
105105
/// <param name="currentTime">A timestamp to compare to the BPM.</param>
106-
public static bool IsOnTheBeat(float bpm, float currentTime)
106+
public static bool IsOnTheBeat(int bpm, float currentTime)
107107
{
108108
return UtilitiesInternal.IsOnTheBeat(bpm, currentTime);
109109
}

UnityPackage/Scripts/Utilities.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static class UtilitiesInternal
1616
#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
1717
[DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)]
1818
#endif
19-
public static extern float ConvertTickToPosition(float tick, int resolution);
19+
public static extern float ConvertTickToPosition(int tick, int resolution);
2020

2121
#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
2222
[DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -35,7 +35,7 @@ public static extern int ConvertSecondsToTicksInternal(float seconds, int resolu
3535
#elif LINUX_BUILD || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
3636
[DllImport("libRhythmGameUtilities.so", CallingConvention = CallingConvention.Cdecl)]
3737
#endif
38-
public static extern bool IsOnTheBeat(float bpm, float currentTime);
38+
public static extern bool IsOnTheBeat(int bpm, float currentTime);
3939

4040
#if WINDOWS_BUILD || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
4141
[DllImport("libRhythmGameUtilities.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -79,7 +79,7 @@ public static class Utilities
7979
///
8080
/// <param name="tick">The tick.</param>
8181
/// <param name="resolution">The resolution of the song.</param>
82-
public static float ConvertTickToPosition(float tick, int resolution)
82+
public static float ConvertTickToPosition(int tick, int resolution)
8383
{
8484
return UtilitiesInternal.ConvertTickToPosition(tick, resolution);
8585
}
@@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar
103103
///
104104
/// <param name="bpm">The base BPM for a song.</param>
105105
/// <param name="currentTime">A timestamp to compare to the BPM.</param>
106-
public static bool IsOnTheBeat(float bpm, float currentTime)
106+
public static bool IsOnTheBeat(int bpm, float currentTime)
107107
{
108108
return UtilitiesInternal.IsOnTheBeat(bpm, currentTime);
109109
}

include/RhythmGameUtilities/Utilities.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ extern "C"
159159
* @public
160160
*/
161161

162-
PACKAGE_API float ConvertTickToPosition(float tick, int resolution)
162+
PACKAGE_API float ConvertTickToPosition(int tick, int resolution)
163163
{
164-
return tick / resolution;
164+
return tick / (float)resolution;
165165
}
166166

167167
/**
@@ -172,9 +172,9 @@ extern "C"
172172
* @public
173173
*/
174174

175-
PACKAGE_API bool IsOnTheBeat(float bpm, float currentTime)
175+
PACKAGE_API bool IsOnTheBeat(int bpm, float currentTime)
176176
{
177-
auto beatInterval = SECONDS_PER_MINUTE / bpm;
177+
auto beatInterval = SECONDS_PER_MINUTE / (float)bpm;
178178

179179
auto beatFraction = currentTime / beatInterval;
180180

0 commit comments

Comments
 (0)