0
0
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:
cg2121 2017-07-01 19:05:21 -07:00 committed by jp9000
parent 16c6e69722
commit 14d330c455
2 changed files with 26 additions and 0 deletions

View File

@ -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;
}

View File

@ -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