~ubuntu-branches/ubuntu/raring/mumble/raring

« back to all changes in this revision

Viewing changes to src/mumble/AudioConfigDialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thorvald Natvig
  • Date: 2010-01-09 19:28:50 UTC
  • mfrom: (9.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109192850-zs4g5vwrrpd71kob
Tags: 1.2.1-2
Fix upgrade failure when upgrading mumble-server directly from 1.1.x
to 1.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
3
3
 
4
4
   All rights reserved.
239
239
 
240
240
        audiorate = q;
241
241
 
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);
244
244
 
245
245
        // TCP is 12 more bytes than UDP
246
246
        if (NetworkConfig::TcpModeEnabled())
266
266
 
267
267
        qlBitrate->setPalette(pal);
268
268
 
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);
271
271
 
272
272
        if (p == 1) {
420
420
 
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);
 
436
 
 
437
        qsOtherVolume->setEnabled(r.bAttenuateOthersOnTalk || r.bAttenuateOthers);
 
438
        qlOtherVolume->setEnabled(r.bAttenuateOthersOnTalk || r.bAttenuateOthers);
434
439
}
435
440
 
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());
481
488
                }
482
489
                bool canmute = aor->canMuteOthers();
483
490
                qsOtherVolume->setEnabled(canmute);
 
491
                qcbAttenuateOthersOnTalk->setEnabled(canmute);
 
492
                qcbAttenuateOthers->setEnabled(canmute);
484
493
                qlOtherVolume->setEnabled(canmute);
485
494
 
486
495
                bool usesdelay = aor->usesOutputDelay();
503
512
        }
504
513
        qlVolume->setPalette(pal);
505
514
 
506
 
        qlVolume->setText(tr("%1%").arg(v));
 
515
        qlVolume->setText(tr("%1 %").arg(v));
507
516
}
508
517
 
509
518
void AudioOutputDialog::on_qsOtherVolume_valueChanged(int v) {
510
 
        qlOtherVolume->setText(tr("%1%").arg(v));
 
519
        qlOtherVolume->setText(tr("%1 %").arg(v));
511
520
}
512
521
 
513
522
void AudioOutputDialog::on_qsPacketDelay_valueChanged(int v) {
515
524
}
516
525
 
517
526
void AudioOutputDialog::on_qsPacketLoss_valueChanged(int v) {
518
 
        qlPacketLoss->setText(tr("%1%").arg(v));
 
527
        qlPacketLoss->setText(tr("%1 %").arg(v));
519
528
}
520
529
 
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));
523
532
}
524
533
 
525
534
void AudioOutputDialog::on_qcbLoopback_currentIndexChanged(int v) {
534
543
}
535
544
 
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);
540
549
}
541
550
 
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);
546
555
}
547
556
 
548
557
void AudioOutputDialog::on_qsMaxDistVolume_valueChanged(int v) {
549
 
        qlMaxDistVolume->setText(tr("%1%").arg(v));
 
558
        qlMaxDistVolume->setText(tr("%1 %").arg(v));
550
559
}
551
560
 
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));
554
563
}
555
564
 
556
565
void AudioOutputDialog::on_qcbPositional_stateChanged(int v) {
557
566
        qgbVolume->setEnabled(v);
558
567
}
 
568
 
 
569
void AudioOutputDialog::on_qcbAttenuateOthersOnTalk_clicked(bool checked) {
 
570
        bool b = qcbAttenuateOthers->isChecked() || checked;
 
571
        qsOtherVolume->setEnabled(b);
 
572
        qlOtherVolume->setEnabled(b);
 
573
}
 
574
 
 
575
void AudioOutputDialog::on_qcbAttenuateOthers_clicked(bool checked) {
 
576
        bool b = qcbAttenuateOthersOnTalk->isChecked() || checked;
 
577
        qsOtherVolume->setEnabled(b);
 
578
        qlOtherVolume->setEnabled(b);
 
579
}