diff --git a/examples/ArduinoControls/all_controls/all_controls.pde b/examples/ArduinoControls/all_controls/all_controls.pde index 46a9a34..20b1ed0 100644 --- a/examples/ArduinoControls/all_controls/all_controls.pde +++ b/examples/ArduinoControls/all_controls/all_controls.pde @@ -56,7 +56,7 @@ void draw() { noFill(); if (ac.getPushButton(0)) fill(255, 0, 0); - if (ac.getPushButton(1)) fill(0, 255, 0); + if (ac.getPushButtonOnce(1)) fill(0, 255, 0); //only green for 1 frame if (ac.getPushButton(2)) fill(0, 0, 255); //show ellipse at relative smoothed potentiometer value (prevents jumping around) diff --git a/examples/BPM_Timings/adsr/adsr.pde b/examples/BPM_Timings/adsr/adsr.pde index e873d48..998bf41 100644 --- a/examples/BPM_Timings/adsr/adsr.pde +++ b/examples/BPM_Timings/adsr/adsr.pde @@ -31,9 +31,10 @@ PImage img; void setup() { size(500, 500); bpm = new BeatsPerMinute(this); + bpm.showInfoPanel(); img = loadImage("adsr.png"); imageMode(CENTER); - textAlign(CENTER,CENTER); + textAlign(CENTER, CENTER); textSize(40); stroke(50); fill(0); @@ -46,7 +47,7 @@ void draw() { text("1", width/5, height/2 - 100); s = lerp(0, 100, bpm.linear()); circle(width/5, height/2, s); - + // fast attack, no decay, no release // so very fast progression (in 20% of the time of 1 beat) from 0 to 1, and keep it at 1 for the remainder of the time text("2", width/5 * 2, height/2 - 100); @@ -58,7 +59,7 @@ void draw() { s = lerp(0, 100, bpm.adsr(attackDuration, decayDuration, sustainLevel, releaseDuration, durationInBeats)); // s = lerp(0, 100, bpm.adsr(0.2)); // this has the same effect because all other values are default values circle(width/5 * 2, height/2, s); - + // slow attack, fast release // slowly progress (in 80% of the time of 1 beat) from 0 to 1, and quickly progress from 1 to 0 text("3", width/5 * 3, height/2 - 100); diff --git a/examples/BPM_Timings/basic/basic.pde b/examples/BPM_Timings/basic/basic.pde index 7f07ef0..e2cb8fe 100644 --- a/examples/BPM_Timings/basic/basic.pde +++ b/examples/BPM_Timings/basic/basic.pde @@ -12,6 +12,7 @@ void setup() { size(500, 500); bpm = new BeatsPerMinute(this); bpm.setBPM(30); + } void draw() { diff --git a/examples/BPM_Timings/beatcount/beatcount.pde b/examples/BPM_Timings/beatcount/beatcount.pde index 396ce3e..b99612b 100644 --- a/examples/BPM_Timings/beatcount/beatcount.pde +++ b/examples/BPM_Timings/beatcount/beatcount.pde @@ -12,21 +12,17 @@ BeatsPerMinute bpm; void setup() { size(500, 500); bpm = new BeatsPerMinute(this) - //.setBPM(120) //.showInfoPanel() - //.setInfoPanelY(200) - //.setInfoPanelKey('o') - //.disableKeyPress() ; } void draw() { - surface.setTitle(bpm.setSurfaceTitle()); + surface.setTitle(bpm.getSurfaceTitle()); background(100); textAlign(CENTER, CENTER); textSize(20); - text(bpm.setSurfaceTitle(), width/2, 50); + text(bpm.getSurfaceTitle(), width/2, 50); textSize(30); - text("The beatcount is: " + (int) bpm.beatCount, width/2, height/2); + text("The beatcount is: " + (int) bpm.getBeatCount(), width/2, height/2); } diff --git a/examples/FrequencyAnalyzer/basics/basics.pde b/examples/FrequencyAnalyzer/basics/basics.pde index 6dec456..54914be 100644 --- a/examples/FrequencyAnalyzer/basics/basics.pde +++ b/examples/FrequencyAnalyzer/basics/basics.pde @@ -19,6 +19,7 @@ void setup() { //.setAudioInputMode(AudioInputMode.AUDIO_FILE, 128) // also set bufferSize, needs to be power of 2. Lower amount means less audio resolution and decreasing delay //.setAudioInputMode(AudioInputMode.LINE_IN) .setAudioOutputMode(AudioOutputMode.MONO) + .showInfoPanel() ; } diff --git a/noteToSelf.md b/noteToSelf.md index a5d8763..da5aeed 100644 --- a/noteToSelf.md +++ b/noteToSelf.md @@ -78,6 +78,20 @@ ln -s ../../../src/bpm/library/arduinocontrols/LEDMode.java ./examples/ArduinoCo ln -s ../../../src/bpm/library/arduinocontrols/Potentiometer.java ./examples/ArduinoControls/basics/Potentiometer.java ln -s ../../../src/bpm/library/arduinocontrols/PushButton.java ./examples/ArduinoControls/basics/PushButton.java ln -s ../../../src/bpm/library/InfoPanel.java ./examples/ArduinoControls/basics/InfoPanel.java + +ln -s ../../../src/bpm/library/arduinocontrols/ArduinoControls.java ./examples/ArduinoControls/all_controls/ArduinoControls.java +ln -s ../../../src/bpm/library/arduinocontrols/LED.java ./examples/ArduinoControls/all_controls/LED.java +ln -s ../../../src/bpm/library/arduinocontrols/LEDMode.java ./examples/ArduinoControls/all_controls/LEDMode.java +ln -s ../../../src/bpm/library/arduinocontrols/Potentiometer.java ./examples/ArduinoControls/all_controls/Potentiometer.java +ln -s ../../../src/bpm/library/arduinocontrols/PushButton.java ./examples/ArduinoControls/all_controls/PushButton.java +ln -s ../../../src/bpm/library/InfoPanel.java ./examples/ArduinoControls/all_controls/InfoPanel.java + +ln -s ../../../src/bpm/library/arduinocontrols/ArduinoControls.java ./examples/ArduinoControls/smoothing/ArduinoControls.java +ln -s ../../../src/bpm/library/arduinocontrols/LED.java ./examples/ArduinoControls/smoothing/LED.java +ln -s ../../../src/bpm/library/arduinocontrols/LEDMode.java ./examples/ArduinoControls/smoothing/LEDMode.java +ln -s ../../../src/bpm/library/arduinocontrols/Potentiometer.java ./examples/ArduinoControls/smoothing/Potentiometer.java +ln -s ../../../src/bpm/library/arduinocontrols/PushButton.java ./examples/ArduinoControls/smoothing/PushButton.java +ln -s ../../../src/bpm/library/InfoPanel.java ./examples/ArduinoControls/smoothing/InfoPanel.java ``` FrequencyAnalyzer examples: ``` @@ -110,8 +124,14 @@ ln -s ../../../src/bpm/library/InfoPanel.java ./examples/FrequencyAnalyzer/stere ``` BPM_Timing examples: ``` +ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/adsr/BeatsPerMinute.java +ln -s ../../../src/bpm/library/InfoPanel.java ./examples/BPM_Timings/adsr/InfoPanel.java +ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/adsrSquares/BeatsPerMinute.java +ln -s ../../../src/bpm/library/InfoPanel.java ./examples/BPM_Timings/adsrSquares/InfoPanel.java ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/animatedSVG/BeatsPerMinute.java ln -s ../../../src/bpm/library/InfoPanel.java ./examples/BPM_Timings/animatedSVG/InfoPanel.java +ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/basic/BeatsPerMinute.java +ln -s ../../../src/bpm/library/InfoPanel.java ./examples/BPM_Timings/basic/InfoPanel.java ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/beatcount/BeatsPerMinute.java ln -s ../../../src/bpm/library/InfoPanel.java ./examples/BPM_Timings/beatcount/InfoPanel.java ln -s ../../../src/bpm/library/beatsperminute/BeatsPerMinute.java ./examples/BPM_Timings/colorPalettes/BeatsPerMinute.java diff --git a/resources/build.properties b/resources/build.properties index 52ea3f3..434474e 100644 --- a/resources/build.properties +++ b/resources/build.properties @@ -132,12 +132,12 @@ source.repository=https://github.com/vincentsijben/bpm-tmings-for-processing.git # This is used to compare different versions of the same Library, and check if # an update is available. -library.version=17 +library.version=18 # The version as the user will see it. -library.prettyVersion=1.2.3 +library.prettyVersion=1.2.4 # The min and max revision of Processing compatible with your Library. diff --git a/src/bpm/library/InfoPanel.java b/src/bpm/library/InfoPanel.java index 4ca691d..e60bec8 100644 --- a/src/bpm/library/InfoPanel.java +++ b/src/bpm/library/InfoPanel.java @@ -15,12 +15,13 @@ public class InfoPanel { private boolean keyPressedActionTaken; public boolean enableKeyPress; + public InfoPanel(PApplet parent) { this.parent = parent; this.x = 0; this.y = 0; this.w = parent.width; - this.h = 100; + this.h = 150; this.keyboardKey = 'i'; this.show = Boolean.FALSE; this.keyPressedActionTaken = false; diff --git a/src/bpm/library/arduinocontrols/ArduinoControls.java b/src/bpm/library/arduinocontrols/ArduinoControls.java index f1cbde0..fd97abe 100644 --- a/src/bpm/library/arduinocontrols/ArduinoControls.java +++ b/src/bpm/library/arduinocontrols/ArduinoControls.java @@ -292,28 +292,31 @@ public void draw() { // popMatrix in registermethod draw() this.parent.popMatrix(); this.parent.popStyle(); - this.parent.hint(PConstants.DISABLE_DEPTH_TEST); - if (this.infoPanel.show) { - //System.out.println(""+this.infoPanel.x + this.infoPanel.y + this.infoPanel.w + this.infoPanel.h); - boolean portrait = false; //this.infoPanelLocation[2] < this.infoPanelLocation[3]; + if (this.infoPanel.show) { + this.parent.hint(PConstants.DISABLE_DEPTH_TEST); + + // put the parents imageMode temporarily to CORNER + this.parent.pushStyle(); + this.parent.imageMode(PConstants.CORNER); + // + PGraphics overlay = this.infoPanel.overlay; overlay.beginDraw(); - overlay.background(0, 200); + overlay.background(0, 170); overlay.noStroke(); overlay.fill(255); - if (portrait) { - for (int i=0; i