Wii U - Use a frame callback instead of a thread

This commit is contained in:
Clownacy 2020-04-19 19:05:25 +01:00
parent 07ee648181
commit 288c2dccee

View file

@ -94,12 +94,8 @@ static void Callback(void *output_stream, size_t frames_total)
OSUnlockMutex(&organya_mutex); OSUnlockMutex(&organya_mutex);
} }
static int ThreadFunction(int argc, const char *argv[]) static void FrameCallback(void)
{ {
for (;;)
{
OSTestThreadCancel();
static int last_half = 1; static int last_half = 1;
unsigned int half; unsigned int half;
@ -145,9 +141,6 @@ static int ThreadFunction(int argc, const char *argv[])
} }
} }
return 0;
}
bool AudioBackend_Init(void) bool AudioBackend_Init(void)
{ {
if (!AXIsInit()) if (!AXIsInit())
@ -207,9 +200,7 @@ bool AudioBackend_Init(void)
AXVoiceEnd(voice); AXVoiceEnd(voice);
//AXRegisterAppFrameCallback(FrameCallback); AXRegisterAppFrameCallback(FrameCallback);
OSRunThread(OSGetDefaultThread(0), ThreadFunction, 0, NULL);
return true; return true;
} }
@ -219,10 +210,6 @@ bool AudioBackend_Init(void)
void AudioBackend_Deinit(void) void AudioBackend_Deinit(void)
{ {
OSCancelThread(OSGetDefaultThread(0));
OSJoinThread(OSGetDefaultThread(0), NULL);
AXFreeVoice(voice); AXFreeVoice(voice);
AXQuit(); AXQuit();