package com.haxademic.app.haxmapper.textures;

import com.haxademic.core.app.P;
import com.haxademic.core.math.MathUtil;

public class TextureEQColumns 
extends BaseTexture {

	protected int _numLines = 40;
	protected boolean _hasStroke = true;
	
	public TextureEQColumns( int width, int height ) {
		super();

		buildGraphics( width, height );
	}
	
	public void newLineMode() {
		_numLines = MathUtil.randRange(20, 30);
		_hasStroke = !_hasStroke;
	}

	public void update() {
		super.update();
		
		float eqW = _texture.width / _numLines;
		float spectrumInterval = ( 512f / _numLines );
		float avergeInterval = ( 32f / _numLines );
		
		_texture.beginDraw();
		_texture.clear();
		
		if( _hasStroke == true ) {
			_texture.stroke(0);
			_texture.strokeWeight(1);
		} else {
			_texture.noStroke();
		}

		for( int i=0; i < _numLines; i++ ) {
			 _texture.fill( _colorEase.colorInt(), P.constrain( P.p.audioIn.getEqAvgBand( P.floor(i*avergeInterval) ) * 255, 0, 255 ) );
//			_texture.fill( _colorEase.colorInt(), P.constrain( P.p.audioIn.getEqBand( P.floor(i*spectrumInterval) ) * 255, 0, 255 ) );
			_texture.rect(i * eqW, 0, eqW, _texture.height );  //  P.p.audioIn.getEqBand( P.floor(i*spectrumInterval)%512 ) * 50
		}
		
		_texture.endDraw();
	}
}

@@ -239,16 +239,53 @@
  true;%0A%09
+protected boolean _barsGrow = false;%0A
 %0A%09public
@@ -378,18 +378,17 @@
 t );%0A%09%7D%0A
-%09
 %0A
+
 %09public 
@@ -478,16 +478,57 @@
 Stroke;%0A
+%09%09_barsGrow = MathUtil.randBoolean(P.p);%0A
 %09%7D%0A%0A%09pub
@@ -565,19 +565,17 @@
 date();%0A
-%09%09
 %0A
+
 %09%09float 
@@ -606,24 +606,27 @@
 numLines;%0A%09%09
+// 
 float spectr
@@ -706,19 +706,17 @@
 ines );%0A
-%09%09
 %0A
+
 %09%09_textu
@@ -751,19 +751,17 @@
 lear();%0A
-%09%09
 %0A
+
 %09%09if( _h
@@ -873,16 +873,45 @@
 );%0A%09%09%7D%0A%0A
+%09%09if( _barsGrow == true ) %7B%0A%09
 %09%09for( i
@@ -944,17 +944,17 @@
  ) %7B%0A%09%09%09
- 
+%09
 _texture
@@ -977,38 +977,62 @@
 e.colorInt()
-, P.constrain(
+ );%0A%09%09%09%09_texture.rect(i * eqW, 0, eqW,
  P.p.audioIn
@@ -1080,27 +1080,158 @@
 ) * 
-255, 0, 255 ) );%0A//
+_texture.height * 0.8f );  //  P.p.audioIn.getEqBand( P.floor(i*spectrumInterval)%25512 ) * 50%0A%09%09%09%7D%0A%09%09%7D else %7B%0A%09%09%09for( int i=0; i %3C _numLines; i++ ) %7B%0A%09
 %09%09%09_
@@ -1289,32 +1289,35 @@
 .p.audioIn.getEq
+Avg
 Band( P.floor(i*
@@ -1312,32 +1312,30 @@
 ( P.floor(i*
-spectrum
+averge
 Interval) ) 
@@ -1353,16 +1353,17 @@
 55 ) );%0A
+%09
 %09%09%09_text
@@ -1474,22 +1474,25 @@
  ) * 50%0A
+%09%09%09%7D%0A
 %09%09%7D%0A
-%09%09
 %0A%09%09_text

Add vertically-growing bars mode