ref: f1fd371db7347cc48eb7ae6f449ff9742a6feea5
parent: 9e9b8942a5a387c7b3ee5a40ad03f936df0e90b8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Nov 3 15:19:21 EST 2020
Update 3DS-Software threading priority code This matches the 3DS-Hardware backend
--- a/src/Backends/Audio/SoftwareMixer/3DS.cpp
+++ b/src/Backends/Audio/SoftwareMixer/3DS.cpp
@@ -14,6 +14,8 @@
#define FRAMES_PER_BUFFER (SAMPLE_RATE / 30) // 33.333 milliseconds
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define CLAMP(a, min, max) MIN(MAX((a), (min)), (max))
static void (*parent_callback)(long *stream, size_t frames_total);
@@ -134,9 +136,11 @@
LightEvent_Init(&audio_thread_event, RESET_ONESHOT);
- audio_thread_die = false;
+ s32 priority = 0x30;
+ svcGetThreadPriority(&priority, CUR_THREAD_HANDLE);
- audio_thread = threadCreate(AudioThread, NULL, 32 * 1024, 0x18, -1, false);
+ audio_thread_die = false;
+ audio_thread = threadCreate(AudioThread, NULL, 32 * 1024, CLAMP(priority - 1, 0x18, 0x3F), -1, false);
return SAMPLE_RATE;
}