diff --git a/src/Backends/Audio/WiiU-Software.cpp b/src/Backends/Audio/WiiU-Software.cpp index 45469fc9..62a5d47c 100644 --- a/src/Backends/Audio/WiiU-Software.cpp +++ b/src/Backends/Audio/WiiU-Software.cpp @@ -14,6 +14,8 @@ #include "SoftwareMixer.h" +#define AUDIO_BUFFERS 2 // Double-buffer + #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define CLAMP(x, y, z) MIN(MAX((x), (y)), (z)) @@ -163,11 +165,11 @@ bool AudioBackend_Init(void) if (stream_buffer_long != NULL) { - stream_buffers[0] = (short*)malloc(buffer_length * sizeof(short) * 2); // `* 2` because it's a double-buffer + stream_buffers[0] = (short*)malloc(buffer_length * sizeof(short) * AUDIO_BUFFERS); if (stream_buffers[0] != NULL) { - stream_buffers[1] = (short*)malloc(buffer_length * sizeof(short) * 2); // `* 2` because it's a double-buffer + stream_buffers[1] = (short*)malloc(buffer_length * sizeof(short) * AUDIO_BUFFERS); if (stream_buffers[1] != NULL) { @@ -203,7 +205,7 @@ bool AudioBackend_Init(void) .dataType = AX_VOICE_FORMAT_LPCM16, .loopingEnabled = AX_VOICE_LOOP_ENABLED, .loopOffset = 0, - .endOffset = (buffer_length * 2) - 1, // -1 or else you'll get popping! + .endOffset = (buffer_length * AUDIO_BUFFERS) - 1, // -1 or else you'll get popping! .currentOffset = 0, .data = stream_buffers[i] };