diff options
-rw-r--r-- | gtk2_ardour/automation_line.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.h | 29 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/event_type_map.h | 12 | ||||
-rw-r--r-- | libs/ardour/event_type_map.cc | 6 | ||||
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 6 |
7 files changed, 52 insertions, 33 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index f06cbee510..102a3fd29c 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -116,8 +116,9 @@ AutomationLine::queue_reset () void AutomationLine::show () { - if (_interpolation != AutomationList::Discrete) + if (_interpolation != AutomationList::Discrete) { line->show(); + } if (points_visible) { for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) { @@ -629,8 +630,9 @@ AutomationLine::determine_visible_control_points (ALPoints& points) line->property_points() = line_points; - if (_visible && _interpolation != AutomationList::Discrete) + if (_visible && _interpolation != AutomationList::Discrete) { line->show(); + } } @@ -1201,8 +1203,9 @@ AutomationLine::show_all_control_points () void AutomationLine::hide_all_but_selected_control_points () { - if (alist->interpolation() == AutomationList::Discrete) + if (alist->interpolation() == AutomationList::Discrete) { return; + } points_visible = false; @@ -1216,8 +1219,9 @@ AutomationLine::hide_all_but_selected_control_points () void AutomationLine::track_entered() { - if (alist->interpolation() != AutomationList::Discrete) + if (alist->interpolation() != AutomationList::Discrete) { show_all_control_points(); + } } void diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 3444de3cb2..6cf3b5ade6 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -106,8 +106,8 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin string get_verbose_cursor_string (double) const; string fraction_to_string (double) const; double string_to_fraction (string const &) const; - void view_to_model_y (double&) const; - void model_to_view_y (double&) const; + void view_to_model_y (double&) const; + void model_to_view_y (double&) const; void set_list(boost::shared_ptr<ARDOUR::AutomationList> list); boost::shared_ptr<ARDOUR::AutomationList> the_list() const { return alist; } @@ -129,23 +129,24 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin protected: - string _name; - guint32 _height; - uint32_t _line_color; + string _name; + guint32 _height; + uint32_t _line_color; + boost::shared_ptr<ARDOUR::AutomationList> alist; - bool _visible : 1; - bool _uses_gain_mapping : 1; + bool _visible : 1; + bool _uses_gain_mapping : 1; bool terminal_points_can_slide : 1; - bool update_pending : 1; - bool no_draw : 1; - bool points_visible : 1; + bool update_pending : 1; + bool no_draw : 1; + bool points_visible : 1; bool did_push; - ArdourCanvas::Group& _parent_group; - ArdourCanvas::Group* group; - ArdourCanvas::Line* line; /* line */ - ArdourCanvas::Points line_points; /* coordinates for canvas line */ + ArdourCanvas::Group& _parent_group; + ArdourCanvas::Group* group; + ArdourCanvas::Line* line; /* line */ + ArdourCanvas::Points line_points; /* coordinates for canvas line */ std::vector<ControlPoint*> control_points; /* visible control points */ struct ALPoint { diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index b7ed914926..e3b5ee9f4c 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -349,24 +349,27 @@ AutomationTimeAxisView::interpolation_changed () } } - if (_line) + if (_line) { _line->set_interpolation(style); + } } void AutomationTimeAxisView::set_interpolation (AutomationList::InterpolationStyle style) { _control->list()->set_interpolation(style); - if (_line) + if (_line) { _line->set_interpolation(style); + } } void AutomationTimeAxisView::clear_clicked () { _session.begin_reversible_command (_("clear automation")); - if (_line) + if (_line) { _line->clear (); + } _session.commit_reversible_command (); } @@ -524,8 +527,9 @@ AutomationTimeAxisView::build_display_menu () items.push_back (MenuElem (_("State"), *auto_state_menu)); /* mode menu */ - - if (_control->parameter().type() == MidiCCAutomation) { + + if ( EventTypeMap::instance().is_midi_parameter(_control->parameter()) ) { + Menu* auto_mode_menu = manage (new Menu); auto_mode_menu->set_name ("ArdourContextMenu"); MenuList& am_items = auto_mode_menu->items(); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 9f3da122c5..c482c744cf 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -469,11 +469,7 @@ MidiTimeAxisView::add_cc_track() void MidiTimeAxisView::add_parameter_track(const Evoral::Parameter& param) { - if ( param.type() != MidiCCAutomation && - param.type() != MidiPgmChangeAutomation && - param.type() != MidiPitchBenderAutomation && - param.type() != MidiChannelPressureAutomation - ) { + if ( !EventTypeMap::instance().is_midi_parameter(param) ) { error << "MidiTimeAxisView: unknown automation child " << ARDOUR::EventTypeMap::instance().to_symbol(param) << endmsg; return; diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index dfa11d6408..d6f26aeac7 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -24,6 +24,8 @@ #include <string> #include <evoral/TypeMap.hpp> +class Evoral::Parameter; + namespace ARDOUR { /** This is the interface Ardour provides to Evoral about what @@ -35,10 +37,12 @@ public: uint8_t parameter_midi_type(const Evoral::Parameter& param) const; uint32_t midi_event_type(uint8_t status) const; - bool is_integer(const Evoral::Parameter& param) const; - Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const; - Evoral::Parameter new_parameter(const std::string& str) const; - std::string to_symbol(const Evoral::Parameter& param) const; + bool is_integer(const Evoral::Parameter& param) const; + Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const; + Evoral::Parameter new_parameter(const std::string& str) const; + std::string to_symbol(const Evoral::Parameter& param) const; + + bool is_midi_parameter(const Evoral::Parameter& param); static EventTypeMap& instance() { return event_type_map; } diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index 39c2e3d6eb..a4d8317a42 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -38,6 +38,12 @@ EventTypeMap::type_is_midi(uint32_t type) const return (type >= MidiCCAutomation) && (type <= MidiChannelPressureAutomation); } +bool +EventTypeMap::is_midi_parameter(const Evoral::Parameter& param) +{ + return type_is_midi(param.type()); +} + uint8_t EventTypeMap::parameter_midi_type(const Evoral::Parameter& param) const { diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index 5ec8c2dac9..022945b0f8 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -770,6 +770,7 @@ ControlList::unlocked_eval (double x) const if (x >= _events.front()->when) { return _events.front()->value; } else { + // hansfbaier: v--------- Why commented ??? // return _default_value; return _events.front()->value; } @@ -780,6 +781,7 @@ ControlList::unlocked_eval (double x) const } else if (x == _events.front()->when) { return _events.front()->value; } else if (x < _events.front()->when) { + // hansfbaier: v--------- Why commented ??? // return _default_value; return _events.front()->value; } @@ -789,8 +791,9 @@ ControlList::unlocked_eval (double x) const upos = _events.back()->when; uval = _events.back()->value; - if (_interpolation == Discrete) + if (_interpolation == Discrete) { return lval; + } /* linear interpolation betweeen the two points */ @@ -805,6 +808,7 @@ ControlList::unlocked_eval (double x) const } else if (x == _events.front()->when) { return _events.front()->value; } else if (x < _events.front()->when) { + // hansfbaier: v--------- Why commented ??? // return _default_value; return _events.front()->value; } |