Spectrum/Waterfall display zoom feature - work in progress (issue #33)

Implements zoom in/out by mouse scroll wheel and by right-click context
menu.

Still have to add ability to drag spectrum left/right when zoomed in.
This commit is contained in:
denny
2015-11-11 20:07:37 -05:00
parent c178e99a5d
commit 7455077cfa
12 changed files with 559 additions and 280 deletions

View File

@@ -78,7 +78,8 @@ public class ComplexDecibelConverter extends DFTResultsConverter
{
int halfResults = results.length / 2;
float dftScalor = 1.0f / (float)( halfResults ^ 2 );
// float dftBinSizeScalor = 1.0f / (float)Math.pow( halfResults, 2.0 );
float dftBinSizeScalor = 1.0f / (float)halfResults;
float[] processed = new float[ halfResults ];
@@ -91,7 +92,7 @@ public class ComplexDecibelConverter extends DFTResultsConverter
//Convert the scaled value to decibels.
float decibels = 10.0f * (float)Math.log10(
( ( results[ x ] * results[ x ] ) +
( results[ x + 1 ] * results[ x + 1 ] ) ) * dftScalor );
( results[ x + 1 ] * results[ x + 1 ] ) ) * dftBinSizeScalor );
// We have to swap the upper and lower halves of the JTransforms
// DFT results for correct display

View File

@@ -21,7 +21,7 @@ public class RealDecibelConverter extends DFTResultsConverter
@Override
public void receive( float[] results )
{
float dftScalor = 1.0f / (float)( results.length ^ 2 );
float dftBinSizeScalor = 1.0f / (float)results.length;
float[] processed = new float[ results.length / 4 ];
@@ -33,7 +33,7 @@ public class RealDecibelConverter extends DFTResultsConverter
processed[ x ] = 20.0f * (float)Math.log10(
( ( results[ index ] * results[ index ] ) +
( results[ index + 1 ] * results[ index + 1 ] ) ) * dftScalor );
( results[ index + 1 ] * results[ index + 1 ] ) ) * dftBinSizeScalor );
}
dispatch( processed );