Reduce coupling between Plugin and PluginInsert.
[ardour.git] / libs / ardour / audioengine.cc
index 731336262293629a4689ee37ff0a2fbf2624fd82..076700cebfec5a8445d0c473b65c36e3d2eb4618 100644 (file)
@@ -115,23 +115,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)
 {
@@ -693,7 +676,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 +700,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;
 }