Add constant to control number of Wii U buffers
This commit is contained in:
parent
371d66255b
commit
e0c67b421a
1 changed files with 5 additions and 3 deletions
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "SoftwareMixer.h"
|
#include "SoftwareMixer.h"
|
||||||
|
|
||||||
|
#define AUDIO_BUFFERS 2 // Double-buffer
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#define CLAMP(x, y, z) MIN(MAX((x), (y)), (z))
|
#define CLAMP(x, y, z) MIN(MAX((x), (y)), (z))
|
||||||
|
@ -163,11 +165,11 @@ bool AudioBackend_Init(void)
|
||||||
|
|
||||||
if (stream_buffer_long != NULL)
|
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)
|
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)
|
if (stream_buffers[1] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +205,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) - 1, // -1 or else you'll get popping!
|
.endOffset = (buffer_length * AUDIO_BUFFERS) - 1, // -1 or else you'll get popping!
|
||||||
.currentOffset = 0,
|
.currentOffset = 0,
|
||||||
.data = stream_buffers[i]
|
.data = stream_buffers[i]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue