libobs: Implement audio monitoring

Adds functions to turn on audio monitoring to allow the user to hear
playback of an audio source over the user's speaker.  It can be set to
turn off monitoring and only output to stream, or it can be set to
output only to monitoring, or it can be set to both.

On windows, audio monitoring uses WASAPI.  Windows also is capable of
syncing the audio to the video according to when the video frame itself
was played.

On mac, it uses AudioQueue.

On linux, it's not currently implemented and won't do anything (to be
implemented).
This commit is contained in:
jp9000
2017-02-05 21:37:35 -08:00
parent 74f9c389cb
commit d2934eca7e
13 changed files with 1170 additions and 7 deletions

View File

@@ -582,6 +582,15 @@ EXPORT enum obs_obj_type obs_obj_get_type(void *obj);
EXPORT const char *obs_obj_get_id(void *obj);
EXPORT bool obs_obj_invalid(void *obj);
typedef bool (*obs_enum_audio_device_cb)(void *data, const char *name,
const char *id);
EXPORT void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb,
void *data);
EXPORT bool obs_set_audio_monitoring_device(const char *name, const char *id);
EXPORT void obs_get_audio_monitoring_device(const char **name, const char **id);
/* ------------------------------------------------------------------------- */
/* View context */
@@ -914,6 +923,17 @@ EXPORT void obs_source_set_deinterlace_field_order(obs_source_t *source,
EXPORT enum obs_deinterlace_field_order obs_source_get_deinterlace_field_order(
const obs_source_t *source);
enum obs_monitoring_type {
OBS_MONITORING_TYPE_NONE,
OBS_MONITORING_TYPE_MONITOR_ONLY,
OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT
};
EXPORT void obs_source_set_monitoring_type(obs_source_t *source,
enum obs_monitoring_type type);
EXPORT enum obs_monitoring_type obs_source_get_monitoring_type(
const obs_source_t *source);
/* ------------------------------------------------------------------------- */
/* Functions used by sources */