mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Resolves #411
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user