adapt to DoubleableBeats and so forth (gui edition)
This commit is contained in:
@@ -983,8 +983,8 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
|
||||
Temporal::TempoMap::SharedPtr tmap (Temporal::TempoMap::use());
|
||||
Beats floor_lower_beat = std::max (Beats(), tmap->quarters_at_sample (lower)).round_down_to_beat ();
|
||||
|
||||
if (floor_lower_beat < 0.0) {
|
||||
floor_lower_beat = 0.0;
|
||||
if (floor_lower_beat < Temporal::Beats()) {
|
||||
floor_lower_beat = Temporal::Beats();
|
||||
}
|
||||
|
||||
const samplepos_t beat_before_lower_pos = tmap->sample_at (floor_lower_beat, _session->sample_rate());
|
||||
|
||||
@@ -3219,7 +3219,7 @@ MidiRegionView::change_note_time (NoteBase* event, Temporal::Beats delta, bool r
|
||||
Temporal::Beats new_time;
|
||||
|
||||
if (relative) {
|
||||
if (delta < 0.0) {
|
||||
if (delta < Temporal::Beats()) {
|
||||
if (event->note()->time() < -delta) {
|
||||
new_time = Temporal::Beats();
|
||||
} else {
|
||||
@@ -4277,7 +4277,11 @@ MidiRegionView::get_velocity_for_add (MidiModel::TimeType time) const
|
||||
MidiModel::Notes::const_iterator n = m;
|
||||
--n;
|
||||
|
||||
const double frac = (time - (*n)->time()) / ((*m)->time() - (*n)->time());
|
||||
const double t = DoubleableBeats (time).to_double();
|
||||
const double next = DoubleableBeats ((*n)->time()).to_double ();
|
||||
const double mmmm = DoubleableBeats ((*m)->time()).to_double ();
|
||||
|
||||
const double frac = (t - next) / (mmmm - next);
|
||||
|
||||
return (*n)->velocity() + (frac * ((*m)->velocity() - (*n)->velocity()));
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ QuantizeDialog::grid_size_to_musical_time (const string& txt) const
|
||||
if ( txt == _grid_strings[0] ) { //"Main Grid"
|
||||
bool success;
|
||||
|
||||
Temporal::Beats b = editor.get_grid_type_as_beats (success, timepos_t (0));
|
||||
Temporal::DoubleableBeats b = editor.get_grid_type_as_beats (success, timepos_t (0));
|
||||
if (!success) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
@@ -236,15 +236,19 @@ StepEditor::move_step_edit_beat_pos (Temporal::Beats beats)
|
||||
if (!step_edit_region_view) {
|
||||
return;
|
||||
}
|
||||
if (beats > 0.0) {
|
||||
|
||||
const Temporal::Beats zero;
|
||||
|
||||
if (beats > zero) {
|
||||
step_edit_beat_pos = min (step_edit_beat_pos + beats, step_edit_region->length().beats());
|
||||
} else if (beats < 0.0) {
|
||||
} else if (beats < zero) {
|
||||
if (-beats < step_edit_beat_pos) {
|
||||
step_edit_beat_pos += beats; // its negative, remember
|
||||
} else {
|
||||
step_edit_beat_pos = Temporal::Beats();
|
||||
}
|
||||
}
|
||||
|
||||
step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user