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:
denny
2015-09-01 07:10:26 -04:00
parent 538a299246
commit f4d8ea281d
570 changed files with 21578 additions and 17012 deletions

View File

@@ -2,9 +2,6 @@ package dsp.gain;
import java.util.concurrent.atomic.AtomicBoolean;
import sample.real.RealBuffer;
import sample.real.RealSampleListener;
import sample.real.RealSampleProvider;
import buffer.DoubleCircularBuffer;
import buffer.FloatCircularBuffer;
@@ -61,8 +58,7 @@ import buffer.FloatCircularBuffer;
* those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of Moe Wheatley.
******************************************************************************/
public class RealAutomaticGainControl implements RealSampleListener,
RealSampleProvider
public class AutomaticGainControl
{
private static final double SAMPLE_RATE = 48000;
@@ -139,38 +135,10 @@ public class RealAutomaticGainControl implements RealSampleListener,
private DoubleCircularBuffer mMagnitudeBuffer =
new DoubleCircularBuffer( (int)( SAMPLE_RATE * WINDOW_TIME_CONSTANT ) );
private RealSampleListener mListener;
public RealAutomaticGainControl()
public AutomaticGainControl()
{
}
@Override
public void receive( float currentSample )
{
float processed = process( currentSample );
if( mListener != null )
{
mListener.receive( processed );
}
}
/**
* Applies AGC to a buffer of real (float) samples
*/
public RealBuffer process( RealBuffer buffer )
{
float[] samples = buffer.getSamples();
for( int x = 0; x < samples.length; x++ )
{
samples[ x ] = process( samples[ x ] );
}
return new RealBuffer( samples );
}
public float process( float currentSample )
{
float delayedSample = mDelayBuffer.get( currentSample );
@@ -233,9 +201,7 @@ public class RealAutomaticGainControl implements RealSampleListener,
}
delayedSample = (float)( delayedSample * gain );
return delayedSample;
return (float)( delayedSample * gain );
}
/**
@@ -254,16 +220,4 @@ public class RealAutomaticGainControl implements RealSampleListener,
{
return mAGCEnabled.get();
}
@Override
public void setListener( RealSampleListener listener )
{
mListener = listener;
}
@Override
public void removeListener( RealSampleListener listener )
{
mListener = null;
}
}

View File

@@ -0,0 +1,53 @@
package dsp.gain;
import sample.Listener;
import sample.real.RealBuffer;
public class AutomaticGainControl_RB extends AutomaticGainControl
implements Listener<RealBuffer>
{
private Listener<RealBuffer> mListener;
public AutomaticGainControl_RB()
{
}
public void dispose()
{
mListener = null;
}
/**
* Applies AGC to a buffer of real (float) samples
*/
public RealBuffer process( RealBuffer buffer )
{
float[] samples = buffer.getSamples();
for( int x = 0; x < samples.length; x++ )
{
samples[ x ] = process( samples[ x ] );
}
return buffer;
}
@Override
public void receive( RealBuffer buffer )
{
if( mListener != null )
{
mListener.receive( process( buffer ) );
}
}
public void setListener( Listener<RealBuffer> listener )
{
mListener = listener;
}
public void removeListener()
{
mListener = null;
}
}

View File

@@ -4,7 +4,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import sample.Listener;
import sample.Provider;
import sample.complex.ComplexSample;
import sample.complex.Complex;
import buffer.ComplexCircularBuffer;
import buffer.DoubleCircularBuffer;
@@ -61,8 +61,8 @@ import buffer.DoubleCircularBuffer;
* those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of Moe Wheatley.
******************************************************************************/
public class ComplexAutomaticGainControl implements Listener<ComplexSample>,
Provider<ComplexSample>
public class ComplexAutomaticGainControl implements Listener<Complex>,
Provider<Complex>
{
private static final double SAMPLE_RATE = 48000;
@@ -138,16 +138,16 @@ public class ComplexAutomaticGainControl implements Listener<ComplexSample>,
private DoubleCircularBuffer mMagnitudeBuffer =
new DoubleCircularBuffer( (int)( SAMPLE_RATE * WINDOW_TIME_CONSTANT ) );
private Listener<ComplexSample> mListener;
private Listener<Complex> mListener;
public ComplexAutomaticGainControl()
{
}
@Override
public void receive( ComplexSample currentSample )
public void receive( Complex currentSample )
{
ComplexSample delayedSample = mDelayBuffer.get( currentSample );
Complex delayedSample = mDelayBuffer.get( currentSample );
double gain = MANUAL_AGC_GAIN;
@@ -235,13 +235,13 @@ public class ComplexAutomaticGainControl implements Listener<ComplexSample>,
}
@Override
public void setListener( Listener<ComplexSample> listener )
public void setListener( Listener<Complex> listener )
{
mListener = listener;
}
@Override
public void removeListener( Listener<ComplexSample> listener )
public void removeListener( Listener<Complex> listener )
{
mListener = null;
}

View File

@@ -4,8 +4,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sample.Listener;
import sample.Provider;
import sample.complex.ComplexSample;
import sample.complex.Complex;
import sample.complex.ComplexSampleListener;
import buffer.FloatCircularBuffer;
/*******************************************************************************
@@ -31,8 +31,7 @@ import buffer.FloatCircularBuffer;
* feedforward_agc_cc_impl.cc
*
******************************************************************************/
public class ComplexFeedForwardGainControl
implements Listener<ComplexSample>, Provider<ComplexSample>
public class ComplexFeedForwardGainControl implements ComplexSampleListener
{
private final static Logger mLog =
LoggerFactory.getLogger( ComplexFeedForwardGainControl.class );
@@ -40,7 +39,7 @@ public class ComplexFeedForwardGainControl
public static final float OBJECTIVE_ENVELOPE = 1.0f;
public static final float MINIMUM_ENVELOPE = 0.0001f;
private Listener<ComplexSample> mListener;
private ComplexSampleListener mListener;
private FloatCircularBuffer mEnvelopeHistory;
@@ -65,9 +64,9 @@ public class ComplexFeedForwardGainControl
}
@Override
public void receive( ComplexSample sample )
public void receive( float inphase, float quadrature )
{
float envelope = sample.envelope();
float envelope = Complex.envelope( inphase, quadrature );
if( envelope > mMaxEnvelope )
{
@@ -99,9 +98,7 @@ public class ComplexFeedForwardGainControl
/* Apply current gain value to the sample and send to the listener */
if( mListener != null )
{
sample.multiply( mGain );
mListener.receive( sample );
mListener.receive( inphase *= mGain, quadrature *= mGain );
}
}
@@ -110,15 +107,8 @@ public class ComplexFeedForwardGainControl
mGain = OBJECTIVE_ENVELOPE / mMaxEnvelope;
}
@Override
public void setListener( Listener<ComplexSample> listener )
public void setListener( ComplexSampleListener listener )
{
mListener = listener;
}
@Override
public void removeListener( Listener<ComplexSample> listener )
{
mListener = null;
}
}

View File

@@ -1,12 +1,12 @@
package dsp.gain;
import sample.Listener;
import sample.complex.ComplexSample;
import sample.complex.Complex;
public class ComplexGain implements Listener<ComplexSample>
public class ComplexGain implements Listener<Complex>
{
private float mGain;
private Listener<ComplexSample> mListener;
private Listener<Complex> mListener;
public ComplexGain( float gain )
{
@@ -14,7 +14,7 @@ public class ComplexGain implements Listener<ComplexSample>
}
@Override
public void receive( ComplexSample sample )
public void receive( Complex sample )
{
if( mListener != null )
{
@@ -24,7 +24,7 @@ public class ComplexGain implements Listener<ComplexSample>
}
}
public void setListener( Listener<ComplexSample> listener )
public void setListener( Listener<Complex> listener )
{
mListener = listener;
}