Patch from colinf to add tape-style region stretching via rubberband. Fixes #3075.

git-svn-id: svn://localhost/ardour2/branches/3.0@7620 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-08-13 16:50:29 +00:00
parent 5524e377a2
commit d62f7e1c72
4 changed files with 39 additions and 15 deletions

View file

@ -201,6 +201,7 @@ static const gchar *_rb_opt_strings[] = {
N_("Unpitched percussion with stable notes"), N_("Unpitched percussion with stable notes"),
N_("Crisp monophonic instrumental"), N_("Crisp monophonic instrumental"),
N_("Unpitched solo percussion"), N_("Unpitched solo percussion"),
N_("Resample without preserving pitch"),
0 0
}; };
#endif #endif
@ -329,6 +330,7 @@ Editor::Editor ()
edit_point_strings = I18N (_edit_point_strings); edit_point_strings = I18N (_edit_point_strings);
#ifdef USE_RUBBERBAND #ifdef USE_RUBBERBAND
rb_opt_strings = I18N (_rb_opt_strings); rb_opt_strings = I18N (_rb_opt_strings);
rb_current_opt = 4;
#endif #endif
snap_threshold = 5.0; snap_threshold = 5.0;

View file

@ -221,6 +221,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
#ifdef USE_RUBBERBAND #ifdef USE_RUBBERBAND
std::vector<std::string> rb_opt_strings; std::vector<std::string> rb_opt_strings;
int rb_current_opt;
#endif #endif
/* things that need to be public to be used in the main menubar */ /* things that need to be public to be used in the main menubar */

View file

@ -171,21 +171,42 @@ Editor::time_fx (RegionSelection& regions, float val, bool pitching)
txt = current_timefx->stretch_opts_selector.get_active_text (); txt = current_timefx->stretch_opts_selector.get_active_text ();
if (txt == rb_opt_strings[0]) { for (int i = 0; i <= 6; i++) {
transients = NoTransients; peaklock = false; longwin = true; shortwin = false; if (txt == rb_opt_strings[i]) {
} else if (txt == rb_opt_strings[1]) { rb_current_opt = i;
transients = NoTransients; peaklock = false; longwin = false; shortwin = false; break;
} else if (txt == rb_opt_strings[2]) { }
transients = NoTransients; peaklock = true; longwin = false; shortwin = false;
} else if (txt == rb_opt_strings[3]) {
transients = BandLimitedTransients; peaklock = true; longwin = false; shortwin = false;
} else if (txt == rb_opt_strings[5]) {
transients = Transients; peaklock = false; longwin = false; shortwin = true;
} else {
/* default/4 */
transients = Transients; peaklock = true; longwin = false; shortwin = false;
} }
switch (rb_current_opt) {
case 0:
transients = NoTransients; peaklock = false; longwin = true; shortwin = false;
break;
case 1:
transients = NoTransients; peaklock = false; longwin = false; shortwin = false;
break;
case 2:
transients = NoTransients; peaklock = true; longwin = false; shortwin = false;
break;
case 3:
transients = BandLimitedTransients; peaklock = true; longwin = false; shortwin = false;
break;
case 5:
transients = Transients; peaklock = false; longwin = false; shortwin = true;
break;
case 6:
transients = NoTransients;
precise = true;
preserve_formants = false;
current_timefx->request.pitch_fraction = 1/val;
shortwin = true;
// peaklock = false;
break;
default:
/* default/4 */
transients = Transients; peaklock = true; longwin = false; shortwin = false;
break;
};
if (realtime) options |= RubberBandStretcher::OptionProcessRealTime; if (realtime) options |= RubberBandStretcher::OptionProcessRealTime;
if (precise) options |= RubberBandStretcher::OptionStretchPrecise; if (precise) options |= RubberBandStretcher::OptionStretchPrecise;

View file

@ -145,7 +145,7 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch)
set_popdown_strings (stretch_opts_selector, editor.rb_opt_strings); set_popdown_strings (stretch_opts_selector, editor.rb_opt_strings);
/* set default */ /* set default */
stretch_opts_selector.set_active_text (editor.rb_opt_strings[4]); stretch_opts_selector.set_active_text (editor.rb_opt_strings[editor.rb_current_opt]);
table->attach (stretch_opts_selector, 2, 3, 0, 1, Gtk::FILL, Gtk::EXPAND & Gtk::FILL, 0, 0); table->attach (stretch_opts_selector, 2, 3, 0, 1, Gtk::FILL, Gtk::EXPAND & Gtk::FILL, 0, 0);
table->attach (precise_button, 1, 3, 1, 2, Gtk::FILL, Gtk::EXPAND, 0, 0); table->attach (precise_button, 1, 3, 1, 2, Gtk::FILL, Gtk::EXPAND, 0, 0);