Updates the NBFM decoder to allow user to select between 12.5 and 25.0

kHz channel bandwidth so that 25 kHz channels can be demodulated correctly.
This commit is contained in:
Denny
2018-09-16 07:21:14 -04:00
parent dae68515a5
commit a17132be0d
18 changed files with 362 additions and 225 deletions

View File

@@ -74,8 +74,7 @@ public class SourceManager
return mTunerModel;
}
public Source getSource(SourceConfiguration config, int bandwidth, ChannelSpecification channelSpecification)
throws SourceException
public Source getSource(SourceConfiguration config, ChannelSpecification channelSpecification) throws SourceException
{
Source retVal = null;
@@ -85,10 +84,10 @@ public class SourceManager
retVal = mMixerManager.getSource(config);
break;
case TUNER:
retVal = mTunerModel.getSource((SourceConfigTuner) config, bandwidth, channelSpecification);
retVal = mTunerModel.getSource((SourceConfigTuner) config, channelSpecification);
break;
case RECORDING:
retVal = mRecordingSourceManager.getSource(config, bandwidth);
retVal = mRecordingSourceManager.getSource(config, channelSpecification);
case NONE:
default:
break;

View File

@@ -1,19 +1,17 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 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/>
* sdr-trunk
* 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.source.recording;
@@ -22,6 +20,7 @@ import io.github.dsheirer.source.Source;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.config.SourceConfigRecording;
import io.github.dsheirer.source.config.SourceConfiguration;
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
import io.github.dsheirer.source.tuner.channel.TunerChannel;
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
import org.slf4j.Logger;
@@ -33,64 +32,64 @@ import java.util.List;
public class RecordingSourceManager
{
private final static Logger mLog = LoggerFactory.getLogger( RecordingSourceManager.class );
private final static Logger mLog = LoggerFactory.getLogger(RecordingSourceManager.class);
private ArrayList<Recording> mRecordings = new ArrayList<Recording>();
private ArrayList<Recording> mRecordings = new ArrayList<Recording>();
private SettingsManager mSettingsManager;
private SettingsManager mSettingsManager;
public RecordingSourceManager( SettingsManager settingsManager )
{
mSettingsManager = settingsManager;
loadRecordings();
}
public RecordingSourceManager(SettingsManager settingsManager)
{
mSettingsManager = settingsManager;
loadRecordings();
}
/**
* Iterates current recordings to get a tuner channel source for the frequency
* specified in the channel config's source config object
*/
public Source getSource( SourceConfiguration config, int bandwidth )
throws SourceException
public Source getSource(SourceConfiguration config, ChannelSpecification channelSpecification)
throws SourceException
{
TunerChannelSource retVal = null;
TunerChannelSource retVal = null;
if( config instanceof SourceConfigRecording )
{
SourceConfigRecording configRecording = (SourceConfigRecording)config;
TunerChannel tunerChannel = configRecording.getTunerChannel();
tunerChannel.setBandwidth( bandwidth );
if(config instanceof SourceConfigRecording)
{
SourceConfigRecording configRecording = (SourceConfigRecording)config;
Recording recording = getRecordingFromAlias(
configRecording.getRecordingAlias() );
if( recording != null )
{
retVal = recording.getChannel( tunerChannel );
}
else
{
throw new SourceException( "Recording with alias name [" +
configRecording.getRecordingAlias() + "] is not currently available" );
}
}
return retVal;
TunerChannel tunerChannel = configRecording.getTunerChannel();
tunerChannel.setBandwidth(channelSpecification.getBandwidth());
Recording recording = getRecordingFromAlias(
configRecording.getRecordingAlias());
if(recording != null)
{
retVal = recording.getChannel(tunerChannel);
}
else
{
throw new SourceException("Recording with alias name [" +
configRecording.getRecordingAlias() + "] is not currently available");
}
}
return retVal;
}
public Recording getRecordingFromAlias( String alias )
public Recording getRecordingFromAlias(String alias)
{
for( Recording recording: mRecordings )
{
if( recording.getRecordingConfiguration()
.getAlias().contentEquals( alias ) )
{
return recording;
}
}
return null;
for(Recording recording : mRecordings)
{
if(recording.getRecordingConfiguration()
.getAlias().contentEquals(alias))
{
return recording;
}
}
return null;
}
/**
@@ -98,47 +97,47 @@ public class RecordingSourceManager
*/
public List<Recording> getRecordings()
{
Collections.sort( mRecordings );
return mRecordings;
}
public void addRecording( Recording recording )
{
mRecordings.add( recording );
}
public Recording addRecording( RecordingConfiguration config )
{
Recording recording = new Recording( mSettingsManager, config );
Collections.sort(mRecordings);
mRecordings.add( recording );
return recording;
return mRecordings;
}
public void removeRecording( Recording recording )
public void addRecording(Recording recording)
{
/* Remove the config from the settings manager */
mSettingsManager.removeRecordingConfiguration(
recording.getRecordingConfiguration() );
mRecordings.remove( recording );
mRecordings.add(recording);
}
public Recording addRecording(RecordingConfiguration config)
{
Recording recording = new Recording(mSettingsManager, config);
mRecordings.add(recording);
return recording;
}
public void removeRecording(Recording recording)
{
/* Remove the config from the settings manager */
mSettingsManager.removeRecordingConfiguration(
recording.getRecordingConfiguration());
mRecordings.remove(recording);
}
private void loadRecordings()
{
List<RecordingConfiguration> recordingConfigurations =
mSettingsManager.getRecordingConfigurations();
List<RecordingConfiguration> recordingConfigurations =
mSettingsManager.getRecordingConfigurations();
mLog.info( "RecordingSourceManager - discovered [" +
recordingConfigurations.size() + "] recording configurations" );
for( RecordingConfiguration config: recordingConfigurations )
{
Recording recording = new Recording( mSettingsManager, config );
mRecordings.add( recording );
}
}
mLog.info("RecordingSourceManager - discovered [" +
recordingConfigurations.size() + "] recording configurations");
for(RecordingConfiguration config : recordingConfigurations)
{
Recording recording = new Recording(mSettingsManager, config);
mRecordings.add(recording);
}
}
}

View File

@@ -340,13 +340,13 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
*
* Returns null if no tuner can source the channel
*/
public Source getSource(SourceConfigTuner config, int bandwidth, ChannelSpecification channelSpecification)
public Source getSource(SourceConfigTuner config, ChannelSpecification channelSpecification)
{
TunerChannelSource retVal = null;
TunerChannel tunerChannel = config.getTunerChannel();
tunerChannel.setBandwidth(bandwidth);
tunerChannel.setBandwidth(channelSpecification.getBandwidth());
Iterator<Tuner> it = mTuners.iterator();

View File

@@ -21,18 +21,21 @@ package io.github.dsheirer.source.tuner.channel;
public class ChannelSpecification
{
private double mMinimumSampleRate;
private int mBandwidth;
private double mPassFrequency;
private double mStopFrequency;
/**
* Constructs a channel specification instance.
* @param minimumSampleRate requested for the channel
* @param bandwidth
* @param passFrequency for the pass band of the channel
* @param stopFrequency for the stop band of teh channel
*/
public ChannelSpecification(double minimumSampleRate, double passFrequency, double stopFrequency)
public ChannelSpecification(double minimumSampleRate, int bandwidth, double passFrequency, double stopFrequency)
{
mMinimumSampleRate = minimumSampleRate;
mBandwidth = bandwidth;
mPassFrequency = passFrequency;
mStopFrequency = stopFrequency;
}
@@ -45,6 +48,14 @@ public class ChannelSpecification
return mMinimumSampleRate;
}
/**
* Bandwidth of the channel in Hertz
*/
public int getBandwidth()
{
return mBandwidth;
}
/**
* Pass band frequency for filtering the channel
*/