Demote message about empty MIDI tracks to info.
[ardour.git] / libs / ardour / audioengine.cc
index 731336262293629a4689ee37ff0a2fbf2624fd82..9861fcc60882626f1ce7eb9efaf25a1b83fc7326 100644 (file)
@@ -101,6 +101,9 @@ AudioEngine::~AudioEngine ()
        stop_metering_thread ();
        stop_hw_event_processing();
        drop_backend ();
+       for (BackendMap::const_iterator i = _backends.begin(); i != _backends.end(); ++i) {
+               i->second->deinstantiate();
+       }
 }
 
 AudioEngine*
@@ -115,23 +118,6 @@ AudioEngine::create ()
        return _instance;
 }
 
-void
-_thread_init_callback (void * /*arg*/)
-{
-       /* make sure that anybody who needs to know about this thread
-          knows about it.
-       */
-
-       pthread_set_name (X_("audioengine"));
-
-       PBD::notify_gui_about_thread_creation ("gui", pthread_self(), X_("Audioengine"), 4096);
-       PBD::notify_gui_about_thread_creation ("midiui", pthread_self(), X_("Audioengine"), 128);
-
-       SessionEvent::create_per_thread_pool (X_("Audioengine"), 512);
-
-       AsyncMIDIPort::set_process_thread (pthread_self());
-}
-
 void
 AudioEngine::split_cycle (pframes_t offset)
 {
@@ -341,11 +327,9 @@ AudioEngine::process_callback (pframes_t nframes)
        */
 
        if (_freewheeling && !Freewheel.empty()) {
-                Freewheel (nframes);
+               Freewheel (nframes);
        } else {
-               if (_session) {
-                       _session->process (nframes);
-               }
+               _session->process (nframes);
        }
 
        if (_freewheeling) {
@@ -693,7 +677,15 @@ AudioEngine::discover_backends ()
 AudioBackendInfo*
 AudioEngine::backend_discover (const string& path)
 {
+#ifdef PLATFORM_WINDOWS
+       // do not show popup dialog (e.g. missing libjack.dll)
+       // win7+ should use SetThreadErrorMode()
+       SetErrorMode(SEM_FAILCRITICALERRORS);
+#endif
        Glib::Module module (path);
+#ifdef PLATFORM_WINDOWS
+       SetErrorMode(0); // reset to system default
+#endif
        AudioBackendInfo* info;
        AudioBackendInfo* (*dfunc)(void);
        void* func = 0;
@@ -709,11 +701,14 @@ AudioEngine::backend_discover (const string& path)
                error << Glib::Module::get_last_error() << endmsg;
                return 0;
        }
-
-       module.make_resident ();
        
        dfunc = (AudioBackendInfo* (*)(void))func;
        info = dfunc();
+       if (!info->available()) {
+               return 0;
+       }
+
+       module.make_resident ();
        
        return info;
 }