Adds tuner preference editor with channelizer type options. Updates (#456)

tuners to use the preference to select either polyphase or heterodyne
channelizers.
This commit is contained in:
Denny Sheirer
2018-12-25 06:43:10 -05:00
committed by GitHub
parent b67d4d92dc
commit efd811407e
25 changed files with 717 additions and 249 deletions

View File

@@ -157,7 +157,7 @@ public class SDRTrunk implements Listener<TunerEvent>
mJavaFxWindowManager = new JavaFxWindowManager(mUserPreferences);
mSourceManager = new SourceManager(tunerModel, mSettingsManager);
mSourceManager = new SourceManager(tunerModel, mSettingsManager, mUserPreferences);
mChannelProcessingManager = new ChannelProcessingManager(channelMapModel, eventLogManager, recorderManager,
mSourceManager, aliasModel);

View File

@@ -1,20 +1,25 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.channelizer;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.SampleType;
import io.github.dsheirer.sample.buffer.ReusableComplexBuffer;
@@ -79,7 +84,7 @@ public class ChannelizerViewer extends JFrame
*/
public ChannelizerViewer(int channelsPerRow)
{
mTestTuner = new TestTuner();
mTestTuner = new TestTuner(new UserPreferences());
// mChannelCount = (int)(mTestTuner.getTunerController().getUsableBandwidth() / CHANNEL_BANDWIDTH);
mChannelCount = (int)(mTestTuner.getTunerController().getBandwidth() / CHANNEL_BANDWIDTH);
@@ -544,7 +549,7 @@ public class ChannelizerViewer extends JFrame
}
else
{
TestTuner tuner = new TestTuner();
TestTuner tuner = new TestTuner(new UserPreferences());
List<TunerChannel> tunerChannels = getTunerChannels(tuner);

View File

@@ -1,20 +1,25 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.channelizer;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.SampleType;
import io.github.dsheirer.sample.buffer.ReusableComplexBuffer;
@@ -72,7 +77,7 @@ public class ChannelizerViewer2 extends JFrame
private ChannelArrayPanel mBottomChannelArrayPanel;
private DFTSize mMainPanelDFTSize = DFTSize.FFT32768;
private DFTSize mChannelPanelDFTSize = DFTSize.FFT04096;
private TestTuner mTestTuner = new TestTuner();
private TestTuner mTestTuner = new TestTuner(new UserPreferences());
/**
* GUI Test utility for researching polyphase channelizers.

View File

@@ -1,21 +1,26 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.preference;
import io.github.dsheirer.gui.preference.tuner.TunerPreferenceEditor;
import io.github.dsheirer.preference.UserPreferences;
import javafx.scene.Node;
@@ -32,6 +37,8 @@ public class PreferenceEditorFactory
return new TalkgroupFormatPreferenceEditor(userPreferences);
case CHANNEL_EVENT:
return new DecodeEventViewPreferenceEditor(userPreferences);
case TUNER:
return new TunerPreferenceEditor(userPreferences);
}
return null;

View File

@@ -1,18 +1,22 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.preference;
@@ -21,8 +25,9 @@ package io.github.dsheirer.gui.preference;
*/
public enum PreferenceEditorType
{
CHANNEL_EVENT("Channel Events"),
TALKGROUP_FORMAT("Talkgroups");
CHANNEL_EVENT("Channel Event"),
TALKGROUP_FORMAT("Talkgroup Display"),
TUNER("Tuner");
private String mLabel;

View File

@@ -1,18 +1,22 @@
/*******************************************************************************
* sdr-trunk
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.preference;
@@ -188,6 +192,7 @@ public class PreferencesEditor extends Application
TreeItem<String> displayItem = new TreeItem<>("Display");
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.CHANNEL_EVENT));
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.TALKGROUP_FORMAT));
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.TUNER));
treeRoot.getChildren().add(displayItem);
displayItem.setExpanded(true);

View File

@@ -26,9 +26,11 @@ import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
import io.github.dsheirer.protocol.Protocol;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
@@ -58,6 +60,7 @@ public class TalkgroupFormatPreferenceEditor extends HBox
mEditorPane.add(new Label("Protocol"), 0, row);
mEditorPane.add(new Label("Display Format"), 1, row++);
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, row++, 3, 1);
for(Protocol protocol : Protocol.TALKGROUP_PROTOCOLS)
{

View File

@@ -0,0 +1,159 @@
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2018 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.gui.preference.tuner;
import io.github.dsheirer.preference.UserPreferences;
import io.github.dsheirer.preference.tuner.ChannelizerType;
import io.github.dsheirer.preference.tuner.TunerPreference;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.scene.control.Alert;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
/**
* Preference settings for channel event view
*/
public class TunerPreferenceEditor extends HBox
{
private static final String HELP_TEXT_POLYPHASE = "Processes all channels from tuner. This " +
"channelizer is more efficient when decoding 3 or more channels.";
private static final String HELP_TEXT_HETERODYNE = "Processes each channel on-demand. This " +
"channelizer may work better for computers with constrained resources when processing a small number of channels.";
private TunerPreference mTunerPreference;
private GridPane mEditorPane;
private ChoiceBox<ChannelizerType> mChannelizerTypeChoiceBox;
private Label mChannelizerLabel;
private Label mPolyphaseLabel;
private Label mHelpTextPolyphaseLabel;
private Label mHeterodyneLabel;
private Label mHelpTextHeterodyneLabel;
public TunerPreferenceEditor(UserPreferences userPreferences)
{
mTunerPreference = userPreferences.getTunerPreference();
getChildren().add(getEditorPane());
}
private GridPane getEditorPane()
{
if(mEditorPane == null)
{
mEditorPane = new GridPane();
mEditorPane.setPadding(new Insets(10, 10, 10, 10));
GridPane.setMargin(getChannelizerLabel(), new Insets(0, 10, 0, 0));
GridPane.setHalignment(getChannelizerLabel(), HPos.LEFT);
mEditorPane.add(getChannelizerLabel(), 0, 0);
mEditorPane.add(getChannelizerTypeChoiceBox(), 1, 0);
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, 1, 2, 1);
mEditorPane.add(getPolyphaseLabel(), 0, 2, 2, 1);
mEditorPane.add(getHelpTextPolyphaseLabel(), 0, 3, 2, 3);
mEditorPane.add(new Label(" "), 0, 6);
mEditorPane.add(getHeterodyneLabel(), 0, 7, 2, 1);
mEditorPane.add(getHelpTextHeterodyneLabel(), 0, 8, 2, 3);
}
return mEditorPane;
}
private Label getChannelizerLabel()
{
if(mChannelizerLabel == null)
{
mChannelizerLabel = new Label("Channelizer Type");
}
return mChannelizerLabel;
}
private ChoiceBox<ChannelizerType> getChannelizerTypeChoiceBox()
{
if(mChannelizerTypeChoiceBox == null)
{
mChannelizerTypeChoiceBox = new ChoiceBox<>();
mChannelizerTypeChoiceBox.getItems().addAll(ChannelizerType.values());
ChannelizerType current = mTunerPreference.getChannelizerType();
mChannelizerTypeChoiceBox.getSelectionModel().select(current);
mChannelizerTypeChoiceBox.setOnAction(event -> {
ChannelizerType selected = mChannelizerTypeChoiceBox.getSelectionModel().getSelectedItem();
mTunerPreference.setChannelizerType(selected);
Label label = new Label("Please restart the application for this change to take effect");
label.setWrapText(true);
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.getDialogPane().setContent(label);
alert.show();
});
}
return mChannelizerTypeChoiceBox;
}
private Label getPolyphaseLabel()
{
if(mPolyphaseLabel == null)
{
mPolyphaseLabel = new Label("Polyphase (default)");
}
return mPolyphaseLabel;
}
private Label getHelpTextPolyphaseLabel()
{
if(mHelpTextPolyphaseLabel == null)
{
mHelpTextPolyphaseLabel = new Label(HELP_TEXT_POLYPHASE);
mHelpTextPolyphaseLabel.setWrapText(true);
}
return mHelpTextPolyphaseLabel;
}
private Label getHeterodyneLabel()
{
if(mHeterodyneLabel == null)
{
mHeterodyneLabel = new Label("Heterodyne");
}
return mHeterodyneLabel;
}
private Label getHelpTextHeterodyneLabel()
{
if(mHelpTextHeterodyneLabel == null)
{
mHelpTextHeterodyneLabel = new Label(HELP_TEXT_HETERODYNE);
mHelpTextHeterodyneLabel.setWrapText(true);
}
return mHelpTextHeterodyneLabel;
}
}