summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardev_common.sh.in2
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_ops.cc120
-rw-r--r--gtk2_ardour/public_editor.h1
-rw-r--r--gtk2_ardour/rhythm_ferret.cc74
5 files changed, 85 insertions, 115 deletions
diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in
index 332efc3271..a3d41a84b3 100644
--- a/gtk2_ardour/ardev_common.sh.in
+++ b/gtk2_ardour/ardev_common.sh.in
@@ -4,7 +4,7 @@ cd `dirname "$0"`/..
export ARDOUR_PATH=gtk2_ardour/icons:gtk2_ardour/pixmaps:gtk2_ardour:.
export GTK_PATH=libs/clearlooks
-export VAMP_PATH=libs/vamp-sdk:$VAMP_PATH
+export VAMP_PATH=libs/vamp-plugins:$VAMP_PATH
export LD_LIBRARY_PATH=libs/vamp-sdk:libs/surfaces/control_protocol:libs/ardour:libs/midi++2:libs/pbd:libs/rubberband:libs/soundtouch:libs/gtkmm2ext:libs/sigc++2:libs/glibmm2:libs/gtkmm2/atk:libs/gtkmm2/pango:libs/gtkmm2/gdk:libs/gtkmm2/gtk:libs/libgnomecanvasmm:libs/libsndfile:libs/appleutility:$LD_LIBRARY_PATH
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 5ce99636db..4c5dce6fad 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -959,6 +959,8 @@ class Editor : public PublicEditor
void split_region ();
void split_region_at (nframes_t);
void split_regions_at (nframes_t, RegionSelection&);
+ void split_region_at_transients ();
+ void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, std::vector<nframes64_t>&);
void crop_region_to_selection ();
void crop_region_to (nframes_t start, nframes_t end);
void set_sync_point (nframes64_t, const RegionSelection&);
@@ -984,7 +986,6 @@ class Editor : public PublicEditor
void normalize_region ();
void denormalize_region ();
void adjust_region_scale_amplitude (bool up);
- void split_region_at_transients ();
void use_region_as_bar ();
void use_range_as_bar ();
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 6485ce356e..da6774c560 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -5019,7 +5019,7 @@ Editor::define_one_bar (nframes64_t start, nframes64_t end)
void
Editor::split_region_at_transients ()
{
- list<nframes64_t> transients;
+ vector<nframes64_t> positions;
if (!session) {
return;
@@ -5031,7 +5031,7 @@ Editor::split_region_at_transients ()
return;
}
-#if 0
+ session->begin_reversible_command (_("split regions"));
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ) {
@@ -5040,52 +5040,90 @@ Editor::split_region_at_transients ()
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;
+ if (ar && (ar->get_transients (positions) == 0)) {
+ split_region_at_points ((*i)->region(), positions);
+ positions.clear ();
}
-
- 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;
+ i = tmp;
+ }
- string new_name;
+ session->commit_reversible_command ();
- 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;
+void
+Editor::split_region_at_points (boost::shared_ptr<Region> r, vector<nframes64_t>& positions)
+{
+ boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
+
+ if (!ar) {
+ return;
+ }
+
+ boost::shared_ptr<Playlist> pl = ar->playlist();
+
+ if (!pl) {
+ return;
+ }
+
+ if (positions.empty()) {
+ return;
+ }
+
+ vector<nframes64_t>::const_iterator x;
+
+ nframes64_t pos = ar->position();
+
+ XMLNode& before (pl->get_state());
+
+ x = positions.begin();
+
+ while (x != positions.end()) {
+ if ((*x) > pos) {
+ break;
}
-
- pl->thaw ();
-
- transients.clear ();
-
- i = tmp;
}
-#endif
+
+ if (x == positions.end()) {
+ return;
+ }
+
+ pl->freeze ();
+ pl->remove_region (ar);
+
+ do {
+
+ /* file start = original start + how far we from the initial position ?
+ */
+
+ nframes64_t file_start = ar->start() + (pos - ar->position());
+
+ /* length = next position - current position
+ */
+
+ nframes64_t len = (*x) - pos;
+
+ string new_name;
+
+ if (session->region_name (new_name, ar->name())) {
+ continue;
+ }
+
+ pl->add_region (RegionFactory::create (ar->get_sources(), file_start, len, new_name), pos);
+
+ pos += len;
+
+ ++x;
+
+ } while (x != positions.end() && (*x) < ar->last_frame());
+
+ pl->thaw ();
+
+ XMLNode& after (pl->get_state());
+
+ session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
}
+
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 8e666bdf7a..cf03942e13 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -157,6 +157,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual void restore_editing_space() = 0;
virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0;
virtual void toggle_meter_updating() = 0;
+ virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, std::vector<nframes64_t>&) = 0;
sigc::signal<void> ZoomFocusChanged;
sigc::signal<void> ZoomChanged;
diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc
index a52980167f..cc771a3f15 100644
--- a/gtk2_ardour/rhythm_ferret.cc
+++ b/gtk2_ardour/rhythm_ferret.cc
@@ -207,7 +207,7 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl
t.set_threshold (detection_threshold_adjustment.get_value());
t.set_sensitivity (sensitivity_adjustment.get_value());
- if (t.run ("", readable, i, these_results)) {
+ if (t.run ("", readable.get(), i, these_results)) {
continue;
}
@@ -289,83 +289,13 @@ RhythmFerret::do_split_action ()
(*i)->get_time_axis_view().hide_temporary_lines ();
- do_region_split ((*i), current_results);
+ editor.split_region_at_points ((*i)->region(), current_results);
/* i is invalid at this point */
i = tmp;
}
- session->commit_reversible_command ();
-}
-
-void
-RhythmFerret::do_region_split (RegionView* rv, const vector<nframes64_t>& positions)
-{
- boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (rv->region());
-
- if (!ar) {
- return;
- }
-
- boost::shared_ptr<Playlist> pl = ar->playlist();
-
- if (!pl) {
- return;
- }
-
- vector<nframes64_t>::const_iterator x;
-
- nframes64_t pos = ar->position();
-
- XMLNode& before (pl->get_state());
-
- x = positions.begin();
-
- while (x != positions.end()) {
- if ((*x) > pos) {
- break;
- }
- }
-
- if (x == positions.end()) {
- return;
- }
-
- pl->freeze ();
- pl->remove_region (ar);
-
- do {
-
- /* file start = original start + how far we from the initial position ?
- */
-
- nframes64_t file_start = ar->start() + (pos - ar->position());
-
- /* length = next position - current position
- */
-
- nframes64_t len = (*x) - pos;
-
- string new_name;
-
- if (session->region_name (new_name, ar->name())) {
- continue;
- }
-
- pl->add_region (RegionFactory::create (ar->get_sources(), file_start, len, new_name), pos);
-
- pos += len;
-
- ++x;
-
- } while (x != positions.end() && (*x) < ar->last_frame());
-
- pl->thaw ();
-
- XMLNode& after (pl->get_state());
-
- session->add_command (new MementoCommand<Playlist>(*pl, &before, &after));
}
void