mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 16:39:43 +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)
|
||||
goto error;
|
||||
|
||||
IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW);
|
||||
|
||||
handle->bufsize = size / MAX_BUFFERS;
|
||||
handle->buf = (uint8_t*)calloc(1, handle->bufsize * MAX_BUFFERS);
|
||||
if (!handle->buf)
|
||||
goto error;
|
||||
|
||||
if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW)))
|
||||
goto error;
|
||||
|
||||
return handle;
|
||||
|
||||
error:
|
||||
|
@ -31,8 +31,8 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
||||
if (latency < 8)
|
||||
latency = 8; // Do not allow shenanigans.
|
||||
|
||||
xa_t *xa = (xa_t*)calloc(1, sizeof(xa_t));
|
||||
if (xa == NULL)
|
||||
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||
if (!xa)
|
||||
return NULL;
|
||||
|
||||
size_t bufsize = latency * rate / 1000;
|
||||
@ -46,6 +46,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency)
|
||||
free(xa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return xa;
|
||||
}
|
||||
|
||||
@ -60,6 +61,7 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||
if (avail < size)
|
||||
size = avail;
|
||||
}
|
||||
|
||||
size_t ret = xaudio2_write(xa->xa, buf, size);
|
||||
if (ret == 0)
|
||||
return -1;
|
||||
@ -111,4 +113,3 @@ const audio_driver_t audio_xa = {
|
||||
xa_use_float,
|
||||
"xaudio"
|
||||
};
|
||||
|
||||
|
7
driver.c
7
driver.c
@ -177,8 +177,8 @@ void init_drivers(void)
|
||||
|
||||
void uninit_drivers(void)
|
||||
{
|
||||
uninit_video_input();
|
||||
uninit_audio();
|
||||
uninit_video_input();
|
||||
}
|
||||
|
||||
#ifdef HAVE_DYLIB
|
||||
@ -341,8 +341,10 @@ void init_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;
|
||||
|
||||
free(g_extern.audio_data.rewind_buf);
|
||||
g_extern.audio_data.rewind_buf = NULL;
|
||||
|
||||
@ -360,6 +362,7 @@ void uninit_audio(void)
|
||||
|
||||
free(g_extern.audio_data.data);
|
||||
g_extern.audio_data.data = NULL;
|
||||
|
||||
free(g_extern.audio_data.outsamples);
|
||||
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];
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user