diff --git a/src/processing/sound/Amplitude.java b/src/processing/sound/Amplitude.java index 0ba0d33..ddfee84 100644 --- a/src/processing/sound/Amplitude.java +++ b/src/processing/sound/Amplitude.java @@ -31,11 +31,11 @@ Processing Sound (c) 2013-2015 Wilm Thoben */ public class Amplitude { - + PApplet parent; private Engine m_engine; private long ptr; - + public Amplitude(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); @@ -51,25 +51,25 @@ public Amplitude(PApplet theParent) { public void input(SoundObject input){ ptr = m_engine.amplitude(input.returnId()); } - + /** - * Queries a value from the analyzer and returns a float between 0. and 1. - * @webref sound + * Queries a value from the analyzer and returns a float between 0. and 1. + * @webref sound * @return amp An amplitude value between 0-1. **/ public float analyze(){ return m_engine.poll_amplitude(ptr); } - + // public void stop(){ - // m_engine.synthStop(m_nodeId); + // m_engine.synthStop(m_nodeId); // } - + // public int returnId(){ // return m_nodeId; // } - + public void dispose() { m_engine.destroy_amplitude(ptr); //m_engine.synthStop(m_nodeId); diff --git a/src/processing/sound/SawOsc.java b/src/processing/sound/SawOsc.java index b4126e8..c2fb5fb 100644 --- a/src/processing/sound/SawOsc.java +++ b/src/processing/sound/SawOsc.java @@ -19,77 +19,77 @@ Processing Sound (c) 2013-2015 Wilm Thoben Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + package processing.sound; import processing.core.PApplet; /** -* This is a simple Saw Wave Oscillator +* This is a simple Saw Wave Oscillator * @webref sound * @param parent PApplet: typically use "this" **/ public class SawOsc implements Oscillator{ - + PApplet parent; private Engine m_engine; private int[] m_nodeId = {-1,-1}; - + private int[] m_freqId = {-1,-1}; private int[] m_ampId = {-1,-1}; private int[] m_addId = {-1,-1}; private int[] m_posId = {-1,-1}; - + private float m_freq = 440; private float m_amp = 0.5f; private float m_add = 0; private float m_pos = 0; - private int m_panBusId; - + private int m_panBusId; + public SawOsc(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); m_engine.setPreferences(theParent, 512, 44100); - m_engine.start(); - m_panBusId = m_engine.busConstructMono(); + m_engine.start(); + m_panBusId = m_engine.busConstructMono(); } - + public void play(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; m_nodeId = m_engine.sawPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + public void play(float freq, float amp, float add){ m_freq=freq; m_amp=amp; m_add=add; m_nodeId = m_engine.sawPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + public void play(float freq, float amp){ m_freq=freq; m_amp=amp; m_nodeId = m_engine.sawPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + /** * Starts the oscillator * @webref sound **/ - + public void play(){ m_nodeId = m_engine.sawPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + private void set(){ if(m_nodeId[0] != -1 ) { m_engine.oscSet(m_freq, m_amp, m_add, m_pos, m_nodeId); - } + } } private void audioSet(){ if(m_nodeId[0] != -1 ) { m_engine.oscAudioSet(m_freqId, m_ampId, m_addId, m_posId, m_nodeId); - } + } } - + /** * Set multiple parameters at once * @webref sound @@ -103,9 +103,9 @@ public void set(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.set(); } - + /** - * Set the freuquency of the oscillator in Hz. + * Set the frequency of the oscillator in Hz. * @webref sound * @param freq A floating point value of the oscillator in Hz. **/ @@ -118,7 +118,7 @@ public void freq(float freq){ public void freq(SoundObject freq){ m_freqId=freq.returnId(); this.audioSet(); - } + } /** * Set the amplitude/volume of the oscillator @@ -134,35 +134,35 @@ public void amp(float amp){ public void amp(SoundObject amp){ m_ampId=amp.returnId(); this.audioSet(); - } + } /** * Offset the output of the oscillator by given value * @webref sound * @param add A value for modulating other audio signals. - **/ + **/ public void add(float add){ m_add=add; this.set(); } - + public void add(SoundObject add){ m_addId=add.returnId(); this.audioSet(); - } + } /** * Move the sound in a stereo panorama * @webref sound * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. - **/ + **/ public void pan(float pos){ m_pos=pos; this.set(); } - + public void pan(SoundObject pos){ m_posId=pos.returnId(); this.audioSet(); @@ -181,7 +181,7 @@ public void stop(){ } } } - + public int[] returnId(){ return m_nodeId; } diff --git a/src/processing/sound/SinOsc.java b/src/processing/sound/SinOsc.java index 63a315a..7893d6a 100644 --- a/src/processing/sound/SinOsc.java +++ b/src/processing/sound/SinOsc.java @@ -24,13 +24,13 @@ Processing Sound (c) 2013-2015 Wilm Thoben import processing.core.PApplet; /** -* This is a simple Sine Wave Oscillator +* This is a simple Sine Wave Oscillator * @webref sound * @param parent PApplet: typically use "this" **/ public class SinOsc implements Oscillator { - + PApplet parent; private Engine m_engine; private int[] m_nodeId = {-1,-1}; @@ -38,32 +38,32 @@ public class SinOsc implements Oscillator { private float m_amp = 0.5f; private float m_add = 0; private float m_pos = 0; - private int m_panBusId; - + private int m_panBusId; + public SinOsc(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); m_engine.setPreferences(theParent, 512, 44100); - m_engine.start(); + m_engine.start(); m_panBusId = m_engine.busConstructMono(); - + } - + public void play(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.play(); } - + public void play(float freq, float amp, float add){ m_freq=freq; m_amp=amp; m_add=add; this.play(); } - + public void play(float freq, float amp){ m_freq=freq; m_amp=amp; this.play(); } - + /** * Starts the oscillator * @webref sound @@ -72,11 +72,11 @@ public void play(float freq, float amp){ public void play(){ m_nodeId = m_engine.sinePlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + private void set(){ if(m_nodeId[0] != -1 ) { m_engine.oscSet(m_freq, m_amp, m_add, m_pos, m_nodeId); - } + } } /** @@ -87,14 +87,14 @@ private void set(){ * @param add A value for modulating other audio signals. * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. **/ - + public void set(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.set(); } - + /** - * Set the freuquency of the oscillator in Hz. + * Set the frequency of the oscillator in Hz. * @webref sound * @param freq A floating point value of the oscillator in Hz. **/ @@ -114,34 +114,34 @@ public void amp(float amp){ m_amp=amp; this.set(); } - + /** * Offset the output of the oscillator by given value * @webref sound * @param add A value for modulating other audio signals. - **/ + **/ public void add(float add){ m_add=add; this.set(); } - + /** * Move the sound in a stereo panorama * @webref sound * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. - **/ + **/ public void pan(float pos){ m_pos=pos; this.set(); } - + /** * Stop the oscillator. * @webref sound **/ - + public void stop(){ if(m_nodeId[0] != -1 ) { m_engine.synthStop(m_nodeId); @@ -150,7 +150,7 @@ public void stop(){ } } } - + public int[] returnId(){ return m_nodeId; } diff --git a/src/processing/sound/SqrOsc.java b/src/processing/sound/SqrOsc.java index 26f6b1a..46e976d 100644 --- a/src/processing/sound/SqrOsc.java +++ b/src/processing/sound/SqrOsc.java @@ -24,13 +24,13 @@ Processing Sound (c) 2013-2015 Wilm Thoben import processing.core.PApplet; /** -* This is a simple Square Wave Oscillator +* This is a simple Square Wave Oscillator * @webref sound * @param parent PApplet: typically use "this" **/ public class SqrOsc implements SoundObject { - + PApplet parent; private Engine m_engine; private int[] m_nodeId = {-1,-1}; @@ -39,7 +39,7 @@ public class SqrOsc implements SoundObject { private float m_add = 0; private float m_pos = 0; private int m_panBusId; - + public SqrOsc(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); @@ -47,7 +47,7 @@ public SqrOsc(PApplet theParent) { m_engine.start(); m_panBusId = m_engine.busConstructMono(); } - + /** * Starts the oscillator * @webref sound @@ -56,32 +56,32 @@ public SqrOsc(PApplet theParent) { public void play(){ //m_nodeId = m_engine.pulsePlay(m_freq, 0.5f, m_amp*2, m_add-1, m_pos); m_nodeId = m_engine.sqrPlay(m_freq, m_amp, m_add-1, m_pos, m_panBusId); - }; - + }; + public void play(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.play(); }; - + public void play(float freq, float amp, float add){ m_freq=freq; m_amp=amp; m_add=add; this.play(); }; - + public void play(float freq, float amp){ m_freq=freq; m_amp=amp; this.play(); }; - + public void play(float freq){ - m_freq=freq; + m_freq=freq; this.play(); }; - + private void set(){ if(m_nodeId[0] != -1 ) { m_engine.sqrSet(m_freq, m_amp, m_add-1, m_pos, m_nodeId); - } + } } /** @@ -92,23 +92,23 @@ private void set(){ * @param add A value for modulating other audio signals. * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. **/ - + public void set(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.set(); }; - + /** - * Set the freuquency of the oscillator in Hz. + * Set the frequency of the oscillator in Hz. * @webref sound * @param freq A floating point value of the oscillator in Hz. **/ public void freq(float freq){ m_freq=freq; - this.set(); + this.set(); } - + /** * Set the amplitude/volume of the oscillator * @webref sound @@ -119,34 +119,34 @@ public void amp(float amp){ m_amp=amp; this.set(); } - + /** * Offset the output of the oscillator by given value * @webref sound * @param add A value for modulating other audio signals. - **/ + **/ public void add(float add){ m_add=add; this.set(); } - + /** * Move the sound in a stereo panorama * @webref sound * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. - **/ - + **/ + public void pan(float pos){ m_pos=pos; this.set(); } - + /** * Stop the oscillator. * @webref sound **/ - + public void stop(){ if(m_nodeId[0] != -1 ) { m_engine.synthStop(m_nodeId); @@ -155,14 +155,12 @@ public void stop(){ } } } - + public int[] returnId(){ return m_nodeId; } - + public void dispose(){ m_engine.synthStop(m_nodeId); } } - - diff --git a/src/processing/sound/TriOsc.java b/src/processing/sound/TriOsc.java index d6037d8..4be83b9 100644 --- a/src/processing/sound/TriOsc.java +++ b/src/processing/sound/TriOsc.java @@ -24,13 +24,13 @@ Processing Sound (c) 2013-2015 Wilm Thoben import processing.core.PApplet; /** -* This is a simple Triangle Wave Oscillator +* This is a simple Triangle Wave Oscillator * @webref sound * @param parent PApplet: typically use "this" **/ public class TriOsc implements Oscillator{ - + PApplet parent; private Engine m_engine; private int[] m_nodeId = {-1,-1}; @@ -38,31 +38,31 @@ public class TriOsc implements Oscillator{ private float m_amp = 0.5f; private float m_add = 0; private float m_pos = 0; - private int m_panBusId; + private int m_panBusId; public TriOsc(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); m_engine.setPreferences(theParent, 512, 44100); - m_engine.start(); + m_engine.start(); m_panBusId = m_engine.busConstructMono(); } - + public void play(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; m_nodeId = m_engine.triPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + public void play(float freq, float amp, float add){ m_freq=freq; m_amp=amp; m_add=add; m_nodeId = m_engine.triPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + public void play(float freq, float amp){ m_freq=freq; m_amp=amp; m_nodeId = m_engine.triPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + /** * Starts the oscillator * @webref sound @@ -71,13 +71,13 @@ public void play(float freq, float amp){ public void play(){ m_nodeId = m_engine.triPlay(m_freq, m_amp, m_add, m_pos, m_panBusId); } - + private void set(){ - if(m_nodeId[0] != -1 ) { + if(m_nodeId[0] != -1 ) { m_engine.oscSet(m_freq, m_amp, m_add, m_pos, m_nodeId); } } - + /** * Set multiple parameters at once * @webref sound @@ -91,9 +91,9 @@ public void set(float freq, float amp, float add, float pos){ m_freq=freq; m_amp=amp; m_add=add; m_pos=pos; this.set(); } - + /** - * Set the freuquency of the oscillator in Hz. + * Set the frequency of the oscillator in Hz. * @webref sound * @param freq A floating point value of the oscillator in Hz. **/ @@ -113,34 +113,34 @@ public void amp(float amp){ m_amp=amp; this.set(); } - + /** * Offset the output of the oscillator by given value * @webref sound * @param add A value for modulating other audio signals. - **/ + **/ public void add(float add){ m_add=add; this.set(); } - + /** * Move the sound in a stereo panorama * @webref sound * @param pos The panoramic position of the oscillator as a float from -1.0 to 1.0. - **/ + **/ public void pan(float pos){ m_pos=pos; this.set(); } - + /** * Stop the oscillator. * @webref sound **/ - + public void stop(){ if(m_nodeId[0] != -1 ) { m_engine.synthStop(m_nodeId); @@ -149,7 +149,7 @@ public void stop(){ } } } - + public int[] returnId(){ return m_nodeId; } diff --git a/src/processing/sound/WhiteNoise.java b/src/processing/sound/WhiteNoise.java index 0d64cc0..e179ed4 100644 --- a/src/processing/sound/WhiteNoise.java +++ b/src/processing/sound/WhiteNoise.java @@ -24,13 +24,13 @@ Processing Sound (c) 2013-2015 Wilm Thoben import processing.core.PApplet; /** -* This is a White Noise Generator. White Noise has a flat spectrum. +* This is a White Noise Generator. White Noise has a flat spectrum. * @webref sound -* @param parent PApplet: typically use "this" +* @param parent PApplet: typically use "this" **/ public class WhiteNoise implements Noise{ - + PApplet parent; private Engine m_engine; private int[] m_nodeId = {-1,-1}; @@ -39,15 +39,15 @@ public class WhiteNoise implements Noise{ private float m_pos=0; private int m_panBusId; - + public WhiteNoise(PApplet theParent) { this.parent = theParent; parent.registerMethod("dispose", this); m_engine.setPreferences(theParent, 512, 44100); - m_engine.start(); - m_panBusId = m_engine.busConstructMono(); + m_engine.start(); + m_panBusId = m_engine.busConstructMono(); } - + /** * Start the generator * @webref sound @@ -56,7 +56,7 @@ public WhiteNoise(PApplet theParent) { public void play(){ m_nodeId = m_engine.whiteNoisePlay(m_amp, m_add, m_pos, m_panBusId); } - + public void play(float amp, float add, float pos){ m_amp=amp; m_add=add; m_pos=pos; this.play(); @@ -66,18 +66,18 @@ public void play(float amp, float add){ m_amp=amp; m_add=add; this.play(); } - + public void play(float amp){ m_amp=amp; this.play(); } - + private void set(){ if(m_nodeId[0] != -1 ) { m_engine.whiteNoiseSet(m_amp, m_add, m_pos, m_nodeId); } } - + /** * Set multiple parameters at once. * @webref sound @@ -90,18 +90,18 @@ public void set(float amp, float add, float pos){ m_amp=amp; this.set(); } - + /** * Change the amplitude/volume of the generator * @webref sound * @param amp Amplitude value between 0.0 and 1.0. **/ - + public void amp(float amp){ m_amp=amp; this.set(); } - + /** * Offset the generator by a given Value * @webref sound @@ -112,23 +112,23 @@ public void add(float add){ m_add=add; this.set(); } - + /** * Move the sound in a stereo panorama * @webref sound * @param pos Pan the generator in stereo panorama. Allowed values are between -1.0 and 1.0. **/ - + public void pan(float pos){ m_pos=pos; this.set(); } - + /** * Stop the generator * @webref sound **/ - + public void stop(){ if(m_nodeId[0] != -1 ) { m_engine.synthStop(m_nodeId); @@ -137,7 +137,7 @@ public void stop(){ } } } - + public int[] returnId(){ return m_nodeId; } @@ -146,4 +146,3 @@ public void dispose() { m_engine.synthStop(m_nodeId); } }; - \ No newline at end of file