diff options
author | David Robillard <d@drobilla.net> | 2008-02-19 03:24:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-19 03:24:44 +0000 |
commit | 012292b4bdf5bf843232243852b39e8892b837de (patch) | |
tree | cddefe42aab1301df0677d652d37ba757894d97b /gtk2_ardour | |
parent | b79d5bfad3473f54ab24c0b7852fc4bfc9d9ebb0 (diff) |
Less crash-happy MIDI reading on weird MIDI files.
Make "show existing automation" create/show automation tracks for all contained CC in MIDI tracks.
Fix staggered time when importing multi-track MIDI files.
git-svn-id: svn://localhost/ardour2/branches/3.0@3086 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.h | 1 |
4 files changed, 27 insertions, 4 deletions
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 14439f54a6..4d4ab99046 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -529,7 +529,7 @@ Editor::register_actions () /* the next two are duplicate items with different names for use in two different contexts */ - ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Media"), mem_fun (*this, &Editor::external_audio_dialog)); + ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Import Existing Media"), mem_fun (*this, &Editor::external_audio_dialog)); act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Add External Media"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 3e1cf4f648..e13eb81181 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -734,7 +734,9 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64 } } - cout << "TARGET REGIONS: " << target_regions << endl; + // kludge (for MIDI we're abusing "channel" for "track" here) + if (paths.front().rfind(".mid") != Glib::ustring::npos) + target_regions = -1; if (target_regions == 1) { diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index cb72363f88..2c7429c85a 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -262,7 +262,8 @@ MidiTimeAxisView::set_note_range(MidiStreamView::VisibleNoteRange range) void -MidiTimeAxisView::update_range() { +MidiTimeAxisView::update_range() +{ MidiGhostRegion* mgr; for(list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { @@ -272,6 +273,20 @@ MidiTimeAxisView::update_range() { } } +void +MidiTimeAxisView::show_existing_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_existing_automation (); +} + /** Prompt for a controller with a dialog and add an automation track for it */ void @@ -298,7 +313,8 @@ MidiTimeAxisView::create_automation_child (Parameter param, bool show) { if (param.type() == MidiCCAutomation) { - /* FIXME: don't create AutomationList for track itself */ + /* FIXME: don't create AutomationList for track itself + * (not actually needed or used, since the automation is region-ey) */ boost::shared_ptr<AutomationControl> c = _route->control(param); @@ -308,6 +324,10 @@ 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, diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index efc987760b..a91bd01d21 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -65,6 +65,7 @@ class MidiTimeAxisView : public RouteTimeAxisView guint32 show_at (double y, int& nth, Gtk::VBox *parent); void hide (); + void show_existing_automation (); void add_controller_track (); void create_automation_child (ARDOUR::Parameter param, bool show); |