mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Automatic Frequency Control enhancement. Provides default AFC and ability to disable in the Decoder tab of each channel. Spectral display includes visual indicators of frequency center (grey) and current AFC offset (yellow).
This commit is contained in:
@@ -56,6 +56,7 @@ import controller.system.System;
|
||||
import decode.config.AuxDecodeConfiguration;
|
||||
import decode.config.DecodeConfigFactory;
|
||||
import decode.config.DecodeConfiguration;
|
||||
import dsp.afc.AutomaticFrequencyControl;
|
||||
import eventlog.config.EventLogConfiguration;
|
||||
|
||||
@XmlSeeAlso( { Configuration.class } )
|
||||
@@ -134,6 +135,27 @@ public class Channel extends Configuration
|
||||
return mChannelType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the channel is using Automatic Frequency Control
|
||||
* @return
|
||||
*/
|
||||
public boolean hasAFC()
|
||||
{
|
||||
return getAFC() != null;
|
||||
}
|
||||
|
||||
public AutomaticFrequencyControl getAFC()
|
||||
{
|
||||
if( isProcessing() )
|
||||
{
|
||||
return getProcessingChain().getAFC();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resource manager responsible for this channel and registers
|
||||
* the channel manager as a listener to this channel. Fires channel add
|
||||
|
||||
@@ -34,13 +34,11 @@ import record.wave.ComplexWaveRecorder;
|
||||
import record.wave.FloatWaveRecorder;
|
||||
import sample.Broadcaster;
|
||||
import sample.Listener;
|
||||
import sample.Provider;
|
||||
import sample.complex.ComplexSample;
|
||||
import source.ComplexSource;
|
||||
import source.FloatArraySource;
|
||||
import source.FloatSource;
|
||||
import source.Source;
|
||||
import source.Source.SampleType;
|
||||
import source.SourceException;
|
||||
import source.config.SourceConfigMixer;
|
||||
import source.tuner.Tuner;
|
||||
@@ -57,6 +55,8 @@ import controller.state.ChannelState;
|
||||
import controller.state.ChannelState.State;
|
||||
import decode.Decoder;
|
||||
import decode.DecoderFactory;
|
||||
import dsp.afc.AutomaticFrequencyControl;
|
||||
import dsp.afc.FrequencyErrorListener;
|
||||
import eventlog.EventLogType;
|
||||
import eventlog.EventLogger;
|
||||
|
||||
@@ -73,6 +73,7 @@ public class ProcessingChain implements Listener<Message>
|
||||
protected List<Recorder> mRecorders = new ArrayList<Recorder>();
|
||||
protected ArrayList<EventLogger> mEventLoggers = new ArrayList<EventLogger>();
|
||||
protected AudioOutput mAudioOutput;
|
||||
protected AutomaticFrequencyControl mAFC;
|
||||
protected ChannelState mChannelState;
|
||||
protected ResourceManager mResourceManager;
|
||||
private ScheduledFuture<?> mProcessorTask;
|
||||
@@ -101,6 +102,14 @@ public class ProcessingChain implements Listener<Message>
|
||||
mChannel.getAliasListName() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatic Frequency Control, or null if disabled
|
||||
*/
|
||||
public AutomaticFrequencyControl getAFC()
|
||||
{
|
||||
return mAFC;
|
||||
}
|
||||
|
||||
public Listener<List<ComplexSample>> getComplexListener()
|
||||
{
|
||||
@@ -379,6 +388,28 @@ public class ProcessingChain implements Listener<Message>
|
||||
|
||||
mAudioOutput = new AudioOutput( threadName );
|
||||
addFloatListener( mAudioOutput );
|
||||
|
||||
/* Automatic frequency control */
|
||||
if( mAFC != null )
|
||||
{
|
||||
mAFC.dispose();
|
||||
mAFC = null;
|
||||
}
|
||||
|
||||
if( mSource instanceof FrequencyErrorListener &&
|
||||
mChannel.getDecodeConfiguration().isAFCEnabled() )
|
||||
{
|
||||
FrequencyErrorListener listener =
|
||||
(FrequencyErrorListener)mSource;
|
||||
|
||||
mAFC = new AutomaticFrequencyControl( listener );
|
||||
|
||||
/* Register AFC to receive frequency change events */
|
||||
listener.addListener( mAFC );
|
||||
|
||||
/* Add AFC as listener to the decoder */
|
||||
mDecoder.addUnfilteredFloatListener( mAFC );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user