(Audio) Implement write_avail always, even if just as a stub

This commit is contained in:
twinaphex 2015-03-24 08:05:19 +01:00
parent 30a0e99972
commit 3a78276418
6 changed files with 40 additions and 16 deletions

View File

@ -461,9 +461,7 @@ bool audio_driver_mute_toggle(void)
static int audio_driver_write_avail(void) static int audio_driver_write_avail(void)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
if (driver if (driver && driver->audio)
&& driver->audio
&& driver->audio->write_avail)
return driver->audio->write_avail(driver->audio_data); return driver->audio->write_avail(driver->audio_data);
return 0; return 0;
} }
@ -503,9 +501,7 @@ void audio_driver_readjust_input_rate(void)
bool audio_driver_alive(void) bool audio_driver_alive(void)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
if (driver if (driver && driver->audio)
&& driver->audio
&& driver->audio->alive)
return driver->audio->alive(driver->audio_data); return driver->audio->alive(driver->audio_data);
return false; return false;
} }
@ -542,9 +538,7 @@ void audio_driver_set_nonblock_state(bool toggle)
ssize_t audio_driver_write(const void *buf, size_t size) ssize_t audio_driver_write(const void *buf, size_t size)
{ {
driver_t *driver = driver_get_ptr(); driver_t *driver = driver_get_ptr();
if (driver if (driver && driver->audio)
&& driver->audio
&& driver->audio->write)
return driver->audio->write(driver->audio_data, buf, size); return driver->audio->write(driver->audio_data, buf, size);
return 0; return 0;
} }

View File

@ -67,6 +67,12 @@ static bool null_audio_use_float(void *data)
return true; return true;
} }
static size_t null_audio_write_avail(void *data)
{
(void)data;
return 0;
}
audio_driver_t audio_null = { audio_driver_t audio_null = {
null_audio_init, null_audio_init,
null_audio_write, null_audio_write,
@ -77,6 +83,6 @@ audio_driver_t audio_null = {
null_audio_free, null_audio_free,
null_audio_use_float, null_audio_use_float,
"null", "null",
NULL, null_audio_write_avail,
NULL NULL
}; };

View File

@ -229,6 +229,12 @@ static bool ps3_audio_use_float(void *data)
return true; return true;
} }
static size_t ps3_audio_write_avail(void *data)
{
(void)data;
return 0;
}
audio_driver_t audio_ps3 = { audio_driver_t audio_ps3 = {
ps3_audio_init, ps3_audio_init,
ps3_audio_write, ps3_audio_write,
@ -239,6 +245,6 @@ audio_driver_t audio_ps3 = {
ps3_audio_free, ps3_audio_free,
ps3_audio_use_float, ps3_audio_use_float,
"ps3", "ps3",
NULL, ps3_audio_write_avail,
NULL NULL
}; };

View File

@ -124,6 +124,12 @@ static bool ra_use_float(void *data)
return false; return false;
} }
static size_t ra_write_avail(void *data)
{
(void)data;
return 0;
}
audio_driver_t audio_roar = { audio_driver_t audio_roar = {
ra_init, ra_init,
ra_write, ra_write,
@ -134,6 +140,6 @@ audio_driver_t audio_roar = {
ra_free, ra_free,
ra_use_float, ra_use_float,
"roar", "roar",
NULL, ra_write_avail,
NULL NULL
}; };

View File

@ -225,12 +225,18 @@ static void sdl_audio_free(void *data)
free(sdl); free(sdl);
} }
static bool sdl_use_float(void *data) static bool sdl_audio_use_float(void *data)
{ {
(void)data; (void)data;
return false; return false;
} }
static size_t sdl_audio_write_avail(void *data)
{
(void)data;
return 0;
}
audio_driver_t audio_sdl = { audio_driver_t audio_sdl = {
sdl_audio_init, sdl_audio_init,
sdl_audio_write, sdl_audio_write,
@ -239,12 +245,12 @@ audio_driver_t audio_sdl = {
sdl_audio_alive, sdl_audio_alive,
sdl_audio_set_nonblock_state, sdl_audio_set_nonblock_state,
sdl_audio_free, sdl_audio_free,
sdl_use_float, sdl_audio_use_float,
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
"sdl2", "sdl2",
#else #else
"sdl", "sdl",
#endif #endif
NULL, sdl_audio_write_avail,
NULL NULL
}; };

View File

@ -128,6 +128,12 @@ static bool xenon360_use_float(void *data)
return false; return false;
} }
static size_t xenon360_write_avail(void *data)
{
(void)data;
return 0;
}
audio_driver_t audio_xenon360 = { audio_driver_t audio_xenon360 = {
xenon360_audio_init, xenon360_audio_init,
xenon360_audio_write, xenon360_audio_write,
@ -138,6 +144,6 @@ audio_driver_t audio_xenon360 = {
xenon360_audio_free, xenon360_audio_free,
xenon360_use_float, xenon360_use_float,
"xenon360", "xenon360",
NULL, xenon360_write_avail,
NULL NULL
}; };