/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* LFO control signal generator.
*
* @author Karl Helgason
*/
public SoftLowFrequencyOscillator() {
// If sin_step is 0 then sin_stepfreq must be -INF
}
}
public void reset() {
for (int i = 0; i < used_count; i++) {
delay_counter[i] = 0;
sin_phase[i] = 0;
// If sin_step is 0 then sin_stepfreq must be -INF
sin_step[i] = 0;
}
used_count = 0;
}
for (int i = 0; i < used_count; i++) {
}
}
public void processControlLogic() {
for (int i = 0; i < used_count; i++) {
if (delay_counter[i] > 0) {
delay_counter[i]--;
} else {
double f = freq[i][0];
if (sin_stepfreq[i] != f) {
sin_stepfreq[i] = f;
}
/*
double fr = 440.0 * Math.pow(2.0,
(freq[i][0] - 6900.0) / 1200.0);
sin_phase[i] += fr * sin_factor;
*/
/*
sin_phase[i] += sin_step[i];
while (sin_phase[i] > PI2)
sin_phase[i] -= PI2;
out[i][0] = 0.5 + Math.sin(sin_phase[i]) * 0.5;
*/
double p = sin_phase[i];
p += sin_step[i];
while (p > PI2)
p -= PI2;
sin_phase[i] = p;
}
}
}
if (instance >= used_count)
return null;
}
}