44 lines
852 B
C++
44 lines
852 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <compare>
|
|
|
|
class audio_frame;
|
|
|
|
class midi_tick {
|
|
public:
|
|
midi_tick(int64_t in_ticks) : ticks(in_ticks) {
|
|
|
|
}
|
|
explicit midi_tick(const audio_frame& in_frame);
|
|
|
|
[[nodiscard]] audio_frame to_audio_frame() const;
|
|
[[nodiscard]] int64_t get_ticks() const {
|
|
return ticks;
|
|
}
|
|
operator int64_t() const {
|
|
return ticks;
|
|
}
|
|
private:
|
|
int64_t ticks;
|
|
};
|
|
|
|
class audio_frame {
|
|
public:
|
|
audio_frame(int64_t in_frames) : frames(in_frames) {
|
|
|
|
}
|
|
explicit audio_frame(const midi_tick& in_tick);
|
|
|
|
[[nodiscard]] midi_tick to_midi_tick() const;
|
|
[[nodiscard]] int64_t get_frames() const {
|
|
return frames;
|
|
}
|
|
operator int64_t() const {
|
|
return frames;
|
|
}
|
|
auto operator<=>(const audio_frame&) const = default;
|
|
private:
|
|
int64_t frames;
|
|
};
|