Add constant to control number of Wii U buffers

This commit is contained in:
Clownacy 2020-06-30 20:38:28 +01:00
parent 371d66255b
commit e0c67b421a

View file

@ -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]
};