tempo match midi auditioning - #5881
This commit is contained in:
parent
07d5a389fa
commit
1374501727
|
@ -474,6 +474,23 @@ SoundFileBox::audition ()
|
|||
r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
|
||||
}
|
||||
|
||||
frameoffset_t audition_position = 0;
|
||||
switch(_import_position) {
|
||||
case ImportAtTimestamp:
|
||||
audition_position = 0;
|
||||
break;
|
||||
case ImportAtPlayhead:
|
||||
audition_position = _session->transport_frame();
|
||||
break;
|
||||
case ImportAtStart:
|
||||
audition_position = _session->current_start_frame();
|
||||
break;
|
||||
case ImportAtEditPoint:
|
||||
audition_position = PublicEditor::instance().get_preferred_edit_position ();
|
||||
break;
|
||||
}
|
||||
r->set_position(audition_position);
|
||||
|
||||
_session->audition_region(r);
|
||||
}
|
||||
|
||||
|
@ -1662,6 +1679,7 @@ SoundFileOmega::SoundFileOmega (string title, ARDOUR::Session* s,
|
|||
str.push_back (_("session start"));
|
||||
set_popdown_strings (where_combo, str);
|
||||
where_combo.set_active_text (str.front());
|
||||
where_combo.signal_changed().connect (sigc::mem_fun (*this, &SoundFileOmega::where_combo_changed));
|
||||
|
||||
Label* l = manage (new Label);
|
||||
l->set_markup (_("<b>Add files as ...</b>"));
|
||||
|
@ -1855,6 +1873,12 @@ SoundFileOmega::src_combo_changed()
|
|||
preview.set_src_quality(get_src_quality());
|
||||
}
|
||||
|
||||
void
|
||||
SoundFileOmega::where_combo_changed()
|
||||
{
|
||||
preview.set_import_position(get_position());
|
||||
}
|
||||
|
||||
ImportDisposition
|
||||
SoundFileOmega::get_channel_disposition () const
|
||||
{
|
||||
|
|
|
@ -71,6 +71,7 @@ class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr, public P
|
|||
bool audition_oneshot();
|
||||
bool autoplay () const;
|
||||
void set_src_quality(ARDOUR::SrcQuality q) { _src_quality = q; }
|
||||
void set_import_position(Editing::ImportPosition p) { _import_position = p; }
|
||||
|
||||
protected:
|
||||
std::string path;
|
||||
|
@ -119,6 +120,7 @@ class SoundFileBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr, public P
|
|||
bool seek_button_release(GdkEventButton*);
|
||||
bool _seeking;
|
||||
ARDOUR::SrcQuality _src_quality;
|
||||
Editing::ImportPosition _import_position;
|
||||
};
|
||||
|
||||
class SoundFileBrowser : public ArdourWindow
|
||||
|
@ -316,6 +318,7 @@ class SoundFileOmega : public SoundFileBrowser
|
|||
void reset_options_noret ();
|
||||
bool bad_file_message ();
|
||||
void src_combo_changed ();
|
||||
void where_combo_changed ();
|
||||
|
||||
void do_something (int action);
|
||||
};
|
||||
|
|
|
@ -136,6 +136,7 @@ class LIBARDOUR_API Auditioner : public Track
|
|||
static void *_drop_ports (void *);
|
||||
void actually_drop_ports ();
|
||||
void output_changed (IOChange, void*);
|
||||
frameoffset_t _import_position;
|
||||
};
|
||||
|
||||
}; /* namespace ARDOUR */
|
||||
|
|
|
@ -53,6 +53,7 @@ Auditioner::Auditioner (Session& s)
|
|||
, _synth_added (false)
|
||||
, _synth_changed (false)
|
||||
, _queue_panic (false)
|
||||
, _import_position (0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -370,6 +371,7 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
|||
_synth_added = false;
|
||||
}
|
||||
midi_region.reset();
|
||||
_import_position = 0;
|
||||
|
||||
/* copy it */
|
||||
the_region = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (region));
|
||||
|
@ -399,13 +401,14 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
|||
_midi_audition = true;
|
||||
set_diskstream(_diskstream_midi);
|
||||
the_region.reset();
|
||||
_import_position = region->position();
|
||||
|
||||
/* copy it */
|
||||
midi_region = (boost::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (region)));
|
||||
midi_region->set_position (0);
|
||||
midi_region->set_position (_import_position);
|
||||
|
||||
_diskstream->playlist()->drop_regions ();
|
||||
_diskstream->playlist()->add_region (midi_region, 0, 1);
|
||||
_diskstream->playlist()->add_region (midi_region, _import_position, 1);
|
||||
midi_diskstream()->reset_tracker();
|
||||
|
||||
ProcessorStreams ps;
|
||||
|
@ -457,7 +460,7 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
|||
|
||||
if (_midi_audition) {
|
||||
length = midi_region->length();
|
||||
offset = midi_region->sync_offset (dir);
|
||||
offset = _import_position + midi_region->sync_offset (dir);
|
||||
} else {
|
||||
length = the_region->length();
|
||||
offset = the_region->sync_offset (dir);
|
||||
|
@ -527,7 +530,7 @@ Auditioner::play_audition (framecnt_t nframes)
|
|||
}
|
||||
|
||||
if (!_seeking) {
|
||||
AuditionProgress(current_frame, length); /* emit */
|
||||
AuditionProgress(current_frame - _import_position, length); /* emit */
|
||||
}
|
||||
|
||||
if (current_frame >= length) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user