#include <sys/time.h>
#include <errno.h>
#include <unistd.h>
+#include <algorithm>
#include <sndfile.h>
build_interthread_progress_window ();
}
-
if (chns == Editing::ImportMergeFiles) {
/* create 1 region from all paths, add to 1 track,
ignore "track"
interthread_progress_window->set_title (title.get_string());
interthread_progress_window->set_position (Gtk::WIN_POS_MOUSE);
- interthread_progress_window->show_all ();
interthread_progress_bar.set_fraction (0.0f);
interthread_cancel_label.set_text (_("Cancel Import"));
current_interthread_info = &import_status;
import_status.replace_existing_source = replace;
interthread_progress_connection = Glib::signal_timeout().connect
- (bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 100);
+ (bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 500);
track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
ARDOUR_UI::instance()->flush_pending ();
gint
Editor::import_progress_timeout (void *arg)
{
+ bool reset = false;
+
+ if (!interthread_progress_window->is_visible()) {
+ interthread_progress_window->show_all ();
+ reset = true;
+ }
+
interthread_progress_label.set_text (import_status.doing_what);
if (import_status.freeze) {
interthread_progress_bar.pulse ();
return FALSE;
} else {
- interthread_progress_bar.set_fraction (import_status.progress);
+ float val = import_status.progress;
+ interthread_progress_bar.set_fraction (min (max (0.0f, val), 1.0f));
}
- return !(import_status.done || import_status.cancel);
+ if (reset) {
+
+ /* the window is now visible, speed up the updates */
+
+ interthread_progress_connection.disconnect ();
+ interthread_progress_connection = Glib::signal_timeout().connect
+ (bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 100);
+ return false;
+ } else {
+ return !(import_status.done || import_status.cancel);
+ }
}
af.SetClientFormat (client_format);
} catch (CAXException& cax) {
- error << string_compose ("CoreAudioSource: %1 (%2)", cax.mOperation, name()) << endmsg;
+
+ error << string_compose(_("CoreAudioSource: cannot open file \"%1\" for %2"),
+ _path, (writable() ? "read+write" : "reading")) << endmsg;
throw failed_constructor ();
}
}
if ((sf = sf_open (_path.c_str(), (writable() ? SFM_RDWR : SFM_READ), &_info)) == 0) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
+#ifndef HAVE_COREAUDIO
+ /* if we have CoreAudio, we will be falling back to that if libsndfile fails,
+ so we don't want to see this message.
+ */
+
error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"),
_path, (writable() ? "read+write" : "reading"), errbuf) << endmsg;
+#endif
return -1;
}
if (_channel >= _info.channels) {
+#ifndef HAVE_COREAUDIO
error << string_compose(_("SndFileSource: file only contains %1 channels; %2 is invalid as a channel number"), _info.channels, _channel) << endmsg;
+#endif
sf_close (sf);
sf = 0;
return -1;