diff options
-rw-r--r-- | src/com/jsyn/io/AudioFifo.java | 23 | ||||
-rw-r--r-- | src/com/jsyn/unitgen/FilterLowPass.java | 12 | ||||
-rw-r--r-- | src/com/jsyn/unitgen/FilterStateVariable.java | 9 | ||||
-rw-r--r-- | tests/com/jsyn/engine/TestFifo.java | 6 |
4 files changed, 26 insertions, 24 deletions
diff --git a/src/com/jsyn/io/AudioFifo.java b/src/com/jsyn/io/AudioFifo.java index 889bacc..0c563e4 100644 --- a/src/com/jsyn/io/AudioFifo.java +++ b/src/com/jsyn/io/AudioFifo.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,7 +23,7 @@ import java.util.concurrent.locks.ReentrantLock; /** * FIFO that implements AudioInputStream, AudioOutputStream interfaces. This can be used to send * audio data between different threads. The reads or writes may or may not wait based on flags. - * + * * @author Phil Burk (C) 2010 Mobileer Inc */ public class AudioFifo implements AudioInputStream, AudioOutputStream { @@ -38,8 +38,8 @@ public class AudioFifo implements AudioInputStream, AudioOutputStream { private boolean writeWaitEnabled = true; private boolean readWaitEnabled = true; final Lock lock = new ReentrantLock(); - final Condition notFull = lock.newCondition(); - final Condition notEmpty = lock.newCondition(); + final Condition notFull = lock.newCondition(); + final Condition notEmpty = lock.newCondition(); /** * @param size Number of doubles in the FIFO. Must be a power of 2. Eg. 1024. @@ -75,7 +75,7 @@ public class AudioFifo implements AudioInputStream, AudioOutputStream { @Override public double read() { double value = Double.NaN; - if (readWaitEnabled) { + if (readWaitEnabled) { lock.lock(); try { while (available() < 1) { @@ -89,19 +89,19 @@ public class AudioFifo implements AudioInputStream, AudioOutputStream { } finally { lock.unlock(); } - + } else { if (readIndex != writeIndex) { value = readOneInternal(); } } - + if (writeWaitEnabled) { lock.lock(); notFull.signal(); lock.unlock(); } - + return value; } @@ -128,13 +128,13 @@ public class AudioFifo implements AudioInputStream, AudioOutputStream { } finally { lock.unlock(); } - + } else { if (available() != buffer.length) { writeOneInternal(value); } } - + if (readWaitEnabled) { lock.lock(); notEmpty.signal(); @@ -201,5 +201,4 @@ public class AudioFifo implements AudioInputStream, AudioOutputStream { public boolean isReadWaitEnabled() { return readWaitEnabled; } - } diff --git a/src/com/jsyn/unitgen/FilterLowPass.java b/src/com/jsyn/unitgen/FilterLowPass.java index 93d58f2..f9b350f 100644 --- a/src/com/jsyn/unitgen/FilterLowPass.java +++ b/src/com/jsyn/unitgen/FilterLowPass.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. @@ -15,7 +15,7 @@ */ /** * Aug 21, 2009 - * com.jsyn.engine.units.Filter_HighPass.java + * com.jsyn.engine.units.Filter_HighPass.java */ package com.jsyn.unitgen; @@ -23,14 +23,16 @@ package com.jsyn.unitgen; /** * Filter that allows frequencies below the center frequency to pass. This filter is based on the * BiQuad filter. Coefficients are updated whenever the frequency or Q changes. - * + * * @author Phil Burk (C) 2009 Mobileer Inc Translated from 'C' to Java by Lisa * Tolenti. + * + * @see FilterFourPoles */ public class FilterLowPass extends FilterBiquadCommon { /** - * This method is by Filter_Biquad to update coefficients for the Filter_LowPass filter. + * This method is by FilterBiquad to update coefficients for the lowpass filter. */ @Override public void updateCoefficients() { diff --git a/src/com/jsyn/unitgen/FilterStateVariable.java b/src/com/jsyn/unitgen/FilterStateVariable.java index 751b3ae..74dde5e 100644 --- a/src/com/jsyn/unitgen/FilterStateVariable.java +++ b/src/com/jsyn/unitgen/FilterStateVariable.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,17 +23,18 @@ import com.jsyn.ports.UnitOutputPort; * A versatile filter described in Hal Chamberlain's "Musical Applications of MicroProcessors". It * is convenient because its frequency and resonance can each be controlled by a single value. The * "output" port of this filter is the "lowPass" output multiplied by the "amplitude" - * + * * @author Phil Burk (C) 2009 Mobileer Inc * @see FilterLowPass * @see FilterHighPass + * @see FilterFourPoles */ public class FilterStateVariable extends TunableFilter { /** * Amplitude of Output in the range of 0.0 to 1.0. SIGNAL_TYPE_RAW_SIGNED Defaults to 1.0 * <P> * Note that the amplitude only affects the "output" port and not the lowPass, bandPass or - * highPass signals. Use a MultiplyUnit if you need to scale those signals. + * highPass signals. Use a Multiply unit if you need to scale those signals. */ public UnitInputPort amplitude; diff --git a/tests/com/jsyn/engine/TestFifo.java b/tests/com/jsyn/engine/TestFifo.java index cc539d1..03333bf 100644 --- a/tests/com/jsyn/engine/TestFifo.java +++ b/tests/com/jsyn/engine/TestFifo.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. @@ -216,7 +216,7 @@ public class TestFifo extends TestCase { watchdog.interrupt(); } - + public void testBlockReadAndWriteWaitStress() { final int chunk = 10000000; // 10 Megabytes final AudioFifo fifo = new AudioFifo(); |