mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-20 04:27:48 -05:00
Class renaming and cleanup.
This commit is contained in:
@@ -41,9 +41,9 @@ import java.util.Map;
|
|||||||
* This filter currently supports a maximum decimation rate of 2801. Higher decimation rates can be added by
|
* This filter currently supports a maximum decimation rate of 2801. Higher decimation rates can be added by
|
||||||
* adding additional prime factors to the PRIMES array.
|
* adding additional prime factors to the PRIMES array.
|
||||||
*/
|
*/
|
||||||
public class ComplexPrimeCICDecimate2 implements Listener<ReusableComplexBuffer>
|
public class ComplexPrimeCICDecimate implements Listener<ReusableComplexBuffer>
|
||||||
{
|
{
|
||||||
// private final static Logger mLog = LoggerFactory.getLogger(ComplexPrimeCICDecimate2.class);
|
// private final static Logger mLog = LoggerFactory.getLogger(ComplexPrimeCICDecimate.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PRIME numbers to use for decimation stage sizing. This list contains values that should
|
* PRIME numbers to use for decimation stage sizing. This list contains values that should
|
||||||
@@ -104,7 +104,7 @@ public class ComplexPrimeCICDecimate2 implements Listener<ReusableComplexBuffer>
|
|||||||
* @throws FilterDesignException if a final low-pass cleanup filter cannot be created for the output channel rate
|
* @throws FilterDesignException if a final low-pass cleanup filter cannot be created for the output channel rate
|
||||||
* and specified pass/stop frequencies.
|
* and specified pass/stop frequencies.
|
||||||
*/
|
*/
|
||||||
public ComplexPrimeCICDecimate2(double sampleRate, int decimation, int passFrequency, int stopFrequency)
|
public ComplexPrimeCICDecimate(double sampleRate, int decimation, int passFrequency, int stopFrequency)
|
||||||
throws FilterDesignException
|
throws FilterDesignException
|
||||||
{
|
{
|
||||||
Validate.isTrue(decimation <= PRIMES[PRIMES.length - 1]);
|
Validate.isTrue(decimation <= PRIMES[PRIMES.length - 1]);
|
||||||
@@ -51,7 +51,7 @@ public abstract class Tuner implements ISourceEventProcessor
|
|||||||
//Register to receive frequency and sample rate change notifications
|
//Register to receive frequency and sample rate change notifications
|
||||||
mTunerController.addListener(this::process);
|
mTunerController.addListener(this::process);
|
||||||
|
|
||||||
// mChannelSourceManager = new TunerChannelSourceManager(mTunerController);
|
// mChannelSourceManager = new PolyphaseChannelSourceManager(mTunerController);
|
||||||
mChannelSourceManager = new HeterodyneChannelSourceManager(mTunerController);
|
mChannelSourceManager = new HeterodyneChannelSourceManager(mTunerController);
|
||||||
|
|
||||||
//Register to receive channel count change notifications
|
//Register to receive channel count change notifications
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package io.github.dsheirer.source.tuner.channel;
|
package io.github.dsheirer.source.tuner.channel;
|
||||||
|
|
||||||
import io.github.dsheirer.dsp.filter.cic.ComplexPrimeCICDecimate2;
|
import io.github.dsheirer.dsp.filter.cic.ComplexPrimeCICDecimate;
|
||||||
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
|
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
|
||||||
import io.github.dsheirer.dsp.mixer.IOscillator;
|
import io.github.dsheirer.dsp.mixer.IOscillator;
|
||||||
import io.github.dsheirer.dsp.mixer.LowPhaseNoiseOscillator;
|
import io.github.dsheirer.dsp.mixer.LowPhaseNoiseOscillator;
|
||||||
@@ -34,9 +34,9 @@ import java.util.List;
|
|||||||
* CIC decimation filter that requires the decimation rate to be an integer multiple. Sample buffer processing
|
* CIC decimation filter that requires the decimation rate to be an integer multiple. Sample buffer processing
|
||||||
* occurs on a scheduled runnable thread.
|
* occurs on a scheduled runnable thread.
|
||||||
*/
|
*/
|
||||||
public class CICTunerChannelSource2 extends TunerChannelSource implements Listener<ReusableComplexBuffer>
|
public class CICTunerChannelSource extends TunerChannelSource implements Listener<ReusableComplexBuffer>
|
||||||
{
|
{
|
||||||
// private final static Logger mLog = LoggerFactory.getLogger(CICTunerChannelSource2.class);
|
// private final static Logger mLog = LoggerFactory.getLogger(CICTunerChannelSource.class);
|
||||||
|
|
||||||
//Maximum number of filled buffers for the blocking queue
|
//Maximum number of filled buffers for the blocking queue
|
||||||
private static final int BUFFER_MAX_CAPACITY = 300;
|
private static final int BUFFER_MAX_CAPACITY = 300;
|
||||||
@@ -53,7 +53,7 @@ public class CICTunerChannelSource2 extends TunerChannelSource implements Listen
|
|||||||
private OverflowableReusableBufferTransferQueue<ReusableComplexBuffer> mBuffer;
|
private OverflowableReusableBufferTransferQueue<ReusableComplexBuffer> mBuffer;
|
||||||
private ReusableComplexBufferQueue mReusableComplexBufferQueue = new ReusableComplexBufferQueue("CICTunerChannelSource");
|
private ReusableComplexBufferQueue mReusableComplexBufferQueue = new ReusableComplexBufferQueue("CICTunerChannelSource");
|
||||||
private IOscillator mFrequencyCorrectionMixer;
|
private IOscillator mFrequencyCorrectionMixer;
|
||||||
private ComplexPrimeCICDecimate2 mDecimationFilter;
|
private ComplexPrimeCICDecimate mDecimationFilter;
|
||||||
private Listener<ReusableComplexBuffer> mListener;
|
private Listener<ReusableComplexBuffer> mListener;
|
||||||
private List<ReusableComplexBuffer> mSampleBuffers = new ArrayList<>();
|
private List<ReusableComplexBuffer> mSampleBuffers = new ArrayList<>();
|
||||||
private double mChannelSampleRate;
|
private double mChannelSampleRate;
|
||||||
@@ -70,12 +70,12 @@ public class CICTunerChannelSource2 extends TunerChannelSource implements Listen
|
|||||||
* @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter
|
* @throws FilterDesignException if a final cleanup filter cannot be designed using the remez filter
|
||||||
* designer and the filter parameters.
|
* designer and the filter parameters.
|
||||||
*/
|
*/
|
||||||
public CICTunerChannelSource2(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
|
public CICTunerChannelSource(Listener<SourceEvent> producerSourceEventListener, TunerChannel tunerChannel,
|
||||||
double sampleRate, int decimation) throws FilterDesignException
|
double sampleRate, int decimation) throws FilterDesignException
|
||||||
{
|
{
|
||||||
super(producerSourceEventListener, tunerChannel);
|
super(producerSourceEventListener, tunerChannel);
|
||||||
|
|
||||||
mDecimationFilter = new ComplexPrimeCICDecimate2(sampleRate, decimation, CHANNEL_PASS_FREQUENCY, CHANNEL_STOP_FREQUENCY);
|
mDecimationFilter = new ComplexPrimeCICDecimate(sampleRate, decimation, CHANNEL_PASS_FREQUENCY, CHANNEL_STOP_FREQUENCY);
|
||||||
|
|
||||||
mBuffer = new OverflowableReusableBufferTransferQueue<>(BUFFER_MAX_CAPACITY, BUFFER_OVERFLOW_RESET_THRESHOLD);
|
mBuffer = new OverflowableReusableBufferTransferQueue<>(BUFFER_MAX_CAPACITY, BUFFER_OVERFLOW_RESET_THRESHOLD);
|
||||||
//Setup the frequency mixer to the current source frequency
|
//Setup the frequency mixer to the current source frequency
|
||||||
@@ -20,7 +20,7 @@ import io.github.dsheirer.sample.Listener;
|
|||||||
import io.github.dsheirer.source.SourceEvent;
|
import io.github.dsheirer.source.SourceEvent;
|
||||||
import io.github.dsheirer.source.SourceException;
|
import io.github.dsheirer.source.SourceException;
|
||||||
import io.github.dsheirer.source.tuner.TunerController;
|
import io.github.dsheirer.source.tuner.TunerController;
|
||||||
import io.github.dsheirer.source.tuner.channel.CICTunerChannelSource2;
|
import io.github.dsheirer.source.tuner.channel.CICTunerChannelSource;
|
||||||
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
import io.github.dsheirer.source.tuner.channel.TunerChannel;
|
||||||
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
|
import io.github.dsheirer.source.tuner.channel.TunerChannelSource;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -40,7 +40,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
|||||||
|
|
||||||
private final static int OBJECTIVE_CHANNEL_SAMPLE_RATE = 30000;
|
private final static int OBJECTIVE_CHANNEL_SAMPLE_RATE = 30000;
|
||||||
|
|
||||||
private List<CICTunerChannelSource2> mChannelSources = new CopyOnWriteArrayList<>();
|
private List<CICTunerChannelSource> mChannelSources = new CopyOnWriteArrayList<>();
|
||||||
private SortedSet<TunerChannel> mTunerChannels = new TreeSet<>();
|
private SortedSet<TunerChannel> mTunerChannels = new TreeSet<>();
|
||||||
private TunerController mTunerController;
|
private TunerController mTunerController;
|
||||||
private ChannelSourceEventProcessor mChannelSourceEventProcessor = new ChannelSourceEventProcessor();
|
private ChannelSourceEventProcessor mChannelSourceEventProcessor = new ChannelSourceEventProcessor();
|
||||||
@@ -73,7 +73,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Attempt to create the channel source first, in case we get a filter design exception
|
//Attempt to create the channel source first, in case we get a filter design exception
|
||||||
CICTunerChannelSource2 tunerChannelSource = new CICTunerChannelSource2(mChannelSourceEventProcessor,
|
CICTunerChannelSource tunerChannelSource = new CICTunerChannelSource(mChannelSourceEventProcessor,
|
||||||
tunerChannel, mTunerController.getSampleRate(), decimation);
|
tunerChannel, mTunerController.getSampleRate(), decimation);
|
||||||
|
|
||||||
//Add to the list of channel sources so that it will receive the tuner frequency change
|
//Add to the list of channel sources so that it will receive the tuner frequency change
|
||||||
@@ -156,7 +156,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
|||||||
*/
|
*/
|
||||||
private void broadcastToChannels(SourceEvent sourceEvent)
|
private void broadcastToChannels(SourceEvent sourceEvent)
|
||||||
{
|
{
|
||||||
for(CICTunerChannelSource2 channelSource: mChannelSources)
|
for(CICTunerChannelSource channelSource: mChannelSources)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -176,7 +176,7 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
|||||||
*/
|
*/
|
||||||
private void updateTunerFrequency(long tunerFrequency)
|
private void updateTunerFrequency(long tunerFrequency)
|
||||||
{
|
{
|
||||||
for(CICTunerChannelSource2 channelSource : mChannelSources)
|
for(CICTunerChannelSource channelSource : mChannelSources)
|
||||||
{
|
{
|
||||||
channelSource.setFrequency(tunerFrequency);
|
channelSource.setFrequency(tunerFrequency);
|
||||||
}
|
}
|
||||||
@@ -193,21 +193,21 @@ public class HeterodyneChannelSourceManager extends ChannelSourceManager
|
|||||||
switch(sourceEvent.getEvent())
|
switch(sourceEvent.getEvent())
|
||||||
{
|
{
|
||||||
case REQUEST_START_SAMPLE_STREAM:
|
case REQUEST_START_SAMPLE_STREAM:
|
||||||
if(sourceEvent.getSource() instanceof CICTunerChannelSource2)
|
if(sourceEvent.getSource() instanceof CICTunerChannelSource)
|
||||||
{
|
{
|
||||||
mTunerController.addBufferListener((CICTunerChannelSource2)sourceEvent.getSource());
|
mTunerController.addBufferListener((CICTunerChannelSource)sourceEvent.getSource());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REQUEST_STOP_SAMPLE_STREAM:
|
case REQUEST_STOP_SAMPLE_STREAM:
|
||||||
if(sourceEvent.getSource() instanceof CICTunerChannelSource2)
|
if(sourceEvent.getSource() instanceof CICTunerChannelSource)
|
||||||
{
|
{
|
||||||
mTunerController.removeBufferListener((CICTunerChannelSource2)sourceEvent.getSource());
|
mTunerController.removeBufferListener((CICTunerChannelSource)sourceEvent.getSource());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REQUEST_SOURCE_DISPOSE:
|
case REQUEST_SOURCE_DISPOSE:
|
||||||
if(sourceEvent.getSource() instanceof CICTunerChannelSource2)
|
if(sourceEvent.getSource() instanceof CICTunerChannelSource)
|
||||||
{
|
{
|
||||||
CICTunerChannelSource2 channelSource = (CICTunerChannelSource2)sourceEvent.getSource();
|
CICTunerChannelSource channelSource = (CICTunerChannelSource)sourceEvent.getSource();
|
||||||
mChannelSources.remove(channelSource);
|
mChannelSources.remove(channelSource);
|
||||||
mTunerChannels.remove(channelSource.getTunerChannel());
|
mTunerChannels.remove(channelSource.getTunerChannel());
|
||||||
channelSource.dispose();
|
channelSource.dispose();
|
||||||
|
|||||||
@@ -26,20 +26,20 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
public class TunerChannelSourceManager extends ChannelSourceManager
|
public class PolyphaseChannelSourceManager extends ChannelSourceManager
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(TunerChannelSourceManager.class);
|
private final static Logger mLog = LoggerFactory.getLogger(PolyphaseChannelSourceManager.class);
|
||||||
private PolyphaseChannelManager mPolyphaseChannelManager;
|
private PolyphaseChannelManager mPolyphaseChannelManager;
|
||||||
private TunerController mTunerController;
|
private TunerController mTunerController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TunerChannelSourceManager is responsible for managing the tuner's center tuned frequency and providing access to
|
* PolyphaseChannelSourceManager is responsible for managing the tuner's center tuned frequency and providing access to
|
||||||
* polyphase tuner channel sources (ie DDCs). This class is responsible for determining IF a requested channel can
|
* polyphase tuner channel sources (ie DDCs). This class is responsible for determining IF a requested channel can
|
||||||
* be provided and then adjusting the center frequency and provisioning a DDC Polyphase Tuner channel source.
|
* be provided and then adjusting the center frequency and provisioning a DDC Polyphase Tuner channel source.
|
||||||
*
|
*
|
||||||
* @param tunerController with a center tuned frequency that will be managed by this instance
|
* @param tunerController with a center tuned frequency that will be managed by this instance
|
||||||
*/
|
*/
|
||||||
public TunerChannelSourceManager(TunerController tunerController)
|
public PolyphaseChannelSourceManager(TunerController tunerController)
|
||||||
{
|
{
|
||||||
mTunerController = tunerController;
|
mTunerController = tunerController;
|
||||||
|
|
||||||
Reference in New Issue
Block a user