aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/jsyn/JSyn.java6
-rw-r--r--src/com/jsyn/Synthesizer.java2
-rw-r--r--src/com/jsyn/ports/UnitDataQueuePort.java14
-rw-r--r--src/com/jsyn/swing/ASCIIMusicKeyboard.java34
-rw-r--r--src/com/jsyn/swing/EnvelopeEditorBox.java13
-rw-r--r--src/com/jsyn/swing/RotaryController.java20
-rw-r--r--src/com/jsyn/swing/XYController.java10
-rw-r--r--src/com/jsyn/unitgen/ChannelIn.java8
-rw-r--r--src/com/jsyn/unitgen/Compare.java10
-rw-r--r--src/com/jsyn/unitgen/FilterBiquad.java41
-rw-r--r--src/com/jsyn/unitgen/FourWayFade.java24
-rw-r--r--src/com/jsyn/unitgen/GrainFarm.java14
-rw-r--r--src/com/jsyn/unitgen/Latch.java12
-rw-r--r--src/com/jsyn/unitgen/LineIn.java8
-rw-r--r--src/com/jsyn/unitgen/Pan.java8
-rw-r--r--src/com/jsyn/unitgen/SampleGrainFarm.java22
-rw-r--r--src/com/jsyn/unitgen/Select.java15
-rw-r--r--src/com/jsyn/unitgen/UnitGenerator.java24
-rw-r--r--src/com/jsyn/unitgen/VariableRateMonoReader.java14
-rw-r--r--src/com/jsyn/util/SampleLoader.java19
-rw-r--r--src/com/softsynth/math/Polynomial.java18
-rw-r--r--src/com/softsynth/math/PrimeFactors.java16
-rw-r--r--src/com/softsynth/shared/time/TimeStamp.java8
23 files changed, 192 insertions, 168 deletions
diff --git a/src/com/jsyn/JSyn.java b/src/com/jsyn/JSyn.java
index 6185bb0..e42d141 100644
--- a/src/com/jsyn/JSyn.java
+++ b/src/com/jsyn/JSyn.java
@@ -24,7 +24,9 @@ import com.jsyn.engine.SynthesisEngine;
/**
* JSyn Synthesizer for Java. Use this factory class to create a synthesizer. This code demonstrates
- * how to start playing a sine wave: <code><pre>
+ * how to start playing a sine wave:
+ *
+ * <pre><code>
// Create a context for the synthesizer.
synth = JSyn.createSynthesizer();
@@ -46,7 +48,7 @@ import com.jsyn.engine.SynthesisEngine;
// We only need to start the LineOut. It will pull data from the oscillator.
lineOut.start();
- </pre></code>
+</code> </pre>
*
* @author Phil Burk (C) 2010 Mobileer Inc
*/
diff --git a/src/com/jsyn/Synthesizer.java b/src/com/jsyn/Synthesizer.java
index ca23ee8..784b355 100644
--- a/src/com/jsyn/Synthesizer.java
+++ b/src/com/jsyn/Synthesizer.java
@@ -185,7 +185,7 @@ public interface Synthesizer {
* This task must be very quick and should not perform any blocking operations. If you are not
* certain that you need an Audio rate task then don't use this.
*
- * @param blockTask
+ * @param task
*/
public void addAudioTask(Runnable task);
diff --git a/src/com/jsyn/ports/UnitDataQueuePort.java b/src/com/jsyn/ports/UnitDataQueuePort.java
index 0c88711..f96e12a 100644
--- a/src/com/jsyn/ports/UnitDataQueuePort.java
+++ b/src/com/jsyn/ports/UnitDataQueuePort.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,11 +25,11 @@ import com.softsynth.shared.time.TimeStamp;
/**
* Queue for SequentialData, samples or envelopes
- *
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
*/
public class UnitDataQueuePort extends UnitPort {
- private LinkedList<QueuedBlock> blocks = new LinkedList<QueuedBlock>();
+ private final LinkedList<QueuedBlock> blocks = new LinkedList<QueuedBlock>();
private QueueDataCommand currentBlock;
private int frameIndex;
private int numChannels = 1;
@@ -330,7 +330,7 @@ public class UnitDataQueuePort extends UnitPort {
/**
* Queue entire amount of data with no options.
- *
+ *
* @param queueableData
*/
public void queue(SequentialData queueableData) {
@@ -391,8 +391,8 @@ public class UnitDataQueuePort extends UnitPort {
/**
* Convenience method that will queue the decay portion of a SequentialData object, or the gap
* and release loop portions if they exist. This could be used to implement a NoteOff method.
- *
- * @ifStop Will setAutostop(true) if release portion queued without a release loop. This will
+ *
+ * @param ifStop Will setAutostop(true) if release portion queued without a release loop. This will
* stop execution of the unit.
*/
public void queueOff(SequentialData queueableData, boolean ifStop, TimeStamp timeStamp) {
diff --git a/src/com/jsyn/swing/ASCIIMusicKeyboard.java b/src/com/jsyn/swing/ASCIIMusicKeyboard.java
index 40f7792..f1379d8 100644
--- a/src/com/jsyn/swing/ASCIIMusicKeyboard.java
+++ b/src/com/jsyn/swing/ASCIIMusicKeyboard.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,25 +30,25 @@ import javax.swing.JPanel;
/**
* Support for playing musical scales on the ASCII keyboard of a computer. Has a Sustain checkbox
* that simulates a sustain pedal. Auto-repeat keys are detected and suppressed.
- *
+ *
* @author Phil Burk (C) 2012 Mobileer Inc
*/
@SuppressWarnings("serial")
public abstract class ASCIIMusicKeyboard extends JPanel {
- private JCheckBox sustainBox;
- private JButton focusButton;
+ private final JCheckBox sustainBox;
+ private final JButton focusButton;
public static final String PENTATONIC_KEYS = "zxcvbasdfgqwert12345";
public static final String SEPTATONIC_KEYS = "zxcvbnmasdfghjqwertyu1234567890";
private String keyboardLayout = SEPTATONIC_KEYS; /* default music keyboard layout */
private int basePitch = 48;
- private KeyListener keyListener;
- private JLabel countLabel;
+ private final KeyListener keyListener;
+ private final JLabel countLabel;
private int onCount;
private int offCount;
private int pressedCount;
private int releasedCount;
- private HashSet<Integer> pressedKeys = new HashSet<Integer>();
- private HashSet<Integer> onKeys = new HashSet<Integer>();
+ private final HashSet<Integer> pressedKeys = new HashSet<Integer>();
+ private final HashSet<Integer> onKeys = new HashSet<Integer>();
public ASCIIMusicKeyboard() {
focusButton = new JButton("Click here to play ASCII keys.");
@@ -143,15 +143,15 @@ public abstract class ASCIIMusicKeyboard extends JPanel {
/**
* This will be called when a key is released. It may also be called for sustaining notes when
* the Sustain check box is turned off.
- *
- * @param pitch
+ *
+ * @param keyIndex
*/
public abstract void keyOff(int keyIndex);
/**
* This will be called when a key is pressed.
- *
- * @param pitch
+ *
+ * @param keyIndex
*/
public abstract void keyOn(int keyIndex);
@@ -160,9 +160,11 @@ public abstract class ASCIIMusicKeyboard extends JPanel {
}
/**
- * Specify the keys that will be active for music. If the first character in the layout is
+ * Specify the keys that will be active for music.
+ * For example "qwertyui".
+ * If the first character in the layout is
* pressed then keyOn() will be called with 0. Default is SEPTATONIC_KEYS.
- *
+ *
* @param keyboardLayout defines order of playable keys
*/
public void setKeyboardLayout(String keyboardLayout) {
@@ -175,7 +177,7 @@ public abstract class ASCIIMusicKeyboard extends JPanel {
/**
* Define offset used by convertIndexToPitch().
- *
+ *
* @param basePitch
*/
public void setBasePitch(int basePitch) {
diff --git a/src/com/jsyn/swing/EnvelopeEditorBox.java b/src/com/jsyn/swing/EnvelopeEditorBox.java
index b7b224a..44fe53c 100644
--- a/src/com/jsyn/swing/EnvelopeEditorBox.java
+++ b/src/com/jsyn/swing/EnvelopeEditorBox.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,11 +23,16 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
+import com.jsyn.data.SegmentedEnvelope;
+import com.jsyn.unitgen.VariableRateDataReader;
+
/**
* Edit a list of ordered duration,value pairs suitable for use with a SegmentedEnvelope.
- *
+ *
* @author (C) 1997-2013 Phil Burk, SoftSynth.com
- * @see SynthEnvelope
+ * @see EnvelopePoints
+ * @see SegmentedEnvelope
+ * @see VariableRateDataReader
*/
/* ========================================================================== */
diff --git a/src/com/jsyn/swing/RotaryController.java b/src/com/jsyn/swing/RotaryController.java
index 87f1d34..6cc84f3 100644
--- a/src/com/jsyn/swing/RotaryController.java
+++ b/src/com/jsyn/swing/RotaryController.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,22 +32,22 @@ import javax.swing.event.ChangeListener;
/**
* Rotary controller looks like a knob on a synthesizer. You control this knob by clicking on it and
- * dragging <b>up</b> or down</b>. If you move the mouse to the <b>left</b> of the knob then you
+ * dragging <b>up</b> or <b>down</b>. If you move the mouse to the <b>left</b> of the knob then you
* will have <b>coarse</b> control. If you move the mouse to the <b>right</b> of the knob then you
* will have <b>fine</b> control.
* <P>
- *
+ *
* @author (C) 2010 Phil Burk, Mobileer Inc
* @version 16.1
*/
public class RotaryController extends JPanel {
private static final long serialVersionUID = 6681532871556659546L;
private static final double SENSITIVITY = 0.01;
- private BoundedRangeModel model;
+ private final BoundedRangeModel model;
- private double minAngle = 1.4 * Math.PI;
- private double maxAngle = -0.4 * Math.PI;
- private double unitIncrement = 0.01;
+ private final double minAngle = 1.4 * Math.PI;
+ private final double maxAngle = -0.4 * Math.PI;
+ private final double unitIncrement = 0.01;
private int lastY;
private int startX;
private Color knobColor = Color.LIGHT_GRAY;
@@ -109,7 +109,7 @@ public class RotaryController extends JPanel {
/**
* A fractional value is useful for drawing.
- *
+ *
* @return model value as a normalized fraction between 0.0 and 1.0
*/
public double getFractionFromModel() {
@@ -235,7 +235,7 @@ public class RotaryController extends JPanel {
/**
* Override this method if you want to draw your own knob.
- *
+ *
* @param g graphics context
* @param x position of center of knob
* @param y position of center of knob
diff --git a/src/com/jsyn/swing/XYController.java b/src/com/jsyn/swing/XYController.java
index b9cf90a..0d97c62 100644
--- a/src/com/jsyn/swing/XYController.java
+++ b/src/com/jsyn/swing/XYController.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@ import javax.swing.JPanel;
/**
* Root class for 2 dimensional X,Y controller for wave editors, Theremins, etc. Maps pixel
* coordinates into "world" coordinates.
- *
+ *
* @author (C) 1997 Phil Burk, SoftSynth.com
*/
@@ -111,7 +111,7 @@ public class XYController extends JPanel {
return height - (int) (((wy - minWorldY) * height) / (maxWorldY - minWorldY));
}
- /** Clip wx to the min & max World X values. */
+ /** Clip wx to the min and max World X values. */
public double clipWorldX(double wx) {
if (wx < minWorldX)
wx = minWorldX;
@@ -120,7 +120,7 @@ public class XYController extends JPanel {
return wx;
}
- /** Clip wy to the min & max World Y values. */
+ /** Clip wy to the min and max World Y values. */
public double clipWorldY(double wy) {
if (wy < minWorldY)
wy = minWorldY;
diff --git a/src/com/jsyn/unitgen/ChannelIn.java b/src/com/jsyn/unitgen/ChannelIn.java
index e42c06a..0d8584e 100644
--- a/src/com/jsyn/unitgen/ChannelIn.java
+++ b/src/com/jsyn/unitgen/ChannelIn.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,8 +20,8 @@ import com.jsyn.ports.UnitOutputPort;
/**
* Provides access to one specific channel of the audio input. For ChannelIn to work you must call
- * the Synthesizer start() method with numInputChannels > 0.
- *
+ * the Synthesizer start() method with numInputChannels &gt; 0.
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
* @see ChannelOut
* @see LineIn
diff --git a/src/com/jsyn/unitgen/Compare.java b/src/com/jsyn/unitgen/Compare.java
index 4d55740..7de2e53 100644
--- a/src/com/jsyn/unitgen/Compare.java
+++ b/src/com/jsyn/unitgen/Compare.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,9 +17,9 @@
package com.jsyn.unitgen;
/**
- *
- Output 1.0 if inputA > inputB. Otherwise output 0.0.
- *
+ *
+ Output 1.0 if inputA &gt; inputB. Otherwise output 0.0.
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
* @version 016
* @see Maximum
diff --git a/src/com/jsyn/unitgen/FilterBiquad.java b/src/com/jsyn/unitgen/FilterBiquad.java
index 5e5d508..f9b792f 100644
--- a/src/com/jsyn/unitgen/FilterBiquad.java
+++ b/src/com/jsyn/unitgen/FilterBiquad.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,13 +20,13 @@ import com.jsyn.ports.UnitInputPort;
/**
* Base class for a set of IIR filters.
- *
+ *
* @author Phil Burk (C) 2011 Mobileer Inc
* @see FilterBandStop
* @see FilterBandPass
* @see FilterLowPass
* @see FilterHighPass
- * @see FilterTwoPoleTwoZero
+ * @see FilterTwoPolesTwoZeros
*/
public abstract class FilterBiquad extends TunableFilter {
public UnitInputPort amplitude;
@@ -67,20 +67,29 @@ public abstract class FilterBiquad extends TunableFilter {
/**
* Each filter calls performBiquadFilter() through the generate(int, int) method. This method
* has converted Robert Bristow-Johnson's coefficients for the Direct I form in this way: Here
- * is the equation that JSyn uses for this filter: y(n) = A0*x(n) + A1*x(n-1) + A2*x(n-2) -
- * B1*y(n-1) - B2*y(n-2) Here is the equation that Robert Bristow-Johnson uses: y[n] =
- * (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2] So to
- * translate between JSyn coefficients and RBJ coefficients:
- *
+ * is the equation that JSyn uses for this filter:
+ *
+ * <pre>
+ * y(n) = A0*x(n) + A1*x(n-1) + A2*x(n-2) -vB1*y(n-1) - B2*y(n-2)
+ * </pre>
+ *
+ * Here is the equation that Robert Bristow-Johnson uses:
+ *
+ * <pre>
+ * y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
+ * </pre>
+ *
+ * So to translate between JSyn coefficients and RBJ coefficients:
+ *
* <pre>
- * JSyn => RBJ
- * A0 => b0/a0
- * A1 => b1/a0
- * A2 => b2/a0
- * B1 => a1/a0
- * B2 => a2/a0
+ * JSyn =&gt; RBJ
+ * A0 =&gt; b0/a0
+ * A1 =&gt; b1/a0
+ * A2 =&gt; b2/a0
+ * B1 =&gt; a1/a0
+ * B2 =&gt; a2/a0
* </pre>
- *
+ *
* @param start
* @param limit
*/
diff --git a/src/com/jsyn/unitgen/FourWayFade.java b/src/com/jsyn/unitgen/FourWayFade.java
index ac30739..c7fd22a 100644
--- a/src/com/jsyn/unitgen/FourWayFade.java
+++ b/src/com/jsyn/unitgen/FourWayFade.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@ import com.jsyn.ports.UnitOutputPort;
* Mix inputs 0-3 based on the value of two fade ports. You can think of the four inputs arranged
* clockwise as follows.
* <P>
- *
+ *
* <PRE>
* input[0] ---- input[1]
* | |
@@ -33,20 +33,20 @@ import com.jsyn.ports.UnitOutputPort;
* | |
* input[3] ---- input[2]
* </PRE>
- *
- * The "fade" port has two parts. Fade[0] fades between the pair of inputs (0&3) and the pair of
- * inputs (1&2). Fade[1] fades between the pair of inputs (0&1) and the pair of inputs (3&2).
- *
+ *
+ * The "fade" port has two parts. Fade[0] fades between the pair of inputs (0,3) and the pair of
+ * inputs (1,2). Fade[1] fades between the pair of inputs (0,1) and the pair of inputs (3,2).
+ *
* <PRE>
* Fade[0] Fade[1] Output
* -1 -1 Input[3]
* -1 +1 Input[0]
* +1 -1 Input[2]
* +1 +1 Input[1]
- *
- *
- * -----Fade[0]----->
- *
+ *
+ *
+ * -----Fade[0]-----&gt;
+ *
* A
* |
* |
@@ -55,7 +55,7 @@ import com.jsyn.ports.UnitOutputPort;
* |
* </PRE>
* <P>
- *
+ *
* @author (C) 1997-2009 Phil Burk, Mobileer Inc
*/
public class FourWayFade extends UnitGenerator {
diff --git a/src/com/jsyn/unitgen/GrainFarm.java b/src/com/jsyn/unitgen/GrainFarm.java
index 7cff6f1..78179bc 100644
--- a/src/com/jsyn/unitgen/GrainFarm.java
+++ b/src/com/jsyn/unitgen/GrainFarm.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,11 +24,13 @@ import com.jsyn.util.PseudoRandom;
* A unit generator that generates a cloud of sound using multiple Grains. Special thanks to my
* friend Ross Bencina for his excellent article on Granular Synthesis. Several of his ideas are
* reflected in this architecture. "Implementing Real-Time Granular Synthesis" by Ross Bencina,
- * Audio Anecdotes III, 2001. <code><pre>
+ * Audio Anecdotes III, 2001.
+ *
+ * <pre><code>
synth.add( sampleGrainFarm = new GrainFarm() );
grainFarm.allocate( NUM_GRAINS );
-</pre><code>
- *
+</code></pre>
+ *
* @author Phil Burk (C) 2011 Mobileer Inc
* @see Grain
* @see GrainSourceSine
@@ -48,7 +50,7 @@ public class GrainFarm extends UnitGenerator implements UnitSource {
PseudoRandom randomizer;
private GrainState[] states;
private double countScaler = 1.0;
- private GrainScheduler scheduler = new StochasticGrainScheduler();
+ private final GrainScheduler scheduler = new StochasticGrainScheduler();
public GrainFarm() {
randomizer = new PseudoRandom();
diff --git a/src/com/jsyn/unitgen/Latch.java b/src/com/jsyn/unitgen/Latch.java
index 5818101..0518f69 100644
--- a/src/com/jsyn/unitgen/Latch.java
+++ b/src/com/jsyn/unitgen/Latch.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,11 +20,11 @@ import com.jsyn.ports.UnitInputPort;
/**
* Latch or hold an input value.
- * <P>
+ * <p>
* Pass a value unchanged if gate true, otherwise output held value.
- * <P>
- * output = ( gate > 0.0 ) ? input : previous_output;
- *
+ * <p>
+ * output = ( gate &gt; 0.0 ) ? input : previous_output;
+ *
* @author (C) 1997-2010 Phil Burk, Mobileer Inc
* @see EdgeDetector
*/
diff --git a/src/com/jsyn/unitgen/LineIn.java b/src/com/jsyn/unitgen/LineIn.java
index 500b55c..aeef965 100644
--- a/src/com/jsyn/unitgen/LineIn.java
+++ b/src/com/jsyn/unitgen/LineIn.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,8 +22,8 @@ import com.jsyn.ports.UnitOutputPort;
/**
* External audio input is sent to the output of this unit. The LineIn provides a stereo signal
* containing channels 0 and 1. For LineIn to work you must call the Synthesizer start() method with
- * numInputChannels > 0.
- *
+ * numInputChannels &gt; 0.
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
* @see Synthesizer
* @see ChannelIn
diff --git a/src/com/jsyn/unitgen/Pan.java b/src/com/jsyn/unitgen/Pan.java
index 329342a..bc90984 100644
--- a/src/com/jsyn/unitgen/Pan.java
+++ b/src/com/jsyn/unitgen/Pan.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,9 +26,9 @@ import com.jsyn.ports.UnitOutputPort;
* is input, and output[1] is zero. When pan is 0, output[0] and output[1] are both input/2. When
* pan is +1, output[0] is zero, and output[1] is input.
* <P>
- *
+ *
* @author (C) 1997 Phil Burk, SoftSynth.com
- * @see SelectUnit
+ * @see Select
*/
public class Pan extends UnitGenerator {
public UnitInputPort input;
diff --git a/src/com/jsyn/unitgen/SampleGrainFarm.java b/src/com/jsyn/unitgen/SampleGrainFarm.java
index 93a694f..3f908d6 100644
--- a/src/com/jsyn/unitgen/SampleGrainFarm.java
+++ b/src/com/jsyn/unitgen/SampleGrainFarm.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,16 +21,18 @@ import com.jsyn.ports.UnitInputPort;
/**
* A GrainFarm that uses a FloatSample as source material. In this example we load a FloatSample for
- * use as a source material. <code><pre>
- synth.add( sampleGrainFarm = new SampleGrainFarm() );
+ * use as a source material.
+ *
+ * <pre><code>
+ synth.add(sampleGrainFarm = new SampleGrainFarm());
// Load a sample that we want to "granulate" from a file.
- sample = SampleLoader.loadFloatSample( sampleFile );
- sampleGrainFarm.setSample( sample );
+ sample = SampleLoader.loadFloatSample(sampleFile);
+ sampleGrainFarm.setSample(sample);
// Use a ramp to move smoothly within the file.
- synth.add( ramp = new ContinuousRamp() );
- ramp.output.connect( sampleGrainFarm.position );
-</pre><code>
- *
+ synth.add(ramp = new ContinuousRamp());
+ ramp.output.connect(sampleGrainFarm.position);
+</code></pre>
+ *
* @author Phil Burk (C) 2011 Mobileer Inc
*/
public class SampleGrainFarm extends GrainFarm {
diff --git a/src/com/jsyn/unitgen/Select.java b/src/com/jsyn/unitgen/Select.java
index 14186a8..6d8792e 100644
--- a/src/com/jsyn/unitgen/Select.java
+++ b/src/com/jsyn/unitgen/Select.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,12 +21,11 @@ import com.jsyn.ports.UnitOutputPort;
/**
* SelectUnit unit. Select InputA or InputB based on value on Select port.
- *
- * <pre>
- * output = ( select > 0.0 ) ? inputB : inputA;
- *
- * <pre>
- *
+ *
+ *<pre> <code>
+ output = ( select &gt; 0.0 ) ? inputB : inputA;
+</code> </pre>
+ *
* @author (C) 2004-2009 Phil Burk, SoftSynth.com
*/
diff --git a/src/com/jsyn/unitgen/UnitGenerator.java b/src/com/jsyn/unitgen/UnitGenerator.java
index 6d71270..a9a7459 100644
--- a/src/com/jsyn/unitgen/UnitGenerator.java
+++ b/src/com/jsyn/unitgen/UnitGenerator.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ import com.softsynth.shared.time.TimeStamp;
/**
* Base class for all unit generators.
- *
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
*/
public abstract class UnitGenerator {
@@ -39,12 +39,12 @@ public abstract class UnitGenerator {
public static final double FALSE = 0.0;
public static final double TRUE = 1.0;
protected SynthesisEngine synthesisEngine;
- private LinkedHashMap<String, UnitPort> ports = new LinkedHashMap<String, UnitPort>();
+ private final LinkedHashMap<String, UnitPort> ports = new LinkedHashMap<String, UnitPort>();
private Circuit circuit;
private long lastFrameCount;
private boolean enabled = true;
private static int nextId;
- private int id = nextId++;
+ private final int id = nextId++;
private int frameRate;
private double framePeriod;
@@ -85,7 +85,7 @@ public abstract class UnitGenerator {
/**
* Perform essential synthesis function.
- *
+ *
* @param start offset into port buffers
* @param limit limit offset into port buffers for loop
*/
@@ -213,9 +213,9 @@ public abstract class UnitGenerator {
* executed. If not enabled then it will not execute and will not pull data from units that are
* connected to its inputs. Disabling a unit at the output of a tree of units can be used to
* turn off the entire tree, thus saving CPU cycles.
- *
+ *
* @param enabled
- * @see UnitGate.setupAutoDisabled
+ * @see UnitGate#setupAutoDisable(UnitGenerator)
* @see start
*/
public void setEnabled(boolean enabled) {
@@ -232,7 +232,7 @@ public abstract class UnitGenerator {
* inputs. Those units will then pull data their inputs until the entire chain is executed. If
* units are connected in a circle then this will be detected and the infinite recursion will be
* blocked.
- *
+ *
* @see setEnabled
*/
public void start() {
@@ -245,7 +245,7 @@ public abstract class UnitGenerator {
/**
* Start a unit at the specified time.
- *
+ *
* @param time
* @see start
*/
@@ -255,7 +255,7 @@ public abstract class UnitGenerator {
/**
* Start a unit at the specified time.
- *
+ *
* @param timeStamp
* @see start
*/
@@ -269,7 +269,7 @@ public abstract class UnitGenerator {
/**
* Stop a unit at the specified time.
- *
+ *
* @param time
* @see start
*/
diff --git a/src/com/jsyn/unitgen/VariableRateMonoReader.java b/src/com/jsyn/unitgen/VariableRateMonoReader.java
index 3af660e..52b7f1e 100644
--- a/src/com/jsyn/unitgen/VariableRateMonoReader.java
+++ b/src/com/jsyn/unitgen/VariableRateMonoReader.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,11 +23,13 @@ import com.jsyn.ports.UnitOutputPort;
/**
* This reader can play any SequentialData and will interpolate between adjacent values. It can play
- * both {@link SegmentedEnvelope envelopes} and {@link FloatSample samples}. <code><pre>
+ * both {@link SegmentedEnvelope envelopes} and {@link FloatSample samples}.
+ *
+ * <pre><code>
// Queue an envelope to the dataQueue port.
- ampEnv.dataQueue.queue( ampEnvelope );
-</pre></code>
- *
+ ampEnv.dataQueue.queue(ampEnvelope);
+</code></pre>
+ *
* @author Phil Burk (C) 2009 Mobileer Inc
* @see FloatSample
* @see ShortSample
diff --git a/src/com/jsyn/util/SampleLoader.java b/src/com/jsyn/util/SampleLoader.java
index 611a7d6..170b4cb 100644
--- a/src/com/jsyn/util/SampleLoader.java
+++ b/src/com/jsyn/util/SampleLoader.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,14 +30,14 @@ import com.jsyn.util.soundfile.CustomSampleLoader;
* such as unsigned 8-bit, uLaw, A-Law and MP3 are not support. If you need to load one of those
* files try setJavaSoundPreferred(true). Or convert it to a supported format using Audacity or Sox
* or some other sample file tool. Here is an example of loading a sample from a file.
- *
+ *
* <pre>
* <code>
* File sampleFile = new File("guitar.wav");
* FloatSample sample = SampleLoader.loadFloatSample( sampleFile );
- * </code>
+ * </code>
* </pre>
- *
+ *
* @author Phil Burk (C) 2011 Mobileer Inc
*/
public class SampleLoader {
@@ -46,7 +46,7 @@ public class SampleLoader {
/**
* Try to create an implementation of AudioSampleLoader.
- *
+ *
* @return A device supported on this platform.
*/
private static AudioSampleLoader createLoader() {
@@ -97,8 +97,9 @@ public class SampleLoader {
* If set true then the audio file parser from JavaSound will be used. Note that JavaSound
* cannot load audio files containing floating point data. But it may be able to load some
* compressed data formats such as uLaw.
- *
- * @note JavaSound is not supported on Android.
+ *
+ * Note: JavaSound is not supported on Android.
+ *
* @param javaSoundPreferred
*/
public static void setJavaSoundPreferred(boolean javaSoundPreferred) {
@@ -108,7 +109,7 @@ public class SampleLoader {
/**
* Decode 24 bit samples from a BigEndian byte array into a float array. The samples will be
* normalized into the range -1.0 to +1.0.
- *
+ *
* @param audioBytes raw data from an audio file
* @param offset first element of byte array
* @param numBytes number of bytes to process
diff --git a/src/com/softsynth/math/Polynomial.java b/src/com/softsynth/math/Polynomial.java
index 8670e97..5f29f38 100644
--- a/src/com/softsynth/math/Polynomial.java
+++ b/src/com/softsynth/math/Polynomial.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,13 +23,13 @@ import java.util.Vector;
* Implement polynomial using Vector as coefficient holder. Element index is power of X, value at a
* given index is coefficient.<br>
* <br>
- *
+ *
* @author Nick Didkovsky, (C) 1997 Phil Burk and Nick Didkovsky
*/
public class Polynomial {
- private Vector terms;
+ private final Vector terms;
class DoubleHolder {
double value;
@@ -118,14 +118,14 @@ public class Polynomial {
return ((DoubleHolder) terms.elementAt(power)).get();
}
- /** @ return number of terms in this polynomial */
+ /** @return number of terms in this polynomial */
public int size() {
return terms.size();
}
/**
* Add two polynomials together
- *
+ *
* @return new Polynomial that is the sum of p1 and p2
*/
public static Polynomial plus(Polynomial p1, Polynomial p2) {
@@ -138,7 +138,7 @@ public class Polynomial {
/**
* Subtract polynomial from another. (First arg - Second arg)
- *
+ *
* @return new Polynomial p1 - p2
*/
public static Polynomial minus(Polynomial p1, Polynomial p2) {
@@ -151,7 +151,7 @@ public class Polynomial {
/**
* Multiply two Polynomials
- *
+ *
* @return new Polynomial that is the product p1 * p2
*/
@@ -167,7 +167,7 @@ public class Polynomial {
/**
* Multiply a Polynomial by a scaler
- *
+ *
* @return new Polynomial that is the product p1 * p2
*/
diff --git a/src/com/softsynth/math/PrimeFactors.java b/src/com/softsynth/math/PrimeFactors.java
index 5607951..06c0d55 100644
--- a/src/com/softsynth/math/PrimeFactors.java
+++ b/src/com/softsynth/math/PrimeFactors.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@ import java.util.ArrayList;
/**
* Tool for factoring primes and prime ratios. This class contains a static array of primes
* generated using the Sieve of Eratosthenes.
- *
+ *
* @author Phil Burk (C) 2011 Mobileer Inc
*/
public class PrimeFactors {
@@ -170,13 +170,13 @@ public class PrimeFactors {
/**
* Get prime from table.
- *
- * @warning Do not exceed getPrimeCount()-1.
- * @param i
+ *
+ *
+ * @param n Warning: Do not exceed getPrimeCount()-1.
* @return Nth prime number, the 0th prime is 2
*/
- public static int getPrime(int i) {
- return primes[i];
+ public static int getPrime(int n) {
+ return primes[n];
}
/**
diff --git a/src/com/softsynth/shared/time/TimeStamp.java b/src/com/softsynth/shared/time/TimeStamp.java
index fd054d2..6d243ed 100644
--- a/src/com/softsynth/shared/time/TimeStamp.java
+++ b/src/com/softsynth/shared/time/TimeStamp.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public class TimeStamp implements Comparable<TimeStamp> {
}
/**
- * @return -1 if (this < t2), 0 if equal, or +1
+ * @return -1 if (this &lt; t2), 0 if equal, or +1
*/
@Override
public int compareTo(TimeStamp t2) {
@@ -45,7 +45,7 @@ public class TimeStamp implements Comparable<TimeStamp> {
/**
* Create a new TimeStamp at a relative offset in seconds.
- *
+ *
* @param delta
* @return earlier or later TimeStamp
*/