mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
Functions to enable and disable audio and video, and an environment function to query status of audio and video enables
This commit is contained in:
parent
a8fc4b204a
commit
7deeb6d2fa
@ -183,6 +183,8 @@ static void *audio_driver_resampler_data = NULL;
|
|||||||
static const audio_driver_t *current_audio = NULL;
|
static const audio_driver_t *current_audio = NULL;
|
||||||
static void *audio_driver_context_audio_data = NULL;
|
static void *audio_driver_context_audio_data = NULL;
|
||||||
|
|
||||||
|
static bool audio_suspended = false;
|
||||||
|
|
||||||
enum resampler_quality audio_driver_get_resampler_quality(void)
|
enum resampler_quality audio_driver_get_resampler_quality(void)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -559,6 +561,9 @@ void audio_driver_set_nonblocking_state(bool enable)
|
|||||||
**/
|
**/
|
||||||
static void audio_driver_flush(const int16_t *data, size_t samples)
|
static void audio_driver_flush(const int16_t *data, size_t samples)
|
||||||
{
|
{
|
||||||
|
if (audio_suspended)
|
||||||
|
return;
|
||||||
|
|
||||||
struct resampler_data src_data;
|
struct resampler_data src_data;
|
||||||
bool is_perfcnt_enable = false;
|
bool is_perfcnt_enable = false;
|
||||||
bool is_paused = false;
|
bool is_paused = false;
|
||||||
@ -696,6 +701,9 @@ static void audio_driver_flush(const int16_t *data, size_t samples)
|
|||||||
**/
|
**/
|
||||||
void audio_driver_sample(int16_t left, int16_t right)
|
void audio_driver_sample(int16_t left, int16_t right)
|
||||||
{
|
{
|
||||||
|
if (audio_suspended)
|
||||||
|
return;
|
||||||
|
|
||||||
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = left;
|
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = left;
|
||||||
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = right;
|
audio_driver_output_samples_conv_buf[audio_driver_data_ptr++] = right;
|
||||||
|
|
||||||
@ -1286,11 +1294,31 @@ bool audio_driver_owns_driver(void)
|
|||||||
return audio_driver_data_own;
|
return audio_driver_data_own;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_driver_suspend(void)
|
||||||
|
{
|
||||||
|
audio_suspended = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool audio_driver_is_suspended(void)
|
||||||
|
{
|
||||||
|
return audio_suspended;
|
||||||
|
}
|
||||||
|
|
||||||
|
void audio_driver_resume(void)
|
||||||
|
{
|
||||||
|
audio_suspended = false;
|
||||||
|
}
|
||||||
|
|
||||||
void audio_driver_set_active(void)
|
void audio_driver_set_active(void)
|
||||||
{
|
{
|
||||||
audio_driver_active = true;
|
audio_driver_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool audio_driver_is_active(void)
|
||||||
|
{
|
||||||
|
return audio_driver_active;
|
||||||
|
}
|
||||||
|
|
||||||
void audio_driver_destroy(void)
|
void audio_driver_destroy(void)
|
||||||
{
|
{
|
||||||
audio_driver_active = false;
|
audio_driver_active = false;
|
||||||
|
@ -152,8 +152,16 @@ void audio_driver_set_own_driver(void);
|
|||||||
|
|
||||||
void audio_driver_unset_own_driver(void);
|
void audio_driver_unset_own_driver(void);
|
||||||
|
|
||||||
|
void audio_driver_suspend(void);
|
||||||
|
|
||||||
|
bool audio_driver_is_suspended(void);
|
||||||
|
|
||||||
|
void audio_driver_resume(void);
|
||||||
|
|
||||||
void audio_driver_set_active(void);
|
void audio_driver_set_active(void);
|
||||||
|
|
||||||
|
bool audio_driver_is_active(void);
|
||||||
|
|
||||||
void audio_driver_destroy(void);
|
void audio_driver_destroy(void);
|
||||||
|
|
||||||
void audio_driver_deinit_resampler(void);
|
void audio_driver_deinit_resampler(void);
|
||||||
|
19
dynamic.c
19
dynamic.c
@ -1692,6 +1692,25 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
ledintf->set_led_state = led_driver_set_led;
|
ledintf->set_led_state = led_driver_set_led;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE:
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
if (!audio_driver_is_suspended() && audio_driver_is_active())
|
||||||
|
{
|
||||||
|
result |= 2;
|
||||||
|
}
|
||||||
|
if (video_driver_is_active() && !video_driver_is_stub_frame())
|
||||||
|
{
|
||||||
|
result |= 1;
|
||||||
|
}
|
||||||
|
if (data != NULL)
|
||||||
|
{
|
||||||
|
int* result_p = (int*)data;
|
||||||
|
*result_p = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
RARCH_LOG("Environ UNSUPPORTED (#%u).\n", cmd);
|
||||||
|
@ -1585,6 +1585,11 @@ void video_driver_unset_stub_frame(void)
|
|||||||
frame_bak = NULL;
|
frame_bak = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool video_driver_is_stub_frame(void)
|
||||||
|
{
|
||||||
|
return current_video->frame == video_null.frame;
|
||||||
|
}
|
||||||
|
|
||||||
bool video_driver_supports_recording(void)
|
bool video_driver_supports_recording(void)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -2146,6 +2151,11 @@ void video_driver_set_active(void)
|
|||||||
video_driver_active = true;
|
video_driver_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void video_driver_unset_active(void)
|
||||||
|
{
|
||||||
|
video_driver_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool video_driver_is_active(void)
|
bool video_driver_is_active(void)
|
||||||
{
|
{
|
||||||
return video_driver_active;
|
return video_driver_active;
|
||||||
|
@ -905,6 +905,7 @@ void video_driver_destroy(void);
|
|||||||
void video_driver_set_cached_frame_ptr(const void *data);
|
void video_driver_set_cached_frame_ptr(const void *data);
|
||||||
void video_driver_set_stub_frame(void);
|
void video_driver_set_stub_frame(void);
|
||||||
void video_driver_unset_stub_frame(void);
|
void video_driver_unset_stub_frame(void);
|
||||||
|
bool video_driver_is_stub_frame(void);
|
||||||
bool video_driver_supports_recording(void);
|
bool video_driver_supports_recording(void);
|
||||||
bool video_driver_supports_viewport_read(void);
|
bool video_driver_supports_viewport_read(void);
|
||||||
bool video_driver_supports_read_frame_raw(void);
|
bool video_driver_supports_read_frame_raw(void);
|
||||||
@ -949,6 +950,7 @@ bool video_driver_is_video_cache_context(void);
|
|||||||
void video_driver_set_video_cache_context_ack(void);
|
void video_driver_set_video_cache_context_ack(void);
|
||||||
bool video_driver_is_video_cache_context_ack(void);
|
bool video_driver_is_video_cache_context_ack(void);
|
||||||
void video_driver_set_active(void);
|
void video_driver_set_active(void);
|
||||||
|
void video_driver_unset_active(void);
|
||||||
bool video_driver_is_active(void);
|
bool video_driver_is_active(void);
|
||||||
bool video_driver_gpu_record_init(unsigned size);
|
bool video_driver_gpu_record_init(unsigned size);
|
||||||
void video_driver_gpu_record_deinit(void);
|
void video_driver_gpu_record_deinit(void);
|
||||||
|
@ -1113,6 +1113,7 @@ struct retro_led_interface
|
|||||||
retro_set_led_state_t set_led_state;
|
retro_set_led_state_t set_led_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
|
||||||
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
#define RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE (41 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
/* const struct retro_hw_render_interface ** --
|
/* const struct retro_hw_render_interface ** --
|
||||||
|
Loading…
x
Reference in New Issue
Block a user