Factor out grid beat divisions.
[ardour.git] / gtk2_ardour / sfdb_ui.cc
index 9ef39d0aaa95a9e89c4b6959602137a6de263b1b..d6ba793c2f943ca5a0e5916e6c4d89232d8ab6f7 100644 (file)
@@ -68,6 +68,7 @@
 #include "gain_meter.h"
 #include "main_clock.h"
 #include "public_editor.h"
+#include "timers.h"
 
 #include "sfdb_freesound_mootcher.h"
 
@@ -283,10 +284,15 @@ SoundFileBox::setup_labels (const string& filename)
 
        if (SMFSource::valid_midi_file (path)) {
 
-               boost::shared_ptr<SMFSource> ms =
-                       boost::dynamic_pointer_cast<SMFSource> (
-                                       SourceFactory::createExternal (DataType::MIDI, *_session,
-                                                                                        path, 0, Source::Flag (0), false));
+               boost::shared_ptr<SMFSource> ms;
+               try {
+                       ms = boost::dynamic_pointer_cast<SMFSource> (
+                               SourceFactory::createExternal (DataType::MIDI, *_session,
+                                                              path, 0, Source::Flag (0), false));
+               } catch (const std::exception& e) {
+                       error << string_compose(_("Could not read file: %1 (%2)."),
+                                               path, e.what()) << endmsg;
+               }
 
                preview_label.set_markup (_("<b>Midi File Information</b>"));
 
@@ -851,7 +857,7 @@ SoundFileBrowser::remove_gain_meter ()
 void
 SoundFileBrowser::start_metering ()
 {
-       metering_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun(*this, &SoundFileBrowser::meter));
+       metering_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &SoundFileBrowser::meter));
 }
 
 void