mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 20:28:11 -05:00
Add decibel selection to audio condition
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user