/* This is the fourth part of building a 4-step Sequencer Synthesizer modeling the one found at: http://www.handmadeelectronicinstruments.com/store/product/four-step-sequencer-synthesizer/ We know have a working 4-step Sequencer Synthesizer, but why not add some more visual feedback? With some minor modifications, we make the window twice as high and draw the audio waveform. Most of the mods are done in setup() (to make the window taller and replace the controls), and at the top of draw(). We also need to make some minor changes to getZone(). Andy Sarroff, 2/2014 */ import beads.*; int uiX; int bSize; color c; PImage bgimg; PImage ledOn; PImage ledOff; PImage swOn; PImage swOff; int zone = -1; Control[] controls = new Control[7]; Switch[] switches = new Switch[5]; Clock cl; // create our AudioContext, which will oversee audio input/output AudioContext ac; Glide[] glides = new Glide[7]; BiquadFilter lpf; WavePlayer[] wp = new WavePlayer[4]; ScalingMixer sc; Gain g; void setup() { size(692, 692); // http://img.ehowcdn.com/default/ehow/images/a07/fd/m6/types-brushed-aluminum-sheets-1.1-800x800.jpg bgimg = loadImage("aluminum.jpg"); // The following parameter will store the y-coordinate of the top of the // user interface uiX = bgimg.height; bgimg.resize(bgimg.width*2, bgimg.height*2); // Set size of window to match background image imageMode(CENTER); // Load images // http://openclipart.org/image/300px/svg_to_png/88123/led_red_black.png ledOn = loadImage("led.png"); ledOn.resize(ledOn.width/10, 0); ledOff = loadImage("ledOff.png"); ledOff.resize(ledOff.width/10, 0); // http://www.yourpowercentre.com.au/wp-content/uploads/2013/10/switch.jpg swOn = loadImage("swOn.png"); swOn.resize(swOn.width/3, 0); swOff = loadImage("swOff.png"); swOff.resize(swOff.width/3, 0); // http://578e7a9bafc08e847f59-b21544d490ba797ec9de9d17e947de3d.r81.cf1.rackcdn.com/lrs-18519e_7379.jpg PImage img = loadImage("knob_t.png"); img.resize(img.width/4, 0); background(bgimg); // The following code has been modified to displace the controls in the y // direction by the value stored in uiX. // Inititalize controls for (int i=0; i// //println(zone); } void updateControl() { if (zone == 0) { controls[zone].update(); } else if (zone >= 2 && zone <=3) { controls[zone-1].update(); } else if (zone >=8 && zone <= 11) { controls[zone-5].update(); } } void mousePressed() { getZone(); if (zone == 1) { switches[4].on = !switches[4].on; if (switches[4].on) { ac.start(); } else { for (int i=0; i<4; i++) { switches[i].on = false; } ac.stop(); } } } // START NO NOTES // code used to capture screenshots void keyReleased() { boolean online = true; if (key == '`' && !online) save("sketch.png"); }