This commit is contained in:
Gianpaolo Coro 2014-02-04 08:06:36 +00:00
parent 9de369762e
commit 7e8b730858
1 changed files with 2 additions and 2 deletions

View File

@ -71,7 +71,7 @@ public class SpectrogramCustom extends FunctionGraphCustom
protected double spectra_max = 0.;
protected double spectra_min = 0.;
protected double deltaF = 0.; // distance in Hz between two spectrum samples
protected int spectra_indexmax = 0; // index in each spectrum corresponding to FREQ_MAX
public int spectra_indexmax = 0; // index in each spectrum corresponding to FREQ_MAX
@ -220,7 +220,7 @@ public class SpectrogramCustom extends FunctionGraphCustom
if (rect_height < 2) rect_height = 2;
for (int i=0; i<spectra_indexmax; i++) {
int color;
if (Double.isNaN(spectrum[i]) || spectrum[i] < spectra_max - DYNAMIC_RANGE) {
if (spectrum.length<=i || Double.isNaN(spectrum[i]) || spectrum[i] < spectra_max - DYNAMIC_RANGE) {
color = 255; // white
} else {
color = (int) (255 * (spectra_max-spectrum[i])/DYNAMIC_RANGE);