mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Resolves #170 adding support for Airspy Mini tuner's 3 and 6 MHz
sample rates. Resolves issue in PolyphaseChannelManager responding to sample rate changes in the tuner. The manager now recreates the channelizer when needed if the tuner's sample rate has changed since the last time the channelizer was used. Updates the Tuner selection view to reflect tuner lock state. Updates the tuner editors to enable/disable frequency controller and sample rate controls according to the tuner's lock state.
This commit is contained in:
@@ -22,8 +22,8 @@ import io.github.dsheirer.source.SourceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class FrequencyController
|
||||
{
|
||||
@@ -38,7 +38,7 @@ public class FrequencyController
|
||||
private double mSampleRate = 0.0d;
|
||||
private boolean mLocked = false;
|
||||
|
||||
private List<ISourceEventProcessor> mProcessors = new ArrayList<>();
|
||||
private List<ISourceEventProcessor> mProcessors = new CopyOnWriteArrayList<>();
|
||||
|
||||
public FrequencyController(Tunable tunable, long minFrequency, long maxFrequency, double frequencyCorrection)
|
||||
{
|
||||
@@ -95,9 +95,16 @@ public class FrequencyController
|
||||
*/
|
||||
public void setSampleRate(int sampleRate) throws SourceException
|
||||
{
|
||||
mSampleRate = sampleRate;
|
||||
if(!mLocked)
|
||||
{
|
||||
mSampleRate = sampleRate;
|
||||
|
||||
broadcastSampleRateChange();
|
||||
broadcastSampleRateChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
mLog.warn("Cannot change sample rate while tuner is is LOCKED state.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,6 +115,17 @@ public class FrequencyController
|
||||
return mSampleRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the specified frequency can be tuned (ie is within min/max frequency) by this controller.
|
||||
*
|
||||
* @param frequency to evaluate
|
||||
* @return true if the frequency falls within the tuning range of this controller
|
||||
*/
|
||||
public boolean canTune(long frequency)
|
||||
{
|
||||
return getMinimumFrequency() <= frequency && frequency <= getMaximumFrequency();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get frequency in hertz
|
||||
*/
|
||||
@@ -128,17 +146,6 @@ public class FrequencyController
|
||||
setFrequency(frequency, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the specified frequency can be tuned (ie is within min/max frequency) by this controller.
|
||||
*
|
||||
* @param frequency to evaluate
|
||||
* @return true if the frequency falls within the tuning range of this controller
|
||||
*/
|
||||
public boolean canTune(long frequency)
|
||||
{
|
||||
return getMinimumFrequency() <= frequency && frequency <= getMaximumFrequency();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set frequency with optional broadcast of frequency change event. This
|
||||
* method supports changing the frequency correction value without
|
||||
|
||||
Reference in New Issue
Block a user