step_edit_insert_position = 0;
_step_edit_triplet_countdown = 0;
_step_edit_within_chord = 0;
- _step_edit_chord_duration = 0.0;
+ _step_edit_chord_duration = Evoral::Beats();
step_edit_region_view = 0;
_track->PlaylistChanged.connect (*this, invalidator (*this),
{
_step_edit_triplet_countdown = 0;
_step_edit_within_chord = 0;
- _step_edit_chord_duration = 0.0;
+ _step_edit_chord_duration = Evoral::Beats();
step_edit_region.reset ();
step_edit_region_view = 0;
last_added_pitch = -1;
- last_added_end = 0;
+ last_added_end = Evoral::Beats();
resync_step_edit_position ();
prepare_step_edit_region ();
incoming.read_contents (size, buf);
if ((buf[0] & 0xf0) == MIDI_CMD_NOTE_ON) {
- step_add_note (buf[0] & 0xf, buf[1], buf[2], 0.0);
+ step_add_note (buf[0] & 0xf, buf[1], buf[2], Evoral::Beats());
}
}
}
}
void
-StepEditor::step_edit_sustain (Evoral::MusicalTime beats)
+StepEditor::step_edit_sustain (Evoral::Beats beats)
{
if (step_edit_region_view) {
step_edit_region_view->step_sustain (beats);
}
void
-StepEditor::move_step_edit_beat_pos (Evoral::MusicalTime beats)
+StepEditor::move_step_edit_beat_pos (Evoral::Beats beats)
{
if (beats > 0.0) {
step_edit_beat_pos = min (step_edit_beat_pos + beats,
if (-beats < step_edit_beat_pos) {
step_edit_beat_pos += beats; // its negative, remember
} else {
- step_edit_beat_pos = 0;
+ step_edit_beat_pos = Evoral::Beats();
}
}
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
int
-StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::MusicalTime beat_duration)
+StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evoral::Beats beat_duration)
{
/* do these things in case undo removed the step edit region
*/
_editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
}
- Evoral::MusicalTime at = step_edit_beat_pos;
- Evoral::MusicalTime len = beat_duration;
+ Evoral::Beats at = step_edit_beat_pos;
+ Evoral::Beats len = beat_duration;
if ((last_added_pitch >= 0) && (pitch == last_added_pitch) && (last_added_end == step_edit_beat_pos)) {
up by 1 tick from where the last note ended
*/
- at += 1.0/Timecode::BBT_Time::ticks_per_beat;
- len -= 1.0/Timecode::BBT_Time::ticks_per_beat;
+ at += Evoral::Beats::ticks(1);
+ len -= Evoral::Beats::ticks(1);
}
step_edit_region_view->step_add_note (channel, pitch, velocity, at, len);
step_edit_beat_pos += beat_duration;
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
} else {
- step_edit_beat_pos += 1.0/Timecode::BBT_Time::ticks_per_beat; // tiny, but no longer overlapping
+ step_edit_beat_pos += Evoral::Beats::ticks(1); // tiny, but no longer overlapping
_step_edit_chord_duration = max (_step_edit_chord_duration, beat_duration);
}
}
void
-StepEditor::set_step_edit_cursor_width (Evoral::MusicalTime beats)
+StepEditor::set_step_edit_cursor_width (Evoral::Beats beats)
{
if (step_edit_region_view) {
step_edit_region_view->set_step_edit_cursor_width (beats);
}
void
-StepEditor::step_edit_rest (Evoral::MusicalTime beats)
+StepEditor::step_edit_rest (Evoral::Beats beats)
{
bool success;
void
StepEditor::step_edit_beat_sync ()
{
- step_edit_beat_pos = ceil (step_edit_beat_pos);
+ step_edit_beat_pos = step_edit_beat_pos.round_up_to_beat();
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
}
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos);
- fpos = _session->tempo_map().round_to_bar (fpos, 1);
- step_edit_beat_pos = ceil (step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()));
+ fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways);
+ step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat();
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
}
step_edit_region.reset();
step_edit_region_view = 0;
// force a recompute of the insert position
- step_edit_beat_pos = -1.0;
+ step_edit_beat_pos = Evoral::Beats(-1);
}
}