13
0

tempo mapping: MappingTwist drag should differentiate between ramped and constant twist

TODO:  probably break these into separate ::Drag classes
This commit is contained in:
Ben Loftis 2023-05-17 09:35:24 -05:00
parent c452a4816c
commit ca5e56f98c
3 changed files with 12 additions and 7 deletions

View File

@ -3588,7 +3588,8 @@ MappingTwistDrag::MappingTwistDrag (Editor* e, ArdourCanvas::Item* i, Temporal::
TempoPoint& prv,
TempoPoint& fcus,
TempoPoint& nxt,
XMLNode& before)
XMLNode& before,
bool ramped)
: Drag (e, i, Temporal::BeatTime)
, prev (prv)
, focus (fcus)
@ -3598,6 +3599,7 @@ MappingTwistDrag::MappingTwistDrag (Editor* e, ArdourCanvas::Item* i, Temporal::
, delta (0.)
, _before_state (&before)
, _drag_valid (true)
, _do_ramp (ramped)
{
DEBUG_TRACE (DEBUG::Drags, "New MappingTwistDrag\n");
initial_focus_npm = focus.note_types_per_minute ();
@ -3660,11 +3662,10 @@ MappingTwistDrag::motion (GdkEvent* event, bool first_move)
delta += scaling_factor * pixel_distance;
std::cerr << "pixels " << pixel_distance << " spp " << spp << " SF " << scaling_factor << " delta = " << delta << std::endl;
bool do_a_ramp = true; // @ben
if (do_a_ramp) {
map->ramped_twist_tempi (prev, focus, next, initial_pre_npm + delta);
if (_do_ramp) {
map->ramped_twist_tempi (prev, focus, next, initial_focus_npm + delta); //was: PRE ... maybe we don't need 2 anymore?
} else {
map->linear_twist_tempi (prev, focus, next, initial_focus_npm + delta);
map->constant_twist_tempi (prev, focus, next, initial_focus_npm + delta);
}
_editor->mid_tempo_change (Editor::MappingChanged);
}

View File

@ -957,7 +957,8 @@ public:
Temporal::TempoPoint& prev,
Temporal::TempoPoint& focus,
Temporal::TempoPoint& next,
XMLNode&);
XMLNode&,
bool ramped);
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
@ -992,6 +993,7 @@ private:
XMLNode* _before_state;
bool _drag_valid;
bool _do_ramp;
};

View File

@ -3001,7 +3001,9 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
/* special case 3: if we are on the left side of the LAST marker: behave as if we clicked the marker prior*/
TempoPoint* after_after = const_cast<TempoPoint*> (map->next_tempo (*focus));
if (!after_after) {
if (after_after) {
after = after_after;
} else {
at_end = true;
}