Skip to content
Merged
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
23 changes: 23 additions & 0 deletions includes/RhythmGameUtilities/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, int> bpmChanges)
{
Expand Down Expand Up @@ -107,11 +115,26 @@ std::vector<BeatBar> CalculateBeatBars(std::map<int, int> 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;
Expand Down