Add logging when XAudio fails.

This commit is contained in:
Themaister 2011-01-28 20:57:13 +01:00
parent 5bcde44684
commit 334f11d5bc
2 changed files with 9 additions and 4 deletions

View File

@ -19,6 +19,7 @@
#include "driver.h"
#include <stdlib.h>
#include "xaudio-c.h"
#include "general.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -35,6 +36,7 @@ static xaudio2_write_avail_t pxawrite_avail = NULL;
static xaudio2_free_t pxafree = NULL;
static HMODULE lib = NULL;
#define LIB_NAME "xaudio-c.dll"
#define SYM(X) ((void*)GetProcAddress(lib, "xaudio2_" #X))
static void deinit_lib(void)
@ -48,7 +50,7 @@ static bool init_lib(void)
if (lib)
return true;
lib = LoadLibrary("xaudio-c.dll");
lib = LoadLibrary(LIB_NAME);
if (!lib)
return false;
@ -87,12 +89,15 @@ static void* __xa_init(const char* device, int rate, int latency)
if (xa == NULL)
return NULL;
size_t bufsize = latency * 4 * rate / 1000;
size_t bufsize = latency * rate / 1000;
bufsize = next_pow2(bufsize);
xa->xa = pxanew(rate, 2, 16, bufsize);
SSNES_LOG("XAudio2: Requesting %d ms latency, using %d ms latency.\n", latency, (int)bufsize * rate / 1000);
xa->xa = pxanew(rate, 2, 16, bufsize << 2);
if (!xa->xa)
{
SSNES_ERR("Failed to init XAudio2.\n");
free(xa);
return NULL;
}

View File

@ -61,7 +61,7 @@
# but lots of dropped frames. Reasonable values for this is 32000 +/- 100 Hz.
# audio_in_rate = 31980
# Audio driver backend. Depending on configuration possible candidates are: alsa, oss, jack, rsound, roar, openal and sdl
# Audio driver backend. Depending on configuration possible candidates are: alsa, oss, jack, rsound, roar, openal, sdl and xaudio
# audio_driver =
# Override the default audio device the audio_driver uses.