mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
Converted frequency to long primitive type (from integer) in anticipation of HackRF support which requires frequencies greater than 2.147 GHz, which is the max hertz value that can be represented by an integer primitive.
This commit is contained in:
@@ -167,7 +167,7 @@ public class ConfigurationControllerModel extends DefaultTreeModel
|
|||||||
* Convenience method to add a new default system, site and channel to
|
* Convenience method to add a new default system, site and channel to
|
||||||
* the tree
|
* the tree
|
||||||
*/
|
*/
|
||||||
public void createChannel( int frequency, DecoderType decoder )
|
public void createChannel( long frequency, DecoderType decoder )
|
||||||
{
|
{
|
||||||
System system = new System();
|
System system = new System();
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public abstract class CallEvent
|
|||||||
|
|
||||||
public abstract int getChannel();
|
public abstract int getChannel();
|
||||||
|
|
||||||
public abstract int getFrequency();
|
public abstract long getFrequency();
|
||||||
|
|
||||||
public static String getCSVHeader()
|
public static String getCSVHeader()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.util.LinkedList;
|
|||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
|
||||||
import log.Log;
|
|
||||||
import sample.Broadcaster;
|
import sample.Broadcaster;
|
||||||
import sample.Listener;
|
import sample.Listener;
|
||||||
|
|
||||||
|
|||||||
@@ -829,7 +829,7 @@ public class Channel extends Configuration
|
|||||||
* Indicates if any part of this channel is contained within the
|
* Indicates if any part of this channel is contained within the
|
||||||
* minimum and maximum frequency values.
|
* minimum and maximum frequency values.
|
||||||
*/
|
*/
|
||||||
public boolean isWithin( int minimum, int maximum )
|
public boolean isWithin( long minimum, long maximum )
|
||||||
{
|
{
|
||||||
return getTunerChannel() != null &&
|
return getTunerChannel() != null &&
|
||||||
getTunerChannel().isWithin( minimum, maximum );
|
getTunerChannel().isWithin( minimum, maximum );
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class ChannelMap
|
|||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency( int channelNumber )
|
public long getFrequency( int channelNumber )
|
||||||
{
|
{
|
||||||
for( ChannelRange range: mRanges )
|
for( ChannelRange range: mRanges )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ChannelRange
|
|||||||
return mFirst <= channel && channel <= mLast;
|
return mFirst <= channel && channel <= mLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency( int channel )
|
public long getFrequency( int channel )
|
||||||
{
|
{
|
||||||
if( hasChannel( channel ) )
|
if( hasChannel( channel ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class FleetsyncCallEvent extends CallEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ import decode.DecoderType;
|
|||||||
public class LTRCallEvent extends CallEvent
|
public class LTRCallEvent extends CallEvent
|
||||||
{
|
{
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public LTRCallEvent( CallEventType callEventType,
|
public LTRCallEvent( CallEventType callEventType,
|
||||||
AliasList aliasList,
|
AliasList aliasList,
|
||||||
String fromID,
|
String fromID,
|
||||||
String toID,
|
String toID,
|
||||||
int channel,
|
int channel,
|
||||||
int frequency,
|
long frequency,
|
||||||
String details )
|
String details )
|
||||||
{
|
{
|
||||||
super( DecoderType.LTR_STANDARD, callEventType,
|
super( DecoderType.LTR_STANDARD, callEventType,
|
||||||
@@ -101,7 +101,7 @@ public class LTRCallEvent extends CallEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ public class LTRCallEvent extends CallEvent
|
|||||||
private String mToID;
|
private String mToID;
|
||||||
private String mDetails;
|
private String mDetails;
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public Builder( CallEventType callEventType )
|
public Builder( CallEventType callEventType )
|
||||||
{
|
{
|
||||||
@@ -148,7 +148,7 @@ public class LTRCallEvent extends CallEvent
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder frequency( int frequency )
|
public Builder frequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ public class LTRNetChannelState extends ChannelState
|
|||||||
private Alias mFromTalkgroupAlias;
|
private Alias mFromTalkgroupAlias;
|
||||||
private String mFromTalkgroupType;
|
private String mFromTalkgroupType;
|
||||||
private int mChannelNumber;
|
private int mChannelNumber;
|
||||||
private String mUniqueID;
|
|
||||||
private LTRCallEvent mCurrentCallEvent;
|
private LTRCallEvent mCurrentCallEvent;
|
||||||
private LTRNetActivitySummary mActivitySummary;
|
private LTRNetActivitySummary mActivitySummary;
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MDCCallEvent extends CallEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ import decode.DecoderType;
|
|||||||
public class MPT1327CallEvent extends CallEvent
|
public class MPT1327CallEvent extends CallEvent
|
||||||
{
|
{
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public MPT1327CallEvent( CallEventType callEventType,
|
public MPT1327CallEvent( CallEventType callEventType,
|
||||||
AliasList aliasList,
|
AliasList aliasList,
|
||||||
String fromID,
|
String fromID,
|
||||||
String toID,
|
String toID,
|
||||||
int channel,
|
int channel,
|
||||||
int frequency,
|
long frequency,
|
||||||
String details )
|
String details )
|
||||||
{
|
{
|
||||||
super( DecoderType.MPT1327, callEventType,
|
super( DecoderType.MPT1327, callEventType,
|
||||||
@@ -71,7 +71,7 @@ public class MPT1327CallEvent extends CallEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ public class MPT1327CallEvent extends CallEvent
|
|||||||
private String mToID;
|
private String mToID;
|
||||||
private String mDetails;
|
private String mDetails;
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public Builder( CallEventType callEventType )
|
public Builder( CallEventType callEventType )
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ public class MPT1327CallEvent extends CallEvent
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder frequency( int frequency )
|
public Builder frequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class MPT1327ChannelState extends ChannelState
|
|||||||
.build() );
|
.build() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int frequency = mChannelMap.getFrequency( channelNumber );
|
long frequency = mChannelMap.getFrequency( channelNumber );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CLEAR:
|
case CLEAR:
|
||||||
@@ -330,7 +330,7 @@ public class MPT1327ChannelState extends ChannelState
|
|||||||
|
|
||||||
SourceConfigTuner source = new SourceConfigTuner();
|
SourceConfigTuner source = new SourceConfigTuner();
|
||||||
|
|
||||||
int frequency = mChannelMap.getFrequency( channelNumber );
|
long frequency = mChannelMap.getFrequency( channelNumber );
|
||||||
|
|
||||||
source.setFrequency( frequency );
|
source.setFrequency( frequency );
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ import decode.DecoderType;
|
|||||||
public class PassportCallEvent extends CallEvent
|
public class PassportCallEvent extends CallEvent
|
||||||
{
|
{
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public PassportCallEvent( CallEventType callEventType,
|
public PassportCallEvent( CallEventType callEventType,
|
||||||
AliasList aliasList,
|
AliasList aliasList,
|
||||||
String fromID,
|
String fromID,
|
||||||
String toID,
|
String toID,
|
||||||
int channel,
|
int channel,
|
||||||
int frequency,
|
long frequency,
|
||||||
String details )
|
String details )
|
||||||
{
|
{
|
||||||
super( DecoderType.PASSPORT, callEventType,
|
super( DecoderType.PASSPORT, callEventType,
|
||||||
@@ -81,7 +81,7 @@ public class PassportCallEvent extends CallEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ public class PassportCallEvent extends CallEvent
|
|||||||
private String mToID;
|
private String mToID;
|
||||||
private String mDetails;
|
private String mDetails;
|
||||||
private int mChannel;
|
private int mChannel;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
public Builder( CallEventType callEventType )
|
public Builder( CallEventType callEventType )
|
||||||
{
|
{
|
||||||
@@ -128,7 +128,7 @@ public class PassportCallEvent extends CallEvent
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder frequency( int frequency )
|
public Builder frequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class PassportChannelState extends ChannelState
|
|||||||
private String mMobileID;
|
private String mMobileID;
|
||||||
private Alias mMobileIDAlias;
|
private Alias mMobileIDAlias;
|
||||||
private int mChannelNumber;
|
private int mChannelNumber;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private PassportCallEvent mCurrentCallEvent;
|
private PassportCallEvent mCurrentCallEvent;
|
||||||
private PassportActivitySummary mActivitySummary;
|
private PassportActivitySummary mActivitySummary;
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ import decode.DecoderType;
|
|||||||
public class PassportMessage extends Message
|
public class PassportMessage extends Message
|
||||||
{
|
{
|
||||||
private static final String sUNKNOWN = "**UNKNOWN**";
|
private static final String sUNKNOWN = "**UNKNOWN**";
|
||||||
private static final int sINT_NULL_VALUE = -1;
|
|
||||||
private static final double sDOUBLE_NULL_VALUE = -1.0D;
|
|
||||||
private SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
|
private SimpleDateFormat mSDF = new SimpleDateFormat( "yyyyMMdd HHmmss" );
|
||||||
private DecimalFormat mDecimalFormatter = new DecimalFormat("0.00000");
|
private DecimalFormat mDecimalFormatter = new DecimalFormat("0.00000");
|
||||||
|
|
||||||
@@ -189,7 +187,7 @@ public class PassportMessage extends Message
|
|||||||
return getInt( sLCN );
|
return getInt( sLCN );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLCNFrequency()
|
public long getLCNFrequency()
|
||||||
{
|
{
|
||||||
return getSiteFrequency( getLCN() );
|
return getSiteFrequency( getLCN() );
|
||||||
}
|
}
|
||||||
@@ -209,7 +207,7 @@ public class PassportMessage extends Message
|
|||||||
return PassportBand.lookup( getInt( sNEIGHBOR_BAND ) );
|
return PassportBand.lookup( getInt( sNEIGHBOR_BAND ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency( int base, int channel )
|
public long getFrequency( int base, int channel )
|
||||||
{
|
{
|
||||||
return ( base + ( channel * 12500 ) );
|
return ( base + ( channel * 12500 ) );
|
||||||
}
|
}
|
||||||
@@ -219,7 +217,7 @@ public class PassportMessage extends Message
|
|||||||
return getInt( sFREE );
|
return getInt( sFREE );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFreeFrequency()
|
public long getFreeFrequency()
|
||||||
{
|
{
|
||||||
return getSiteFrequency( getFree() );
|
return getSiteFrequency( getFree() );
|
||||||
}
|
}
|
||||||
@@ -229,18 +227,16 @@ public class PassportMessage extends Message
|
|||||||
return mDecimalFormatter.format( (double)getFreeFrequency() / 1000000.0d );
|
return mDecimalFormatter.format( (double)getFreeFrequency() / 1000000.0d );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNeighborFrequency()
|
public long getNeighborFrequency()
|
||||||
{
|
{
|
||||||
int retVal = 0;
|
|
||||||
|
|
||||||
if( getMessageType() == MessageType.SY_IDLE )
|
if( getMessageType() == MessageType.SY_IDLE )
|
||||||
{
|
{
|
||||||
PassportBand band = getNeighborBand();
|
PassportBand band = getNeighborBand();
|
||||||
|
|
||||||
retVal = getFrequency( band.getBase(), getFree() );
|
return getFrequency( band.getBase(), getFree() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -392,10 +388,8 @@ public class PassportMessage extends Message
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSiteFrequency( int channel )
|
public long getSiteFrequency( int channel )
|
||||||
{
|
{
|
||||||
int freq = 0;
|
|
||||||
|
|
||||||
if( mIdleMessage != null && 0 < channel && channel < 1792 )
|
if( mIdleMessage != null && 0 < channel && channel < 1792 )
|
||||||
{
|
{
|
||||||
PassportBand band = mIdleMessage.getSiteBand();
|
PassportBand band = mIdleMessage.getSiteBand();
|
||||||
@@ -404,11 +398,11 @@ public class PassportMessage extends Message
|
|||||||
{
|
{
|
||||||
int base = band.getBase();
|
int base = band.getBase();
|
||||||
|
|
||||||
freq = getFrequency( base, channel );
|
return getFrequency( base, channel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return freq;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class FilterFactory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static double[] getSinc( int sampleRate,
|
public static double[] getSinc( int sampleRate,
|
||||||
int frequency,
|
long frequency,
|
||||||
int length,
|
int length,
|
||||||
WindowType window )
|
WindowType window )
|
||||||
{
|
{
|
||||||
@@ -129,7 +129,7 @@ public class FilterFactory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static double[] getUnityResponseArray( int sampleRate,
|
public static double[] getUnityResponseArray( int sampleRate,
|
||||||
int frequency,
|
long frequency,
|
||||||
int length )
|
int length )
|
||||||
{
|
{
|
||||||
double[] unityArray = new double[ length * 2 ];
|
double[] unityArray = new double[ length * 2 ];
|
||||||
@@ -215,7 +215,7 @@ public class FilterFactory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static double[] getLowPass( int sampleRate,
|
public static double[] getLowPass( int sampleRate,
|
||||||
int cutoff,
|
long cutoff,
|
||||||
int filterLength,
|
int filterLength,
|
||||||
WindowType windowType )
|
WindowType windowType )
|
||||||
{
|
{
|
||||||
@@ -293,14 +293,14 @@ public class FilterFactory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static double[] getHighPass( int sampleRate,
|
public static double[] getHighPass( int sampleRate,
|
||||||
int cutoff,
|
long cutoff,
|
||||||
int filterLength,
|
int filterLength,
|
||||||
WindowType windowType )
|
WindowType windowType )
|
||||||
{
|
{
|
||||||
//Convert the high frequency cutoff to its low frequency cutoff
|
//Convert the high frequency cutoff to its low frequency cutoff
|
||||||
//equivalent, so that when we generate the low pass filter, prior to
|
//equivalent, so that when we generate the low pass filter, prior to
|
||||||
//inversion, its at the correct frequency
|
//inversion, its at the correct frequency
|
||||||
int convertedCutoff = sampleRate / 2 - cutoff;
|
long convertedCutoff = sampleRate / 2 - cutoff;
|
||||||
|
|
||||||
return invert( getSinc( sampleRate,
|
return invert( getSinc( sampleRate,
|
||||||
convertedCutoff,
|
convertedCutoff,
|
||||||
@@ -309,8 +309,8 @@ public class FilterFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double[] getHighPass( int sampleRate,
|
public static double[] getHighPass( int sampleRate,
|
||||||
int stopFrequency,
|
long stopFrequency,
|
||||||
int passFrequency,
|
long passFrequency,
|
||||||
int attenuation,
|
int attenuation,
|
||||||
WindowType windowType,
|
WindowType windowType,
|
||||||
boolean forceOddLength )
|
boolean forceOddLength )
|
||||||
@@ -376,8 +376,8 @@ public class FilterFactory
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int getTapCount( int sampleRate,
|
public static int getTapCount( int sampleRate,
|
||||||
int pass,
|
long pass,
|
||||||
int stop,
|
long stop,
|
||||||
int attenuation )
|
int attenuation )
|
||||||
{
|
{
|
||||||
double frequency = ( (double)stop - (double)pass ) / (double)sampleRate;
|
double frequency = ( (double)stop - (double)pass ) / (double)sampleRate;
|
||||||
@@ -386,8 +386,10 @@ public class FilterFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ComplexFilter[] getDecimationFilters( int sampleRate,
|
public static ComplexFilter[] getDecimationFilters( int sampleRate,
|
||||||
int decimatedRate, int passFrequency, int attenuation,
|
int decimatedRate,
|
||||||
WindowType windowType )
|
long passFrequency,
|
||||||
|
int attenuation,
|
||||||
|
WindowType windowType )
|
||||||
{
|
{
|
||||||
ComplexFilter[] filters;
|
ComplexFilter[] filters;
|
||||||
|
|
||||||
@@ -480,9 +482,9 @@ public class FilterFactory
|
|||||||
* @throws - AssertionException if sample rate is not a multiple of 48 kHz
|
* @throws - AssertionException if sample rate is not a multiple of 48 kHz
|
||||||
*/
|
*/
|
||||||
public static int[] getPolyphaseDecimationRates( int sampleRate,
|
public static int[] getPolyphaseDecimationRates( int sampleRate,
|
||||||
int decimatedRate,
|
int decimatedRate,
|
||||||
int passFrequency,
|
long passFrequency,
|
||||||
int stopFrequency )
|
long stopFrequency )
|
||||||
{
|
{
|
||||||
int[] rates;
|
int[] rates;
|
||||||
|
|
||||||
@@ -609,8 +611,8 @@ public class FilterFactory
|
|||||||
*/
|
*/
|
||||||
public static int getOptimalStageOneRate( int sampleRate,
|
public static int getOptimalStageOneRate( int sampleRate,
|
||||||
int decimation,
|
int decimation,
|
||||||
int passFrequency,
|
long passFrequency,
|
||||||
int stopFrequency )
|
long stopFrequency )
|
||||||
{
|
{
|
||||||
double ratio = getBandwidthRatio( passFrequency, stopFrequency );
|
double ratio = getBandwidthRatio( passFrequency, stopFrequency );
|
||||||
|
|
||||||
@@ -637,7 +639,7 @@ public class FilterFactory
|
|||||||
* Used in conjunction with the optimal stage one decimation rate method
|
* Used in conjunction with the optimal stage one decimation rate method
|
||||||
* above.
|
* above.
|
||||||
*/
|
*/
|
||||||
private static double getBandwidthRatio( int passFrequency, int stopFrequency )
|
private static double getBandwidthRatio( long passFrequency, long stopFrequency )
|
||||||
{
|
{
|
||||||
assert( passFrequency < stopFrequency );
|
assert( passFrequency < stopFrequency );
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import dsp.filter.Window.WindowType;
|
|||||||
public class GoertzelFilter
|
public class GoertzelFilter
|
||||||
{
|
{
|
||||||
private int mSampleRate;
|
private int mSampleRate;
|
||||||
private int mTargetFrequency;
|
private long mTargetFrequency;
|
||||||
private int mBlockSize;
|
private int mBlockSize;
|
||||||
private double[] mWindowCoefficients;
|
private double[] mWindowCoefficients;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class GoertzelFilter
|
|||||||
* the magnitude
|
* the magnitude
|
||||||
*/
|
*/
|
||||||
public GoertzelFilter( int sampleRate,
|
public GoertzelFilter( int sampleRate,
|
||||||
int targetFrequency,
|
long targetFrequency,
|
||||||
int blockSize,
|
int blockSize,
|
||||||
WindowType window )
|
WindowType window )
|
||||||
{
|
{
|
||||||
@@ -139,15 +139,15 @@ public class GoertzelFilter
|
|||||||
*/
|
*/
|
||||||
public int getSampleRate()
|
public int getSampleRate()
|
||||||
{
|
{
|
||||||
return mSampleRate;
|
return mSampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the Target Frequency
|
* @return the Target Frequency
|
||||||
*/
|
*/
|
||||||
public int getTargetFrequency()
|
public long getTargetFrequency()
|
||||||
{
|
{
|
||||||
return mTargetFrequency;
|
return mTargetFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,7 +155,7 @@ public class GoertzelFilter
|
|||||||
*/
|
*/
|
||||||
public int getBlockSize()
|
public int getBlockSize()
|
||||||
{
|
{
|
||||||
return mBlockSize;
|
return mBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,19 +58,23 @@ final public class IIRBiQuadraticFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// constructor without gain setting
|
// constructor without gain setting
|
||||||
public IIRBiQuadraticFilter(Type type, double center_freq, double sample_rate, double Q) {
|
public IIRBiQuadraticFilter(Type type, double center_freq, double sample_rate, double Q)
|
||||||
|
{
|
||||||
configure(type, center_freq, sample_rate, Q, 0);
|
configure(type, center_freq, sample_rate, Q, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset()
|
||||||
|
{
|
||||||
x1 = x2 = y1 = y2 = 0;
|
x1 = x2 = y1 = y2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double frequency() {
|
public double frequency()
|
||||||
|
{
|
||||||
return center_freq;
|
return center_freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configure(Type type, double center_freq, double sample_rate, double Q, double gainDB) {
|
public void configure(Type type, double center_freq, double sample_rate, double Q, double gainDB)
|
||||||
|
{
|
||||||
reset();
|
reset();
|
||||||
Q = (Q == 0) ? 1e-9 : Q;
|
Q = (Q == 0) ? 1e-9 : Q;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -80,7 +84,8 @@ final public class IIRBiQuadraticFilter {
|
|||||||
reconfigure(center_freq);
|
reconfigure(center_freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configure(Type type, double center_freq, double sample_rate, double Q) {
|
public void configure(Type type, double center_freq, double sample_rate, double Q)
|
||||||
|
{
|
||||||
configure(type, center_freq, sample_rate, Q, 0);
|
configure(type, center_freq, sample_rate, Q, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +172,8 @@ final public class IIRBiQuadraticFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// provide a static decibel result for testing
|
// provide a static decibel result for testing
|
||||||
public double log_result(double f) {
|
public double log_result(double f)
|
||||||
|
{
|
||||||
double r;
|
double r;
|
||||||
try {
|
try {
|
||||||
r = 10 * Math.log10(result(f));
|
r = 10 * Math.log10(result(f));
|
||||||
@@ -181,12 +187,14 @@ final public class IIRBiQuadraticFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return the constant set for this filter
|
// return the constant set for this filter
|
||||||
public double[] constants() {
|
public double[] constants()
|
||||||
|
{
|
||||||
return new double[]{b0, b1, b2, a1, a2};
|
return new double[]{b0, b1, b2, a1, a2};
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform one filtering step
|
// perform one filtering step
|
||||||
public double filter(double x) {
|
public double filter(double x)
|
||||||
|
{
|
||||||
y = b0 * x + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
|
y = b0 * x + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2;
|
||||||
x2 = x1;
|
x2 = x1;
|
||||||
x1 = x;
|
x1 = x;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
|
|
||||||
private Color mHighlightColor = Color.YELLOW;
|
private Color mHighlightColor = Color.YELLOW;
|
||||||
|
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
|
|
||||||
private Cursor mBlankCursor;
|
private Cursor mBlankCursor;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JFrequencyControl( int value )
|
public JFrequencyControl( long value )
|
||||||
{
|
{
|
||||||
this();
|
this();
|
||||||
mFrequency = value;
|
mFrequency = value;
|
||||||
@@ -127,7 +127,7 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
* rebroadcast this event, just set the control to indicate the new frequency.
|
* rebroadcast this event, just set the control to indicate the new frequency.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
setFrequency( frequency, false );
|
setFrequency( frequency, false );
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
* Loads the frequency into the display and optionally fires a change event
|
* Loads the frequency into the display and optionally fires a change event
|
||||||
* to all registered listeners
|
* to all registered listeners
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency, boolean fireChangeEvent )
|
public void setFrequency( long frequency, boolean fireChangeEvent )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
|
|
||||||
@@ -146,14 +146,14 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFrequency()
|
private void updateFrequency()
|
||||||
{
|
{
|
||||||
int frequency = 0;
|
long frequency = 0;
|
||||||
|
|
||||||
for( Digit digit: mDigits.values() )
|
for( Digit digit: mDigits.values() )
|
||||||
{
|
{
|
||||||
@@ -209,10 +209,10 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
* to the power (ie column) set for this digit. Optionally, fires a
|
* to the power (ie column) set for this digit. Optionally, fires a
|
||||||
* value change event to all listeners.
|
* value change event to all listeners.
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency, boolean fireChangeEvent )
|
public void setFrequency( long frequency, boolean fireChangeEvent )
|
||||||
{
|
{
|
||||||
//Strip the digits higher than this one
|
//Strip the digits higher than this one
|
||||||
int lower = frequency % (int)( Math.pow( 10, mPower + 1) );
|
long lower = frequency % (int)( Math.pow( 10, mPower + 1) );
|
||||||
|
|
||||||
//Set the value to int value of dividing by 10 to this power
|
//Set the value to int value of dividing by 10 to this power
|
||||||
int value = (int)( lower / (int)( Math.pow( 10, mPower ) ) );
|
int value = (int)( lower / (int)( Math.pow( 10, mPower ) ) );
|
||||||
@@ -220,7 +220,7 @@ public class JFrequencyControl extends JPanel implements FrequencyChangeListener
|
|||||||
set( value, fireChangeEvent );
|
set( value, fireChangeEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mValue * (int)Math.pow( 10, mPower );
|
return mValue * (int)Math.pow( 10, mPower );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,33 +38,6 @@ public class ComplexSample implements Serializable
|
|||||||
mRight = right;
|
mRight = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
Log.info( "Starting ... " );
|
|
||||||
|
|
||||||
int frequency = 15000;
|
|
||||||
int sampleRate = 2000000;
|
|
||||||
|
|
||||||
float anglePerSample = (float)( 2.0d * Math.PI * (float)frequency / (float)sampleRate );
|
|
||||||
|
|
||||||
ComplexSample current = new ComplexSample( 0.0f, -1.0f );
|
|
||||||
|
|
||||||
ComplexSample stepPerSample = ComplexSample.fromAngle( anglePerSample );
|
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for( int x = 0; x < sampleRate; x++ )
|
|
||||||
{
|
|
||||||
// Log.info( x + " " + current.toString() );
|
|
||||||
current.multiply( stepPerSample );
|
|
||||||
current.fastNormalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.info( "Elapsed: " + ( System.currentTimeMillis() - start ) );
|
|
||||||
|
|
||||||
Log.info( "Finished!" );
|
|
||||||
}
|
|
||||||
|
|
||||||
public ComplexSample copy()
|
public ComplexSample copy()
|
||||||
{
|
{
|
||||||
return new ComplexSample( mLeft, mRight );
|
return new ComplexSample( mLeft, mRight );
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class ComplexSampleRateCounter implements Listener<ComplexSample>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mExpectedSampleRate = bandwidth;
|
mExpectedSampleRate = bandwidth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public abstract class Source
|
|||||||
|
|
||||||
public abstract int getSampleRate() throws SourceException;
|
public abstract int getSampleRate() throws SourceException;
|
||||||
|
|
||||||
public abstract int getFrequency() throws SourceException;
|
public abstract long getFrequency() throws SourceException;
|
||||||
|
|
||||||
public abstract void dispose();
|
public abstract void dispose();
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class SourceConfigTuner extends SourceConfiguration
|
|||||||
{
|
{
|
||||||
private static DecimalFormat sFORMAT = new DecimalFormat( "0.00000" );
|
private static DecimalFormat sFORMAT = new DecimalFormat( "0.00000" );
|
||||||
|
|
||||||
private int mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
|
|
||||||
public SourceConfigTuner()
|
public SourceConfigTuner()
|
||||||
{
|
{
|
||||||
@@ -35,12 +35,12 @@ public class SourceConfigTuner extends SourceConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute( name = "frequency" )
|
@XmlAttribute( name = "frequency" )
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import source.SourceException;
|
|||||||
|
|
||||||
public class MixerSource extends FloatArraySource
|
public class MixerSource extends FloatArraySource
|
||||||
{
|
{
|
||||||
private int mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
private int mBufferSize = 16384;
|
private int mBufferSize = 16384;
|
||||||
|
|
||||||
private BufferReader mBufferReader = new BufferReader();
|
private BufferReader mBufferReader = new BufferReader();
|
||||||
@@ -141,7 +141,7 @@ public class MixerSource extends FloatArraySource
|
|||||||
/**
|
/**
|
||||||
* Returns the frequency of this source. Default is 0.
|
* Returns the frequency of this source. Default is 0.
|
||||||
*/
|
*/
|
||||||
public int getFrequency() throws SourceException
|
public long getFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ public class MixerSource extends FloatArraySource
|
|||||||
* be useful if you are streaming an external audio source in through the
|
* be useful if you are streaming an external audio source in through the
|
||||||
* sound card and you want to specify a frequency for that source
|
* sound card and you want to specify a frequency for that source
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 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 source.tuner;
|
|
||||||
|
|
||||||
import sample.Broadcaster;
|
|
||||||
import sample.Listener;
|
|
||||||
import sample.complex.ComplexSample;
|
|
||||||
import dsp.filter.ComplexFilter;
|
|
||||||
import dsp.filter.FilterFactory;
|
|
||||||
import dsp.filter.Window.WindowType;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public class DigitalDropChannel implements Listener<ComplexSample>,
|
|
||||||
FrequencyChangeListener
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Implements a frequency translating, decimating FIR filter channelizer.
|
|
||||||
*
|
|
||||||
* Uses multiple cascaded half-band low pass filters that each decimate by
|
|
||||||
* two, to achieve an overall power-of-two decimation factor.
|
|
||||||
*
|
|
||||||
* @param decimation - power of 2 decimation factor
|
|
||||||
*
|
|
||||||
* @param frequencyShift +/- frequency shift in hertz
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static int sCHANNEL_RATE = 48000;
|
|
||||||
private static int sCHANNEL_PASS_FREQUENCY = 12500;
|
|
||||||
|
|
||||||
private NumericallyControlledOscillator mFrequencyTranslator;
|
|
||||||
|
|
||||||
private ComplexFilter[] mFilters;
|
|
||||||
|
|
||||||
private Broadcaster<ComplexSample> mComplexSampleBroadcaster =
|
|
||||||
new Broadcaster<ComplexSample>();
|
|
||||||
|
|
||||||
private int mSampleRate;
|
|
||||||
private int mFrequencyShift;
|
|
||||||
|
|
||||||
public DigitalDropChannel( int sampleRate, int frequencyShift )
|
|
||||||
{
|
|
||||||
if( sampleRate % sCHANNEL_RATE != 0 )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "Sample rate must be an "
|
|
||||||
+ "integer multiple of 48000" );
|
|
||||||
}
|
|
||||||
|
|
||||||
mFrequencyShift = frequencyShift;
|
|
||||||
|
|
||||||
setSampleRate( sampleRate );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSampleRate( int sampleRate )
|
|
||||||
{
|
|
||||||
if( sampleRate != mSampleRate )
|
|
||||||
{
|
|
||||||
/* Setup or adjust the frequency translator */
|
|
||||||
if( mFrequencyTranslator == null )
|
|
||||||
{
|
|
||||||
mFrequencyTranslator =
|
|
||||||
new NumericallyControlledOscillator( mFrequencyShift,
|
|
||||||
sampleRate );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFrequencyTranslator.setSampleRate( sampleRate );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get new decimation filters */
|
|
||||||
mFilters = FilterFactory
|
|
||||||
.getDecimationFilters( sampleRate,
|
|
||||||
sCHANNEL_RATE,
|
|
||||||
sCHANNEL_PASS_FREQUENCY,
|
|
||||||
48, //dB attenuation
|
|
||||||
WindowType.HAMMING );
|
|
||||||
|
|
||||||
/* wire the first filter stage to the frequency translator */
|
|
||||||
// mFrequencyTranslator.setListener( mFilters[ 0 ] );
|
|
||||||
|
|
||||||
/* wire the remaining filters together */
|
|
||||||
if( mFilters.length > 1 )
|
|
||||||
{
|
|
||||||
for( int x = 1; x < mFilters.length; x++ )
|
|
||||||
{
|
|
||||||
mFilters[ x - 1 ].setListener( mFilters[ x ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the sample broadcaster as a listener to the final filter */
|
|
||||||
// mFilters[ mFilters.length - 1 ].setListener( mComplexSampleBroadcaster );
|
|
||||||
|
|
||||||
mSampleRate = sampleRate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
|
||||||
{
|
|
||||||
mFrequencyTranslator.setFrequency( frequency );
|
|
||||||
|
|
||||||
if( bandwidth != mSampleRate )
|
|
||||||
{
|
|
||||||
setSampleRate( bandwidth );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFrequencyOffset()
|
|
||||||
{
|
|
||||||
return mFrequencyTranslator.getFrequency();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addListener( Listener<ComplexSample> listener )
|
|
||||||
{
|
|
||||||
mComplexSampleBroadcaster.addListener( listener );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeListener( Listener<ComplexSample> listener )
|
|
||||||
{
|
|
||||||
mComplexSampleBroadcaster.removeListener( listener );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getListenerCount()
|
|
||||||
{
|
|
||||||
return mComplexSampleBroadcaster.getListenerCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeListeners()
|
|
||||||
{
|
|
||||||
mComplexSampleBroadcaster.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( ComplexSample sample )
|
|
||||||
{
|
|
||||||
mFrequencyTranslator.receive( sample );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -34,5 +34,5 @@ public interface FrequencyChangeListener
|
|||||||
* @param frequency - uncorrected frequency in hertz
|
* @param frequency - uncorrected frequency in hertz
|
||||||
* @param bandwidth - bandwidth in hertz
|
* @param bandwidth - bandwidth in hertz
|
||||||
*/
|
*/
|
||||||
public void frequencyChanged( int frequency, int bandwidth );
|
public void frequencyChanged( long frequency, int bandwidth );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ import source.SourceException;
|
|||||||
public class FrequencyController
|
public class FrequencyController
|
||||||
{
|
{
|
||||||
private Tunable mTunable;
|
private Tunable mTunable;
|
||||||
private int mFrequency = 101100000;
|
private long mFrequency = 101100000;
|
||||||
private int mTunedFrequency = 101100000;
|
private long mTunedFrequency = 101100000;
|
||||||
private int mMinimumFrequency;
|
private long mMinimumFrequency;
|
||||||
private int mMaximumFrequency;
|
private long mMaximumFrequency;
|
||||||
private double mFrequencyCorrection = 0d;
|
private double mFrequencyCorrection = 0d;
|
||||||
private int mBandwidth = 0;
|
private int mBandwidth = 0;
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@ public class FrequencyController
|
|||||||
new ArrayList<FrequencyChangeListener>();
|
new ArrayList<FrequencyChangeListener>();
|
||||||
|
|
||||||
public FrequencyController( Tunable tunable,
|
public FrequencyController( Tunable tunable,
|
||||||
int minFrequency,
|
long minFrequency,
|
||||||
int maxFrequency,
|
long maxFrequency,
|
||||||
double frequencyCorrection ) throws SourceException
|
double frequencyCorrection ) throws SourceException
|
||||||
{
|
{
|
||||||
mTunable = tunable;
|
mTunable = tunable;
|
||||||
@@ -66,7 +66,7 @@ public class FrequencyController
|
|||||||
/**
|
/**
|
||||||
* Get frequency in hertz
|
* Get frequency in hertz
|
||||||
*/
|
*/
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ public class FrequencyController
|
|||||||
* @throws SourceException if tunable doesn't support tuning a corrected
|
* @throws SourceException if tunable doesn't support tuning a corrected
|
||||||
* version of the requested frequency
|
* version of the requested frequency
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency ) throws SourceException
|
public void setFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
setFrequency( frequency, true );
|
setFrequency( frequency, true );
|
||||||
}
|
}
|
||||||
@@ -87,10 +87,10 @@ public class FrequencyController
|
|||||||
* method supports changing the frequency correction value without
|
* method supports changing the frequency correction value without
|
||||||
* broadcasting a frequency change event.
|
* broadcasting a frequency change event.
|
||||||
*/
|
*/
|
||||||
private void setFrequency( int frequency, boolean broadcastChange )
|
private void setFrequency( long frequency, boolean broadcastChange )
|
||||||
throws SourceException
|
throws SourceException
|
||||||
{
|
{
|
||||||
int tunedFrequency = getTunedFrequency( frequency );
|
long tunedFrequency = getTunedFrequency( frequency );
|
||||||
|
|
||||||
if( tunedFrequency < mMinimumFrequency ||
|
if( tunedFrequency < mMinimumFrequency ||
|
||||||
tunedFrequency > mMaximumFrequency )
|
tunedFrequency > mMaximumFrequency )
|
||||||
@@ -114,17 +114,17 @@ public class FrequencyController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTunedFrequency()
|
public long getTunedFrequency()
|
||||||
{
|
{
|
||||||
return mTunedFrequency;
|
return mTunedFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumFrequency()
|
public long getMinimumFrequency()
|
||||||
{
|
{
|
||||||
return mMinimumFrequency;
|
return mMinimumFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaximumFrequency()
|
public long getMaximumFrequency()
|
||||||
{
|
{
|
||||||
return mMaximumFrequency;
|
return mMaximumFrequency;
|
||||||
}
|
}
|
||||||
@@ -134,9 +134,9 @@ public class FrequencyController
|
|||||||
* corrected frequency.
|
* corrected frequency.
|
||||||
* @param correctedFrequency
|
* @param correctedFrequency
|
||||||
*/
|
*/
|
||||||
private int getTunedFrequency( int correctedFrequency )
|
private long getTunedFrequency( long correctedFrequency )
|
||||||
{
|
{
|
||||||
return (int)( (double)correctedFrequency /
|
return (long)( (double)correctedFrequency /
|
||||||
( 1.0 + ( mFrequencyCorrection / 1000000.0 ) ) );
|
( 1.0 + ( mFrequencyCorrection / 1000000.0 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ public class FrequencyController
|
|||||||
* from the tuned frequency.
|
* from the tuned frequency.
|
||||||
* @param tunedFrequency
|
* @param tunedFrequency
|
||||||
*/
|
*/
|
||||||
private int getCorrectedFrequency( int tunedFrequency )
|
private long getCorrectedFrequency( long tunedFrequency )
|
||||||
{
|
{
|
||||||
return (int)( (double)tunedFrequency /
|
return (int)( (double)tunedFrequency /
|
||||||
( 1.0 - ( mFrequencyCorrection / 1000000.0 ) ) );
|
( 1.0 - ( mFrequencyCorrection / 1000000.0 ) ) );
|
||||||
@@ -205,12 +205,12 @@ public class FrequencyController
|
|||||||
/**
|
/**
|
||||||
* Gets the tuned frequency of the device
|
* Gets the tuned frequency of the device
|
||||||
*/
|
*/
|
||||||
public int getTunedFrequency() throws SourceException;
|
public long getTunedFrequency() throws SourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tuned frequency of the device
|
* Sets the tuned frequency of the device
|
||||||
*/
|
*/
|
||||||
public void setTunedFrequency( int frequency ) throws SourceException;
|
public void setTunedFrequency( long frequency ) throws SourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current bandwidth setting of the device
|
* Gets the current bandwidth setting of the device
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import util.Oscillator;
|
|||||||
public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
||||||
FrequencyChangeListener
|
FrequencyChangeListener
|
||||||
{
|
{
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private int mSampleRate;
|
private int mSampleRate;
|
||||||
private Oscillator mSineWaveGenerator;
|
private Oscillator mSineWaveGenerator;
|
||||||
private Listener<ComplexSample> mListener;
|
private Listener<ComplexSample> mListener;
|
||||||
@@ -39,7 +39,7 @@ public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
|||||||
* shifted outside of the sampling bandwidth will wrap around, due to the
|
* shifted outside of the sampling bandwidth will wrap around, due to the
|
||||||
* nature of quadrature sampling.
|
* nature of quadrature sampling.
|
||||||
*/
|
*/
|
||||||
public NumericallyControlledOscillator( int frequencyShift, int sampleRate )
|
public NumericallyControlledOscillator( long frequencyShift, int sampleRate )
|
||||||
{
|
{
|
||||||
mFrequency = frequencyShift;
|
mFrequency = frequencyShift;
|
||||||
mSampleRate = sampleRate;
|
mSampleRate = sampleRate;
|
||||||
@@ -66,7 +66,7 @@ public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
if( frequency != mFrequency )
|
if( frequency != mFrequency )
|
||||||
{
|
{
|
||||||
@@ -84,7 +84,7 @@ public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
|||||||
* all subsequent samples will be output at the new translated frequency
|
* all subsequent samples will be output at the new translated frequency
|
||||||
* @param frequency - hertz
|
* @param frequency - hertz
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
Log.info( "NumericallyControlledOscillator - setting sine wave gen to freq:" + frequency );
|
Log.info( "NumericallyControlledOscillator - setting sine wave gen to freq:" + frequency );
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class NumericallyControlledOscillator implements Listener<ComplexSample>,
|
|||||||
* Current frequency shift setting
|
* Current frequency shift setting
|
||||||
* @return - frequency - hertz
|
* @return - frequency - hertz
|
||||||
*/
|
*/
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public abstract class Tuner implements FrequencyChangeBroadcaster,
|
|||||||
* Tuner Local Oscillator Frequency
|
* Tuner Local Oscillator Frequency
|
||||||
* @return - frequency in Hertz
|
* @return - frequency in Hertz
|
||||||
*/
|
*/
|
||||||
public abstract int getFrequency() throws SourceException;
|
public abstract long getFrequency() throws SourceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a tuner frequency channel source, tuned to the correct frequency
|
* Returns a tuner frequency channel source, tuned to the correct frequency
|
||||||
@@ -171,7 +171,7 @@ public abstract class Tuner implements FrequencyChangeBroadcaster,
|
|||||||
/**
|
/**
|
||||||
* Broadcasts a frequency change event to all registered listeners
|
* Broadcasts a frequency change event to all registered listeners
|
||||||
*/
|
*/
|
||||||
public void broadcastFrequencyChange( int frequency, int bandwidth )
|
public void broadcastFrequencyChange( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
for( FrequencyChangeListener listener: mFrequencyChangeListeners )
|
for( FrequencyChangeListener listener: mFrequencyChangeListeners )
|
||||||
{
|
{
|
||||||
@@ -183,7 +183,7 @@ public abstract class Tuner implements FrequencyChangeBroadcaster,
|
|||||||
* Frequency change listener method. We receive change events from the
|
* Frequency change listener method. We receive change events from the
|
||||||
* controller and rebroadcast them to all registered listeners.
|
* controller and rebroadcast them to all registered listeners.
|
||||||
*/
|
*/
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
broadcastFrequencyChange( frequency, bandwidth );
|
broadcastFrequencyChange( frequency, bandwidth );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ package source.tuner;
|
|||||||
public class TunerChannel implements Comparable<TunerChannel>
|
public class TunerChannel implements Comparable<TunerChannel>
|
||||||
{
|
{
|
||||||
private Type mType;
|
private Type mType;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private int mBandwidth;
|
private int mBandwidth;
|
||||||
|
|
||||||
public TunerChannel( Type type, int frequency, int bandwidth )
|
public TunerChannel( Type type, long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mType = type;
|
mType = type;
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
@@ -40,12 +40,12 @@ public class TunerChannel implements Comparable<TunerChannel>
|
|||||||
mType = type;
|
mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
}
|
}
|
||||||
@@ -60,12 +60,12 @@ public class TunerChannel implements Comparable<TunerChannel>
|
|||||||
mBandwidth = bandwidth;
|
mBandwidth = bandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinFrequency()
|
public long getMinFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency - ( mBandwidth / 2 );
|
return mFrequency - ( mBandwidth / 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxFrequency()
|
public long getMaxFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency + ( mBandwidth / 2 );
|
return mFrequency + ( mBandwidth / 2 );
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public class TunerChannel implements Comparable<TunerChannel>
|
|||||||
* Indicates if any part of this tuner channel is contained within the
|
* Indicates if any part of this tuner channel is contained within the
|
||||||
* minimum and maximum frequency values.
|
* minimum and maximum frequency values.
|
||||||
*/
|
*/
|
||||||
public boolean isWithin( int minimum, int maximum )
|
public boolean isWithin( long minimum, long maximum )
|
||||||
{
|
{
|
||||||
return ( ( minimum <= getMinFrequency() && getMinFrequency() <= maximum ) ||
|
return ( ( minimum <= getMinFrequency() && getMinFrequency() <= maximum ) ||
|
||||||
( minimum <= getMaxFrequency() && getMaxFrequency() <= maximum ) );
|
( minimum <= getMaxFrequency() && getMaxFrequency() <= maximum ) );
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
|
|
||||||
private ComplexSampleAssembler mBufferAssembler =
|
private ComplexSampleAssembler mBufferAssembler =
|
||||||
new ComplexSampleAssembler( 3000 );
|
new ComplexSampleAssembler( 3000 );
|
||||||
private int mTunerFrequency;
|
private long mTunerFrequency;
|
||||||
private int mTunerSampleRate;
|
private int mTunerSampleRate;
|
||||||
private ThreadPoolManager mThreadPoolManager;
|
private ThreadPoolManager mThreadPoolManager;
|
||||||
private ScheduledFuture<?> mTaskHandle;
|
private ScheduledFuture<?> mTaskHandle;
|
||||||
@@ -153,13 +153,13 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Frequency change */
|
/* Frequency change */
|
||||||
if( frequency != mTunerFrequency )
|
if( frequency != mTunerFrequency )
|
||||||
{
|
{
|
||||||
int frequencyOffset = frequency - mTunerChannel.getFrequency();
|
long frequencyOffset = frequency - mTunerChannel.getFrequency();
|
||||||
|
|
||||||
if( mSineWaveGenerator == null )
|
if( mSineWaveGenerator == null )
|
||||||
{
|
{
|
||||||
@@ -180,7 +180,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
/* Bandwidth/Sample rate change */
|
/* Bandwidth/Sample rate change */
|
||||||
if( bandwidth != mTunerSampleRate )
|
if( bandwidth != mTunerSampleRate )
|
||||||
{
|
{
|
||||||
int frequencyOffset = frequency - mTunerChannel.getFrequency();
|
long frequencyOffset = frequency - mTunerChannel.getFrequency();
|
||||||
|
|
||||||
if( mSineWaveGenerator == null )
|
if( mSineWaveGenerator == null )
|
||||||
{
|
{
|
||||||
@@ -225,7 +225,7 @@ public class TunerChannelSource extends ComplexSource
|
|||||||
return mTuner.getSampleRate();
|
return mTuner.getSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency() throws SourceException
|
public long getFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return mTuner.getFrequency();
|
return mTuner.getFrequency();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class TunerController implements Tunable
|
|||||||
* @throws SourceException - for any issues related to constructing the
|
* @throws SourceException - for any issues related to constructing the
|
||||||
* class, tuning a frequency, or setting the bandwidth
|
* class, tuning a frequency, or setting the bandwidth
|
||||||
*/
|
*/
|
||||||
public TunerController( int minimumFrequency, int maximumFrequency )
|
public TunerController( long minimumFrequency, long maximumFrequency )
|
||||||
throws SourceException
|
throws SourceException
|
||||||
{
|
{
|
||||||
mFrequencyController = new FrequencyController( this,
|
mFrequencyController = new FrequencyController( this,
|
||||||
@@ -71,7 +71,7 @@ public abstract class TunerController implements Tunable
|
|||||||
* @param frequency in hertz
|
* @param frequency in hertz
|
||||||
* @throws SourceException - if the tuner has any issues
|
* @throws SourceException - if the tuner has any issues
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency ) throws SourceException
|
public void setFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
mFrequencyController.setFrequency( frequency );
|
mFrequencyController.setFrequency( frequency );
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public abstract class TunerController implements Tunable
|
|||||||
*
|
*
|
||||||
* @return frequency in hertz
|
* @return frequency in hertz
|
||||||
*/
|
*/
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequencyController.getFrequency();
|
return mFrequencyController.getFrequency();
|
||||||
}
|
}
|
||||||
@@ -96,12 +96,12 @@ public abstract class TunerController implements Tunable
|
|||||||
mFrequencyController.setFrequencyCorrection( correction );
|
mFrequencyController.setFrequencyCorrection( correction );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinFrequency()
|
public long getMinFrequency()
|
||||||
{
|
{
|
||||||
return mFrequencyController.getMinimumFrequency();
|
return mFrequencyController.getMinimumFrequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxFrequency()
|
public long getMaxFrequency()
|
||||||
{
|
{
|
||||||
return mFrequencyController.getMaximumFrequency();
|
return mFrequencyController.getMaximumFrequency();
|
||||||
}
|
}
|
||||||
@@ -127,8 +127,8 @@ public abstract class TunerController implements Tunable
|
|||||||
//Sort the existing locks and get the min/max locked frequencies
|
//Sort the existing locks and get the min/max locked frequencies
|
||||||
Collections.sort( mTunedChannels );
|
Collections.sort( mTunedChannels );
|
||||||
|
|
||||||
int minLockedFrequency = mTunedChannels.get( 0 ).getMinFrequency();
|
long minLockedFrequency = mTunedChannels.get( 0 ).getMinFrequency();
|
||||||
int maxLockedFrequency = mTunedChannels
|
long maxLockedFrequency = mTunedChannels
|
||||||
.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
||||||
|
|
||||||
//Requested channel is higher than min locked frequency
|
//Requested channel is higher than min locked frequency
|
||||||
@@ -195,14 +195,14 @@ public abstract class TunerController implements Tunable
|
|||||||
{
|
{
|
||||||
Collections.sort( mTunedChannels );
|
Collections.sort( mTunedChannels );
|
||||||
|
|
||||||
int minLockedFrequency = mTunedChannels.get( 0 ).getMinFrequency();
|
long minLockedFrequency = mTunedChannels.get( 0 ).getMinFrequency();
|
||||||
int maxLockedFrequency = mTunedChannels
|
long maxLockedFrequency = mTunedChannels
|
||||||
.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
.get( mTunedChannels.size() - 1 ).getMaxFrequency();
|
||||||
|
|
||||||
int middle = minLockedFrequency +
|
long middle = minLockedFrequency +
|
||||||
( ( maxLockedFrequency - minLockedFrequency ) / 2 );
|
( ( maxLockedFrequency - minLockedFrequency ) / 2 );
|
||||||
int middleMin = middle - 10000;
|
long middleMin = middle - 10000;
|
||||||
int middleMax = middle + 10000;
|
long middleMax = middle + 10000;
|
||||||
|
|
||||||
Iterator<TunerChannel> it = mTunedChannels.iterator();
|
Iterator<TunerChannel> it = mTunedChannels.iterator();
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class TunerNode extends BaseNode implements FrequencyChangeListener
|
|||||||
private static DecimalFormat FREQUENCY_FORMAT = new DecimalFormat( "0.00000" );
|
private static DecimalFormat FREQUENCY_FORMAT = new DecimalFormat( "0.00000" );
|
||||||
private static DecimalFormat SAMPLE_RATE_FORMAT = new DecimalFormat( "0.000" );
|
private static DecimalFormat SAMPLE_RATE_FORMAT = new DecimalFormat( "0.000" );
|
||||||
|
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private int mBandwidth;
|
private int mBandwidth;
|
||||||
|
|
||||||
public TunerNode( Tuner tuner )
|
public TunerNode( Tuner tuner )
|
||||||
@@ -117,7 +117,7 @@ public class TunerNode extends BaseNode implements FrequencyChangeListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
mBandwidth = bandwidth;
|
mBandwidth = bandwidth;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class B100Tuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency() throws SourceException
|
public long getFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class FCDTuner extends MixerTuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency() throws SourceException
|
public long getFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return mController.getFrequency();
|
return mController.getFrequency();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public abstract class FCDTunerController extends TunerController
|
|||||||
private UsbPipe mPipeIn;
|
private UsbPipe mPipeIn;
|
||||||
private UsbPipe mPipeOut;
|
private UsbPipe mPipeOut;
|
||||||
private FCDConfiguration mConfiguration = new FCDConfiguration();
|
private FCDConfiguration mConfiguration = new FCDConfiguration();
|
||||||
private int mSampleRate;
|
|
||||||
|
|
||||||
public FCDTunerController( USBTunerDevice device,
|
public FCDTunerController( USBTunerDevice device,
|
||||||
int minTunableFrequency,
|
int minTunableFrequency,
|
||||||
@@ -147,7 +146,7 @@ public abstract class FCDTunerController extends TunerController
|
|||||||
/**
|
/**
|
||||||
* Sets the actual (uncorrected) device frequency
|
* Sets the actual (uncorrected) device frequency
|
||||||
*/
|
*/
|
||||||
public void setTunedFrequency( int frequency ) throws SourceException
|
public void setTunedFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -163,11 +162,11 @@ public abstract class FCDTunerController extends TunerController
|
|||||||
/**
|
/**
|
||||||
* Gets the actual (uncorrected) device frequency
|
* Gets the actual (uncorrected) device frequency
|
||||||
*/
|
*/
|
||||||
public int getTunedFrequency() throws SourceException
|
public long getTunedFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (int)send( FCDCommand.APP_GET_FREQUENCY_HZ );
|
return send( FCDCommand.APP_GET_FREQUENCY_HZ );
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class FCD1TunerEditorPanel extends JPanel implements FrequencyChangeListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
//Disregard the bandwidth value, which shouldn't be changing
|
//Disregard the bandwidth value, which shouldn't be changing
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class FCD2TunerEditorPanel extends JPanel implements FrequencyChangeListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
//Disregard the bandwidth, which shouldn't be changing
|
//Disregard the bandwidth, which shouldn't be changing
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class RTL2832Tuner extends Tuner
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFrequency() throws SourceException
|
public long getFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return mController.getFrequency();
|
return mController.getFrequency();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ public abstract class RTL2832TunerController extends TunerController
|
|||||||
* tuner controller class for that tuner type.
|
* tuner controller class for that tuner type.
|
||||||
*/
|
*/
|
||||||
public RTL2832TunerController( USBTunerDevice tunerDevice,
|
public RTL2832TunerController( USBTunerDevice tunerDevice,
|
||||||
int minTunableFrequency,
|
long minTunableFrequency,
|
||||||
int maxTunableFrequency ) throws SourceException
|
long maxTunableFrequency ) throws SourceException
|
||||||
{
|
{
|
||||||
super( minTunableFrequency, maxTunableFrequency );
|
super( minTunableFrequency, maxTunableFrequency );
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
*
|
*
|
||||||
* TODO: change frequency to a long primitive type
|
* TODO: change frequency to a long primitive type
|
||||||
*/
|
*/
|
||||||
public static final int sMIN_FREQUENCY = 52000000;
|
public static final long sMIN_FREQUENCY = 52000000;
|
||||||
public static final int sMIN_FREQUENCY_EXTENDED = 52000000;
|
public static final long sMIN_FREQUENCY_EXTENDED = 52000000;
|
||||||
public static final int sMAX_FREQUENCY = 2147000000;
|
public static final long sMAX_FREQUENCY = 2200000000l;
|
||||||
public static final int sMAX_FREQUENCY_EXTENDED = 2147000000;
|
public static final long sMAX_FREQUENCY_EXTENDED = 2200000000l;
|
||||||
public static final long sMIN_VCO = 2600000000l; //2.6 GHz
|
public static final long sMIN_VCO = 2600000000l; //2.6 GHz
|
||||||
public static final long sMAX_VCO = 3900000000l; //3.9 GHz
|
public static final long sMAX_VCO = 3900000000l; //3.9 GHz
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTunedFrequency() throws SourceException
|
public long getTunedFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -276,7 +276,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTunedFrequency( int frequency ) throws SourceException
|
public void setTunedFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
/* Get the phase locked loop setting */
|
/* Get the phase locked loop setting */
|
||||||
PLL pll = PLL.fromFrequency( frequency );
|
PLL pll = PLL.fromFrequency( frequency );
|
||||||
@@ -288,13 +288,13 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
/* remainder is just as it describes. It is what is left over after we
|
/* remainder is just as it describes. It is what is left over after we
|
||||||
* carve out scaled oscillator frequency increments (z) from the desired
|
* carve out scaled oscillator frequency increments (z) from the desired
|
||||||
* frequency. */
|
* frequency. */
|
||||||
int remainder = frequency - ( ( z & 0xFF ) * pll.getScaledOscillator() );
|
int remainder = (int)( frequency - ( ( z & 0xFF ) * pll.getScaledOscillator() ) );
|
||||||
|
|
||||||
/* X is a 16-bit representation of the remainder */
|
/* X is a 16-bit representation of the remainder */
|
||||||
int x = (int)( (double)remainder / (double)pll.getScaledOscillator() * sE4K_PLL_Y );
|
int x = (int)( (double)remainder / (double)pll.getScaledOscillator() * sE4K_PLL_Y );
|
||||||
|
|
||||||
/* Calculate the exact (tunable) frequency and apply that to the tuner */
|
/* Calculate the exact (tunable) frequency and apply that to the tuner */
|
||||||
int actualFrequency = calculateActualFrequency( pll, z, x );
|
long actualFrequency = calculateActualFrequency( pll, z, x );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hack: if we're trying to set the minimum frequency for the E4K, due
|
* Hack: if we're trying to set the minimum frequency for the E4K, due
|
||||||
@@ -353,9 +353,9 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateActualFrequency( PLL pll, byte z, int x )
|
private long calculateActualFrequency( PLL pll, byte z, int x )
|
||||||
{
|
{
|
||||||
int whole = (int)( pll.getScaledOscillator() * ( z & 0xFF ) );
|
long whole = pll.getScaledOscillator() * ( z & 0xFF );
|
||||||
|
|
||||||
int fractional = (int)( pll.getScaledOscillator() *
|
int fractional = (int)( pll.getScaledOscillator() *
|
||||||
( (double)x / (double)sE4K_PLL_Y ) );
|
( (double)x / (double)sE4K_PLL_Y ) );
|
||||||
@@ -880,7 +880,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBand( int frequency,
|
public void setBand( long frequency,
|
||||||
boolean controlI2CRepeater ) throws UsbException
|
boolean controlI2CRepeater ) throws UsbException
|
||||||
{
|
{
|
||||||
if( controlI2CRepeater )
|
if( controlI2CRepeater )
|
||||||
@@ -918,7 +918,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRFFilter( int frequency,
|
private void setRFFilter( long frequency,
|
||||||
boolean controlI2CRepeater ) throws UsbException
|
boolean controlI2CRepeater ) throws UsbException
|
||||||
{
|
{
|
||||||
RFFilter filter = RFFilter.fromFrequency( frequency );
|
RFFilter filter = RFFilter.fromFrequency( frequency );
|
||||||
@@ -1057,7 +1057,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
return toString();
|
return toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Band fromFrequency( int frequency )
|
public static Band fromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
if( frequency < 140000000 ) //140 MHz
|
if( frequency < 140000000 ) //140 MHz
|
||||||
{
|
{
|
||||||
@@ -1092,14 +1092,14 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
PLL_1200M0( 0x01, 1200000000, 4, 7200000, false, "1200.0 MHz" );
|
PLL_1200M0( 0x01, 1200000000, 4, 7200000, false, "1200.0 MHz" );
|
||||||
|
|
||||||
private int mValue;
|
private int mValue;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private int mMultiplier;
|
private int mMultiplier;
|
||||||
private int mScaledOscillator;
|
private int mScaledOscillator;
|
||||||
private boolean mRequires3PhaseMixing;
|
private boolean mRequires3PhaseMixing;
|
||||||
private String mLabel;
|
private String mLabel;
|
||||||
|
|
||||||
private PLL( int value,
|
private PLL( int value,
|
||||||
int frequency,
|
long frequency,
|
||||||
int multiplier,
|
int multiplier,
|
||||||
int scaledOscillator,
|
int scaledOscillator,
|
||||||
boolean requires3Phase,
|
boolean requires3Phase,
|
||||||
@@ -1119,7 +1119,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
return (byte)mValue;
|
return (byte)mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -1151,7 +1151,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
|
|
||||||
/* Returns the PLL setting with the closest frequency that is greater
|
/* Returns the PLL setting with the closest frequency that is greater
|
||||||
* than the frequency argument */
|
* than the frequency argument */
|
||||||
public static PLL fromFrequency( int frequency )
|
public static PLL fromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
for( PLL pll: values() )
|
for( PLL pll: values() )
|
||||||
{
|
{
|
||||||
@@ -1235,10 +1235,10 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
M1750( 15, 1735000000, 2147000000 );
|
M1750( 15, 1735000000, 2147000000 );
|
||||||
|
|
||||||
private int mValue;
|
private int mValue;
|
||||||
private int mMinFrequency;
|
private long mMinFrequency;
|
||||||
private int mMaxFrequency;
|
private long mMaxFrequency;
|
||||||
|
|
||||||
private RFFilter( int value, int minFrequency, int maxFrequency )
|
private RFFilter( int value, long minFrequency, long maxFrequency )
|
||||||
{
|
{
|
||||||
mValue = value;
|
mValue = value;
|
||||||
mMinFrequency = minFrequency;
|
mMinFrequency = minFrequency;
|
||||||
@@ -1263,7 +1263,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
/**
|
/**
|
||||||
* Minimum frequency for this filter.
|
* Minimum frequency for this filter.
|
||||||
*/
|
*/
|
||||||
public int getMinimumFrequency()
|
public long getMinimumFrequency()
|
||||||
{
|
{
|
||||||
return mMinFrequency;
|
return mMinFrequency;
|
||||||
}
|
}
|
||||||
@@ -1272,7 +1272,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
* Maximum frequency for this filter is less than this value, but does
|
* Maximum frequency for this filter is less than this value, but does
|
||||||
* not include this value.
|
* not include this value.
|
||||||
*/
|
*/
|
||||||
public int getMaximumFrequency()
|
public long getMaximumFrequency()
|
||||||
{
|
{
|
||||||
return mMaxFrequency;
|
return mMaxFrequency;
|
||||||
}
|
}
|
||||||
@@ -1285,7 +1285,7 @@ public class E4KTunerController extends RTL2832TunerController
|
|||||||
* @throws IllegalArgumentException if the frequency is outside the
|
* @throws IllegalArgumentException if the frequency is outside the
|
||||||
* max value (2200 MHz)
|
* max value (2200 MHz)
|
||||||
*/
|
*/
|
||||||
public static RFFilter fromFrequency( int frequency )
|
public static RFFilter fromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
if( frequency < 350000000 )
|
if( frequency < 350000000 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,18 +22,17 @@ import gui.control.JFrequencyControl;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import com.jidesoft.swing.JideTabbedPane;
|
|
||||||
|
|
||||||
import log.Log;
|
import log.Log;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import source.SourceComponentEditor;
|
|
||||||
import source.SourceException;
|
import source.SourceException;
|
||||||
import source.tuner.FrequencyChangeListener;
|
import source.tuner.FrequencyChangeListener;
|
||||||
import source.tuner.rtl.RTL2832InfoPanel;
|
import source.tuner.rtl.RTL2832InfoPanel;
|
||||||
|
|
||||||
|
import com.jidesoft.swing.JideTabbedPane;
|
||||||
|
|
||||||
import controller.ResourceManager;
|
import controller.ResourceManager;
|
||||||
|
|
||||||
public class E4KTunerEditorPanel extends JPanel implements FrequencyChangeListener
|
public class E4KTunerEditorPanel extends JPanel implements FrequencyChangeListener
|
||||||
@@ -89,7 +88,7 @@ public class E4KTunerEditorPanel extends JPanel implements FrequencyChangeListen
|
|||||||
* apply end-user requested frequency changes against the tuner
|
* apply end-user requested frequency changes against the tuner
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( final int frequency, int bandwidth )
|
public void frequencyChanged( final long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
EventQueue.invokeLater( new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ import controller.ResourceManager;
|
|||||||
|
|
||||||
public class R820TTunerController extends RTL2832TunerController
|
public class R820TTunerController extends RTL2832TunerController
|
||||||
{
|
{
|
||||||
public static final int MIN_FREQUENCY = 24000000;
|
public static final long MIN_FREQUENCY = 24000000;
|
||||||
public static final int MAX_FREQUENCY = 1766000000;
|
public static final long MAX_FREQUENCY = 1766000000;
|
||||||
public static final int R820T_IF_FREQUENCY = 3570000;
|
public static final int R820T_IF_FREQUENCY = 3570000;
|
||||||
public static final byte VERSION = (byte)49;
|
public static final byte VERSION = (byte)49;
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
* Not implemented.
|
* Not implemented.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTunedFrequency() throws SourceException
|
public long getTunedFrequency() throws SourceException
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
* of setting the multiplexer and then setting the Oscillator (PLL).
|
* of setting the multiplexer and then setting the Oscillator (PLL).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setTunedFrequency( int frequency ) throws SourceException
|
public void setTunedFrequency( long frequency ) throws SourceException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -154,7 +154,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
|
|
||||||
boolean controlI2C = false;
|
boolean controlI2C = false;
|
||||||
|
|
||||||
int offsetFrequency = frequency + R820T_IF_FREQUENCY;
|
long offsetFrequency = frequency + R820T_IF_FREQUENCY;
|
||||||
|
|
||||||
setMux( offsetFrequency, controlI2C );
|
setMux( offsetFrequency, controlI2C );
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
/**
|
/**
|
||||||
* Sets the multiplexer for the desired center frequency.
|
* Sets the multiplexer for the desired center frequency.
|
||||||
*/
|
*/
|
||||||
private void setMux( int frequency, boolean controlI2C ) throws UsbException
|
private void setMux( long frequency, boolean controlI2C ) throws UsbException
|
||||||
{
|
{
|
||||||
FrequencyRange range = FrequencyRange.getRangeForFrequency( frequency );
|
FrequencyRange range = FrequencyRange.getRangeForFrequency( frequency );
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
/**
|
/**
|
||||||
* Sets the system IF frequency
|
* Sets the system IF frequency
|
||||||
*/
|
*/
|
||||||
private void systemFrequencySelect( int frequency, boolean controlI2C )
|
private void systemFrequencySelect( long frequency, boolean controlI2C )
|
||||||
throws UsbException
|
throws UsbException
|
||||||
{
|
{
|
||||||
/* LNA top? */
|
/* LNA top? */
|
||||||
@@ -472,7 +472,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
* @param controlI2C - control the I2C repeater locally
|
* @param controlI2C - control the I2C repeater locally
|
||||||
* @throws UsbException - if unable to set any of the R820T registers
|
* @throws UsbException - if unable to set any of the R820T registers
|
||||||
*/
|
*/
|
||||||
private void setPLL( int frequency, boolean controlI2C ) throws UsbException
|
private void setPLL( long frequency, boolean controlI2C ) throws UsbException
|
||||||
{
|
{
|
||||||
/* Set reference divider to 0 */
|
/* Set reference divider to 0 */
|
||||||
writeR820TRegister( Register.REFERENCE_DIVIDER_2, (byte)0x00, controlI2C );
|
writeR820TRegister( Register.REFERENCE_DIVIDER_2, (byte)0x00, controlI2C );
|
||||||
@@ -970,16 +970,16 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
RANGE_650( 650000000, 1766000000, 0x00, 0x40, 0x00, 0x00, 0x00 ),
|
RANGE_650( 650000000, 1766000000, 0x00, 0x40, 0x00, 0x00, 0x00 ),
|
||||||
RANGE_UNK( 0, 0, 0, 0, 0, 0, 0 );
|
RANGE_UNK( 0, 0, 0, 0, 0, 0, 0 );
|
||||||
|
|
||||||
private int mMinFrequency;
|
private long mMinFrequency;
|
||||||
private int mMaxFrequency;
|
private long mMaxFrequency;
|
||||||
private int mOpenDrain;
|
private int mOpenDrain;
|
||||||
private int mRFMux_PolyMux;
|
private int mRFMux_PolyMux;
|
||||||
private int mTF_c;
|
private int mTF_c;
|
||||||
private int mXtalCap20p;
|
private int mXtalCap20p;
|
||||||
private int mXtalCap10p;
|
private int mXtalCap10p;
|
||||||
|
|
||||||
private FrequencyRange( int minFrequency,
|
private FrequencyRange( long minFrequency,
|
||||||
int maxFrequency,
|
long maxFrequency,
|
||||||
int openDrain,
|
int openDrain,
|
||||||
int rfMuxPloy,
|
int rfMuxPloy,
|
||||||
int tf_c,
|
int tf_c,
|
||||||
@@ -995,12 +995,12 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
mXtalCap10p = xtalCap10p;
|
mXtalCap10p = xtalCap10p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains( int frequency )
|
public boolean contains( long frequency )
|
||||||
{
|
{
|
||||||
return mMinFrequency <= frequency && frequency <= mMaxFrequency;
|
return mMinFrequency <= frequency && frequency <= mMaxFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FrequencyRange getRangeForFrequency( int frequency )
|
public static FrequencyRange getRangeForFrequency( long frequency )
|
||||||
{
|
{
|
||||||
for( FrequencyRange range: values() )
|
for( FrequencyRange range: values() )
|
||||||
{
|
{
|
||||||
@@ -1013,12 +1013,12 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
return RANGE_UNK;
|
return RANGE_UNK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinFrequency()
|
public long getMinFrequency()
|
||||||
{
|
{
|
||||||
return mMinFrequency;
|
return mMinFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxFrequency()
|
public long getMaxFrequency()
|
||||||
{
|
{
|
||||||
return mMaxFrequency;
|
return mMaxFrequency;
|
||||||
}
|
}
|
||||||
@@ -1100,16 +1100,16 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
|
|
||||||
private int mDividerNumber;
|
private int mDividerNumber;
|
||||||
private int mMixerDivider;
|
private int mMixerDivider;
|
||||||
private int mMinimumFrequency;
|
private long mMinimumFrequency;
|
||||||
private int mMaximumFrequency;
|
private long mMaximumFrequency;
|
||||||
private int mRegisterSetting;
|
private int mRegisterSetting;
|
||||||
private int mIntegralValue;
|
private int mIntegralValue;
|
||||||
private static final int mVCOPowerReference = 2;
|
private static final int mVCOPowerReference = 2;
|
||||||
|
|
||||||
private FrequencyDivider( int dividerNumber,
|
private FrequencyDivider( int dividerNumber,
|
||||||
int mixerDivider,
|
int mixerDivider,
|
||||||
int minimumFrequency,
|
long minimumFrequency,
|
||||||
int maximumFrequency,
|
long maximumFrequency,
|
||||||
int registerSetting,
|
int registerSetting,
|
||||||
int integralValue )
|
int integralValue )
|
||||||
{
|
{
|
||||||
@@ -1144,12 +1144,12 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
return mMixerDivider;
|
return mMixerDivider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumFrequency()
|
public long getMinimumFrequency()
|
||||||
{
|
{
|
||||||
return mMinimumFrequency;
|
return mMinimumFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaximumFrequency()
|
public long getMaximumFrequency()
|
||||||
{
|
{
|
||||||
return mMaximumFrequency;
|
return mMaximumFrequency;
|
||||||
}
|
}
|
||||||
@@ -1159,7 +1159,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
return (byte)mRegisterSetting;
|
return (byte)mRegisterSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains( int frequency )
|
public boolean contains( long frequency )
|
||||||
{
|
{
|
||||||
return mMinimumFrequency <= frequency &&
|
return mMinimumFrequency <= frequency &&
|
||||||
frequency <= mMaximumFrequency;
|
frequency <= mMaximumFrequency;
|
||||||
@@ -1172,7 +1172,7 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
* @param frequency - desired frequency
|
* @param frequency - desired frequency
|
||||||
* @return - FrequencyDivider to use for the specified frequency
|
* @return - FrequencyDivider to use for the specified frequency
|
||||||
*/
|
*/
|
||||||
public static FrequencyDivider fromFrequency( int frequency )
|
public static FrequencyDivider fromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
for( FrequencyDivider divider: FrequencyDivider.values() )
|
for( FrequencyDivider divider: FrequencyDivider.values() )
|
||||||
{
|
{
|
||||||
@@ -1188,11 +1188,11 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
/**
|
/**
|
||||||
* Returns the integral to use for this frequency
|
* Returns the integral to use for this frequency
|
||||||
*/
|
*/
|
||||||
public Integral getIntegral( int frequency )
|
public Integral getIntegral( long frequency )
|
||||||
{
|
{
|
||||||
if( contains( frequency ) )
|
if( contains( frequency ) )
|
||||||
{
|
{
|
||||||
int delta = frequency - mMinimumFrequency;
|
int delta = (int)( frequency - mMinimumFrequency );
|
||||||
|
|
||||||
int integral = (int)Math.round( (double)delta /
|
int integral = (int)Math.round( (double)delta /
|
||||||
(double)mIntegralValue );
|
(double)mIntegralValue );
|
||||||
@@ -1212,11 +1212,11 @@ public class R820TTunerController extends RTL2832TunerController
|
|||||||
* by the integral value to derive a 16-bit fractional value, returned
|
* by the integral value to derive a 16-bit fractional value, returned
|
||||||
* as an integer
|
* as an integer
|
||||||
*/
|
*/
|
||||||
public int getSDM( Integral integral, int frequency )
|
public int getSDM( Integral integral, long frequency )
|
||||||
{
|
{
|
||||||
if( contains( frequency ) )
|
if( contains( frequency ) )
|
||||||
{
|
{
|
||||||
int delta = frequency - ( integral.getNumber() * mIntegralValue );
|
int delta = (int)( frequency - ( integral.getNumber() * mIntegralValue ) );
|
||||||
|
|
||||||
double fractional = (double)delta / (double)mIntegralValue;
|
double fractional = (double)delta / (double)mIntegralValue;
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class R820TTunerEditorPanel extends JPanel implements FrequencyChangeList
|
|||||||
* apply end-user requested frequency changes against the tuner
|
* apply end-user requested frequency changes against the tuner
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( final int frequency, int bandwidth )
|
public void frequencyChanged( final long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
EventQueue.invokeLater( new Runnable()
|
EventQueue.invokeLater( new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ComplexWaveSource extends WaveSource
|
|||||||
|
|
||||||
private AudioInputStream mInputStream = null;
|
private AudioInputStream mInputStream = null;
|
||||||
private int mBytesPerFrame = 0;
|
private int mBytesPerFrame = 0;
|
||||||
private int mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
|
|
||||||
private byte[] mBuffer;
|
private byte[] mBuffer;
|
||||||
private int mBufferPointer = 0;
|
private int mBufferPointer = 0;
|
||||||
@@ -86,7 +86,7 @@ public class ComplexWaveSource extends WaveSource
|
|||||||
* Returns the frequency set for this file. Normally returns zero, but
|
* Returns the frequency set for this file. Normally returns zero, but
|
||||||
* the value can be set with setFrequency() method.
|
* the value can be set with setFrequency() method.
|
||||||
*/
|
*/
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ public class ComplexWaveSource extends WaveSource
|
|||||||
/**
|
/**
|
||||||
* Changes the value returned from getFrequency() for this source.
|
* Changes the value returned from getFrequency() for this source.
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class FloatWaveSource extends WaveSource
|
|||||||
|
|
||||||
private AudioInputStream mInputStream = null;
|
private AudioInputStream mInputStream = null;
|
||||||
private int mBytesPerFrame = 0;
|
private int mBytesPerFrame = 0;
|
||||||
private int mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
|
|
||||||
private byte[] mBuffer;
|
private byte[] mBuffer;
|
||||||
private int mBufferPointer = 0;
|
private int mBufferPointer = 0;
|
||||||
@@ -84,7 +84,7 @@ public class FloatWaveSource extends WaveSource
|
|||||||
* Returns the frequency set for this file. Normally returns zero, but
|
* Returns the frequency set for this file. Normally returns zero, but
|
||||||
* the value can be set with setFrequency() method.
|
* the value can be set with setFrequency() method.
|
||||||
*/
|
*/
|
||||||
public int getFrequency()
|
public long getFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency;
|
return mFrequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ public class DFTProcessor implements Listener<Float[]>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mSampleRate = bandwidth;
|
mSampleRate = bandwidth;
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
private static DecimalFormat sFORMAT = new DecimalFormat( "000.000" );
|
private static DecimalFormat sFORMAT = new DecimalFormat( "000.000" );
|
||||||
private static DecimalFormat sCURSOR_FORMAT = new DecimalFormat( "000.00000" );
|
private static DecimalFormat sCURSOR_FORMAT = new DecimalFormat( "000.00000" );
|
||||||
private int mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
private int mBandwidth = 0;
|
private int mBandwidth = 0;
|
||||||
private Point mCursorLocation = new Point( 0, 0 );
|
private Point mCursorLocation = new Point( 0, 0 );
|
||||||
private boolean mCursorVisible = false;
|
private boolean mCursorVisible = false;
|
||||||
@@ -239,13 +239,13 @@ public class OverlayPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
private void drawFrequencies( Graphics2D graphics )
|
private void drawFrequencies( Graphics2D graphics )
|
||||||
{
|
{
|
||||||
int minFrequency = getMinFrequency();
|
long minFrequency = getMinFrequency();
|
||||||
int maxFrequency = getMaxFrequency();
|
long maxFrequency = getMaxFrequency();
|
||||||
|
|
||||||
//TODO: the increment should be changeable according to the overall bandwidth
|
//TODO: the increment should be changeable according to the overall bandwidth
|
||||||
// so that when we move to higher sample rates, the display reacts accordingly
|
// so that when we move to higher sample rates, the display reacts accordingly
|
||||||
|
|
||||||
int frequency;
|
long frequency;
|
||||||
|
|
||||||
if( mBandwidth < 200000 )
|
if( mBandwidth < 200000 )
|
||||||
{
|
{
|
||||||
@@ -280,7 +280,7 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Draws a vertical line and a corresponding frequency label at the bottom
|
* Draws a vertical line and a corresponding frequency label at the bottom
|
||||||
*/
|
*/
|
||||||
private void drawFrequencyLineAndLabel( Graphics2D graphics, int frequency )
|
private void drawFrequencyLineAndLabel( Graphics2D graphics, long frequency )
|
||||||
{
|
{
|
||||||
float xAxis = getAxisFromFrequency( frequency );
|
float xAxis = getAxisFromFrequency( frequency );
|
||||||
|
|
||||||
@@ -305,12 +305,12 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Returns the x-axis value corresponding to the frequency
|
* Returns the x-axis value corresponding to the frequency
|
||||||
*/
|
*/
|
||||||
public float getAxisFromFrequency( int frequency )
|
public float getAxisFromFrequency( long frequency )
|
||||||
{
|
{
|
||||||
float canvasMiddle = (float)getSize().getWidth() / 2;
|
float canvasMiddle = (float)getSize().getWidth() / 2;
|
||||||
|
|
||||||
//Determine frequency offset from middle
|
//Determine frequency offset from middle
|
||||||
int frequencyOffset = mFrequency - frequency;
|
long frequencyOffset = mFrequency - frequency;
|
||||||
|
|
||||||
//Determine ratio of offset to bandwidth
|
//Determine ratio of offset to bandwidth
|
||||||
float ratio = (float)frequencyOffset / (float)mBandwidth;
|
float ratio = (float)frequencyOffset / (float)mBandwidth;
|
||||||
@@ -325,7 +325,7 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Returns the frequency corresponding to the x-axis value
|
* Returns the frequency corresponding to the x-axis value
|
||||||
*/
|
*/
|
||||||
public int getFrequencyFromAxis( double xAxis )
|
public long getFrequencyFromAxis( double xAxis )
|
||||||
{
|
{
|
||||||
float width = (float)getSize().getWidth();
|
float width = (float)getSize().getWidth();
|
||||||
|
|
||||||
@@ -339,7 +339,7 @@ public class OverlayPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
private void drawFrequencyLabel( Graphics2D graphics,
|
private void drawFrequencyLabel( Graphics2D graphics,
|
||||||
float xaxis,
|
float xaxis,
|
||||||
int frequency )
|
long frequency )
|
||||||
{
|
{
|
||||||
String label = sFORMAT.format( (float)frequency / 1000000.0f );
|
String label = sFORMAT.format( (float)frequency / 1000000.0f );
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ public class OverlayPanel extends JPanel
|
|||||||
* Frequency change event handler
|
* Frequency change event handler
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mBandwidth = bandwidth;
|
mBandwidth = bandwidth;
|
||||||
mFrequency = frequency;
|
mFrequency = frequency;
|
||||||
@@ -493,8 +493,8 @@ public class OverlayPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
mVisibleChannels.clear();
|
mVisibleChannels.clear();
|
||||||
|
|
||||||
int minimum = getMinFrequency();
|
long minimum = getMinFrequency();
|
||||||
int maximum = getMaxFrequency();
|
long maximum = getMaxFrequency();
|
||||||
|
|
||||||
for( Channel channel: mChannels )
|
for( Channel channel: mChannels )
|
||||||
{
|
{
|
||||||
@@ -545,7 +545,7 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Currently displayed minimum frequency
|
* Currently displayed minimum frequency
|
||||||
*/
|
*/
|
||||||
private int getMinFrequency()
|
private long getMinFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency - ( mBandwidth / 2 );
|
return mFrequency - ( mBandwidth / 2 );
|
||||||
}
|
}
|
||||||
@@ -553,7 +553,7 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Currently displayed maximum frequency
|
* Currently displayed maximum frequency
|
||||||
*/
|
*/
|
||||||
private int getMaxFrequency()
|
private long getMaxFrequency()
|
||||||
{
|
{
|
||||||
return mFrequency + ( mBandwidth / 2 );
|
return mFrequency + ( mBandwidth / 2 );
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ public class OverlayPanel extends JPanel
|
|||||||
* Returns a list of channel configs that contain the frequency within their
|
* Returns a list of channel configs that contain the frequency within their
|
||||||
* min/max frequency settings.
|
* min/max frequency settings.
|
||||||
*/
|
*/
|
||||||
public ArrayList<Channel> getChannelsAtFrequency( int frequency )
|
public ArrayList<Channel> getChannelsAtFrequency( long frequency )
|
||||||
{
|
{
|
||||||
ArrayList<Channel> configs = new ArrayList<Channel>();
|
ArrayList<Channel> configs = new ArrayList<Channel>();
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ public class SpectralDisplayPanel extends JPanel
|
|||||||
* Receives frequency change events -- primarily from tuner components.
|
* Receives frequency change events -- primarily from tuner components.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void frequencyChanged( int frequency, int bandwidth )
|
public void frequencyChanged( long frequency, int bandwidth )
|
||||||
{
|
{
|
||||||
mChannelPanel.frequencyChanged( frequency, bandwidth );
|
mChannelPanel.frequencyChanged( frequency, bandwidth );
|
||||||
mDFTProcessor.frequencyChanged( frequency, bandwidth );
|
mDFTProcessor.frequencyChanged( frequency, bandwidth );
|
||||||
@@ -479,7 +479,7 @@ public class SpectralDisplayPanel extends JPanel
|
|||||||
contextMenu.add( new PauseItem( mWaterfallPanel, "Pause" ) );
|
contextMenu.add( new PauseItem( mWaterfallPanel, "Pause" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int frequency =
|
long frequency =
|
||||||
mChannelPanel.getFrequencyFromAxis( event.getX() );
|
mChannelPanel.getFrequencyFromAxis( event.getX() );
|
||||||
|
|
||||||
if( event.getComponent() == mChannelPanel )
|
if( event.getComponent() == mChannelPanel )
|
||||||
@@ -757,10 +757,10 @@ public class SpectralDisplayPanel extends JPanel
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private ResourceManager mResourceManager;
|
private ResourceManager mResourceManager;
|
||||||
private int mFrequency;
|
private long mFrequency;
|
||||||
private DecoderType mDecoder;
|
private DecoderType mDecoder;
|
||||||
|
|
||||||
public DecoderItem( ResourceManager manager, int frequency, DecoderType type )
|
public DecoderItem( ResourceManager manager, long frequency, DecoderType type )
|
||||||
{
|
{
|
||||||
super( type.getDisplayString() );
|
super( type.getDisplayString() );
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class WaterfallPanel extends JPanel implements DFTResultsListener,
|
|||||||
|
|
||||||
private Point mCursorLocation = new Point( 0, 0 );
|
private Point mCursorLocation = new Point( 0, 0 );
|
||||||
private boolean mCursorVisible = false;
|
private boolean mCursorVisible = false;
|
||||||
private int mCursorFrequency = 0;
|
private long mCursorFrequency = 0;
|
||||||
private AtomicBoolean mPaused = new AtomicBoolean();
|
private AtomicBoolean mPaused = new AtomicBoolean();
|
||||||
|
|
||||||
private ResourceManager mResourceManager;
|
private ResourceManager mResourceManager;
|
||||||
@@ -162,7 +162,7 @@ public class WaterfallPanel extends JPanel implements DFTResultsListener,
|
|||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCursorFrequency( int frequency )
|
public void setCursorFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mCursorFrequency = frequency;
|
mCursorFrequency = frequency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class Oscillator
|
|||||||
* @param frequency - positive or negative frequency in hertz
|
* @param frequency - positive or negative frequency in hertz
|
||||||
* @param sampleRate - in hertz
|
* @param sampleRate - in hertz
|
||||||
*/
|
*/
|
||||||
public Oscillator( int frequency, int sampleRate )
|
public Oscillator( long frequency, int sampleRate )
|
||||||
{
|
{
|
||||||
mSampleRate = (double)sampleRate;
|
mSampleRate = (double)sampleRate;
|
||||||
mFrequency = (double)frequency;
|
mFrequency = (double)frequency;
|
||||||
@@ -53,7 +53,7 @@ public class Oscillator
|
|||||||
/**
|
/**
|
||||||
* Sets or changes the frequency of this oscillator
|
* Sets or changes the frequency of this oscillator
|
||||||
*/
|
*/
|
||||||
public void setFrequency( int frequency )
|
public void setFrequency( long frequency )
|
||||||
{
|
{
|
||||||
mFrequency = (double)frequency;
|
mFrequency = (double)frequency;
|
||||||
update();
|
update();
|
||||||
|
|||||||
Reference in New Issue
Block a user