Java Code Examples for com.sun.media.sound.SoftLowFrequencyOscillator#processControlLogic()

The following examples show how to use com.sun.media.sound.SoftLowFrequencyOscillator#processControlLogic() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestProcessControlLogic.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 2
Source File: TestProcessControlLogic.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 3
Source File: TestProcessControlLogic.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 4
Source File: TestProcessControlLogic.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 5
Source File: TestProcessControlLogic.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 6
Source File: TestProcessControlLogic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 7
Source File: TestProcessControlLogic.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 8
Source File: TestProcessControlLogic.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 9
Source File: TestProcessControlLogic.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 10
Source File: TestProcessControlLogic.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 11
Source File: TestProcessControlLogic.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 12
Source File: TestProcessControlLogic.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}
 
Example 13
Source File: TestProcessControlLogic.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void testLFO(boolean shared, int instance, float freq, float delay,
        float delay2) throws Exception {
    SoftLowFrequencyOscillator lfo =
        shared?TestProcessControlLogic.lfo:new SoftLowFrequencyOscillator();
    lfo.reset();
    double[] lfo_freq = lfo.get(instance, "freq");
    double[] lfo_delay = lfo.get(instance, "delay");
    double[] lfo_delay2 = lfo.get(instance, "delay2");
    double[] lfo_output = lfo.get(instance, null);
    lfo_freq[0] = freq;
    lfo_delay[0] = delay;
    lfo_delay2[0] = delay2;
    lfo.init(synth);

    // For delayCount amount time, the output LFO should be 0.5
    int delayCount = (int) ((Math.pow(2, delay / 1200.0) * control_rate));
    delayCount += (int) ((delay2 * control_rate) / 1000.0);
    for (int i = 0; i < delayCount; i++) {
        if (Math.abs(0.5 - lfo_output[0]) > 0.000001)
            throw new Exception("Incorrect LFO output ("
                    +"0.5 != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

    // After the delay the LFO should start oscillate
    // Let make sure output is accurate enough
    double p_step = (440.0 / control_rate)
    * Math.exp((freq - 6900.0) * (Math.log(2) / 1200.0));
    double p = 0;
    for (int i = 0; i < 30; i++) {
        p += p_step;
        double predicted_output = 0.5 + Math.sin(p * 2 * Math.PI) * 0.5;
        if (Math.abs(predicted_output - lfo_output[0]) > 0.001)
            throw new Exception("Incorrect LFO output ("
                    +predicted_output+" != "+lfo_output[0]+")!");
        lfo.processControlLogic();
    }

}