diff --git a/src/sfizz/FilePool.cpp b/src/sfizz/FilePool.cpp index fa7e5afb3..5157ba0ef 100644 --- a/src/sfizz/FilePool.cpp +++ b/src/sfizz/FilePool.cpp @@ -42,6 +42,8 @@ #include #if defined(_WIN32) #include +#elif defined(__ANDROID__) +#include #else #include #endif @@ -609,6 +611,13 @@ void sfz::FilePool::raiseCurrentThreadPriority() noexcept std::system_error error(GetLastError(), std::system_category()); DBG("[sfizz] Cannot set current thread priority: " << error.what()); } +#elif defined(__ANDROID__) + int tid = gettid(); // Android specific function to get thread ID + int priority = -20; // Highest priority for nice value + if (setpriority(PRIO_PROCESS, tid, priority) != 0) { + // setpriority sets errno on failure + DBG("[sfizz] Cannot set current thread priority: " << strerror(errno)); + } #else pthread_t thread = pthread_self(); int policy;