shithub: cstory

Download patch

ref: 371d66255b2c8eed667af68cb540ecbf29c29fc6
parent: 44465ee4f9cb4f97f5a15f22c33816d5443aa8d8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Jun 30 16:37:16 EDT 2020

Fix popping in the Wii U audio backend

--- a/src/Backends/Audio/WiiU-Software.cpp
+++ b/src/Backends/Audio/WiiU-Software.cpp
@@ -84,7 +84,7 @@
 	AXVoiceOffsets 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;
 
@@ -203,7 +203,7 @@
 								.dataType = AX_VOICE_FORMAT_LPCM16,
 								.loopingEnabled = AX_VOICE_LOOP_ENABLED,
 								.loopOffset = 0,
-								.endOffset = buffer_length * 2,
+								.endOffset = (buffer_length * 2) - 1,	// -1 or else you'll get popping!
 								.currentOffset = 0,
 								.data = stream_buffers[i]
 							};