Updates decoder types to specify channel sample rate and pass/stop
frequencies for requested channels.  Updates tuner channel source
managers to accept a channel specification for channels that are
allocated.
This commit is contained in:
Denny
2018-09-09 09:49:05 -04:00
parent 9950e46e5a
commit b15a3e59a0
14 changed files with 177 additions and 120 deletions

View File

@@ -25,6 +25,7 @@ import io.github.dsheirer.source.mixer.MixerManager;
import io.github.dsheirer.source.recording.RecordingSourceManager;
import io.github.dsheirer.source.tuner.TunerManager;
import io.github.dsheirer.source.tuner.TunerModel;
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
public class SourceManager
{
@@ -73,7 +74,7 @@ public class SourceManager
return mTunerModel;
}
public Source getSource(SourceConfiguration config, int bandwidth)
public Source getSource(SourceConfiguration config, int bandwidth, ChannelSpecification channelSpecification)
throws SourceException
{
Source retVal = null;
@@ -84,7 +85,7 @@ public class SourceManager
retVal = mMixerManager.getSource(config);
break;
case TUNER:
retVal = mTunerModel.getSource((SourceConfigTuner) config, bandwidth);
retVal = mTunerModel.getSource((SourceConfigTuner) config, bandwidth, channelSpecification);
break;
case RECORDING:
retVal = mRecordingSourceManager.getSource(config, bandwidth);

View File

@@ -21,6 +21,7 @@ import io.github.dsheirer.source.Source;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.config.SourceConfigTuner;
import io.github.dsheirer.source.tuner.TunerEvent.Event;
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 io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
@@ -327,7 +328,7 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
*
* Returns null if no tuner can source the channel
*/
public Source getSource(SourceConfigTuner config, int bandwidth)
public Source getSource(SourceConfigTuner config, int bandwidth, ChannelSpecification channelSpecification)
{
TunerChannelSource retVal = null;
@@ -347,7 +348,7 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
{
try
{
retVal = tuner.getChannelSourceManager().getSource(tunerChannel);
retVal = tuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification);
if(retVal != null)
{
@@ -370,7 +371,7 @@ public class TunerModel extends AbstractTableModel implements Listener<TunerEven
try
{
retVal = tuner.getChannelSourceManager().getSource(tunerChannel);
retVal = tuner.getChannelSourceManager().getSource(tunerChannel, channelSpecification);
}
catch(Exception e)
{

View File

@@ -44,12 +44,6 @@ public class CICTunerChannelSource extends TunerChannelSource implements Listene
//Threshold for resetting buffer overflow condition
private static final int BUFFER_OVERFLOW_RESET_THRESHOLD = 100;
//Pass band cutoff frequency for the complex channel - target = 12.5 kHz channel
private static final int CHANNEL_PASS_FREQUENCY = 6000;
//Stop band frequency for the complex channel
private static final int CHANNEL_STOP_FREQUENCY = 6700;
private OverflowableReusableBufferTransferQueue<ReusableComplexBuffer> mBuffer;
private ReusableComplexBufferQueue mReusableComplexBufferQueue = new ReusableComplexBufferQueue("CICTunerChannelSource");
private IOscillator mFrequencyCorrectionMixer;
@@ -65,16 +59,19 @@ public class CICTunerChannelSource extends TunerChannelSource implements Listene
* @param producerSourceEventListener to receive sample stream start/stop requests
* @param tunerChannel that details the desired channel frequency and bandwidth
* @param sampleRate of the incoming sample stream
* @param decimation to use in the CIC decimation filter.
* @param channelSpecification for the requested channel.
* @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter
* designer and the filter parameters.
*/
public CICTunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
double sampleRate, int decimation) throws FilterDesignException
double sampleRate, ChannelSpecification channelSpecification) throws FilterDesignException
{
super(producerSourceEventListener, tunerChannel);
mDecimationFilter = new ComplexPrimeCICDecimate(sampleRate, decimation, CHANNEL_PASS_FREQUENCY, CHANNEL_STOP_FREQUENCY);
int decimation = (int)(sampleRate / channelSpecification.getMinimumSampleRate());
mDecimationFilter = new ComplexPrimeCICDecimate(sampleRate, decimation, channelSpecification.getPassFrequency(),
channelSpecification.getStopFrequency());
mBuffer = new OverflowableReusableBufferTransferQueue<>(BUFFER_MAX_CAPACITY, BUFFER_OVERFLOW_RESET_THRESHOLD);
//Setup the frequency mixer to the current source frequency

View File

@@ -0,0 +1,63 @@
/*******************************************************************************
* 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.tuner.channel;
/**
* Channel source specification
*/
public class ChannelSpecification
{
private double mMinimumSampleRate;
private double mPassFrequency;
private double mStopFrequency;
/**
* Constructs a channel specification instance.
* @param minimumSampleRate requested for the channel
* @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)
{
mMinimumSampleRate = minimumSampleRate;
mPassFrequency = passFrequency;
mStopFrequency = stopFrequency;
}
/**
* Minimum requested sample rate for the channel
*/
public double getMinimumSampleRate()
{
return mMinimumSampleRate;
}
/**
* Pass band frequency for filtering the channel
*/
public double getPassFrequency()
{
return mPassFrequency;
}
/**
* Stop band frequency for filtering the channel
*/
public double getStopFrequency()
{
return mStopFrequency;
}
}

View File

@@ -19,6 +19,7 @@ import io.github.dsheirer.sample.Broadcaster;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.source.ISourceEventProcessor;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
import io.github.dsheirer.source.tuner.channel.TunerChannel;
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
@@ -50,9 +51,10 @@ public abstract class ChannelSourceManager implements ISourceEventProcessor
* resources allocated for the tuner channel source.
*
* @param tunerChannel for requested source
* @param channelSpecification for the requested channel
* @return tuner channel source or null
*/
public abstract TunerChannelSource getSource(TunerChannel tunerChannel);
public abstract TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification);
/**
* Adds a listener to receive source events

View File

@@ -22,6 +22,7 @@ import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.TunerController;
import io.github.dsheirer.source.tuner.channel.CICTunerChannelSource;
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;
@@ -39,7 +40,6 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
{
private final static Logger mLog = LoggerFactory.getLogger(HeterodyneChannelSourceManager.class);
private final static int OBJECTIVE_CHANNEL_SAMPLE_RATE = 25000;
private final static int DELAY_BUFFER_DURATION_MILLISECONDS = 2000;
private List<CICTunerChannelSource> mChannelSources = new CopyOnWriteArrayList<>();
@@ -67,17 +67,15 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
}
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel)
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification)
{
if(CenterFrequencyCalculator.canTune(tunerChannel, mTunerController, mTunerChannels))
{
int decimation = mTunerController.getBandwidth() / OBJECTIVE_CHANNEL_SAMPLE_RATE;
try
{
//Attempt to create the channel source first, in case we get a filter design exception
CICTunerChannelSource tunerChannelSource = new CICTunerChannelSource(mChannelSourceEventProcessor,
tunerChannel, mTunerController.getSampleRate(), decimation);
tunerChannel, mTunerController.getSampleRate(), channelSpecification);
//Add to the list of channel sources so that it will receive the tuner frequency change
mChannelSources.add(tunerChannelSource);
@@ -165,7 +163,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
*/
private void broadcastToChannels(SourceEvent sourceEvent)
{
for(CICTunerChannelSource channelSource: mChannelSources)
for(CICTunerChannelSource channelSource : mChannelSources)
{
try
{

View File

@@ -19,6 +19,7 @@ import io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelManager;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.SourceException;
import io.github.dsheirer.source.tuner.TunerController;
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;
@@ -390,8 +391,13 @@ public class PolyphaseChannelSourceManager extends ChannelSourceManager
* @return allocated DDC tuner channel source, or null if the channel cannot be provided by this source manager
*/
@Override
public TunerChannelSource getSource(TunerChannel tunerChannel)
public TunerChannelSource getSource(TunerChannel tunerChannel, ChannelSpecification channelSpecification)
{
if(channelSpecification != null)
{
throw new IllegalArgumentException("Update polyphase source manager to support channel specifications");
}
if(isTunable(tunerChannel))
{
//Get a new set of currently tuned channels