13
0

Restore visible CC/etc automation tracks on session load.

Fix CC/channel mismatch when creating a new CC track.
Always display CC with 1-based numbering (like channel).


git-svn-id: svn://localhost/ardour2/branches/3.0@3763 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-09-19 17:24:52 +00:00
parent 68f04adec1
commit 7aea02083a
7 changed files with 53 additions and 12 deletions

View File

@ -37,9 +37,9 @@ using namespace ARDOUR;
AddMidiCCTrackDialog::AddMidiCCTrackDialog ()
: Dialog (_("ardour: add midi controller track"))
, _chan_adjustment (1, 1, 16, 8)
, _chan_adjustment (1, 1, 16, 1, 8, 8)
, _chan_spinner (_chan_adjustment)
, _cc_num_adjustment (1, 0, 127, 1, 10)
, _cc_num_adjustment (1, 1, 128, 1, 10, 10)
, _cc_num_spinner (_cc_num_adjustment)
{
set_name ("AddMidiCCTrackDialog");
@ -78,8 +78,8 @@ ARDOUR::Parameter
AddMidiCCTrackDialog::parameter ()
{
int chan = _chan_spinner.get_value_as_int() - 1;
int cc_num = _cc_num_spinner.get_value_as_int();
int cc_num = _cc_num_spinner.get_value_as_int() - 1;
return Parameter(MidiCCAutomation, cc_num, chan);
return Parameter(MidiCCAutomation, chan, cc_num);
}

View File

@ -868,7 +868,7 @@ AutomationTimeAxisView::color_handler ()
int
AutomationTimeAxisView::set_state (const XMLNode& node)
{
return TimeAxisView::set_state (node);
TimeAxisView::set_state (node);
XMLNodeList kids;
XMLNodeConstIterator iter;
@ -894,6 +894,8 @@ AutomationTimeAxisView::set_state (const XMLNode& node)
if (!_marked_for_display)
hide();
return 0;
}
XMLNode*

View File

@ -286,6 +286,20 @@ MidiTimeAxisView::update_range()
}
}
void
MidiTimeAxisView::show_all_automation ()
{
if (midi_track()) {
const set<Parameter> params = midi_track()->midi_diskstream()->
midi_playlist()->contained_automation();
for (set<Parameter>::const_iterator i = params.begin(); i != params.end(); ++i)
create_automation_child(*i, true);
}
RouteTimeAxisView::show_all_automation ();
}
void
MidiTimeAxisView::show_existing_automation ()
{
@ -324,8 +338,7 @@ MidiTimeAxisView::add_controller_track()
void
MidiTimeAxisView::create_automation_child (Parameter param, bool show)
{
if (
param.type() == MidiCCAutomation ||
if ( param.type() == MidiCCAutomation ||
param.type() == MidiPgmChangeAutomation ||
param.type() == MidiPitchBenderAutomation ||
param.type() == MidiChannelAftertouchAutomation
@ -334,6 +347,10 @@ MidiTimeAxisView::create_automation_child (Parameter param, bool show)
/* FIXME: don't create AutomationList for track itself
* (not actually needed or used, since the automation is region-ey) */
AutomationTracks::iterator existing = _automation_tracks.find(param);
if (existing != _automation_tracks.end())
return;
boost::shared_ptr<AutomationControl> c
= boost::dynamic_pointer_cast<AutomationControl>(_route->control(param));
@ -343,10 +360,6 @@ MidiTimeAxisView::create_automation_child (Parameter param, bool show)
_route->add_control(c);
}
AutomationTracks::iterator existing = _automation_tracks.find(param);
if (existing != _automation_tracks.end())
return;
boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session,
_route, _route, c,
editor,

View File

@ -66,6 +66,7 @@ class MidiTimeAxisView : public RouteTimeAxisView
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
void hide ();
void show_all_automation ();
void show_existing_automation ();
void add_controller_track ();
void create_automation_child (ARDOUR::Parameter param, bool show);

View File

@ -415,6 +415,29 @@ RouteTimeAxisView::automation_click ()
automation_action_menu->popup (1, gtk_get_current_event_time());
}
int
RouteTimeAxisView::set_state (const XMLNode& node)
{
TimeAxisView::set_state (node);
XMLNodeList kids = node.children();
XMLNodeConstIterator iter;
const XMLProperty* prop;
for (iter = kids.begin(); iter != kids.end(); ++iter) {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
if ((prop = (*iter)->property ("automation-id")) != 0) {
Parameter param(prop->value());
bool show = ((prop = (*iter)->property ("shown")) != 0) && prop->value() == "yes";
create_automation_child(param, show);
} else {
warning << "Automation child has no ID" << endmsg;
}
}
}
return 0;
}
void
RouteTimeAxisView::build_automation_action_menu ()
{

View File

@ -105,6 +105,8 @@ public:
void remove_underlay (StreamView*);
void build_underlay_menu(Gtk::Menu*);
int set_state (const XMLNode&);
/* This is a bit nasty to expose :/ */
struct RouteAutomationNode {
ARDOUR::Parameter param;

View File

@ -155,7 +155,7 @@ Automatable::describe_parameter (Parameter param)
return (string_compose(_("Pan %1"), param.id() + 1));
} else if (param.type() == MidiCCAutomation) {
return string_compose("CC %1 (%2) [%3]",
param.id(), midi_name(param.id()), int(param.channel()) + 1);
param.id() + 1, midi_name(param.id()), int(param.channel()) + 1);
} else if (param.type() == MidiPgmChangeAutomation) {
return string_compose("Program [%1]", int(param.channel()) + 1);
} else if (param.type() == MidiPitchBenderAutomation) {