@@ -330,7 +330,7 @@ MainWindow::MainWindow(QString exepath,
330330 {
331331 QMenu *menu = new QMenu ();
332332 spectrum = new QAction (" Reload spectrum" , this );
333- connect (spectrum, &QAction::triggered, this , &MainWindow::restartSpectrum);
333+ // connect(spectrum, &QAction::triggered, this, &MainWindow::restartSpectrum);
334334 menu->addAction (tr (" Reload JamesDSP" ), this , SLOT (restart ()));
335335 menu->addAction (tr (" Reset to defaults" ), this , SLOT (reset ()));
336336 // menu->addAction(spectrum);
@@ -479,239 +479,11 @@ MainWindow::~MainWindow()
479479 delete ui;
480480}
481481
482- // Spectrum
483- void MainWindow::setSpectrumVisibility (bool v)
484- {
485- /* m_spectrograph->setVisible(v);
486-
487- if (v)
488- {
489- this->findChild<QFrame*>("analysisLayout_spectrum")->setFrameShape(QFrame::StyledPanel);
490- }
491- else
492- {
493- this->findChild<QFrame*>("analysisLayout_spectrum")->setFrameShape(QFrame::NoFrame);
494- }*/
495- }
496-
497- void MainWindow::initializeSpectrum ()
498- {
499- /* m_spectrograph = new Spectrograph(this);
500- m_audioengine = new AudioStreamEngine(this);
501-
502- int refresh = AppConfig::instance().get<int>(AppConfig::SpectrumRefresh);
503-
504- if (refresh == 0)
505- {
506- refresh = 20;
507- }
508-
509- if (refresh < 10)
510- {
511- refresh = 10;
512- }
513- else if (refresh > 500)
514- {
515- refresh = 500;
516- }
517-
518- m_audioengine->setNotifyIntervalMs(refresh);
519-
520- analysisLayout.reset(new QFrame());
521- analysisLayout->setObjectName("analysisLayout_spectrum");
522- analysisLayout->setFrameShape(QFrame::Shape::StyledPanel);
523- analysisLayout->setLayout(new QHBoxLayout);
524- analysisLayout->layout()->setMargin(0);
525- analysisLayout->layout()->addWidget(m_spectrograph);
526-
527- auto buttonbox = ui->centralWidget->layout()->takeAt(ui->centralWidget->layout()->count() - 1);
528- ui->centralWidget->layout()->addWidget(analysisLayout.data());
529- ui->centralWidget->layout()->addItem(buttonbox);
530- analysisLayout.take();
531-
532- setSpectrumVisibility(false);
533-
534- connect(&AppConfig::instance(), &AppConfig::spectrumChanged, this, [this](bool needReload) {
535- toggleSpectrum(AppConfig::instance().get<bool>(AppConfig::SpectrumEnabled), true);
536- if(needReload)
537- restartSpectrum();
538- });*/
539- }
540-
541- void MainWindow::restartSpectrum ()
542- {
543- // toggleSpectrum(false, false);
544- // toggleSpectrum(AppConfig::instance().get<bool>(AppConfig::SpectrumEnabled), false);
545- }
546-
547- void MainWindow::refreshSpectrumParameters ()
548- {
549- /* int bands = AppConfig::instance().get<int>(AppConfig::SpectrumBands);
550- int minfreq = AppConfig::instance().get<int>(AppConfig::SpectrumMinFreq);
551- int maxfreq = AppConfig::instance().get<int>(AppConfig::SpectrumMaxFreq);
552- int refresh = AppConfig::instance().get<int>(AppConfig::SpectrumRefresh);
553- float multiplier = AppConfig::instance().get<float>(AppConfig::SpectrumMultiplier);
554-
555- // Set default values if undefined
556- if (bands == 0)
557- {
558- bands = 100;
559- }
560-
561- if (maxfreq == 0)
562- {
563- maxfreq = 1000;
564- }
565-
566- if (refresh == 0)
567- {
568- refresh = 10;
569- }
570-
571- if (multiplier == 0)
572- {
573- multiplier = 0.15;
574- }
575-
576- // Check boundaries
577- if (bands < 5 )
578- {
579- bands = 5;
580- }
581- else if (bands > 300)
582- {
583- bands = 300;
584- }
585-
586- if (minfreq < 0)
587- {
588- minfreq = 0;
589- }
590- else if (minfreq > 10000)
591- {
592- minfreq = 10000;
593- }
594-
595- if (maxfreq < 100)
596- {
597- maxfreq = 100;
598- }
599- else if (maxfreq > 24000)
600- {
601- maxfreq = 24000;
602- }
603-
604- if (refresh < 10)
605- {
606- refresh = 10;
607- }
608- else if (refresh > 500)
609- {
610- refresh = 500;
611- }
612-
613- if (multiplier < 0.01)
614- {
615- multiplier = 0.01;
616- }
617- else if (multiplier > 1)
618- {
619- multiplier = 1;
620- }
621-
622- if (maxfreq < minfreq)
623- {
624- maxfreq = minfreq + 100;
625- }
626-
627- QColor outline;
628-
629- if (palette().window().style() == Qt::TexturePattern)
630- {
631- outline = QColor(0, 0, 0, 160);
632- }
633- else
634- {
635- outline = palette().window().color().lighter(140);
636- }
637-
638- m_spectrograph->setTheme(palette().window().color().lighter(),
639- palette().highlight().color(),
640- palette().text().color(),
641- outline.lighter(108),
642- AppConfig::instance().get<bool>(AppConfig::SpectrumGrid),
643- (Spectrograph::Mode) AppConfig::instance().get<int>(AppConfig::SpectrumTheme));
644-
645- m_spectrograph->setParams(bands, minfreq, maxfreq);
646- m_audioengine->setNotifyIntervalMs(refresh);
647- m_audioengine->setMultiplier(multiplier);*/
648- }
649-
650- void MainWindow::toggleSpectrum (bool on,
651- bool ctrl_visibility)
652- {
653- /* refreshSpectrumParameters();
654-
655- if (ctrl_visibility)
656- {
657- spectrum->setVisible(on);
658- }
659-
660- if (on && (!m_spectrograph->isVisible() || !ctrl_visibility))
661- {
662- if (ctrl_visibility)
663- {
664- setSpectrumVisibility(true);
665- this->setFixedSize(this->width(), this->height() + m_spectrograph->size().height());
666- }
667-
668- QAudioDeviceInfo in;
669-
670- for (auto item : QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
671- {
672- if (item.deviceName() == AppConfig::instance().getSpectrumInput())
673- {
674- in = item;
675- }
676- }
677-
678- m_audioengine->setAudioInputDevice(in);
679- m_audioengine->initializeRecord();
680- m_audioengine->startRecording();
681-
682- connect(m_audioengine, static_cast<void (AudioStreamEngine::*)(QAudio::Mode, QAudio::State)>(&AudioStreamEngine::stateChanged),
683- this, [this](QAudio::Mode mode, QAudio::State state) {
684- Q_UNUSED(mode);
685-
686- if (QAudio::ActiveState != state && QAudio::SuspendedState != state)
687- {
688- m_spectrograph->reset();
689- }
690- });
691-
692- connect(m_audioengine, static_cast<void (AudioStreamEngine::*)(qint64, qint64, const FrequencySpectrum &)>(&AudioStreamEngine::spectrumChanged),
693- this, [this](qint64, qint64, const FrequencySpectrum &spectrum) {
694- m_spectrograph->spectrumChanged(spectrum);
695- });
696- }
697- else if (!on && (m_spectrograph->isVisible() || !ctrl_visibility))
698- {
699- if (ctrl_visibility)
700- {
701- setSpectrumVisibility(false);
702- this->setFixedSize(this->width(), this->height() - m_spectrograph->size().height());
703- }
704-
705- m_spectrograph->reset();
706- m_audioengine->reset();
707- }*/
708- }
709-
710482void MainWindow::fireTimerSignal ()
711483{
712484 if (spectrumReloadSignalQueued)
713485 {
714- restartSpectrum ();
486+ // restartSpectrum();
715487 }
716488
717489 spectrumReloadSignalQueued = false ;
@@ -855,7 +627,7 @@ void MainWindow::savePresetFile(const QString &filename)
855627
856628void MainWindow::loadExternalFile ()
857629{
858- QString filename = QFileDialog::getOpenFileName (this , tr (" Load custom audio.conf" ), " " , " *.conf" );
630+ QString filename = QFileDialog::getOpenFileName (this , tr (" Load custom audio.conf" ), " " , " JamesDSP Linux configuration ( *.conf) " );
859631
860632 if (filename == " " )
861633 {
@@ -867,7 +639,7 @@ void MainWindow::loadExternalFile()
867639
868640void MainWindow::saveExternalFile ()
869641{
870- QString filename = QFileDialog::getSaveFileName (this , tr (" Save current audio.conf" ), " " , " *.conf" );
642+ QString filename = QFileDialog::getSaveFileName (this , tr (" Save current audio.conf" ), " " , " JamesDSP Linux configuration ( *.conf) " );
871643
872644 if (filename == " " )
873645 {
0 commit comments