mirror of
https://github.com/yawut/SDL.git
synced 2026-04-26 00:57:36 -05:00
wiiu/audio: Restore thread affinity on early returns
This commit is contained in:
parent
97bedb9f40
commit
351bb2afe8
|
|
@ -60,6 +60,7 @@ static SDL_AudioDevice* cb_this;
|
||||||
#define next_id(id) (id + 1) % NUM_BUFFERS
|
#define next_id(id) (id + 1) % NUM_BUFFERS
|
||||||
|
|
||||||
static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
|
int ret = 0;
|
||||||
AXVoiceOffsets offs;
|
AXVoiceOffsets offs;
|
||||||
AXVoiceVeData vol = {
|
AXVoiceVeData vol = {
|
||||||
.volume = 0x8000,
|
.volume = 0x8000,
|
||||||
|
|
@ -68,7 +69,10 @@ static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
float srcratio;
|
float srcratio;
|
||||||
|
|
||||||
this->hidden = (struct SDL_PrivateAudioData*)SDL_malloc(sizeof(*this->hidden));
|
this->hidden = (struct SDL_PrivateAudioData*)SDL_malloc(sizeof(*this->hidden));
|
||||||
if (this->hidden == NULL) return SDL_OutOfMemory();
|
if (this->hidden == NULL) {
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
|
||||||
SDL_zerop(this->hidden);
|
SDL_zerop(this->hidden);
|
||||||
|
|
||||||
/* We *must not* change cores when setting stuff up */
|
/* We *must not* change cores when setting stuff up */
|
||||||
|
|
@ -117,7 +121,8 @@ static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
if (this->hidden->mixbufs[i] == NULL) {
|
if (this->hidden->mixbufs[i] == NULL) {
|
||||||
AXQuit();
|
AXQuit();
|
||||||
printf("DEBUG: Couldn't allocate buffer");
|
printf("DEBUG: Couldn't allocate buffer");
|
||||||
return SDL_SetError("Couldn't allocate buffer");
|
ret = SDL_SetError("Couldn't allocate buffer");
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(this->hidden->mixbufs[i], 0, this->spec.size);
|
memset(this->hidden->mixbufs[i], 0, this->spec.size);
|
||||||
|
|
@ -129,7 +134,8 @@ static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
if (this->hidden->deintvbuf == NULL) {
|
if (this->hidden->deintvbuf == NULL) {
|
||||||
AXQuit();
|
AXQuit();
|
||||||
printf("DEBUG: Couldn't allocate deinterleave buffer");
|
printf("DEBUG: Couldn't allocate deinterleave buffer");
|
||||||
return SDL_SetError("Couldn't allocate deinterleave buffer");
|
ret = SDL_SetError("Couldn't allocate deinterleave buffer");
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -139,7 +145,8 @@ static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
if (!this->hidden->voice[i]) {
|
if (!this->hidden->voice[i]) {
|
||||||
AXQuit();
|
AXQuit();
|
||||||
printf("DEBUG: couldn't get voice\n");
|
printf("DEBUG: couldn't get voice\n");
|
||||||
return SDL_OutOfMemory();
|
ret = SDL_OutOfMemory();
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start messing with it */
|
/* Start messing with it */
|
||||||
|
|
@ -211,9 +218,10 @@ static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
|
||||||
cb_this = this; //wish there was a better way
|
cb_this = this; //wish there was a better way
|
||||||
AXRegisterAppFrameCallback(_WIIUAUDIO_framecallback);
|
AXRegisterAppFrameCallback(_WIIUAUDIO_framecallback);
|
||||||
|
|
||||||
|
end: ;
|
||||||
/* Put the thread affinity back to normal - we won't call any more AX funcs */
|
/* Put the thread affinity back to normal - we won't call any more AX funcs */
|
||||||
OSSetThreadAffinity(OSGetCurrentThread(), old_affinity);
|
OSSetThreadAffinity(OSGetCurrentThread(), old_affinity);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called every 3ms before a frame of audio is rendered. Keep it fast! */
|
/* Called every 3ms before a frame of audio is rendered. Keep it fast! */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user