diff --git a/includes/RhythmGameUtilities/Utilities.hpp b/includes/RhythmGameUtilities/Utilities.hpp index b2d3e7e..ab177a8 100644 --- a/includes/RhythmGameUtilities/Utilities.hpp +++ b/includes/RhythmGameUtilities/Utilities.hpp @@ -21,6 +21,14 @@ namespace RhythmGameUtilities const float SECONDS_PER_MINUTE = 60.0f; +/** + * Convert seconds to ticks. + * + * @param seconds The seconds to generate ticks with. + * @param resolution The resolution of the song. + * @param bpmChanges All BPM changes within the song. + */ + int ConvertSecondsToTicks(float seconds, int resolution, std::map bpmChanges) { @@ -107,11 +115,26 @@ std::vector CalculateBeatBars(std::map bpmChanges, extern "C" { + + /** + * Convert a tick to a 2D/3D position. + * + * @param tick The tick. + * @param resolution The resolution of the song. + */ + PACKAGE_API float ConvertTickToPosition(float tick, int resolution) { return tick / resolution; } + /** + * Checks to see if the current time of a game or audio file is on the beat. + * + * @param bpm The base BPM for a song. + * @param currentTime A timestamp to compare to the BPM. + */ + PACKAGE_API bool IsOnTheBeat(float bpm, float currentTime) { auto beatInterval = SECONDS_PER_MINUTE / bpm;