2021-10-05 14:48:28 -04:00
|
|
|
#pragma once
|
|
|
|
|
2021-12-29 09:59:18 -05:00
|
|
|
#include "core/time.h"
|
|
|
|
|
|
|
|
namespace kku
|
|
|
|
{
|
2021-10-05 14:48:28 -04:00
|
|
|
|
2022-05-07 23:43:12 -04:00
|
|
|
/// BPMSection
|
|
|
|
///
|
|
|
|
/// Data to setup and distinguish
|
|
|
|
/// a section on beatmap timeline
|
2021-10-05 14:48:28 -04:00
|
|
|
struct BPMSection
|
|
|
|
{
|
2022-05-07 23:43:12 -04:00
|
|
|
/// Amount of beats
|
|
|
|
/// per minute in the section
|
2021-12-29 09:59:18 -05:00
|
|
|
unsigned int bpm = 120; // Hi, osu
|
2022-05-07 23:43:12 -04:00
|
|
|
|
|
|
|
/// Denominator in fraction of major
|
|
|
|
/// beats. Like, 1/2, 1/3. etc...
|
2021-12-29 09:59:18 -05:00
|
|
|
unsigned int fraction = 2;
|
2022-05-07 23:43:12 -04:00
|
|
|
|
|
|
|
/// Timestamp respresenting when
|
|
|
|
/// the section becomes active
|
2021-10-05 14:48:28 -04:00
|
|
|
microsec offset_start = 0;
|
2022-05-07 23:43:12 -04:00
|
|
|
|
|
|
|
/// Interval between beats
|
2021-12-09 02:55:53 -05:00
|
|
|
microsec interval = 0;
|
2021-11-02 13:03:27 -04:00
|
|
|
};
|
2021-10-05 14:48:28 -04:00
|
|
|
|
2022-05-07 23:43:12 -04:00
|
|
|
/// BPMSectionComparator
|
|
|
|
///
|
|
|
|
/// Predicate to define
|
|
|
|
/// BPMSection sorting rule:
|
|
|
|
/// by timestamp of start
|
2021-12-29 09:59:18 -05:00
|
|
|
struct BPMSectionComparator
|
2021-11-02 13:03:27 -04:00
|
|
|
{
|
|
|
|
bool operator()(const BPMSection& lhs, const BPMSection& rhs) const noexcept
|
2021-10-05 14:48:28 -04:00
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
return lhs.offset_start < rhs.offset_start;
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
};
|
2021-12-29 09:59:18 -05:00
|
|
|
|
2022-05-07 23:43:12 -04:00
|
|
|
}
|