libobs: Implement new audio subsystem
The new audio subsystem fixes two issues: - First Primary issue it fixes is the ability for parent sources to intercept the audio of child sources, and do custom processing on them. The main reason for this was the ability to do custom cross-fading in transitions, but it's also useful for things such as side-chain effects, applying audio effects to entire scenes, applying scene-specific audio filters on sub-sources, and other such possibilities. - The secondary issue that needed fixing was audio buffering. Previously, audio buffering was always a fixed buffer size, so it would always have exactly a certain number of milliseconds of audio buffering (and thus output delay). Instead, it now dynamically increases audio buffering only as necessary, minimizing output delay, and removing the need for users to have to worry about an audio buffering setting. The new design makes it so that audio from the leaves of the scene graph flow to the root nodes, and can be intercepted by parent sources. Each audio source handles its own buffering, and each audio tick a specific number of audio frames are popped from the front of the circular buffer on each audio source. Composite sources (such as scenes) can access the audio for child sources and do custom processing or mixing on that audio. Composite sources use the audio_render callback of sources to do synchronous or deferred audio processing per audio tick. Things like scenes now mix audio from their sub-sources.
This commit is contained in:
@@ -180,7 +180,6 @@ struct obs_video_info {
|
||||
struct obs_audio_info {
|
||||
uint32_t samples_per_sec;
|
||||
enum speaker_layout speakers;
|
||||
uint64_t buffer_ms;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -974,6 +973,7 @@ EXPORT uint32_t obs_source_get_base_width(obs_source_t *source);
|
||||
/** Gets the base height for a source (not taking in to account filtering) */
|
||||
EXPORT uint32_t obs_source_get_base_height(obs_source_t *source);
|
||||
|
||||
EXPORT bool obs_source_audio_pending(const obs_source_t *source);
|
||||
EXPORT uint64_t obs_source_get_audio_timestamp(const obs_source_t *source);
|
||||
EXPORT void obs_source_get_audio_mix(const obs_source_t *source,
|
||||
struct obs_source_audio_mix *audio);
|
||||
|
Reference in New Issue
Block a user