mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
P25 - work in progress to improve CQPSK LSM audio output. Audio output is still choppy but greatly improved over the previous test release.
This commit is contained in:
@@ -31,10 +31,10 @@ public class ByteSampleAdapter extends SampleAdapter
|
||||
|
||||
for( int x = 0; x < 256; x++ )
|
||||
{
|
||||
LOOKUP_VALUES[ x ] = (float)( x - 128 );
|
||||
LOOKUP_VALUES[ x ] = (float)( x - 127 ) / 128.0f;
|
||||
}
|
||||
|
||||
LOOKUP_VALUES[ 128 ] = 0.0000001f;
|
||||
//
|
||||
// LOOKUP_VALUES[ 128 ] = 0.0000001f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -284,18 +284,42 @@ public class ComplexSample implements Serializable
|
||||
return new ComplexSample( (float)Math.cos( angle ),
|
||||
(float)Math.sin( angle ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Angle of this sample in radians
|
||||
*/
|
||||
public float angle()
|
||||
{
|
||||
return (float)Math.atan2( y(), x() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides an approximate magnitude value for this sample.
|
||||
*/
|
||||
public float envelope()
|
||||
{
|
||||
float realAbsolute = realAbsolute();
|
||||
float imagAbsolute = imaginaryAbsolute();
|
||||
|
||||
if( realAbsolute > imagAbsolute )
|
||||
{
|
||||
return realAbsolute + ( 0.4f * imagAbsolute );
|
||||
}
|
||||
else
|
||||
{
|
||||
return imagAbsolute + ( 0.4f * realAbsolute );
|
||||
}
|
||||
}
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
ComplexSample sample1 = new ComplexSample( .45f, .45f );
|
||||
ComplexSample sample2 = new ComplexSample( .25f, .25f );
|
||||
ComplexSample sample1_2 = ComplexSample.subtract( sample1, sample2 );
|
||||
ComplexSample s1 = new ComplexSample( 0.24414134f, -0.6026385f );
|
||||
ComplexSample s2 = new ComplexSample( -0.09531293f, -0.7052474f );
|
||||
|
||||
ComplexSample symbol = ComplexSample.multiply( s1, s2.conjugate() );
|
||||
|
||||
mLog.debug( sample1_2.toString() );
|
||||
mLog.debug( "S1 Mag:" + s1.magnitude() + " S2 Mag:" + s2.magnitude() + " SymMag:" + symbol.magnitude() );
|
||||
mLog.debug( "S1:" + s1 + " S2:" + s2 + " Symbol:" + symbol );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user