diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index a253b180b4..a8318ff03f 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -111,6 +111,10 @@ #include "LuaBridge/LuaBridge.h" +#ifdef PLATFORM_WINDOWS +#include "pbd/windows_mmcss.h" +#endif + #ifdef WINDOWS_VST_SUPPORT #include #endif @@ -335,6 +339,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , last_configure_time (0) , last_peak_grab (0) , have_disk_speed_dialog_displayed (false) + , have_mmcss_error_dialog_displayed (false) , _status_bar_visibility (X_("status-bar")) , _log_not_acknowledged (LogLevelNone) , duplicate_routes_dialog (0) @@ -421,6 +426,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) ARDOUR::Session::VersionMismatch.connect (forever_connections, MISSING_INVALIDATOR, std::bind (&ARDOUR_UI::session_format_mismatch, this, _1, _2), gui_context()); +#ifdef PLATFORM_WINDOWS + PBD::MMCSS::MMCSSError.connect (forever_connections, MISSING_INVALIDATOR, std::bind (&ARDOUR_UI::mmcss_error_handler, this), gui_context()); +#endif + /* handle dialog requests */ ARDOUR::Session::Dialog.connect (forever_connections, MISSING_INVALIDATOR, std::bind (&ARDOUR_UI::session_dialog, this, _1), gui_context()); @@ -575,6 +584,7 @@ ARDOUR_UI::engine_stopped () ActionManager::set_sensitive (ActionManager::engine_opposite_sensitive_actions, true); update_sample_rate (); update_cpu_load (); + have_mmcss_error_dialog_displayed = false; } void @@ -2963,6 +2973,33 @@ ARDOUR_UI::disk_speed_dialog_gone (int /*ignored_response*/, MessageDialog* msg) delete msg; } +void +ARDOUR_UI::mmcss_error_handler () +{ + ENSURE_GUI_THREAD (*this, &ARDOUR_UI::mmcss_error_handler) + + if (!have_mmcss_error_dialog_displayed) { + have_mmcss_error_dialog_displayed = true; + ArdourMessageDialog msg (_("MMCSS priority can not be set!\n\n" + "Windows Multimedia Class Scheduler Service (MCSS) is used for time-critical audio processing. " + "By default, Microsoft has limited the number of MMCSS threads to 32, and this limit has been reached.\n\n" + "You can reduce the number of process threads in Preferences > Performance, but that may be insufficient, " + "because MCSS threads are also used for Audio and MIDI I/O.\n" + "One solution is to increase the number of available MCSS threads by modifying the windows registry. " + "A tool to do that conveniently can be found here."), + true, MESSAGE_ERROR); + + for (auto const& w: msg.get_message_area ()->get_children ()) { + Gtk::Label* l = dynamic_cast (w); + if (l) { + l->property_track_visited_links() = false; + l->signal_activate_link().connect ([](std::string const& url) { std::cout << url << "\n"; return PBD::open_uri (url); }, false); + } + } + msg.run (); + } +} + void ARDOUR_UI::session_dialog (std::string msg) { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 362b666426..abb5b4f620 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -765,6 +765,8 @@ private: void disk_speed_dialog_gone (int ignored_response, Gtk::MessageDialog*); void disk_overrun_handler (); void disk_underrun_handler (); + bool have_mmcss_error_dialog_displayed; + void mmcss_error_handler (); void session_format_mismatch (std::string, std::string);