13
0

Update labels in MIDI Automation Lanes when MIDNAM changes

This commit is contained in:
Robin Gareus 2020-04-15 02:38:18 +02:00
parent 4130bc3a86
commit a3af5e31f1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 37 additions and 1 deletions

View File

@ -574,6 +574,22 @@ AutomationTimeAxisView::set_height (uint32_t h, TrackHeightMode m)
}
}
void
AutomationTimeAxisView::update_name_from_param ()
{
/* Note that this is intended for MidiTrack::describe_parameter()
* -> instrument_info().get_controller_name()
* It does not work with parent/plug_name for plugins.
*/
boost::shared_ptr<ARDOUR::Route> r = boost::dynamic_pointer_cast<ARDOUR::Route> (_stripable);
if (!r) {
return;
}
_name = r->describe_parameter(_parameter);
set_tooltip (controls_ebox, _name);
name_label.set_text (_name);
}
void
AutomationTimeAxisView::set_samples_per_pixel (double fpp)
{

View File

@ -73,7 +73,7 @@ public:
TimeAxisView& parent,
bool show_regions,
ArdourCanvas::Canvas& canvas,
const std::string & name, /* translatable */
const std::string & name = "", /* translatable */
const std::string & plug_name = "");
~AutomationTimeAxisView();
@ -82,6 +82,7 @@ public:
void set_samples_per_pixel (double);
std::string name() const { return _name; }
Gdk::Color color () const;
void update_name_from_param ();
boost::shared_ptr<ARDOUR::Stripable> stripable() const;
ARDOUR::PresentationInfo const & presentation_info () const;

View File

@ -351,6 +351,22 @@ MidiTimeAxisView::use_midnam_info ()
controller_menu = 0;
setup_midnam_patches ();
/* update names on any automation lane with MIDNAM names */
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
switch (i->first.type()) {
case MidiCCAutomation:
case MidiPgmChangeAutomation:
case MidiPitchBenderAutomation:
case MidiChannelPressureAutomation:
case MidiNotePressureAutomation:
case MidiSystemExclusiveAutomation:
i->second->update_name_from_param ();
break;
default:
continue;
}
}
}
void
@ -1316,6 +1332,9 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
*this,
true,
parent_canvas,
/* this calls MidiTrack::describe_parameter()
* -> instrument_info().get_controller_name()
*/
_route->describe_parameter(param)));
if (_view) {