X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fsfdb_ui.cc;h=72cd75abb1f703f303377958cbe2dd3000074251;hb=237741d18722252abd4a6a20d3422315481ccffe;hp=899748747d690b82334a8c5809e494fd742d7a2b;hpb=59076a7e4c66db12bbbfbf01f012ca2f6ba4bf56;p=ardour.git diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 899748747d..72cd75abb1 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -21,6 +21,8 @@ #include "gtk2ardour-config.h" #endif +#include "i18n.h" + #include #include #include @@ -69,8 +71,6 @@ #include "sfdb_freesound_mootcher.h" -#include "i18n.h" - using namespace ARDOUR; using namespace PBD; using namespace std; @@ -281,7 +281,7 @@ SoundFileBox::setup_labels (const string& filename) string error_msg; - if (SMFSource::safe_midi_file_extension (path)) { + if (SMFSource::valid_midi_file (path)) { boost::shared_ptr ms = boost::dynamic_pointer_cast ( @@ -406,7 +406,7 @@ SoundFileBox::audition () boost::shared_ptr r; - if (SMFSource::safe_midi_file_extension (path)) { + if (SMFSource::valid_midi_file (path)) { boost::shared_ptr ms = boost::dynamic_pointer_cast ( @@ -474,6 +474,23 @@ SoundFileBox::audition () r = boost::dynamic_pointer_cast (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); } @@ -1309,7 +1326,7 @@ SoundFileOmega::reset_options () /* See if we are thinking about importing any MIDI files */ vector::iterator i = paths.begin (); - while (i != paths.end() && SMFSource::safe_midi_file_extension (*i) == false) { + while (i != paths.end() && SMFSource::valid_midi_file (*i) == false) { ++i; } bool const have_a_midi_file = (i != paths.end ()); @@ -1537,7 +1554,7 @@ SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& src_needed = true; } - } else if (SMFSource::safe_midi_file_extension (*i)) { + } else if (SMFSource::valid_midi_file (*i)) { Evoral::SMF reader; reader.open(*i); @@ -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 (_("Add files as ...")); @@ -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 {