|
|
@ -16,8 +16,8 @@ public class SpectrographBar { |
|
|
|
update(NO_UPDATE); |
|
|
|
update(NO_UPDATE); |
|
|
|
} |
|
|
|
} |
|
|
|
public void update(float value) { |
|
|
|
public void update(float value) { |
|
|
|
if (value!=NO_UPDATE) { |
|
|
|
if (value==NO_UPDATE) { |
|
|
|
if (Math.abs(current_magnitude)>0.3f) { |
|
|
|
if (Math.abs(current_magnitude)>1f) { |
|
|
|
current_magnitude/=1.01f; |
|
|
|
current_magnitude/=1.01f; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
current_magnitude=0; |
|
|
|
current_magnitude=0; |
|
|
@ -27,8 +27,11 @@ public class SpectrographBar { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
public void draw(Graphics g,int x,int w,int h) { |
|
|
|
public void draw(Graphics g,int x,int w,int h) { |
|
|
|
int colVal = (int)((Math.abs(current_magnitude)/60d)*255); |
|
|
|
if (current_magnitude!=NO_UPDATE) { |
|
|
|
g.setColor(new Color(colVal,colVal,colVal,colVal)); |
|
|
|
System.out.println(current_magnitude); |
|
|
|
g.fillRect(x,0,w,h); |
|
|
|
int colVal = (int)(((60d-Math.abs(current_magnitude))/60d)*255); |
|
|
|
|
|
|
|
g.setColor(new Color(colVal,colVal,colVal,colVal)); |
|
|
|
|
|
|
|
g.fillRect(x,0,w,h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|