mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
libobs: Add obs_volmeter_get_cur_db function
This commit is contained in:
parent
16c6e69722
commit
14d330c455
@ -804,3 +804,27 @@ void obs_volmeter_remove_callback(obs_volmeter_t *volmeter,
|
||||
da_erase_item(volmeter->callbacks, &cb);
|
||||
pthread_mutex_unlock(&volmeter->callback_mutex);
|
||||
}
|
||||
|
||||
float obs_volmeter_get_cur_db(enum obs_fader_type type, const float def)
|
||||
{
|
||||
float db;
|
||||
|
||||
switch(type) {
|
||||
case OBS_FADER_CUBIC:
|
||||
db = cubic_def_to_db(def);
|
||||
break;
|
||||
case OBS_FADER_IEC:
|
||||
db = iec_def_to_db(def);
|
||||
break;
|
||||
case OBS_FADER_LOG:
|
||||
db = log_def_to_db(def);
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
break;
|
||||
}
|
||||
|
||||
return db;
|
||||
fail:
|
||||
return -INFINITY;
|
||||
}
|
||||
|
@ -251,6 +251,8 @@ EXPORT void obs_volmeter_add_callback(obs_volmeter_t *volmeter,
|
||||
EXPORT void obs_volmeter_remove_callback(obs_volmeter_t *volmeter,
|
||||
obs_volmeter_updated_t callback, void *param);
|
||||
|
||||
EXPORT float obs_volmeter_get_cur_db(enum obs_fader_type type, const float def);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user