various fixes to get time stretching basically working again

Time domains are not well respected at present, so more work is needed here
This commit is contained in:
Paul Davis 2021-03-19 17:23:41 -06:00
parent 76e5aaea44
commit fed449d54d
4 changed files with 8 additions and 9 deletions

View File

@ -2369,7 +2369,7 @@ private:
void set_show_touched_automation (bool);
bool _show_touched_automation;
int time_fx (ARDOUR::RegionList&, float val, bool pitching);
int time_fx (ARDOUR::RegionList&, Temporal::ratio_t ratio, bool pitching);
void note_edit_done (int, EditNoteDialog*);
void toggle_sound_midi_notes ();

View File

@ -159,7 +159,7 @@ Editor::pitch_shift (RegionSelection& regions, float fraction)
* @param pitching true to pitch shift, false to time stretch.
* @return -1 in case of error, otherwise number of regions processed */
int
Editor::time_fx (RegionList& regions, float val, bool pitching)
Editor::time_fx (RegionList& regions, Temporal::ratio_t ratio, bool pitching)
{
delete current_timefx;
@ -169,7 +169,7 @@ Editor::time_fx (RegionList& regions, float val, bool pitching)
}
const timecnt_t oldlen = regions.front()->length();
const timecnt_t newlen = regions.front()->length() * val;
const timecnt_t newlen = regions.front()->length() * ratio;
const timepos_t pos = regions.front()->position ();
current_timefx = new TimeFXDialog (*this, pitching, oldlen, newlen, pos);

View File

@ -147,8 +147,7 @@ TimeFXDialog::TimeFXDialog (Editor& e, bool pitch, timecnt_t const & oldlen, tim
duration_clock->set_session (e.session());
duration_clock->set (timepos_t (new_length), true);
duration_clock->set_mode (AudioClock::BBT);
#warning NUTEMPO FIXME figure out what we are doing here
// duration_clock->set_bbt_reference (position);
duration_clock->set_bbt_reference (position);
Gtk::Alignment* clock_align = manage (new Gtk::Alignment);
clock_align->add (*duration_clock);
@ -260,14 +259,14 @@ TimeFXDialog::delete_in_progress (GdkEventAny*)
return TRUE;
}
float
Temporal::ratio_t
TimeFXDialog::get_time_fraction () const
{
if (pitching) {
return 1.0;
return Temporal::ratio_t (1, 1);
}
return duration_adjustment.get_value() / 100.0;
return Temporal::ratio_t (duration_adjustment.get_value(), 100);
}
float

View File

@ -71,7 +71,7 @@ public:
void cancel_in_progress ();
gint delete_in_progress (GdkEventAny*);
float get_time_fraction () const;
Temporal::ratio_t get_time_fraction () const;
float get_pitch_fraction () const;
void start_updates ();