@@ -156,6 +156,7 @@ class EditOutputWidget : public QDialog
156
156
QLabel* v_warning_ = 0 ;
157
157
QComboBox* aenc_ = 0 ;
158
158
QLineEdit* a_bitrate_ = 0 ;
159
+ QComboBox* a_mixer_ = 0 ;
159
160
160
161
std::vector<std::string> EnumEncodersByCodec (const char * codec)
161
162
{
@@ -311,8 +312,12 @@ class EditOutputWidget : public QDialog
311
312
}
312
313
++currow;
313
314
{
314
- encLayout->addWidget (new QWidget (), currow, 0 );
315
- encLayout->setRowStretch (currow, 1 );
315
+ int curcol = 0 ;
316
+ encLayout->addWidget (new QLabel (obs_module_text (" AudioMixerID" ), gp), currow, curcol++);
317
+ encLayout->addWidget (a_mixer_ = new QComboBox (gp), currow, curcol++);
318
+
319
+ for (int i = 1 ; i <= 6 ; ++i)
320
+ a_mixer_->addItem (QString (std::to_string (i).c_str ()), i - 1 );
316
321
}
317
322
gp->setLayout (encLayout);
318
323
}
@@ -393,10 +398,12 @@ class EditOutputWidget : public QDialog
393
398
{
394
399
a_bitrate_->setText (obs_module_text (" SameAsOBS" ));
395
400
a_bitrate_->setEnabled (false );
401
+ a_mixer_->setEnabled (false );
396
402
}
397
403
else
398
404
{
399
405
a_bitrate_->setEnabled (true );
406
+ a_mixer_->setEnabled (true );
400
407
}
401
408
}
402
409
@@ -417,6 +424,8 @@ class EditOutputWidget : public QDialog
417
424
conf_[" v-resolution" ] = v_resolution_->text ();
418
425
if (a_bitrate_->isEnabled ())
419
426
try { conf_[" a-bitrate" ] = std::stod (tostdu8 (a_bitrate_->text ())); } catch (...) {}
427
+ if (a_mixer_->isEnabled ())
428
+ conf_[" a-mixer" ] = a_mixer_->currentData ().toDouble ();
420
429
}
421
430
422
431
void LoadConfig ()
@@ -482,6 +491,18 @@ class EditOutputWidget : public QDialog
482
491
a_bitrate_->setText (std::to_string ((int )it->toDouble ()).c_str ());
483
492
else
484
493
a_bitrate_->setText (" 128" );
494
+
495
+ it = conf_.find (" a-mixer" );
496
+ {
497
+ int dataToFind = 1 ;
498
+ if (it != conf_.end () && it->isDouble ())
499
+ dataToFind = (int )it->toDouble ();
500
+ int index = a_mixer_->findData (dataToFind);
501
+ if (index >= 0 )
502
+ a_mixer_->setCurrentIndex (index);
503
+ else
504
+ a_mixer_->setCurrentIndex (0 );
505
+ }
485
506
}
486
507
};
487
508
@@ -593,6 +614,7 @@ class PushWidget : public QWidget, public IOBSOutputEventHanlder
593
614
594
615
std::string venc_id, aenc_id;
595
616
int v_bitrate = 2000 , a_bitrate = 128 ;
617
+ int a_mixer = 0 ;
596
618
int v_width = -1 , v_height = -1 ;
597
619
int v_keyframe_sec = 3 ;
598
620
@@ -625,6 +647,13 @@ class PushWidget : public QWidget, public IOBSOutputEventHanlder
625
647
it = conf_.find (" v-keyframe-sec" );
626
648
if (it != conf_.end () && it->isDouble ())
627
649
v_keyframe_sec = (int )it->toDouble ();
650
+ it = conf_.find (" a-mixer" );
651
+ if (it != conf_.end () && it->isDouble ())
652
+ {
653
+ int data = (int )it->toDouble ();
654
+ if (data >= 0 && data <= 5 )
655
+ a_mixer = data;
656
+ }
628
657
}
629
658
630
659
// ====== prepare encoder
@@ -678,7 +707,7 @@ class PushWidget : public QWidget, public IOBSOutputEventHanlder
678
707
{
679
708
obs_data_t * settings = obs_data_create ();
680
709
obs_data_set_int (settings, " bitrate" , a_bitrate);
681
- aenc = obs_audio_encoder_create (aenc_id.c_str (), " multi-rtmp-audio-encoder" , settings, 0 , nullptr );
710
+ aenc = obs_audio_encoder_create (aenc_id.c_str (), " multi-rtmp-audio-encoder" , settings, a_mixer , nullptr );
682
711
obs_data_release (settings);
683
712
obs_encoder_set_audio (aenc, obs_get_audio ());
684
713
}
0 commit comments