mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
* make MIDI-specific menu show up on all MIDI lanes
* style guide, comments and a little refactoring (remove duplication) git-svn-id: svn://localhost/ardour2/branches/3.0@4422 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
33852a0728
commit
5309c327ec
7 changed files with 52 additions and 33 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
|
|||
string _name;
|
||||
guint32 _height;
|
||||
uint32_t _line_color;
|
||||
|
||||
boost::shared_ptr<ARDOUR::AutomationList> alist;
|
||||
|
||||
bool _visible : 1;
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
||||
|
|
@ -525,7 +528,8 @@ AutomationTimeAxisView::build_display_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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -40,6 +42,8 @@ public:
|
|||
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; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue