mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Initial commit of redesigned internal processing and audio management.
Note: Several of the decoders are currently non-functioning in this commit. If you want the latest functioning codebase, please checkout the commit prior to this one. All decoders will eventually be updated with this new architecture. Currently broken: - Logging and recording - Aux decoders (Fleetsync/MDC/LoJack/Tait) - LTR/Passport decoders Changes in this commit: - Module architecture for decoders and components with central provisioning by the DecoderFactory - Transition from Complex sample stream processing to float buffer processing for improved memory management - Redesigned filter structures - to support buffers and streams - Resolved several memory leak issues - Universal sharing of the thread pool manager - Added centralized audio management with call/user prioritization and new gui with mute/volume controls - Embedded audio metadata for eventual streaming support - Redesigned ProcessingChain to support independent re-use - Added new TrafficChannelManager to handle traffic channel allocations - Traffic Channel pool size and Call timeout available in P25 and MPT1327 configs - Redesigned channel and decoder gui components
This commit is contained in:
@@ -20,14 +20,14 @@ package buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
|
||||
/**
|
||||
* Provides a complex sample enumeration wrapper around a byte array containing
|
||||
* interleaved byte-length I & Q sample values in the range of 0 - 255, converting
|
||||
* those samples into complex samples with value range of -128 to 0 to 127.
|
||||
*/
|
||||
public class ComplexByteBuffer implements Enumeration<ComplexSample>
|
||||
public class ComplexByteBuffer implements Enumeration<Complex>
|
||||
{
|
||||
private static float[] mValues;
|
||||
|
||||
@@ -81,11 +81,11 @@ public class ComplexByteBuffer implements Enumeration<ComplexSample>
|
||||
* method to ensure you do not read past the end of the buffer.
|
||||
*/
|
||||
@Override
|
||||
public ComplexSample nextElement()
|
||||
public Complex nextElement()
|
||||
{
|
||||
// return new ComplexSample( mValues[ ( mBytes[ mPointer++ ] & 0xFF ) ],
|
||||
// mValues[ ( mBytes[ mPointer++ ] & 0xFF ) ] );
|
||||
return new ComplexSample( mValues[ ( mBytes.get() & 0xFF ) ],
|
||||
return new Complex( mValues[ ( mBytes.get() & 0xFF ) ],
|
||||
mValues[ ( mBytes.get() & 0xFF ) ] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package buffer;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
|
||||
/**
|
||||
* Circular sample buffer - allocates a buffer and stores samples in a circular
|
||||
@@ -30,14 +30,14 @@ import sample.complex.ComplexSample;
|
||||
*/
|
||||
public class ComplexCircularBuffer
|
||||
{
|
||||
ComplexSample[] mBuffer;
|
||||
Complex[] mBuffer;
|
||||
int mBufferPointer = 0;
|
||||
|
||||
public ComplexCircularBuffer( int size )
|
||||
{
|
||||
mBuffer = new ComplexSample[ size ];
|
||||
mBuffer = new Complex[ size ];
|
||||
|
||||
Arrays.fill( mBuffer, new ComplexSample( 1.0f, 1.0f ) );
|
||||
Arrays.fill( mBuffer, new Complex( 1.0f, 1.0f ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,16 +46,16 @@ public class ComplexCircularBuffer
|
||||
* @param sample
|
||||
* @return
|
||||
*/
|
||||
public ComplexSample get( ComplexSample sample )
|
||||
public Complex get( Complex sample )
|
||||
{
|
||||
ComplexSample retVal = mBuffer[ mBufferPointer ];
|
||||
Complex retVal = mBuffer[ mBufferPointer ];
|
||||
|
||||
put( sample );
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public void put( ComplexSample sample )
|
||||
public void put( Complex sample )
|
||||
{
|
||||
mBuffer[ mBufferPointer ] = sample;
|
||||
|
||||
@@ -67,9 +67,9 @@ public class ComplexCircularBuffer
|
||||
}
|
||||
}
|
||||
|
||||
public ComplexSample[] get( int count )
|
||||
public Complex[] get( int count )
|
||||
{
|
||||
ComplexSample[] samples = new ComplexSample[ count ];
|
||||
Complex[] samples = new Complex[ count ];
|
||||
|
||||
int tempCounter = mBufferPointer;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
|
||||
public class ComplexSampleBufferAssembler
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public class ComplexSampleBufferAssembler
|
||||
* Load the sample's bytes, left then right, little endian, into the
|
||||
* backing byte array
|
||||
*/
|
||||
public void put( ComplexSample sample )
|
||||
public void put( Complex sample )
|
||||
{
|
||||
mByteBuffer.putShort( (short)( sample.left() * Short.MAX_VALUE ) );
|
||||
mByteBuffer.putShort( (short)( sample.right() * Short.MAX_VALUE ) );
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
******************************************************************************/
|
||||
package buffer;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
|
||||
/**
|
||||
* Implements a FIFO circular buffer for complex samples that provides access
|
||||
@@ -26,17 +26,17 @@ import sample.complex.ComplexSample;
|
||||
*/
|
||||
public class ComplexTappedCircularBuffer
|
||||
{
|
||||
private ComplexSample[] mBuffer;
|
||||
private Complex[] mBuffer;
|
||||
private int mBufferPointer = 0;
|
||||
|
||||
public ComplexTappedCircularBuffer( int length )
|
||||
{
|
||||
mBuffer = new ComplexSample[ length ];
|
||||
mBuffer = new Complex[ length ];
|
||||
|
||||
//Pre-load the buffer with 0-valued samples
|
||||
for( int x = 0; x < length; x++ )
|
||||
{
|
||||
mBuffer[ x ] = new ComplexSample( 0, 0 );
|
||||
mBuffer[ x ] = new Complex( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ComplexTappedCircularBuffer
|
||||
* Adds the sample to the buffer and removes the oldest sample
|
||||
* @param sample
|
||||
*/
|
||||
public void add( ComplexSample sample )
|
||||
public void add( Complex sample )
|
||||
{
|
||||
mBuffer[ mBufferPointer++ ] = sample;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ComplexTappedCircularBuffer
|
||||
* @throws ArrayIndexOutOfBoundsException if you attempt to access a sample
|
||||
* outside of the buffer size
|
||||
*/
|
||||
public ComplexSample get( int index )
|
||||
public Complex get( int index )
|
||||
{
|
||||
/* Since the samples are stored in a forward fashion, we have to access
|
||||
* the samples in reverse to comply with the access contract, where
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
|
||||
public class ShortComplexByteBuffer implements Enumeration<ComplexSample>
|
||||
public class ShortComplexByteBuffer implements Enumeration<Complex>
|
||||
{
|
||||
private ByteBuffer mByteBuffer;
|
||||
|
||||
@@ -45,9 +45,9 @@ public class ShortComplexByteBuffer implements Enumeration<ComplexSample>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexSample nextElement()
|
||||
public Complex nextElement()
|
||||
{
|
||||
return new ComplexSample( (float)mByteBuffer.getShort(),
|
||||
return new Complex( (float)mByteBuffer.getShort(),
|
||||
(float)mByteBuffer.getShort() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sample.complex.ComplexSample;
|
||||
import sample.complex.Complex;
|
||||
import source.mixer.MixerChannel;
|
||||
|
||||
public class StereoByteBuffer implements Enumeration<ComplexSample>
|
||||
public class StereoByteBuffer implements Enumeration<Complex>
|
||||
{
|
||||
private ByteBuffer mByteBuffer;
|
||||
|
||||
@@ -51,9 +51,9 @@ public class StereoByteBuffer implements Enumeration<ComplexSample>
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComplexSample nextElement()
|
||||
public Complex nextElement()
|
||||
{
|
||||
return new ComplexSample( (float)mByteBuffer.getShort(),
|
||||
return new Complex( (float)mByteBuffer.getShort(),
|
||||
(float)mByteBuffer.getShort() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user