UI limitations for mp3 import

This commit is contained in:
Robin Gareus 2019-12-06 18:11:19 +01:00
parent d0b6c437ce
commit c5e46ffd30
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 16 additions and 4 deletions

View file

@ -649,6 +649,13 @@ Editor::embed_sndfiles (vector<string> paths,
return -3; return -3;
} }
if (!finfo.seekable) {
MessageDialog msg ( string_compose ( _("%1\nThis audiofile cannot be embedded. It must be imported!"), short_path (path, 40)), false, Gtk::MESSAGE_ERROR);
msg.set_position (WIN_POS_MOUSE);
msg.run ();
return -2;
}
if (check_sample_rate && (finfo.samplerate != (int) _session->sample_rate())) { if (check_sample_rate && (finfo.samplerate != (int) _session->sample_rate())) {
vector<string> choices; vector<string> choices;

View file

@ -1434,6 +1434,7 @@ SoundFileOmega::reset_options ()
bool same_size; bool same_size;
bool src_needed; bool src_needed;
bool must_copy;
bool selection_includes_multichannel; bool selection_includes_multichannel;
bool selection_can_be_embedded_with_links = check_link_status (_session, paths); bool selection_can_be_embedded_with_links = check_link_status (_session, paths);
ImportMode mode; ImportMode mode;
@ -1445,7 +1446,7 @@ SoundFileOmega::reset_options ()
} }
bool const have_a_midi_file = (i != paths.end ()); bool const have_a_midi_file = (i != paths.end ());
if (check_info (paths, same_size, src_needed, selection_includes_multichannel)) { if (check_info (paths, same_size, src_needed, selection_includes_multichannel, must_copy)) {
Glib::signal_idle().connect (sigc::mem_fun (*this, &SoundFileOmega::bad_file_message)); Glib::signal_idle().connect (sigc::mem_fun (*this, &SoundFileOmega::bad_file_message));
return false; return false;
} }
@ -1606,7 +1607,7 @@ SoundFileOmega::reset_options ()
/* We must copy MIDI files or those from Freesound /* We must copy MIDI files or those from Freesound
* or any file if we are under nsm control */ * or any file if we are under nsm control */
bool const must_copy = _session->get_nsm_state() || have_a_midi_file || notebook.get_current_page() == 2; must_copy |= _session->get_nsm_state() || have_a_midi_file || notebook.get_current_page() == 2;
if (UIConfiguration::instance().get_only_copy_imported_files()) { if (UIConfiguration::instance().get_only_copy_imported_files()) {
@ -1648,7 +1649,7 @@ SoundFileOmega::bad_file_message()
} }
bool bool
SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool& src_needed, bool& multichannel) SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool& src_needed, bool& multichannel, bool& must_copy)
{ {
SoundFileInfo info; SoundFileInfo info;
samplepos_t sz = 0; samplepos_t sz = 0;
@ -1658,6 +1659,7 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
same_size = true; same_size = true;
src_needed = false; src_needed = false;
multichannel = false; multichannel = false;
must_copy = false;
for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
@ -1676,6 +1678,9 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
if (info.samplerate != _session->sample_rate()) { if (info.samplerate != _session->sample_rate()) {
src_needed = true; src_needed = true;
} }
if (!info.seekable) {
must_copy = true;
}
} else if (SMFSource::valid_midi_file (*i)) { } else if (SMFSource::valid_midi_file (*i)) {

View file

@ -325,7 +325,7 @@ private:
Gtk::VBox block_four; Gtk::VBox block_four;
bool check_info (const std::vector<std::string>& paths, bool check_info (const std::vector<std::string>& paths,
bool& same_size, bool& src_needed, bool& multichannel); bool& same_size, bool& src_needed, bool& multichannel, bool& must_copy);
static bool check_link_status (const ARDOUR::Session*, const std::vector<std::string>& paths); static bool check_link_status (const ARDOUR::Session*, const std::vector<std::string>& paths);