#1190 Tuner management redesign. Updates all tuners with direct threaded support. Incorporates USB Hotplug support. Adds black/white listing of tuners. Updates all tuner editors to have a common look and feel. Changes location of tuner configuration file and changes format to JSON. (#1208)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-04-18 07:30:58 -04:00
committed by GitHub
parent 0fb148d31e
commit 96d3996bec
259 changed files with 11974 additions and 12454 deletions

View File

@@ -1,30 +1,27 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* * ******************************************************************************
* * Copyright (C) 2014-2019 Dennis Sheirer
* *
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <http://www.gnu.org/licenses/>
* * *****************************************************************************
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.spectrum;
import io.github.dsheirer.properties.SystemProperties;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerEvent;
import io.github.dsheirer.source.tuner.TunerModel;
import io.github.dsheirer.source.tuner.ui.DiscoveredTunerModel;
import javax.swing.JMenuItem;
import java.awt.EventQueue;
@@ -33,13 +30,13 @@ import java.awt.event.ActionListener;
public class ShowTunerMenuItem extends JMenuItem
{
private TunerModel mTunerModel;
private DiscoveredTunerModel mDiscoveredTunerModel;
private Tuner mTuner;
public ShowTunerMenuItem(TunerModel tunerModel, Tuner tuner)
public ShowTunerMenuItem(DiscoveredTunerModel discoveredTunerModel, Tuner tuner)
{
super(tuner != null ? "Show: " + tuner.getName() : "(empty)");
mTunerModel = tunerModel;
super(tuner != null ? "Show: " + tuner.getPreferredName() : "(empty)");
mDiscoveredTunerModel = discoveredTunerModel;
mTuner = tuner;
addActionListener(new ActionListener()
@@ -52,7 +49,7 @@ public class ShowTunerMenuItem extends JMenuItem
@Override
public void run()
{
mTunerModel.broadcast(new TunerEvent(mTuner, TunerEvent.Event.REQUEST_MAIN_SPECTRAL_DISPLAY));
mDiscoveredTunerModel.broadcast(new TunerEvent(mTuner, TunerEvent.Event.REQUEST_MAIN_SPECTRAL_DISPLAY));
SystemProperties properties = SystemProperties.getInstance();
properties.set(SpectralDisplayPanel.SPECTRAL_DISPLAY_ENABLED, true);
}

View File

@@ -1,3 +1,22 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.spectrum;
import io.github.dsheirer.dsp.filter.smoothing.SmoothingFilter.SmoothingType;

View File

@@ -36,7 +36,8 @@ import io.github.dsheirer.settings.SettingsManager;
import io.github.dsheirer.source.ISourceEventProcessor;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerModel;
import io.github.dsheirer.source.tuner.manager.DiscoveredTuner;
import io.github.dsheirer.source.tuner.ui.DiscoveredTunerModel;
import io.github.dsheirer.spectrum.OverlayPanel.ChannelDisplay;
import io.github.dsheirer.spectrum.converter.ComplexDecibelConverter;
import io.github.dsheirer.spectrum.converter.DFTResultsConverter;
@@ -105,7 +106,7 @@ public class SpectralDisplayPanel extends JPanel
private ChannelModel mChannelModel;
private ChannelProcessingManager mChannelProcessingManager;
private SettingsManager mSettingsManager;
private TunerModel mTunerModel;
private DiscoveredTunerModel mDiscoveredTunerModel;
private Tuner mTuner;
/**
@@ -120,12 +121,12 @@ public class SpectralDisplayPanel extends JPanel
* the DFT is translated to decibels for display in the spectrum and
* waterfall components.
*/
public SpectralDisplayPanel(PlaylistManager playlistManager, SettingsManager settingsManager, TunerModel tunerModel)
public SpectralDisplayPanel(PlaylistManager playlistManager, SettingsManager settingsManager, DiscoveredTunerModel discoveredTunerModel)
{
mChannelModel = playlistManager.getChannelModel();
mChannelProcessingManager = playlistManager.getChannelProcessingManager();
mSettingsManager = settingsManager;
mTunerModel = tunerModel;
mDiscoveredTunerModel = discoveredTunerModel;
mSpectrumPanel = new SpectrumPanel(mSettingsManager);
mOverlayPanel = new OverlayPanel(mSettingsManager, mChannelModel, mChannelProcessingManager);
@@ -442,7 +443,6 @@ public class SpectralDisplayPanel extends JPanel
//Fire frequency and sample rate change events so that the spectrum
//and overlay panels can synchronize
process(SourceEvent.frequencyChange(null, mTuner.getTunerController().getFrequency()));
process(SourceEvent.sampleRateChange(mTuner.getTunerController().getSampleRate()));
}
}
@@ -455,7 +455,7 @@ public class SpectralDisplayPanel extends JPanel
if(mTuner != null)
{
//Deregister for frequency change events from the tuner
mTuner.getTunerController().removeListener(this);
mTuner.getTunerController().removeListener(SpectralDisplayPanel.this);
//Deregister the dft processor from receiving samples
mTuner.getTunerController().removeBufferListener(mComplexDftProcessor);
@@ -468,6 +468,14 @@ public class SpectralDisplayPanel extends JPanel
mWaterfallPanel.clearWaterfall();
}
/**
* Currently displayed tuner
*/
public Tuner getTuner()
{
return mTuner;
}
/**
* Monitors the sizing of the layered pane and resizes the spectrum and
* channel panels whenever the layered pane is resized
@@ -756,9 +764,9 @@ public class SpectralDisplayPanel extends JPanel
boolean separatorAdded = false;
for(Tuner tuner : mTunerModel.getTuners())
for(DiscoveredTuner discoveredTuner : mDiscoveredTunerModel.getAvailableTuners())
{
if(mTuner == null || mTuner != tuner)
if(mTuner == null || mTuner != discoveredTuner.getTuner())
{
if(!separatorAdded)
{
@@ -766,7 +774,7 @@ public class SpectralDisplayPanel extends JPanel
separatorAdded = true;
}
contextMenu.add(new ShowTunerMenuItem(mTunerModel, tuner));
contextMenu.add(new ShowTunerMenuItem(mDiscoveredTunerModel, discoveredTuner.getTuner()));
}
}

View File

@@ -1,24 +1,27 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 Dennis Sheirer
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.spectrum;
import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.settings.SettingsManager;
import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerModel;
import io.github.dsheirer.source.tuner.ui.DiscoveredTunerModel;
import net.miginfocom.swing.MigLayout;
import javax.swing.JFrame;
@@ -32,15 +35,16 @@ public class SpectrumFrame extends JFrame implements WindowListener
private SpectralDisplayPanel mSpectralDisplayPanel;
public SpectrumFrame(PlaylistManager playlistManager, SettingsManager settingsManager, TunerModel tunerModel, Tuner tuner)
public SpectrumFrame(PlaylistManager playlistManager, SettingsManager settingsManager,
DiscoveredTunerModel discoveredTunerModel, Tuner tuner)
{
setTitle("SDRTRunk [" + tuner.getName() + "]");
setTitle("SDRTRunk [" + tuner.getPreferredName() + "]");
setBounds(100, 100, 1280, 600);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(new MigLayout("insets 0 0 0 0", "[grow]", "[grow]"));
mSpectralDisplayPanel = new SpectralDisplayPanel(playlistManager, settingsManager, tunerModel);
mSpectralDisplayPanel = new SpectralDisplayPanel(playlistManager, settingsManager, discoveredTunerModel);
mSpectralDisplayPanel.showTuner(tuner);
add(mSpectralDisplayPanel, "grow");

View File

@@ -1,6 +1,6 @@
/*******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
/*
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,8 +14,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* ****************************************************************************
*/
package io.github.dsheirer.spectrum;
import io.github.dsheirer.dsp.filter.smoothing.GaussianSmoothingFilter;