Skip to content
Permalink
Browse files

audio/wiiu: Properly initialise AXVoiceDeviceMixData

(fixes odd behaviour when surround sound is enabled, hopefully)
  • Loading branch information
QuarkTheAwesome committed Sep 20, 2019
1 parent 0c51093 commit fa6d0c47b8b57e7e4f0b263ef033205a6e3ca993
Showing with 86 additions and 12 deletions.
  1. +86 −12 src/audio/wiiu/SDL_wiiuaudio.c
@@ -66,15 +66,92 @@ static int WIIUAUDIO_OpenDevice(_THIS, void* handle, const char* devname, int is
AXVoiceVeData vol = { AXVoiceVeData vol = {
.volume = 0x8000, .volume = 0x8000,
}; };
AXVoiceDeviceMixData drcmix = { //TODO: AXGetDeviceChannelCount. For now we'll use Decaf's values and
.bus = { //configure for stereo (muted surrounds).
{ .volume = 0x8000 }, //bus 0 AXVoiceDeviceMixData drcmix[4] = {
{ .volume = 0x0000 }, //bus 1 [0] = { //gamepad left channel
{ .volume = 0x0000 }, //bus 2 .bus = {
{ .volume = 0x0000 }, //bus 3 { .volume = 0x8000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[1] = { //gamepad right channel
.bus = {
{ .volume = 0x8000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[2] = { //gamepad surround #1 (virtual)
.bus = {
{ .volume = 0x0000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[3] = { //gamepad surround #2 (virtual)
.bus = {
{ .volume = 0x0000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
};
AXVoiceDeviceMixData tvmix[6] = {
[0] = { //tv left channel
.bus = {
{ .volume = 0x8000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[1] = { //tv right channel
.bus = {
{ .volume = 0x8000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[2] = { //tv surround #1
.bus = {
{ .volume = 0x8000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[3] = { //tv surround #2
.bus = {
{ .volume = 0x0000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[4] = { //tv surround #3
.bus = {
{ .volume = 0x0000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
},
[5] = { //tv surround #4
.bus = {
{ .volume = 0x0000 }, //bus 0
{ .volume = 0x0000 }, //bus 1
{ .volume = 0x0000 }, //bus 2
{ .volume = 0x0000 }, //bus 3
}
}, },
}; };
AXVoiceDeviceMixData tvmix = drcmix;
uint32_t old_affinity; uint32_t old_affinity;
float srcratio; float srcratio;


@@ -96,9 +173,6 @@ static int WIIUAUDIO_OpenDevice(_THIS, void* handle, const char* devname, int is
AXInitWithParams(&initparams); AXInitWithParams(&initparams);
} else printf("DEBUG: AX already up?\n"); } else printf("DEBUG: AX already up?\n");


/* Disable gamepad virtual surround (causes distortion) */
AXSetDRCVSMode(0);

/* Get a voice, top priority (we only need one) */ /* Get a voice, top priority (we only need one) */
this->hidden->voice = AXAcquireVoice(31, NULL, NULL); this->hidden->voice = AXAcquireVoice(31, NULL, NULL);
if (!this->hidden->voice) { if (!this->hidden->voice) {
@@ -114,8 +188,8 @@ static int WIIUAUDIO_OpenDevice(_THIS, void* handle, const char* devname, int is


/* Set the voice's volume */ /* Set the voice's volume */
AXSetVoiceVe(this->hidden->voice, &vol); AXSetVoiceVe(this->hidden->voice, &vol);
AXSetVoiceDeviceMix(this->hidden->voice, AX_DEVICE_TYPE_DRC, 0, &drcmix); AXSetVoiceDeviceMix(this->hidden->voice, AX_DEVICE_TYPE_DRC, 0, drcmix);
AXSetVoiceDeviceMix(this->hidden->voice, AX_DEVICE_TYPE_TV, 0, &tvmix); AXSetVoiceDeviceMix(this->hidden->voice, AX_DEVICE_TYPE_TV, 0, tvmix);


/* Set the samplerate conversion ratio /* Set the samplerate conversion ratio
<source sample rate> / <target sample rate> */ <source sample rate> / <target sample rate> */

0 comments on commit fa6d0c4

Please sign in to comment.
You can’t perform that action at this time.