Skip to content

Commit 582ec85

Browse files
committed
libobs: Add a fader_muted member to obs_source
When a user pushes down the fader to minimum, this tags the source as fader_muted to be used alongside the muted and user_muted members. To narrow the use of this member, we keep it distinct from muted and user_muted. This will be used by audio deduplication logic. Signed-off-by: pkv <[email protected]>
1 parent 7028242 commit 582ec85

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

libobs/obs-audio-controls.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,10 @@ bool obs_fader_set_db(obs_fader_t *fader, const float db)
600600

601601
pthread_mutex_unlock(&fader->mutex);
602602

603-
if (src)
603+
if (src) {
604604
obs_source_set_volume(src, mul);
605+
src->fader_muted = (fader->cur_db <= fader->min_db) ? true : false;
606+
}
605607

606608
return !clamped;
607609
}
@@ -677,6 +679,7 @@ bool obs_fader_attach_source(obs_fader_t *fader, obs_source_t *source)
677679

678680
fader->source = source;
679681
fader->cur_db = mul_to_db(vol);
682+
source->fader_muted = (fader->cur_db <= fader->min_db) ? true : false;
680683

681684
pthread_mutex_unlock(&fader->mutex);
682685

libobs/obs-internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ struct obs_source {
888888
float balance;
889889
/* audio_is_duplicated: tracks whether a source appears multiple times in the audio tree during this tick */
890890
bool audio_is_duplicated;
891+
bool fader_muted;
891892

892893
/* async video data */
893894
gs_texture_t *async_textures[MAX_AV_PLANES];

libobs/obs-source.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ static obs_source_t *obs_source_create_internal(const char *id, const char *name
435435

436436
/* audio deduplication initialization */
437437
source->audio_is_duplicated = false;
438+
source->fader_muted = false;
438439

439440
obs_source_init_finalize(source, canvas);
440441
if (!private) {

0 commit comments

Comments
 (0)