Adjusted color gradient used in spectral display and some code cleanup.

This commit is contained in:
denny
2015-11-29 07:14:21 -05:00
parent ae10b5fc1c
commit 82a7155966
5 changed files with 17 additions and 38 deletions

View File

@@ -492,37 +492,4 @@ public class ChannelSpectrumPanel extends JPanel
{
mSpectrumPanel.setSmoothingType( type );
}
public class SampleAssembler implements RealSampleListener
{
private Listener<ComplexBuffer> mListener;
public SampleAssembler( Listener<ComplexBuffer> listener )
{
mListener = listener;
}
@Override
public void receive( float sample )
{
mSamples[ mSamplePointer++ ] = sample;
if( mSamplePointer >= mSamples.length )
{
if( mEnabled.get() )
{
float[] copy = Arrays.copyOf( mSamples, mSamples.length );
mListener.receive( new ComplexBuffer( copy ) );
}
mSamplePointer = 0;
if( mSamples.length != mSampleBufferSize )
{
mSamples = new float[ mSampleBufferSize ];
}
}
}
}
}

View File

@@ -75,7 +75,7 @@ public class OverlayPanel extends JPanel
}
private final static BasicStroke DASHED_STROKE = new BasicStroke(0.8f,
BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] {5.0f}, 0.0f);
BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] {2.0f, 4.0f}, 0.0f);
private static DecimalFormat CURSOR_FORMAT = new DecimalFormat( "000.00000" );
private long mFrequency = 0;
@@ -342,7 +342,7 @@ public class OverlayPanel extends JPanel
{
Stroke currentStroke = graphics.getStroke();
graphics.setStroke( DASHED_STROKE );
// graphics.setStroke( DASHED_STROKE );
long minFrequency = getMinDisplayFrequency();
long maxFrequency = getMaxDisplayFrequency();
@@ -352,6 +352,12 @@ public class OverlayPanel extends JPanel
int major = mLabelSizeMonitor.getMajorTickIncrement( graphics );
int minor = mLabelSizeMonitor.getMinorTickIncrement( graphics );
//Avoid divide by zero error
if( minor == 0 )
{
minor = 1;
}
//Adjust the start frequency to a multiple of the minor tick spacing
long frequency = minFrequency - ( minFrequency % minor );
@@ -373,7 +379,7 @@ public class OverlayPanel extends JPanel
frequency += minor;
}
graphics.setStroke( currentStroke );
// graphics.setStroke( currentStroke );
}
/**

View File

@@ -189,7 +189,7 @@ public class SpectrumPanel extends JPanel
//Define the gradient
GradientPaint gradient = new GradientPaint( 0,
getSize().height / 4,
( getSize().height - mSpectrumInset ) / 2,
mColorSpectrumGradientTop,
0,
getSize().height,