Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RhythmGameUtilities/Scripts/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand Down Expand Up @@ -79,7 +79,7 @@ public static class Utilities
///
/// <param name="tick">The tick.</param>
/// <param name="resolution">The resolution of the song.</param>
public static float ConvertTickToPosition(float tick, int resolution)
public static float ConvertTickToPosition(int tick, int resolution)
{
return UtilitiesInternal.ConvertTickToPosition(tick, resolution);
}
Expand All @@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar
///
/// <param name="bpm">The base BPM for a song.</param>
/// <param name="currentTime">A timestamp to compare to the BPM.</param>
public static bool IsOnTheBeat(float bpm, float currentTime)
public static bool IsOnTheBeat(int bpm, float currentTime)
{
return UtilitiesInternal.IsOnTheBeat(bpm, currentTime);
}
Expand Down
8 changes: 4 additions & 4 deletions UnityPackage/Scripts/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand Down Expand Up @@ -79,7 +79,7 @@ public static class Utilities
///
/// <param name="tick">The tick.</param>
/// <param name="resolution">The resolution of the song.</param>
public static float ConvertTickToPosition(float tick, int resolution)
public static float ConvertTickToPosition(int tick, int resolution)
{
return UtilitiesInternal.ConvertTickToPosition(tick, resolution);
}
Expand All @@ -103,7 +103,7 @@ public static int ConvertSecondsToTicks(float seconds, int resolution, Dictionar
///
/// <param name="bpm">The base BPM for a song.</param>
/// <param name="currentTime">A timestamp to compare to the BPM.</param>
public static bool IsOnTheBeat(float bpm, float currentTime)
public static bool IsOnTheBeat(int bpm, float currentTime)
{
return UtilitiesInternal.IsOnTheBeat(bpm, currentTime);
}
Expand Down
8 changes: 4 additions & 4 deletions include/RhythmGameUtilities/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;

Expand Down