some work on being able to swap channels and have different MIDI automation displayed in pianoroll

This commit is contained in:
Paul Davis 2024-12-20 11:48:40 -07:00
parent 5248e81f9d
commit 084a23a80d
4 changed files with 46 additions and 2 deletions

View file

@ -7476,8 +7476,10 @@ AutomationDrawDrag::finished (GdkEvent* event, bool motion_occured)
FreehandLineDrag<Evoral::ControlList::OrderedPoints,Evoral::ControlList::OrderedPoint>::finished (event, motion_occured);
MergeableLine* ml = lm->make_merger();
ml->merge_drawn_line (editing_context, *editing_context.session(), drawn_points, !did_snap);
delete ml;
if (ml) {
ml->merge_drawn_line (editing_context, *editing_context.session(), drawn_points, !did_snap);
delete ml;
}
}
/*****************/

View file

@ -256,6 +256,10 @@ MidiCueEditor::set_visible_channel (int n)
{
_visible_channel = n;
visible_channel_label.set_text (string_compose (_("MIDI Channel %1"), _visible_channel + 1));
if (view) {
view->swap_automation_channel (n);
}
}
void

View file

@ -235,6 +235,43 @@ MidiCueView::update_hit (Hit* h)
}
}
void
MidiCueView::swap_automation_channel (int new_channel)
{
std::vector<Evoral::Parameter> new_params;
Evoral::Parameter active (0, 0, 0);
bool have_active = false;
/* Make a note of what was visible, but use the new channel */
for (CueAutomationMap::iterator i = automation_map.begin(); i != automation_map.end(); ++i) {
if (i->second.visible) {
Evoral::Parameter param (i->first.type(), new_channel, i->first.id());
new_params.push_back (param);
if (&i->second == active_automation) {
active = param;
have_active = true;
}
}
}
/* Drop the old */
automation_map.clear ();
/* Create the new */
for (auto const & p : new_params) {
update_automation_display (p, SelectionAdd);
}
if (have_active) {
set_active_automation (active);
} else {
unset_active_automation ();
}
}
void
MidiCueView::update_automation_display (Evoral::Parameter const & param, SelectionOperation op)
{

View file

@ -61,6 +61,7 @@ class MidiCueView : public MidiView
void ghost_sync_selection (NoteBase*);
void update_automation_display (Evoral::Parameter const & param, ARDOUR::SelectionOperation);
void swap_automation_channel (int);
void set_active_automation (Evoral::Parameter const &);
bool is_active_automation (Evoral::Parameter const &) const;
bool is_visible_automation (Evoral::Parameter const &) const;