diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-01-26 02:57:10 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-01-26 02:57:10 +0000 |
commit | 1e51f099fd7baef957204d46bee302908d65de6b (patch) | |
tree | efc8fbf95a139ee90508ad6f6ea17ab652457c5a /gtk2_ardour | |
parent | 315dd3d7705d314b935a7a35007347a41e0f9bfd (diff) |
first pass attempt at tab-to-transient (to be improved)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2970 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour.menus | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/rhythm_ferret.cc | 2 |
5 files changed, 64 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 87e300de0b..bcf4ada3e7 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -44,6 +44,9 @@ <menuitem action='GotoStart'/> <menuitem action='GotoEnd'/> <separator/> + <menuitem action='tab-to-transient-forwards'/> + <menuitem action='tab-to-transient-backwards'/> + <separator/> <menuitem action='Record'/> <separator/> <menuitem action='TransitionToRoll'/> diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 4c5dce6fad..2b89163687 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -987,6 +987,8 @@ class Editor : public PublicEditor void denormalize_region (); void adjust_region_scale_amplitude (bool up); + void tab_to_transient (bool forward); + void use_region_as_bar (); void use_range_as_bar (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 09414c66ef..8ec21850c1 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -369,6 +369,12 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret"), mem_fun(*this, &Editor::show_rhythm_ferret)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), true)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "tab-to-transient-backwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), false)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index da6774c560..2755fcc764 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5127,3 +5127,55 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, vector<nframes64_t> session->add_command (new MementoCommand<Playlist>(*pl, &before, &after)); } +void +Editor::tab_to_transient (bool forward) +{ + + vector<nframes64_t> positions; + + if (!session) { + return; + } + + ExclusiveRegionSelection esr (*this, entered_regionview); + + if (selection->regions.empty()) { + return; + } + + boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (selection->regions.front()->region()); + + if (!ar) { + return; + } + + ar->get_transients (positions); + nframes64_t pos = session->audible_frame (); + + if (forward) { + vector<nframes64_t>::iterator x; + + for (x = positions.begin(); x != positions.end(); ++x) { + if ((*x) > pos) { + break; + } + } + + if (x != positions.end ()) { + session->request_locate (*x); + } + + } else { + vector<nframes64_t>::reverse_iterator x; + + for (x = positions.rbegin(); x != positions.rend(); ++x) { + if ((*x) < pos) { + break; + } + } + + if (x != positions.rend ()) { + session->request_locate (*x); + } + } +} diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc index cc771a3f15..4cdb408076 100644 --- a/gtk2_ardour/rhythm_ferret.cc +++ b/gtk2_ardour/rhythm_ferret.cc @@ -222,7 +222,7 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl results.insert (results.end(), these_results.begin(), these_results.end()); } - if (!results.empty() && (existing_results || readable->n_channels() > 1)) { + if (!results.empty()) { /* now resort to bring transients from different channels together */ |