Move audio_data_own to audio_driver.c

This commit is contained in:
twinaphex 2015-11-29 20:26:30 +01:00
parent c62150c2a2
commit ff13338ca9
4 changed files with 15 additions and 4 deletions

View File

@ -63,6 +63,7 @@ typedef struct audio_driver_input_data
uint64_t buffer_free_samples_count;
} audio_driver_input_data_t;
static bool audio_data_own;
static const rarch_resampler_t *audio_resampler;
static void *audio_resampler_data;
static const audio_driver_t *current_audio;
@ -275,7 +276,7 @@ static bool uninit_audio(void)
current_audio = NULL;
if (!driver->audio_data_own)
if (!audio_data_own)
context_audio_data = NULL;
return true;
@ -829,6 +830,14 @@ bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data)
return current_audio->stop(context_audio_data);
case RARCH_AUDIO_CTL_FIND_DRIVER:
return find_audio_driver();
case RARCH_AUDIO_CTL_SET_OWN_DRIVER:
audio_data_own = true;
break;
case RARCH_AUDIO_CTL_UNSET_OWN_DRIVER:
audio_data_own = false;
break;
case RARCH_AUDIO_CTL_OWNS_DRIVER:
return audio_data_own;
case RARCH_AUDIO_CTL_FRAME_IS_REVERSE:
/* We just rewound. Flush rewind audio buffer. */
audio_driver_flush(audio_data.rewind_buf + audio_data.rewind_ptr,

View File

@ -88,7 +88,10 @@ enum rarch_audio_ctl_state
RARCH_AUDIO_CTL_CALLBACK,
RARCH_AUDIO_CTL_HAS_CALLBACK,
RARCH_AUDIO_CTL_ALIVE,
RARCH_AUDIO_CTL_FRAME_IS_REVERSE
RARCH_AUDIO_CTL_FRAME_IS_REVERSE,
RARCH_AUDIO_CTL_SET_OWN_DRIVER,
RARCH_AUDIO_CTL_UNSET_OWN_DRIVER,
RARCH_AUDIO_CTL_OWNS_DRIVER
};
bool audio_driver_ctl(enum rarch_audio_ctl_state state, void *data);

View File

@ -361,7 +361,7 @@ void init_drivers(int flags)
if (flags & DRIVER_VIDEO)
video_driver_ctl(RARCH_DISPLAY_CTL_UNSET_OWN_DRIVER, NULL);
if (flags & DRIVER_AUDIO)
driver->audio_data_own = false;
audio_driver_ctl(RARCH_AUDIO_CTL_UNSET_OWN_DRIVER, NULL);
if (flags & DRIVER_INPUT)
driver->input_data_own = false;
if (flags & DRIVER_CAMERA)

View File

@ -249,7 +249,6 @@ typedef struct driver
*
* Typically, if a driver intends to make use of this, it should
* set this to true at the end of its 'init' function. */
bool audio_data_own;
bool input_data_own;
bool camera_data_own;
bool location_data_own;