prototype online self-automating LV2 plugin interface
[ardour.git] / gtk2_ardour / main.cc
index f43d1bd4f471cb3f11a3d2d78778f15bbc254254..6a8347fb1d14d60252857b68778d71140bce60d5 100644 (file)
 #include <cstdlib>
 #include <signal.h>
 #include <cerrno>
-#include <fstream>
 #include <vector>
 
 #include <sigc++/bind.h>
 #include <gtkmm/settings.h>
 
+#ifdef HAVE_FFTW35F
+#include <fftw3.h>
+#endif
+
 #include "pbd/error.h"
 #include "pbd/file_utils.h"
 #include "pbd/textreceiver.h"
@@ -48,6 +51,7 @@
 #include <gtkmm2ext/utils.h>
 
 #include "ardour_ui.h"
+#include "ui_config.h"
 #include "opts.h"
 #include "enums.h"
 #include "bundle_env.h"
@@ -99,6 +103,28 @@ gui_jack_error ()
        win.run ();
 }
 
+#ifndef NDEBUG
+static void ardour_g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
+       switch (log_level) {
+               case G_LOG_FLAG_FATAL:
+               case G_LOG_LEVEL_CRITICAL:
+                       fatal << "g_log: " << message << endmsg;
+                       break;
+               case G_LOG_LEVEL_ERROR:
+                       error << "g_log: " << message << endmsg;
+                       break;
+               case G_LOG_LEVEL_WARNING:
+                       warning << "g_log: " << message << endmsg;
+                       break;
+               case G_LOG_LEVEL_MESSAGE:
+               case G_LOG_LEVEL_INFO:
+               default:
+                       info << "g_log: " << message << endmsg;
+                       break;
+       }
+}
+#endif
+
 static gboolean
 tell_about_backend_death (void* /* ignored */)
 {
@@ -261,6 +287,10 @@ int main (int argc, char *argv[])
                Glib::thread_init();
        }
 
+#ifdef HAVE_FFTW35F
+       fftwf_make_planner_thread_safe ();
+#endif
+
 #ifdef ENABLE_NLS
        gtk_set_locale ();
 #endif
@@ -345,20 +375,24 @@ int main (int argc, char *argv[])
        }
 #endif
 
-       UIConfiguration* ui_config = new UIConfiguration;
-
-       if (ui_config->pre_gui_init ()) {
+       if (UIConfiguration::instance().pre_gui_init ()) {
                error << _("Could not complete pre-GUI initialization") << endmsg;
                exit (1);
        }
-       
+
        try {
-               ui = new ARDOUR_UI (&argc, &argv, localedir.c_str(), ui_config);
+               ui = new ARDOUR_UI (&argc, &argv, localedir.c_str());
        } catch (failed_constructor& err) {
                error << string_compose (_("could not create %1 GUI"), PROGRAM_NAME) << endmsg;
                exit (1);
        }
 
+#ifndef NDEBUG
+       g_log_set_handler (NULL,
+                       GLogLevelFlags (G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL |  G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_RECURSION),
+                       &ardour_g_log, NULL);
+#endif
+
        ui->run (text_receiver);
        Gtkmm2ext::Application::instance()->cleanup();
        delete ui;