Skip to content

Commit 3316c80

Browse files
committed
UI: Add headphone checkbox to mixer
This adds a headphone checkbox to the mixer area. It replaces the audio monitor selection in the advanced audio properties. The output to monitor only option is now in the right click menu of the mixer.
1 parent fcee9d1 commit 3316c80

19 files changed

+221
-67
lines changed

UI/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ set(obs_HEADERS
213213
item-widget-helpers.hpp
214214
visibility-checkbox.hpp
215215
locked-checkbox.hpp
216+
headphone-checkbox.hpp
216217
vertical-scroll-area.hpp
217218
visibility-item-widget.hpp
218219
slider-absoluteset-style.hpp

UI/adv-audio-control.cpp

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
3232
volume = new QSpinBox();
3333
forceMono = new QCheckBox();
3434
panning = new QSlider(Qt::Horizontal);
35-
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
36-
monitoringType = new QComboBox();
37-
#endif
3835
syncOffset = new QSpinBox();
3936
mixer1 = new QCheckBox();
4037
mixer2 = new QCheckBox();
@@ -92,19 +89,6 @@ OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
9289
syncOffset->setMaximum(20000);
9390
syncOffset->setValue(int(cur_sync / NSEC_PER_MSEC));
9491

95-
int idx;
96-
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
97-
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.None"),
98-
(int)OBS_MONITORING_TYPE_NONE);
99-
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.MonitorOnly"),
100-
(int)OBS_MONITORING_TYPE_MONITOR_ONLY);
101-
monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.Both"),
102-
(int)OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT);
103-
int mt = (int)obs_source_get_monitoring_type(source);
104-
idx = monitoringType->findData(mt);
105-
monitoringType->setCurrentIndex(idx);
106-
#endif
107-
10892
mixer1->setText("1");
10993
mixer1->setChecked(mixers & (1<<0));
11094
mixer2->setText("2");
@@ -138,10 +122,6 @@ OBSAdvAudioCtrl::OBSAdvAudioCtrl(QGridLayout *, obs_source_t *source_)
138122
this, SLOT(panningChanged(int)));
139123
QWidget::connect(syncOffset, SIGNAL(valueChanged(int)),
140124
this, SLOT(syncOffsetChanged(int)));
141-
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
142-
QWidget::connect(monitoringType, SIGNAL(currentIndexChanged(int)),
143-
this, SLOT(monitoringTypeChanged(int)));
144-
#endif
145125
QWidget::connect(mixer1, SIGNAL(clicked(bool)),
146126
this, SLOT(mixer1Changed(bool)));
147127
QWidget::connect(mixer2, SIGNAL(clicked(bool)),
@@ -165,9 +145,6 @@ OBSAdvAudioCtrl::~OBSAdvAudioCtrl()
165145
forceMonoContainer->deleteLater();
166146
panningContainer->deleteLater();
167147
syncOffset->deleteLater();
168-
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
169-
monitoringType->deleteLater();
170-
#endif
171148
mixerContainer->deleteLater();
172149
}
173150

@@ -181,9 +158,6 @@ void OBSAdvAudioCtrl::ShowAudioControl(QGridLayout *layout)
181158
layout->addWidget(forceMonoContainer, lastRow, idx++);
182159
layout->addWidget(panningContainer, lastRow, idx++);
183160
layout->addWidget(syncOffset, lastRow, idx++);
184-
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
185-
layout->addWidget(monitoringType, lastRow, idx++);
186-
#endif
187161
layout->addWidget(mixerContainer, lastRow, idx++);
188162
layout->layout()->setAlignment(mixerContainer,
189163
Qt::AlignHCenter | Qt::AlignVCenter);
@@ -298,29 +272,6 @@ void OBSAdvAudioCtrl::syncOffsetChanged(int milliseconds)
298272
int64_t(milliseconds) * NSEC_PER_MSEC);
299273
}
300274

301-
void OBSAdvAudioCtrl::monitoringTypeChanged(int index)
302-
{
303-
int mt = monitoringType->itemData(index).toInt();
304-
obs_source_set_monitoring_type(source, (obs_monitoring_type)mt);
305-
306-
const char *type = nullptr;
307-
308-
switch (mt) {
309-
case OBS_MONITORING_TYPE_NONE:
310-
type = "none";
311-
break;
312-
case OBS_MONITORING_TYPE_MONITOR_ONLY:
313-
type = "monitor only";
314-
break;
315-
case OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT:
316-
type = "monitor and output";
317-
break;
318-
}
319-
320-
blog(LOG_INFO, "User changed audio monitoring for source '%s' to: %s",
321-
obs_source_get_name(source), type);
322-
}
323-
324275
static inline void setMixer(obs_source_t *source, const int mixerIdx,
325276
const bool checked)
326277
{

UI/adv-audio-control.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class OBSAdvAudioCtrl : public QObject {
2828
QPointer<QLabel> labelL;
2929
QPointer<QLabel> labelR;
3030
QPointer<QSpinBox> syncOffset;
31-
QPointer<QComboBox> monitoringType;
3231
QPointer<QCheckBox> mixer1;
3332
QPointer<QCheckBox> mixer2;
3433
QPointer<QCheckBox> mixer3;
@@ -63,7 +62,6 @@ public slots:
6362
void downmixMonoChanged(bool checked);
6463
void panningChanged(int val);
6564
void syncOffsetChanged(int milliseconds);
66-
void monitoringTypeChanged(int index);
6765
void mixer1Changed(bool checked);
6866
void mixer2Changed(bool checked);
6967
void mixer3Changed(bool checked);

UI/data/locale/en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ VolControl.SliderUnmuted="Volume slider for '%1': %2"
331331
VolControl.SliderMuted="Volume slider for '%1': %2 (currently muted)"
332332
VolControl.Mute="Mute '%1'"
333333
VolControl.Properties="Properties for '%1'"
334+
VolControl.Headphones="Set monitoring for '%1'"
334335

335336
# add scene dialog
336337
Basic.Main.AddSceneDlg.Title="Add Scene"

UI/data/themes/Acri.qss

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,45 @@ MuteCheckBox::indicator:unchecked:disabled {
719719
image: url(./Dark/unmute.png);
720720
}
721721

722+
HeadphoneCheckBox {
723+
outline: none;
724+
}
725+
726+
HeadphoneCheckBox::indicator:checked {
727+
image: url(./Dark/headphones_checked.png);
728+
}
729+
730+
HeadphoneCheckBox::indicator:unchecked {
731+
image: url(./Dark/headphones_unchecked.png);
732+
}
733+
734+
HeadphoneCheckBox::indicator:unchecked:hover {
735+
image: url(./Dark/headphones_unchecked.png);
736+
}
737+
738+
HeadphoneCheckBox::indicator:unchecked:focus {
739+
image: url(./Dark/headphones_unchecked.png);
740+
}
741+
HeadphoneCheckBox::indicator:checked:hover {
742+
image: url(./Dark/headphones_checked.png);
743+
}
744+
745+
HeadphoneCheckBox::indicator:checked:focus {
746+
image: url(./Dark/headphones_checked.png);
747+
}
748+
749+
HeadphoneCheckBox::indicator:checked:disabled {
750+
image: url(./Dark/headphones_checked.png);
751+
}
752+
753+
HeadphoneCheckBox::indicator:unchecked:disabled {
754+
image: url(./Dark/headphones_unchecked.png);
755+
}
756+
722757
OBSHotkeyLabel[hotkeyPairHover=true] {
723758
color: rgba(27, 96, 166);
724759
}
725760

726-
727761
/* Label warning/error */
728762

729763
QLabel#warningLabel {

UI/data/themes/Dark.qss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,18 @@ MuteCheckBox::indicator:unchecked {
542542
image: url(./Dark/unmute.png);
543543
}
544544

545+
HeadphoneCheckBox {
546+
outline: none;
547+
}
548+
549+
HeadphoneCheckBox::indicator:checked {
550+
image: url(./Dark/headphones_checked.png);
551+
}
552+
553+
HeadphoneCheckBox::indicator:unchecked {
554+
image: url(./Dark/headphones_unchecked.png);
555+
}
556+
545557
OBSHotkeyLabel[hotkeyPairHover=true] {
546558
color: red;
547559
}
362 Bytes
Loading
412 Bytes
Loading

UI/data/themes/Default.qss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ MuteCheckBox::indicator:unchecked {
5151
image: url(:/res/images/unmute.png);
5252
}
5353

54+
HeadphoneCheckBox {
55+
outline: none;
56+
}
57+
58+
HeadphoneCheckBox::indicator:checked {
59+
image: url(:/res/images/headphones_checked.png);
60+
}
61+
62+
HeadphoneCheckBox::indicator:unchecked {
63+
image: url(:/res/images/headphones_unchecked.png);
64+
}
65+
5466
OBSHotkeyLabel[hotkeyPairHover=true] {
5567
color: red;
5668
}

UI/data/themes/Rachni.qss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,43 @@ MuteCheckBox::indicator:unchecked:disabled {
701701
image: url(./Dark/unmute.png);
702702
}
703703

704+
HeadphoneCheckBox {
705+
outline: none;
706+
}
707+
708+
HeadphoneCheckBox::indicator:checked {
709+
image: url(./Dark/headphones_checked.png);
710+
}
711+
712+
HeadphoneCheckBox::indicator:unchecked {
713+
image: url(./Dark/headphones_unchecked.png);
714+
}
715+
716+
HeadphoneCheckBox::indicator:unchecked:hover {
717+
background-color: rgba(240, 98, 146, 0.5); /* Pink (Secondary) */
718+
image: url(./Dark/headphones_unchecked.png);
719+
}
720+
721+
HeadphoneCheckBox::indicator:unchecked:focus {
722+
image: url(./Dark/headphones_unchecked.png);
723+
}
724+
HeadphoneCheckBox::indicator:checked:hover {
725+
background-color: rgba(240, 98, 146, 0.5); /* Pink (Secondary) */
726+
image: url(./Dark/headphones_checked.png);
727+
}
728+
729+
HeadphoneCheckBox::indicator:checked:focus {
730+
image: url(./Dark/headphones_checked.png);
731+
}
732+
733+
HeadphoneCheckBox::indicator:checked:disabled {
734+
image: url(./Dark/headphones_checked.png);
735+
}
736+
737+
HeadphoneCheckBox::indicator:unchecked:disabled {
738+
image: url(./Dark/headphones_unchecked.png);
739+
}
740+
704741
/*************************/
705742
/* --- Progress bars --- */
706743
/*************************/

0 commit comments

Comments
 (0)