mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-11-15 22:23:24 -06:00
Support OBS 33 audio monitoring API changes
This commit is contained in:
@@ -6,12 +6,52 @@
|
||||
|
||||
namespace advss {
|
||||
|
||||
void PopulateMonitorTypeSelection(QComboBox *list)
|
||||
// OBS 33 replaced monitoring types with a bool and dropped "monitor only"
|
||||
static constexpr bool monitorOnlySupported = LIBOBS_API_VER <
|
||||
MAKE_SEMANTIC_VERSION(33, 0, 0);
|
||||
|
||||
void PopulateMonitorTypeSelection(QComboBox *list,
|
||||
bool alwaysIncludeMonitorOnly)
|
||||
{
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.none"));
|
||||
list->addItem(
|
||||
obs_module_text("AdvSceneSwitcher.audio.monitor.monitorOnly"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.both"));
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.none"),
|
||||
OBS_MONITORING_TYPE_NONE);
|
||||
if (monitorOnlySupported || alwaysIncludeMonitorOnly) {
|
||||
list->addItem(
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.audio.monitor.monitorOnly"),
|
||||
OBS_MONITORING_TYPE_MONITOR_ONLY);
|
||||
}
|
||||
list->addItem(obs_module_text("AdvSceneSwitcher.audio.monitor.both"),
|
||||
OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT);
|
||||
}
|
||||
|
||||
obs_monitoring_type ToSupportedMonitoringType(obs_monitoring_type type)
|
||||
{
|
||||
if (!monitorOnlySupported && type == OBS_MONITORING_TYPE_MONITOR_ONLY) {
|
||||
return OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
void SetMonitoringType(obs_source_t *source, obs_monitoring_type type)
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(33, 0, 0)
|
||||
obs_source_set_monitoring_enabled(source,
|
||||
type != OBS_MONITORING_TYPE_NONE);
|
||||
#else
|
||||
obs_source_set_monitoring_type(source, type);
|
||||
#endif
|
||||
}
|
||||
|
||||
obs_monitoring_type GetMonitoringType(const obs_source_t *source)
|
||||
{
|
||||
#if LIBOBS_API_VER >= MAKE_SEMANTIC_VERSION(33, 0, 0)
|
||||
return obs_source_get_monitoring_enabled(source)
|
||||
? OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT
|
||||
: OBS_MONITORING_TYPE_NONE;
|
||||
#else
|
||||
return obs_source_get_monitoring_type(source);
|
||||
#endif
|
||||
}
|
||||
|
||||
float DecibelToPercent(float db)
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
#pragma once
|
||||
#include <obs.h>
|
||||
#include <QComboBox>
|
||||
|
||||
namespace advss {
|
||||
|
||||
void PopulateMonitorTypeSelection(QComboBox *list);
|
||||
void PopulateMonitorTypeSelection(QComboBox *list,
|
||||
bool alwaysIncludeMonitorOnly = false);
|
||||
void SetMonitoringType(obs_source_t *source, obs_monitoring_type type);
|
||||
obs_monitoring_type GetMonitoringType(const obs_source_t *source);
|
||||
obs_monitoring_type ToSupportedMonitoringType(obs_monitoring_type type);
|
||||
float DecibelToPercent(float db);
|
||||
float PercentToDecibel(float percent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user