21class QuantizeOptions final
24 static constexpr auto MAX_SNAP_POINTS = 120096;
25 using NoteLength = utils::NoteLength;
29 QuantizeOptions () =
default;
30 QuantizeOptions (NoteLength note_length) { init (note_length); }
32 void init (NoteLength note_length);
39 float get_swing ()
const;
41 float get_amount ()
const;
43 float get_randomization ()
const;
45 void set_swing (
float swing);
47 void set_amount (
float amount);
49 void set_randomization (
float randomization);
55 to_string (NoteLength note_length, NoteType note_type);
68 std::pair<units::precise_tick_t, double>
72 static constexpr auto kNoteLengthKey =
"noteLength"sv;
73 static constexpr auto kNoteTypeKey =
"noteType"sv;
74 static constexpr auto kAdjustStartKey =
"adjustStart"sv;
75 static constexpr auto kAdjustEndKey =
"adjustEnd"sv;
76 static constexpr auto kAmountKey =
"amount"sv;
77 static constexpr auto kSwingKey =
"swing"sv;
78 static constexpr auto kRandomizationTicksKey =
"randTicks"sv;
79 friend void to_json (nlohmann::json &j,
const QuantizeOptions &p)
91 friend void from_json (
const nlohmann::json &j, QuantizeOptions &p)
93 j.at (kNoteLengthKey).get_to (p.note_length_);
94 j.at (kNoteTypeKey).get_to (p.note_type_);
95 j.at (kAdjustStartKey).get_to (p.adjust_start_);
96 j.at (kAdjustEndKey).get_to (p.adjust_end_);
97 j.at (kAmountKey).get_to (p.amount_);
98 j.at (kSwingKey).get_to (p.swing_);
99 j.at (kRandomizationTicksKey).get_to (p.randomization_ticks_);
102 units::precise_tick_t get_prev_point (units::precise_tick_t pos)
const;
103 units::precise_tick_t get_next_point (units::precise_tick_t pos)
const;