Adds airspy USB tuner support and updates the spectral display

component.

-Airspy supported with 10 and 2.5 MSps sample rates.  Additional
decimation may be added later.

-Spectral display updated to include smoothing and filtering options.

Note: the decimated output of a tuner channel from the airspy is
48,076.9 samples per second, versus the normal 48 kHz decimated rate.
This is 1.0015 times the normal rate and doesn't appear to impact the
decoders or audio processing.  Therefore, no fractional resampling has
been added.
This commit is contained in:
denny
2015-10-30 20:49:22 -04:00
parent 5a91630996
commit 70e62ebb35
80 changed files with 4781 additions and 1014 deletions

24
src/sample/Buffer.java Normal file
View File

@@ -0,0 +1,24 @@
package sample;
public class Buffer
{
protected float[] mSamples;
public Buffer( float[] samples )
{
mSamples = samples;
}
public float[] getSamples()
{
return mSamples;
}
/**
* Cleanup method to nullify all data and references
*/
public void dispose()
{
mSamples = null;
}
}

View File

@@ -4,7 +4,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import sample.complex.ComplexBuffer;
import sample.real.RealBuffer;
/**
@@ -57,7 +56,7 @@ public class ConversionUtils
* Converts the float samples in a complex buffer to a little endian 16-bit
* buffer
*/
public static ByteBuffer convertToSigned16BitSamples( ComplexBuffer buffer )
public static ByteBuffer convertToSigned16BitSamples( Buffer buffer )
{
return convertToSigned16BitSamples( buffer.getSamples() );
}

View File

@@ -17,7 +17,7 @@
******************************************************************************/
package sample.adapter;
public class ByteSampleAdapter extends SampleAdapter
public class ByteSampleAdapter implements ISampleAdapter
{
private final static float[] LOOKUP_VALUES;
@@ -33,8 +33,6 @@ public class ByteSampleAdapter extends SampleAdapter
{
LOOKUP_VALUES[ x ] = (float)( x - 127 ) / 128.0f;
}
//
// LOOKUP_VALUES[ 128 ] = 0.0000001f;
}
@Override

View File

@@ -25,7 +25,7 @@ import source.mixer.MixerChannel;
/**
* Converts 16-bit little endian byte data into an array of floats
*/
public class ChannelShortAdapter extends SampleAdapter
public class ChannelShortAdapter implements ISampleAdapter
{
private ShortToFloatMap mMap = new ShortToFloatMap();
private ByteOrder mByteOrder = ByteOrder.LITTLE_ENDIAN;

View File

@@ -1,6 +1,6 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
* Copyright (C) 2014,2015 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
@@ -21,7 +21,7 @@ package sample.adapter;
* Adapter to convert byte data received from a data stream into float[]
* samples
*/
public abstract class SampleAdapter
public interface ISampleAdapter
{
public abstract float[] convert( byte[] samples );
}

View File

@@ -23,7 +23,7 @@ import java.nio.ByteOrder;
/**
* Converts 16-bit little endian byte data into an array of floats
*/
public class ShortAdapter extends SampleAdapter
public class ShortAdapter implements ISampleAdapter
{
private ShortToFloatMap mMap = new ShortToFloatMap();
private ByteOrder mByteOrder = ByteOrder.LITTLE_ENDIAN;

View File

@@ -1,21 +1,17 @@
package sample.complex;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ComplexBuffer
import sample.Buffer;
public class ComplexBuffer extends Buffer
{
private float[] mSamples;
/**
* Wrapper around float array containing interleaved I/Q samples
*/
public ComplexBuffer( float[] samples )
{
mSamples = samples;
super( samples );
}
/**
@@ -27,35 +23,4 @@ public class ComplexBuffer
return new ComplexBuffer( copy );
}
/**
* Interleaved I/Q float sample array
*/
public float[] getSamples()
{
return mSamples;
}
/**
* Converts this sample buffer into a list of complex samples
*/
public List<Complex> getComplexSamples()
{
List<Complex> samples = new ArrayList<Complex>();
for( int x = 0; x < mSamples.length; x += 2 )
{
samples.add( new Complex( mSamples[ x ], mSamples[ x + 1 ] ) );
}
return samples;
}
/**
* Cleanup method to nullify all data and references
*/
public void dispose()
{
mSamples = null;
}
}

View File

@@ -2,31 +2,18 @@ package sample.real;
import java.util.Arrays;
public class RealBuffer
{
private float[] mSamples;
import sample.Buffer;
public class RealBuffer extends Buffer
{
/**
* Wrapper around float array containing float samples
* Wrapper around float array containing real float samples
*/
public RealBuffer( float[] samples )
{
mSamples = samples;
super( samples );
}
/**
* Package private to allow subclass construction and subsequent definition
* of the sample data
*/
RealBuffer()
{
}
protected void setSamples( float[] samples )
{
mSamples = samples;
}
/**
* Creates a deep copy of the buffer
*/
@@ -36,20 +23,4 @@ public class RealBuffer
return new RealBuffer( copy );
}
/**
* Sample data
*/
public float[] getSamples()
{
return mSamples;
}
/**
* Cleanup method to nullify all data and references
*/
public void dispose()
{
mSamples = null;
}
}