Add decibel selection to audio condition

This commit is contained in:
WarmUpTill
2024-02-15 19:56:30 +01:00
committed by WarmUpTill
parent 583b559c78
commit c3f207f93c
10 changed files with 191 additions and 67 deletions

View File

@@ -1,6 +1,7 @@
#include "audio-helpers.hpp"
#include "obs-module-helper.hpp"
#include <cmath>
#include <obs.hpp>
namespace advss {
@@ -13,4 +14,14 @@ void PopulateMonitorTypeSelection(QComboBox *list)
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.both"));
}
float DecibelToPercent(float db)
{
return isfinite((double)db) ? powf(10.0f, db / 20.0f) : 0.0f;
}
float PercentToDecibel(float percent)
{
return (percent == 0.0f) ? -INFINITY : (20.0f * log10f(percent));
}
} // namespace advss