mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Deinit audio before video.
This commit is contained in:
parent
a4767d3d43
commit
c5d1fd32d5
@ -91,13 +91,14 @@ xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, size_t size)
|
|||||||
if (!handle->hEvent)
|
if (!handle->hEvent)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW);
|
|
||||||
|
|
||||||
handle->bufsize = size / MAX_BUFFERS;
|
handle->bufsize = size / MAX_BUFFERS;
|
||||||
handle->buf = (uint8_t*)calloc(1, handle->bufsize * MAX_BUFFERS);
|
handle->buf = (uint8_t*)calloc(1, handle->bufsize * MAX_BUFFERS);
|
||||||
if (!handle->buf)
|
if (!handle->buf)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -31,8 +31,8 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
|||||||
if (latency < 8)
|
if (latency < 8)
|
||||||
latency = 8; // Do not allow shenanigans.
|
latency = 8; // Do not allow shenanigans.
|
||||||
|
|
||||||
xa_t *xa = (xa_t*)calloc(1, sizeof(xa_t));
|
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||||
if (xa == NULL)
|
if (!xa)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
size_t bufsize = latency * rate / 1000;
|
size_t bufsize = latency * rate / 1000;
|
||||||
@ -46,6 +46,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
|||||||
free(xa);
|
free(xa);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return xa;
|
return xa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +61,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
|
|||||||
if (avail < size)
|
if (avail < size)
|
||||||
size = avail;
|
size = avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ret = xaudio2_write(xa->xa, buf, size);
|
size_t ret = xaudio2_write(xa->xa, buf, size);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -111,4 +113,3 @@ const audio_driver_t audio_xa = {
|
|||||||
xa_use_float,
|
xa_use_float,
|
||||||
"xaudio"
|
"xaudio"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
7
driver.c
7
driver.c
@ -177,8 +177,8 @@ void init_drivers(void)
|
|||||||
|
|
||||||
void uninit_drivers(void)
|
void uninit_drivers(void)
|
||||||
{
|
{
|
||||||
uninit_video_input();
|
|
||||||
uninit_audio();
|
uninit_audio();
|
||||||
|
uninit_video_input();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DYLIB
|
#ifdef HAVE_DYLIB
|
||||||
@ -341,8 +341,10 @@ void init_audio(void)
|
|||||||
|
|
||||||
void uninit_audio(void)
|
void uninit_audio(void)
|
||||||
{
|
{
|
||||||
free(g_extern.audio_data.conv_outsamples); g_extern.audio_data.conv_outsamples = NULL;
|
free(g_extern.audio_data.conv_outsamples);
|
||||||
|
g_extern.audio_data.conv_outsamples = NULL;
|
||||||
g_extern.audio_data.data_ptr = 0;
|
g_extern.audio_data.data_ptr = 0;
|
||||||
|
|
||||||
free(g_extern.audio_data.rewind_buf);
|
free(g_extern.audio_data.rewind_buf);
|
||||||
g_extern.audio_data.rewind_buf = NULL;
|
g_extern.audio_data.rewind_buf = NULL;
|
||||||
|
|
||||||
@ -360,6 +362,7 @@ void uninit_audio(void)
|
|||||||
|
|
||||||
free(g_extern.audio_data.data);
|
free(g_extern.audio_data.data);
|
||||||
g_extern.audio_data.data = NULL;
|
g_extern.audio_data.data = NULL;
|
||||||
|
|
||||||
free(g_extern.audio_data.outsamples);
|
free(g_extern.audio_data.outsamples);
|
||||||
g_extern.audio_data.outsamples = NULL;
|
g_extern.audio_data.outsamples = NULL;
|
||||||
|
|
||||||
|
2
ssnes.c
2
ssnes.c
@ -299,7 +299,7 @@ static bool audio_flush(const int16_t *data, size_t samples)
|
|||||||
{
|
{
|
||||||
float f[0x10000];
|
float f[0x10000];
|
||||||
int16_t i[0x10000 * sizeof(float) / sizeof(int16_t)];
|
int16_t i[0x10000 * sizeof(float) / sizeof(int16_t)];
|
||||||
} static const empty_buf = {{0}};
|
} static empty_buf; // Const here would require us to statically initialize it, bloating the binary.
|
||||||
|
|
||||||
if (g_extern.audio_data.use_float)
|
if (g_extern.audio_data.use_float)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user