summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-01-25 05:35:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-01-25 05:35:46 +0000
commitd3f64c28489d2358498b9d7dcfc6fa4228ebd63e (patch)
tree8195496c9330bb4fb279d282598da6dc5c98a361 /gtk2_ardour/editor_ops.cc
parent28e6ad009158ddaea80fd5d800befcbf58ce47ee (diff)
meet rhythm ferret: cute, furry and always on time (ardour build now requires fftw3 & fftw3f, no exceptions, ever)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2959 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc82
1 files changed, 82 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index f960f27d0f..0e725aeda2 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -43,10 +43,12 @@
#include <ardour/location.h>
#include <ardour/named_selection.h>
#include <ardour/audio_track.h>
+#include <ardour/audiofilesource.h>
#include <ardour/audioplaylist.h>
#include <ardour/region_factory.h>
#include <ardour/playlist_factory.h>
#include <ardour/reverse.h>
+#include <ardour/transient_detector.h>
#include <ardour/dB.h>
#include "ardour_ui.h"
@@ -5013,3 +5015,83 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after));
commit_reversible_command ();
}
+
+void
+Editor::split_region_at_transients ()
+{
+ list<nframes64_t> transients;
+
+ if (!session) {
+ return;
+ }
+
+ ExclusiveRegionSelection esr (*this, entered_regionview);
+
+ if (selection->regions.empty()) {
+ return;
+ }
+
+ show_rhythm_ferret ();
+ return;
+#if 0
+
+ cerr << "selection size is " << selection->regions.size() << endl;
+
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ) {
+
+ RegionSelection::iterator tmp;
+
+ tmp = i;
+ ++tmp;
+
+ cerr << "working on " << (*i)->get_item_name() << endl;
+
+ boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> ((*i)->region());
+
+ if (!ar) {
+ continue;
+ }
+
+ boost::shared_ptr<Playlist> pl = ar->playlist();
+
+ if (!pl) {
+ continue;
+ }
+
+ cerr << "getting transients\n";
+
+ ar->get_transients (transients);
+ nframes64_t start = ar->start();
+ nframes64_t pos = ar->position();
+
+ pl->freeze ();
+ pl->remove_region (ar);
+
+ cerr << "creating new regions from " << transients.size() << " transients\n";
+
+ for (list<nframes64_t>::iterator x = transients.begin(); x != transients.end(); ++x) {
+
+ nframes_t len = (*x) - start;
+
+ string new_name;
+
+ if (session->region_name (new_name, ar->name())) {
+ continue;
+ }
+
+ pl->add_region (RegionFactory::create (ar->get_sources(), start, len, new_name), pos);
+
+ start = (*x);
+ pos += len;
+ }
+
+ pl->thaw ();
+
+ transients.clear ();
+
+ cerr << "done with that one\n";
+
+ i = tmp;
+ }
+#endif
+}