1
/* Copyright (C) 2005-2009, Thorvald Natvig <thorvald@natvig.com>
1
/* Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
2
2
Copyright (C) 2008, Andreas Messer <andi@bupfen.de>
242
// 50 packets, in bits, IP + UDP + Crypt + type + seq
243
overhead = 100 * 8 * (20 + 8 + 4 + 1 + 2);
242
// 50 packets, in bits, IP + UDP + Crypt + type + seq + frameheader
243
overhead = 100 * 8 * (20 + 8 + 4 + 1 + 2 + p);
245
245
// TCP is 12 more bytes than UDP
246
246
if (NetworkConfig::TcpModeEnabled())
267
267
qlBitrate->setPalette(pal);
269
QString v = tr("%1kbit/s (Audio %2 %5, Position %4, Overhead %3)").arg(total / 1000.0, 0, 'f', 1).arg(audiorate / 1000.0, 0, 'f', 1).arg(overhead / 1000.0, 0, 'f', 1).arg(posrate / 1000.0, 0, 'f', 1).arg(::AudioInput::preferCELT(q,p) ? tr("CELT") : tr("Speex"));
269
QString v = tr("%1 kbit/s (Audio %2 %5, Position %4, Overhead %3)").arg(total / 1000.0, 0, 'f', 1).arg(audiorate / 1000.0, 0, 'f', 1).arg(overhead / 1000.0, 0, 'f', 1).arg(posrate / 1000.0, 0, 'f', 1).arg(::AudioInput::preferCELT(q,p) ? tr("CELT") : tr("Speex"));
270
270
qlBitrate->setText(v);
421
421
loadSlider(qsDelay, r.iOutputDelay);
422
422
loadSlider(qsVolume, iroundf(r.fVolume * 100.0f));
423
loadSlider(qsOtherVolume, iroundf(r.fOtherVolume * 100.0f));
423
loadSlider(qsOtherVolume, iroundf((1.0f - r.fOtherVolume) * 100.0f));
424
loadCheckBox(qcbAttenuateOthersOnTalk, r.bAttenuateOthersOnTalk);
425
loadCheckBox(qcbAttenuateOthers, r.bAttenuateOthers);
424
426
loadSlider(qsJitter, r.iJitterBufferSize);
425
427
loadComboBox(qcbLoopback, r.lmLoopMode);
426
428
loadSlider(qsPacketDelay, static_cast<int>(r.dMaxPacketDelay));
431
433
loadSlider(qsBloom, iroundf(r.fAudioBloom * 100.0f));
432
434
loadCheckBox(qcbHeadphones, r.bPositionalHeadphone);
433
435
loadCheckBox(qcbPositional, r.bPositionalAudio);
437
qsOtherVolume->setEnabled(r.bAttenuateOthersOnTalk || r.bAttenuateOthers);
438
qlOtherVolume->setEnabled(r.bAttenuateOthersOnTalk || r.bAttenuateOthers);
436
441
void AudioOutputDialog::save() const {
437
442
s.iOutputDelay = qsDelay->value();
438
443
s.fVolume = static_cast<float>(qsVolume->value()) / 100.0f;
439
s.fOtherVolume = static_cast<float>(qsOtherVolume->value()) / 100.0f;
444
s.fOtherVolume = 1.0f - (static_cast<float>(qsOtherVolume->value()) / 100.0f);
445
s.bAttenuateOthersOnTalk = qcbAttenuateOthersOnTalk->isChecked();
446
s.bAttenuateOthers = qcbAttenuateOthers->isChecked();
440
447
s.iJitterBufferSize = qsJitter->value();
441
448
s.qsAudioOutput = qcbSystem->currentText();
442
449
s.lmLoopMode = static_cast<Settings::LoopMode>(qcbLoopback->currentIndex());
482
489
bool canmute = aor->canMuteOthers();
483
490
qsOtherVolume->setEnabled(canmute);
491
qcbAttenuateOthersOnTalk->setEnabled(canmute);
492
qcbAttenuateOthers->setEnabled(canmute);
484
493
qlOtherVolume->setEnabled(canmute);
486
495
bool usesdelay = aor->usesOutputDelay();
504
513
qlVolume->setPalette(pal);
506
qlVolume->setText(tr("%1%").arg(v));
515
qlVolume->setText(tr("%1 %").arg(v));
509
518
void AudioOutputDialog::on_qsOtherVolume_valueChanged(int v) {
510
qlOtherVolume->setText(tr("%1%").arg(v));
519
qlOtherVolume->setText(tr("%1 %").arg(v));
513
522
void AudioOutputDialog::on_qsPacketDelay_valueChanged(int v) {
517
526
void AudioOutputDialog::on_qsPacketLoss_valueChanged(int v) {
518
qlPacketLoss->setText(tr("%1%").arg(v));
527
qlPacketLoss->setText(tr("%1 %").arg(v));
521
530
void AudioOutputDialog::on_qsDelay_valueChanged(int v) {
522
qlDelay->setText(tr("%1ms").arg(v*10));
531
qlDelay->setText(tr("%1 ms").arg(v*10));
525
534
void AudioOutputDialog::on_qcbLoopback_currentIndexChanged(int v) {
536
545
void AudioOutputDialog::on_qsMinDistance_valueChanged(int v) {
537
qlMinDistance->setText(tr("%1m").arg(v/10.0, 0, 'f', 1));
546
qlMinDistance->setText(tr("%1 m").arg(v/10.0, 0, 'f', 1));
538
547
if (qsMaxDistance->value() < v)
539
548
qsMaxDistance->setValue(v);
542
551
void AudioOutputDialog::on_qsMaxDistance_valueChanged(int v) {
543
qlMaxDistance->setText(tr("%1m").arg(v/10.0, 0, 'f', 1));
552
qlMaxDistance->setText(tr("%1 m").arg(v/10.0, 0, 'f', 1));
544
553
if (qsMinDistance->value() > v)
545
554
qsMinDistance->setValue(v);
548
557
void AudioOutputDialog::on_qsMaxDistVolume_valueChanged(int v) {
549
qlMaxDistVolume->setText(tr("%1%").arg(v));
558
qlMaxDistVolume->setText(tr("%1 %").arg(v));
552
561
void AudioOutputDialog::on_qsBloom_valueChanged(int v) {
553
qlBloom->setText(tr("%1%").arg(v+100));
562
qlBloom->setText(tr("%1 %").arg(v+100));
556
565
void AudioOutputDialog::on_qcbPositional_stateChanged(int v) {
557
566
qgbVolume->setEnabled(v);
569
void AudioOutputDialog::on_qcbAttenuateOthersOnTalk_clicked(bool checked) {
570
bool b = qcbAttenuateOthers->isChecked() || checked;
571
qsOtherVolume->setEnabled(b);
572
qlOtherVolume->setEnabled(b);
575
void AudioOutputDialog::on_qcbAttenuateOthers_clicked(bool checked) {
576
bool b = qcbAttenuateOthersOnTalk->isChecked() || checked;
577
qsOtherVolume->setEnabled(b);
578
qlOtherVolume->setEnabled(b);