mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user