project-kyoku/include/core/bpmsection.h

44 lines
843 B
C
Raw Permalink Normal View History

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