*/
public static class GraphicEQ {
- private final HeronLX lx;
+ private final LX lx;
public final BasicParameter level = new BasicParameter("LVL", 0.5);
public final BasicParameter range = new BasicParameter("RNGE", 0.5);
public final static int DEFAULT_NUM_BANDS = 16;
- public GraphicEQ(HeronLX lx) {
+ public GraphicEQ(LX lx) {
this(lx, DEFAULT_NUM_BANDS);
}
* Note that the number of bands is a suggestion. Due to the FFT implementation
* the actual number may be slightly different.
*/
- public GraphicEQ(HeronLX lx, int num) {
+ public GraphicEQ(LX lx, int num) {
this.lx = lx;
fft = new FFT(lx.audioInput().bufferSize(), lx.audioInput().sampleRate());
fft.window(FFT.HAMMING);
ObjectMuckerEffect(GLucose glucose) {
super(glucose);
}
- public void doApply(int[] colors){
+ public void apply(int[] colors){
/*for(Strip s: model.strips){
for(int i=0; i<s.points.size(); i++){
int index = s.points.get(i).index;
frames[i] = new int[model.points.size()];
}
}
- public void doApply(int[] colors) {
+ public void apply(int[] colors) {
if(fcount<maxfbuf){
for(int i=0; i<colors.length; i++){
frames[(maxfbuf-1)-fcount][i]=colors[i];
float zPos;
BouncyBall(int i) {
- addModulator(xPos).setBasis(random(0, TWO_PI)).start();
+ addModulator(xPos.setBasis(random(0, TWO_PI)).start());
addModulator(yPos = new Accelerator(0, 0, 0));
zPos = lerp(model.zMin, model.zMax, (i+2.) / (NUM_BALLS + 4.));
}
}
class Swarm extends SCPattern {
-
+
SawLFO offset = new SawLFO(0, 1, 1000);
SinLFO rate = new SinLFO(350, 1200, 63000);
SinLFO falloff = new SinLFO(15, 50, 17000);
boom.trigger();
}
- void doApply(int[] colors) {
+ void apply(int[] colors) {
float brightv = 100 * bright.getValuef();
float falloffv = falloffv();
float satv = sat.getValuef() * 100;
onEnable();
}
- public void doApply(int[] colors) {
+ public void apply(int[] colors) {
for (Layer l : layers) {
if (l.boom.isRunning()) {
- l.doApply(colors);
+ l.apply(colors);
}
}
}
addParameter(invert);
}
- public void doApply(int[] colors) {
+ public void apply(int[] colors) {
if (!enabled) {
return;
}
lastQuant = 0;
}
- public void doApply(int[] colors) {
+ public void apply(int[] colors) {
float fQuant = amount.getValuef();
if (fQuant > 0) {
float tRamp = (lx.tempo.rampf() % (1./pow(2,floor((1-fQuant) * 4))));
env.setRangeFromHereTo(0, 1000).start();
}
- public void doApply(int[] colors) {
+ public void apply(int[] colors) {
float amt = env.getValuef() * amount.getValuef();
if (amt > 0) {
amt = (1 - amt);
* //\\ //\\ //\\ //\\
* ///\\\ ///\\\ ///\\\ ///\\\
* \\\/// \\\/// \\\/// \\\///
- * \\// \\// \\// \\//
+ * \\// \\// \\// \\//H
*
* EXPERTS ONLY!! EXPERTS ONLY!!
*
// Core engine variables
GLucose glucose;
-HeronLX lx;
+LX lx;
LXPattern[] patterns;
Effects effects;
MappingTool mappingTool;
redraw();
}
+ protected float getNormalized() {
+ if (parameter != null) {
+ if (parameter instanceof BasicParameter) {
+ return ((BasicParameter)parameter).getNormalizedf();
+ }
+ return parameter.getValuef();
+ }
+ return 0;
+ }
+
+ protected UIParameterControl setNormalized(float value) {
+ if (parameter != null) {
+ if (parameter instanceof BasicParameter) {
+ ((BasicParameter)parameter).setNormalized(value);
+ } else {
+ parameter.setValue(value);
+ }
+ }
+ return this;
+ }
+
public UIParameterControl setParameter(LXParameter parameter) {
if (this.parameter != null) {
if (this.parameter instanceof LXListenableParameter) {
private int knobSize = 28;
private final float knobIndent = .4;
private final int knobLabelHeight = 14;
+ private boolean showValue = false;
public UIParameterKnob(float x, float y) {
this(x, y, 0, 0);
}
protected void onDraw(PGraphics pg) {
- float knobValue = (parameter != null) ? parameter.getValuef() : 0;
+ float knobValue = getNormalized();
pg.ellipseMode(CENTER);
pg.noStroke();
pg.fill(#333333);
pg.ellipse(knobSize/2, knobSize/2, knobSize/2, knobSize/2);
- String knobLabel = (parameter != null) ? parameter.getLabel() : null;
+ String knobLabel;
+ if (showValue) {
+ knobLabel = (parameter != null) ? ("" + parameter.getValue()) : null;
+ } else {
+ knobLabel = (parameter != null) ? parameter.getLabel() : null;
+ }
if (knobLabel == null) {
knobLabel = "-";
} else if (knobLabel.length() > 4) {
} else {
lastMousePress = now;
}
+ showValue = true;
+ redraw();
+ }
+
+ public void onMouseReleased(float mx, float my) {
+ showValue = false;
+ redraw();
}
public void onMouseDragged(float mx, float my, float dx, float dy) {
- if (parameter != null) {
- float value = constrain(parameter.getValuef() - dy / 100., 0, 1);
- parameter.setValue(value);
- }
+ float value = constrain(getNormalized() - dy / 100., 0, 1);
+ setNormalized(value);
}
}
private float doubleClickX = 0;
protected void onMousePressed(float mx, float my) {
long now = millis();
- float handleLeft = 4 + parameter.getValuef() * (w-8-handleWidth);
+ float handleLeft = 4 + getNormalized() * (w-8-handleWidth);
if (mx >= handleLeft && mx < handleLeft + handleWidth) {
editing = true;
} else {
if ((now - lastClick) < DOUBLE_CLICK_THRESHOLD && abs(mx - doubleClickX) < 3) {
- parameter.setValue(doubleClickMode);
+ setNormalized(doubleClickMode);
}
doubleClickX = mx;
if (mx < w*.25) {
protected void onMouseDragged(float mx, float my, float dx, float dy) {
if (editing) {
- parameter.setValue(constrain((mx - handleWidth/2. - 4) / (w-8-handleWidth), 0, 1));
+ setNormalized(constrain((mx - handleWidth/2. - 4) / (w-8-handleWidth), 0, 1));
}
}
}