mirror of
https://github.com/libretro/RetroArch.git
synced 2024-06-02 19:57:24 -04:00
(WASAPI) Buffer cleanups (#16057)
This commit is contained in:
parent
285f800c2e
commit
aa1d47ad0f
|
@ -395,10 +395,23 @@ static bool wasapi_alive(void *wh)
|
|||
return w->running;
|
||||
}
|
||||
|
||||
static void wasapi_insert_silence(wasapi_t *w)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 12; i++)
|
||||
audio_driver_menu_sample();
|
||||
}
|
||||
|
||||
static void wasapi_set_nonblock_state(void *wh, bool nonblock)
|
||||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
|
||||
/* Since exclusive mode keeps repeating last sample while
|
||||
* in paused menu, generate some silence first. */
|
||||
if (!nonblock && w->exclusive)
|
||||
wasapi_insert_silence(w);
|
||||
|
||||
w->nonblock = nonblock;
|
||||
}
|
||||
|
||||
|
@ -447,12 +460,13 @@ static size_t wasapi_write_avail(void *wh)
|
|||
wasapi_t *w = (wasapi_t*)wh;
|
||||
UINT32 padding = 0;
|
||||
|
||||
if (w->buffer)
|
||||
return FIFO_WRITE_AVAIL(w->buffer);
|
||||
|
||||
if (FAILED(_IAudioClient_GetCurrentPadding(w->client, &padding)))
|
||||
return 0;
|
||||
|
||||
if (w->buffer)
|
||||
/* Exaggarate available size for best results.. */
|
||||
return FIFO_WRITE_AVAIL(w->buffer) + padding * 2;
|
||||
|
||||
return w->engine_buffer_size - padding * w->frame_size;
|
||||
}
|
||||
|
||||
|
@ -460,7 +474,7 @@ static size_t wasapi_buffer_size(void *wh)
|
|||
{
|
||||
wasapi_t *w = (wasapi_t*)wh;
|
||||
|
||||
if (!w->exclusive && w->buffer)
|
||||
if (w->buffer)
|
||||
return w->buffer->size;
|
||||
|
||||
return w->engine_buffer_size;
|
||||
|
|
Loading…
Reference in a new issue