lollipops: try to make sure we use the right velocity when setting lolli heights (dragging vs. not dragging

This commit is contained in:
Paul Davis 2023-10-27 14:11:27 -06:00
parent bec4344546
commit 4ea676b855
1 changed files with 7 additions and 4 deletions

View File

@ -179,12 +179,12 @@ VelocityGhostRegion::add_note (NoteBase* nb)
}
void
VelocityGhostRegion::set_size_and_position (GhostEvent& ev)
VelocityGhostRegion::set_size_and_position (GhostEvent& gev)
{
ArdourCanvas::Lollipop* l = dynamic_cast<ArdourCanvas::Lollipop*> (ev.item);
ArdourCanvas::Lollipop* l = dynamic_cast<ArdourCanvas::Lollipop*> (gev.item);
const double available_height = base_rect->y1();
const double actual_height = (ev.velocity_while_editing / 127.0) * available_height;
l->set (ArdourCanvas::Duple (ev.event->x0(), base_rect->y1() - actual_height), actual_height, lollipop_radius);
const double actual_height = ((dragging ? gev.velocity_while_editing : gev.event->note()->velocity()) / 127.0) * available_height;
l->set (ArdourCanvas::Duple (gev.event->x0(), base_rect->y1() - actual_height), actual_height, lollipop_radius);
}
void
@ -370,6 +370,7 @@ VelocityGhostRegion::start_line_drag ()
gev->velocity_while_editing = gev->event->note()->velocity();
}
dragging = true;
desensitize_lollis ();
}
@ -378,6 +379,8 @@ VelocityGhostRegion::end_line_drag (bool did_change)
{
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (&parent_rv);
dragging = false;
if (did_change) {
std::vector<NoteBase*> notes;
std::vector<int> velocities;