2016-02-23 23:16:51 +00:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QSpinBox>
|
2017-04-19 19:54:15 +00:00
|
|
|
#include <QComboBox>
|
2016-02-23 23:16:51 +00:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include "qt-wrappers.hpp"
|
2017-04-19 19:54:15 +00:00
|
|
|
#include "obs-app.hpp"
|
2016-02-23 23:16:51 +00:00
|
|
|
#include "adv-audio-control.hpp"
|
2019-07-27 12:47:10 +00:00
|
|
|
#include "window-basic-main.hpp"
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
#ifndef NSEC_PER_MSEC
|
|
|
|
#define NSEC_PER_MSEC 1000000
|
|
|
|
#endif
|
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
#define MIN_DB -96.0
|
|
|
|
#define MAX_DB 26.0
|
|
|
|
|
2018-12-16 16:14:58 +00:00
|
|
|
OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
|
2016-02-23 23:16:51 +00:00
|
|
|
: source(source_)
|
|
|
|
{
|
|
|
|
QHBoxLayout *hlayout;
|
|
|
|
signal_handler_t *handler = obs_source_get_signal_handler(source);
|
|
|
|
const char *sourceName = obs_source_get_name(source);
|
|
|
|
float vol = obs_source_get_volume(source);
|
|
|
|
uint32_t flags = obs_source_get_flags(source);
|
|
|
|
uint32_t mixers = obs_source_get_audio_mixers(source);
|
|
|
|
|
2019-09-22 21:19:10 +00:00
|
|
|
forceMonoContainer = new QWidget();
|
|
|
|
mixerContainer = new QWidget();
|
|
|
|
balanceContainer = new QWidget();
|
|
|
|
labelL = new QLabel();
|
|
|
|
labelR = new QLabel();
|
|
|
|
nameLabel = new QLabel();
|
|
|
|
volume = new QDoubleSpinBox();
|
|
|
|
forceMono = new QCheckBox();
|
|
|
|
balance = new BalanceSlider();
|
2018-02-19 19:54:37 +00:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
2019-09-22 21:19:10 +00:00
|
|
|
monitoringType = new QComboBox();
|
2017-04-19 19:54:15 +00:00
|
|
|
#endif
|
2019-09-22 21:19:10 +00:00
|
|
|
syncOffset = new QSpinBox();
|
|
|
|
mixer1 = new QCheckBox();
|
|
|
|
mixer2 = new QCheckBox();
|
|
|
|
mixer3 = new QCheckBox();
|
|
|
|
mixer4 = new QCheckBox();
|
|
|
|
mixer5 = new QCheckBox();
|
|
|
|
mixer6 = new QCheckBox();
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
volChangedSignal.Connect(handler, "volume", OBSSourceVolumeChanged,
|
2019-09-22 21:19:10 +00:00
|
|
|
this);
|
2016-02-23 23:16:51 +00:00
|
|
|
syncOffsetSignal.Connect(handler, "audio_sync", OBSSourceSyncChanged,
|
2019-09-22 21:19:10 +00:00
|
|
|
this);
|
2016-02-23 23:16:51 +00:00
|
|
|
flagsSignal.Connect(handler, "update_flags", OBSSourceFlagsChanged,
|
2019-09-22 21:19:10 +00:00
|
|
|
this);
|
2016-02-23 23:16:51 +00:00
|
|
|
mixersSignal.Connect(handler, "audio_mixers", OBSSourceMixersChanged,
|
2019-09-22 21:19:10 +00:00
|
|
|
this);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
hlayout = new QHBoxLayout();
|
|
|
|
hlayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
forceMonoContainer->setLayout(hlayout);
|
|
|
|
hlayout = new QHBoxLayout();
|
|
|
|
hlayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
mixerContainer->setLayout(hlayout);
|
|
|
|
hlayout = new QHBoxLayout();
|
|
|
|
hlayout->setContentsMargins(0, 0, 0, 0);
|
2019-07-27 12:47:10 +00:00
|
|
|
balanceContainer->setLayout(hlayout);
|
2019-09-22 21:19:10 +00:00
|
|
|
balanceContainer->setFixedWidth(150);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
labelL->setText("L");
|
|
|
|
|
|
|
|
labelR->setText("R");
|
|
|
|
|
|
|
|
nameLabel->setText(QT_UTF8(sourceName));
|
2019-09-22 21:19:10 +00:00
|
|
|
nameLabel->setAlignment(Qt::AlignVCenter);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
volume->setMinimum(MIN_DB - 0.1);
|
|
|
|
volume->setMaximum(MAX_DB);
|
|
|
|
volume->setSingleStep(0.1);
|
|
|
|
volume->setDecimals(1);
|
|
|
|
volume->setSuffix(" dB");
|
|
|
|
volume->setValue(obs_mul_to_db(vol));
|
2019-09-22 21:19:10 +00:00
|
|
|
volume->setFixedWidth(100);
|
2019-07-27 12:47:10 +00:00
|
|
|
|
|
|
|
if (volume->value() < MIN_DB)
|
|
|
|
volume->setSpecialValueText("-inf dB");
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
forceMono->setChecked((flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0);
|
|
|
|
|
|
|
|
forceMonoContainer->layout()->addWidget(forceMono);
|
2019-09-22 21:19:10 +00:00
|
|
|
forceMonoContainer->layout()->setAlignment(forceMono, Qt::AlignVCenter);
|
|
|
|
forceMonoContainer->setFixedWidth(50);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
balance->setOrientation(Qt::Horizontal);
|
|
|
|
balance->setMinimum(0);
|
|
|
|
balance->setMaximum(100);
|
|
|
|
balance->setTickPosition(QSlider::TicksAbove);
|
|
|
|
balance->setTickInterval(50);
|
|
|
|
|
2019-09-22 21:19:10 +00:00
|
|
|
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
|
2019-07-27 12:47:10 +00:00
|
|
|
|
2019-09-22 21:19:10 +00:00
|
|
|
const char *speakers =
|
|
|
|
config_get_string(main->Config(), "Audio", "ChannelSetup");
|
2019-07-27 12:47:10 +00:00
|
|
|
|
|
|
|
if (strcmp(speakers, "Mono") == 0)
|
|
|
|
balance->setEnabled(false);
|
|
|
|
else
|
|
|
|
balance->setEnabled(true);
|
|
|
|
|
|
|
|
float bal = obs_source_get_balance_value(source) * 100.0f;
|
|
|
|
balance->setValue((int)bal);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
int64_t cur_sync = obs_source_get_sync_offset(source);
|
2019-07-27 12:47:10 +00:00
|
|
|
syncOffset->setMinimum(-950);
|
2016-02-23 23:16:51 +00:00
|
|
|
syncOffset->setMaximum(20000);
|
2019-09-22 21:19:10 +00:00
|
|
|
syncOffset->setSuffix(" ms");
|
2016-02-23 23:16:51 +00:00
|
|
|
syncOffset->setValue(int(cur_sync / NSEC_PER_MSEC));
|
2019-09-22 21:19:10 +00:00
|
|
|
syncOffset->setFixedWidth(100);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2017-04-19 19:54:15 +00:00
|
|
|
int idx;
|
2018-02-19 19:54:37 +00:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
2017-04-19 19:54:15 +00:00
|
|
|
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.None"),
|
2019-09-22 21:19:10 +00:00
|
|
|
(int)OBS_MONITORING_TYPE_NONE);
|
2017-04-19 19:54:15 +00:00
|
|
|
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.MonitorOnly"),
|
2019-09-22 21:19:10 +00:00
|
|
|
(int)OBS_MONITORING_TYPE_MONITOR_ONLY);
|
2017-04-19 19:54:15 +00:00
|
|
|
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.Both"),
|
2019-09-22 21:19:10 +00:00
|
|
|
(int)OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT);
|
2017-04-19 19:54:15 +00:00
|
|
|
int mt = (int)obs_source_get_monitoring_type(source);
|
|
|
|
idx = monitoringType->findData(mt);
|
|
|
|
monitoringType->setCurrentIndex(idx);
|
|
|
|
#endif
|
|
|
|
|
2016-02-23 23:16:51 +00:00
|
|
|
mixer1->setText("1");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer1->setChecked(mixers & (1 << 0));
|
2016-02-23 23:16:51 +00:00
|
|
|
mixer2->setText("2");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer2->setChecked(mixers & (1 << 1));
|
2016-02-23 23:16:51 +00:00
|
|
|
mixer3->setText("3");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer3->setChecked(mixers & (1 << 2));
|
2016-02-23 23:16:51 +00:00
|
|
|
mixer4->setText("4");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer4->setChecked(mixers & (1 << 3));
|
2017-04-19 19:54:15 +00:00
|
|
|
mixer5->setText("5");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer5->setChecked(mixers & (1 << 4));
|
2017-04-19 19:54:15 +00:00
|
|
|
mixer6->setText("6");
|
2019-09-22 21:19:10 +00:00
|
|
|
mixer6->setChecked(mixers & (1 << 5));
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
speaker_layout sl = obs_source_get_speaker_layout(source);
|
2019-09-22 21:19:10 +00:00
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
if (sl == SPEAKERS_STEREO) {
|
|
|
|
balanceContainer->layout()->addWidget(labelL);
|
|
|
|
balanceContainer->layout()->addWidget(balance);
|
|
|
|
balanceContainer->layout()->addWidget(labelR);
|
|
|
|
balanceContainer->setMaximumWidth(170);
|
|
|
|
}
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
mixerContainer->layout()->addWidget(mixer1);
|
|
|
|
mixerContainer->layout()->addWidget(mixer2);
|
|
|
|
mixerContainer->layout()->addWidget(mixer3);
|
|
|
|
mixerContainer->layout()->addWidget(mixer4);
|
2017-04-19 19:54:15 +00:00
|
|
|
mixerContainer->layout()->addWidget(mixer5);
|
|
|
|
mixerContainer->layout()->addWidget(mixer6);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2019-09-22 21:19:10 +00:00
|
|
|
QWidget::connect(volume, SIGNAL(valueChanged(double)), this,
|
|
|
|
SLOT(volumeChanged(double)));
|
|
|
|
QWidget::connect(forceMono, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(downmixMonoChanged(bool)));
|
|
|
|
QWidget::connect(balance, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(balanceChanged(int)));
|
|
|
|
QWidget::connect(balance, SIGNAL(doubleClicked()), this,
|
|
|
|
SLOT(ResetBalance()));
|
|
|
|
QWidget::connect(syncOffset, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(syncOffsetChanged(int)));
|
2018-02-19 19:54:37 +00:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
2019-09-22 21:19:10 +00:00
|
|
|
QWidget::connect(monitoringType, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(monitoringTypeChanged(int)));
|
2017-04-19 19:54:15 +00:00
|
|
|
#endif
|
2019-09-22 21:19:10 +00:00
|
|
|
QWidget::connect(mixer1, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer1Changed(bool)));
|
|
|
|
QWidget::connect(mixer2, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer2Changed(bool)));
|
|
|
|
QWidget::connect(mixer3, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer3Changed(bool)));
|
|
|
|
QWidget::connect(mixer4, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer4Changed(bool)));
|
|
|
|
QWidget::connect(mixer5, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer5Changed(bool)));
|
|
|
|
QWidget::connect(mixer6, SIGNAL(clicked(bool)), this,
|
|
|
|
SLOT(mixer6Changed(bool)));
|
2016-02-23 23:16:51 +00:00
|
|
|
|
2018-12-16 16:14:58 +00:00
|
|
|
setObjectName(sourceName);
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OBSAdvAudioCtrl::~OBSAdvAudioCtrl()
|
|
|
|
{
|
|
|
|
nameLabel->deleteLater();
|
|
|
|
volume->deleteLater();
|
|
|
|
forceMonoContainer->deleteLater();
|
2019-07-27 12:47:10 +00:00
|
|
|
balanceContainer->deleteLater();
|
2016-02-23 23:16:51 +00:00
|
|
|
syncOffset->deleteLater();
|
2018-02-19 19:54:37 +00:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
2017-04-19 19:54:15 +00:00
|
|
|
monitoringType->deleteLater();
|
|
|
|
#endif
|
2016-02-23 23:16:51 +00:00
|
|
|
mixerContainer->deleteLater();
|
|
|
|
}
|
|
|
|
|
2018-12-16 16:14:58 +00:00
|
|
|
void OBSAdvAudioCtrl::ShowAudioControl(QGridLayout *layout)
|
|
|
|
{
|
|
|
|
int lastRow = layout->rowCount();
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
layout->addWidget(nameLabel, lastRow, idx++);
|
|
|
|
layout->addWidget(volume, lastRow, idx++);
|
|
|
|
layout->addWidget(forceMonoContainer, lastRow, idx++);
|
2019-07-27 12:47:10 +00:00
|
|
|
layout->addWidget(balanceContainer, lastRow, idx++);
|
2018-12-16 16:14:58 +00:00
|
|
|
layout->addWidget(syncOffset, lastRow, idx++);
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
|
|
|
layout->addWidget(monitoringType, lastRow, idx++);
|
|
|
|
#endif
|
|
|
|
layout->addWidget(mixerContainer, lastRow, idx++);
|
2019-09-22 21:19:10 +00:00
|
|
|
layout->layout()->setAlignment(mixerContainer, Qt::AlignVCenter);
|
|
|
|
layout->setHorizontalSpacing(15);
|
2018-12-16 16:14:58 +00:00
|
|
|
}
|
|
|
|
|
2016-02-23 23:16:51 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* OBS source callbacks */
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::OBSSourceFlagsChanged(void *param, calldata_t *calldata)
|
|
|
|
{
|
|
|
|
uint32_t flags = (uint32_t)calldata_int(calldata, "flags");
|
2019-09-22 21:19:10 +00:00
|
|
|
QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param),
|
|
|
|
"SourceFlagsChanged", Q_ARG(uint32_t, flags));
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::OBSSourceVolumeChanged(void *param, calldata_t *calldata)
|
|
|
|
{
|
|
|
|
float volume = (float)calldata_float(calldata, "volume");
|
2019-09-22 21:19:10 +00:00
|
|
|
QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param),
|
|
|
|
"SourceVolumeChanged", Q_ARG(float, volume));
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::OBSSourceSyncChanged(void *param, calldata_t *calldata)
|
|
|
|
{
|
|
|
|
int64_t offset = calldata_int(calldata, "offset");
|
2019-09-22 21:19:10 +00:00
|
|
|
QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param),
|
|
|
|
"SourceSyncChanged", Q_ARG(int64_t, offset));
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::OBSSourceMixersChanged(void *param, calldata_t *calldata)
|
|
|
|
{
|
|
|
|
uint32_t mixers = (uint32_t)calldata_int(calldata, "mixers");
|
2019-09-22 21:19:10 +00:00
|
|
|
QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param),
|
|
|
|
"SourceMixersChanged",
|
|
|
|
Q_ARG(uint32_t, mixers));
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* Qt event queue source callbacks */
|
|
|
|
|
|
|
|
static inline void setCheckboxState(QCheckBox *checkbox, bool checked)
|
|
|
|
{
|
|
|
|
checkbox->blockSignals(true);
|
|
|
|
checkbox->setChecked(checked);
|
|
|
|
checkbox->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::SourceFlagsChanged(uint32_t flags)
|
|
|
|
{
|
|
|
|
bool forceMonoVal = (flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0;
|
|
|
|
setCheckboxState(forceMono, forceMonoVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::SourceVolumeChanged(float value)
|
|
|
|
{
|
|
|
|
volume->blockSignals(true);
|
2019-07-27 12:47:10 +00:00
|
|
|
volume->setValue(obs_mul_to_db(value));
|
2016-02-23 23:16:51 +00:00
|
|
|
volume->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::SourceSyncChanged(int64_t offset)
|
|
|
|
{
|
|
|
|
syncOffset->setValue(offset / NSEC_PER_MSEC);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::SourceMixersChanged(uint32_t mixers)
|
|
|
|
{
|
2019-09-22 21:19:10 +00:00
|
|
|
setCheckboxState(mixer1, mixers & (1 << 0));
|
|
|
|
setCheckboxState(mixer2, mixers & (1 << 1));
|
|
|
|
setCheckboxState(mixer3, mixers & (1 << 2));
|
|
|
|
setCheckboxState(mixer4, mixers & (1 << 3));
|
|
|
|
setCheckboxState(mixer5, mixers & (1 << 4));
|
|
|
|
setCheckboxState(mixer6, mixers & (1 << 5));
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* Qt control callbacks */
|
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
void OBSAdvAudioCtrl::volumeChanged(double db)
|
2016-02-23 23:16:51 +00:00
|
|
|
{
|
2019-07-27 12:47:10 +00:00
|
|
|
if (db < MIN_DB) {
|
|
|
|
volume->setSpecialValueText("-inf dB");
|
|
|
|
db = -INFINITY;
|
|
|
|
}
|
|
|
|
|
|
|
|
float val = obs_db_to_mul(db);
|
2016-02-23 23:16:51 +00:00
|
|
|
obs_source_set_volume(source, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::downmixMonoChanged(bool checked)
|
|
|
|
{
|
|
|
|
uint32_t flags = obs_source_get_flags(source);
|
|
|
|
bool forceMonoActive = (flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0;
|
|
|
|
|
|
|
|
if (forceMonoActive != checked) {
|
|
|
|
if (checked)
|
|
|
|
flags |= OBS_SOURCE_FLAG_FORCE_MONO;
|
|
|
|
else
|
|
|
|
flags &= ~OBS_SOURCE_FLAG_FORCE_MONO;
|
|
|
|
|
|
|
|
obs_source_set_flags(source, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-27 12:47:10 +00:00
|
|
|
void OBSAdvAudioCtrl::balanceChanged(int val)
|
|
|
|
{
|
|
|
|
float bal = (float)val / 100.0f;
|
|
|
|
|
|
|
|
if (abs(50 - val) < 10) {
|
|
|
|
balance->blockSignals(true);
|
|
|
|
balance->setValue(50);
|
|
|
|
bal = 0.5f;
|
|
|
|
balance->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_source_set_balance_value(source, bal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::ResetBalance()
|
2016-02-23 23:16:51 +00:00
|
|
|
{
|
2019-07-27 12:47:10 +00:00
|
|
|
balance->setValue(50);
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::syncOffsetChanged(int milliseconds)
|
|
|
|
{
|
|
|
|
int64_t cur_val = obs_source_get_sync_offset(source);
|
|
|
|
|
|
|
|
if (cur_val / NSEC_PER_MSEC != milliseconds)
|
2019-09-22 21:19:10 +00:00
|
|
|
obs_source_set_sync_offset(source, int64_t(milliseconds) *
|
|
|
|
NSEC_PER_MSEC);
|
2016-02-23 23:16:51 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 19:54:15 +00:00
|
|
|
void OBSAdvAudioCtrl::monitoringTypeChanged(int index)
|
|
|
|
{
|
|
|
|
int mt = monitoringType->itemData(index).toInt();
|
|
|
|
obs_source_set_monitoring_type(source, (obs_monitoring_type)mt);
|
|
|
|
|
|
|
|
const char *type = nullptr;
|
|
|
|
|
|
|
|
switch (mt) {
|
|
|
|
case OBS_MONITORING_TYPE_NONE:
|
|
|
|
type = "none";
|
|
|
|
break;
|
|
|
|
case OBS_MONITORING_TYPE_MONITOR_ONLY:
|
|
|
|
type = "monitor only";
|
|
|
|
break;
|
|
|
|
case OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT:
|
|
|
|
type = "monitor and output";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
blog(LOG_INFO, "User changed audio monitoring for source '%s' to: %s",
|
2019-09-22 21:19:10 +00:00
|
|
|
obs_source_get_name(source), type);
|
2017-04-19 19:54:15 +00:00
|
|
|
}
|
|
|
|
|
2016-02-23 23:16:51 +00:00
|
|
|
static inline void setMixer(obs_source_t *source, const int mixerIdx,
|
2019-09-22 21:19:10 +00:00
|
|
|
const bool checked)
|
2016-02-23 23:16:51 +00:00
|
|
|
{
|
|
|
|
uint32_t mixers = obs_source_get_audio_mixers(source);
|
|
|
|
uint32_t new_mixers = mixers;
|
|
|
|
|
2019-09-22 21:19:10 +00:00
|
|
|
if (checked)
|
|
|
|
new_mixers |= (1 << mixerIdx);
|
|
|
|
else
|
|
|
|
new_mixers &= ~(1 << mixerIdx);
|
2016-02-23 23:16:51 +00:00
|
|
|
|
|
|
|
obs_source_set_audio_mixers(source, new_mixers);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer1Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 0, checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer2Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 1, checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer3Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 2, checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer4Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 3, checked);
|
|
|
|
}
|
2017-04-19 19:54:15 +00:00
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer5Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 4, checked);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSAdvAudioCtrl::mixer6Changed(bool checked)
|
|
|
|
{
|
|
|
|
setMixer(source, 5, checked);
|
|
|
|
}
|