Fix popping in the Wii U audio backend

This commit is contained in:
Clownacy 2020-06-30 20:37:16 +01:00
parent 44465ee4f9
commit 371d66255b

View file

@ -84,7 +84,7 @@ static void FrameCallback(void)
AXVoiceOffsets offsets; AXVoiceOffsets offsets;
AXGetVoiceOffsets(voices[0], &offsets); AXGetVoiceOffsets(voices[0], &offsets);
unsigned int current_buffer = offsets.currentOffset > buffer_length ? 1 : 0; // TODO - should probably be '>=' unsigned int current_buffer = offsets.currentOffset / buffer_length;
static unsigned int last_buffer = 1; static unsigned int last_buffer = 1;
@ -203,7 +203,7 @@ bool AudioBackend_Init(void)
.dataType = AX_VOICE_FORMAT_LPCM16, .dataType = AX_VOICE_FORMAT_LPCM16,
.loopingEnabled = AX_VOICE_LOOP_ENABLED, .loopingEnabled = AX_VOICE_LOOP_ENABLED,
.loopOffset = 0, .loopOffset = 0,
.endOffset = buffer_length * 2, .endOffset = (buffer_length * 2) - 1, // -1 or else you'll get popping!
.currentOffset = 0, .currentOffset = 0,
.data = stream_buffers[i] .data = stream_buffers[i]
}; };