From d89b54d768b62a2e12041ab8b4cb8f6064d813e0 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Wed, 14 Jan 2015 14:33:21 -0500 Subject: [PATCH] Add CPU prioritization support for Windows --- plugins/vst_base/RemoteVstPlugin.cpp | 7 +++++++ src/core/main.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index fdea04b5c..234b89acd 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -1877,6 +1877,13 @@ int main( int _argc, char * * _argv ) #endif #endif +#ifdef LMMS_BUILD_WIN32 + if( !SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ) ) + { + printf( "Notice: could not set high priority.\n" ); + } +#endif + // constructor automatically will process messages until it receives // a IdVstLoadPlugin message and processes it __plugin = new RemoteVstPlugin( atoi( _argv[1] ), atoi( _argv[2] ) ); diff --git a/src/core/main.cpp b/src/core/main.cpp index b191b9c7c..e9f691f51 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -48,6 +48,10 @@ #include #include +#ifdef LMMS_BUILD_WIN32 +#include +#endif + #ifdef LMMS_HAVE_SCHED_H #include #endif @@ -422,6 +426,13 @@ int main( int argc, char * * argv ) #endif #endif +#ifdef LMMS_BUILD_WIN32 + if( !SetPriorityClass( GetCurrentProcess(), HIGH_PRIORITY_CLASS ) ) + { + printf( "Notice: could not set high priority.\n" ); + } +#endif + if( render_out.isEmpty() ) { new GuiApplication();