当前位置: 首页>>代码示例>>Java>>正文


Java SynthesisEngine类代码示例

本文整理汇总了Java中com.jsyn.engine.SynthesisEngine的典型用法代码示例。如果您正苦于以下问题:Java SynthesisEngine类的具体用法?Java SynthesisEngine怎么用?Java SynthesisEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SynthesisEngine类属于com.jsyn.engine包,在下文中一共展示了SynthesisEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSet

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public void testSet() throws InterruptedException {
    SynthesisEngine synthesisEngine = new SynthesisEngine();
    synthesisEngine.setRealTime(false);
    synthesisEngine.start();
    synthesisEngine.sleepUntil(0.01);
    Minimum min;
    synthesisEngine.add(min = new Minimum());

    double x = 33.99;
    double y = 8.31;
    min.inputA.set(x);
    min.inputB.set(y);
    synthesisEngine.sleepFor(0.01);
    assertEquals("min set A", x, min.inputA.getValue());
    assertEquals("min set B", y, min.inputB.getValue());
    min.start();
    synthesisEngine.sleepFor(0.01);

    assertEquals("min output", y, min.output.getValue());
    synthesisEngine.stop();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:22,代码来源:TestSet.java

示例2: testSetBadPort

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
/** if we use a port index out of range we want to know now and not blow up the engine. */
public void testSetBadPort() throws InterruptedException {
    SynthesisEngine synthesisEngine = new SynthesisEngine();
    synthesisEngine.setRealTime(false);
    synthesisEngine.start();
    Minimum min;
    synthesisEngine.add(min = new Minimum());

    min.start();
    Exception caught = null;
    try {
        min.inputA.set(1, 23.45);
    } catch (Exception e) {
        caught = e;
    }
    assertTrue("Catch port out of range, caught " + caught,
            (caught instanceof ArrayIndexOutOfBoundsException));

    // Don't blow up here.
    synthesisEngine.sleepUntil(0.01);

    synthesisEngine.stop();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:24,代码来源:TestSet.java

示例3: testMix

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testMix() throws InterruptedException {
    sineOscillator.amplitude.set(3.0);
    sineOscillator.frequency.set(320.0);
    squareOscillator.amplitude.set(3.0);
    squareOscillator.frequency.set(80.0);
    triangleOscillator.amplitude.set(3.0);
    triangleOscillator.frequency.set(80.0);
    sawtoothOscillator.amplitude.set(3.0);
    sawtoothOscillator.frequency.set(80.0);
    //mixerStereo.addPort(sineOscillator.output);
    //mixerStereo.addPort(squareOscillator.output);
    //lineOut.input.connect(mixerStereo.output);
    synth.add(sineOscillator);
    synth.add(squareOscillator);
    synth.add(sawtoothOscillator);
    synth.add(triangleOscillator);
    synth.add(lineOut);

    add.inputA.connect(sineOscillator.output);
    add.inputB.connect(squareOscillator.output);
    add.inputA.connect(sawtoothOscillator.output);

    System.out.println(add.getPortByName("triangle") +", "+add.getPortByName("sine")+", "+add.getPortByName("square"));
    synth.add(add);
    add.start();
    //mixerStereo.activate();

    //vcoa.getOutputPlug().connect(vcoa1.getInputPlug());

    //out.activate();
    lineOut.getInput().connect(add.output);
    synth.start();
    lineOut.start();
    synth.sleepFor(5.0);
    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:38,代码来源:MixerGenerate.java

示例4: TestVcoaToVcoa

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestVcoaToVcoa() throws InterruptedException {
    out.getInput().connect(vcoa.getOutput());
    Vcoa vcoa1 = new Vcoa("VCOA1");
    vcoa1.setOscillatorType(OscillatorType.SINE);
    vcoa1.setAmplitudeSine(1.0);
    vcoa1.setExponentialFrequency(0.5);
    vcoa1.setLinearFrequency(0.5);
    vcoa1.getOutput().connect(vcoa.getFm());

    // to display curves
    //AudioScope scope = new AudioScope( synth );
    //scope.addProbe(vcoa.getTriangleOutput().getUnitOutputPort());
    //scope.setTriggerMode( AudioScope.TriggerMode.AUTO );
    //scope.getModel().getTriggerModel().getLevelModel().setDoubleValue( 0.0001 );
    //scope.getView().setControlsVisible(true);
    //scope.start();
    //JFrame frame = new JFrame();
    //frame.add(scope.getView());
    //frame.pack();
    //frame.setVisible(true);

    out.start();
    synth.start();
    synth.sleepUntil(5);
    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:28,代码来源:BasicChainTest.java

示例5: TestOutParameters

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestOutParameters() throws InterruptedException {
    out.getInput().connect(vcoa.getOutput());
    synth.start();
    out.start();
    synth.sleepUntil(3);
    out.getAmModulator().setValue(0);
    synth.sleepUntil(6);
    out.getAmModulator().setValue(0.1);
    synth.sleepUntil(9);

    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:14,代码来源:BasicChainTest.java

示例6: testReplicator

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testReplicator() throws InterruptedException {
    Replicator repl = new Replicator("REPL");

    vcoa.getOutput().connect(repl.getInput());
    repl.getOutput2().connect(out.getInput());

    out.start();
    synth.start();
    synth.sleepFor(5);

    ((SynthesisEngine) synth).printConnections();

}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:15,代码来源:BasicChainTest.java

示例7: testWhiteNoise

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testWhiteNoise() throws InterruptedException {
    WhiteNoise whiteNoise = new WhiteNoise("WHITE NOISE");
    whiteNoise.activate();
    out.start();
    out.getInput().connect(whiteNoise.getOutput());
    synth.start();
    synth.sleepFor(10);

    ((SynthesisEngine) synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:12,代码来源:BasicChainTest.java

示例8: TestVcfa

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestVcfa() throws InterruptedException {
    Vcfa vcfa = new Vcfa("VCFA");
    Vcoa vcoa2 = new Vcoa("VCOA2");

    //Configuration
    vcoa.setOscillatorType(OscillatorType.SINE);
    vcoa.setAmplitudeSine(1);
    vcoa2.setOscillatorType(OscillatorType.TRIANGLE);
    vcoa2.setAmplitudeTriangle(1.0);
    vcoa2.setExponentialFrequency(0.2);
    vcoa2.setLinearFrequency(0.5);
    vcfa.setCutoff(1.0);

    //Connection
    vcoa.getOutput().connect(vcfa.getInput());
    vcoa2.getOutput().connect(vcfa.getFm());
    vcfa.getOutput().connect(this.out.getInput());

    out.start();
    synth.start();

    int n = 1000;
    while (n >= 0) {
        if (n % 50 == 0){
            vcfa.setCutoff(((double) n) / 1000);
        }

        synth.sleepFor(0.01);
        n--;
    }

    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:35,代码来源:BasicChainTest.java

示例9: checkConnection

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
private void checkConnection(PortBlockPart destination) {
    SynthesisEngine sourceSynth = unitBlockPort.getSynthesisEngine();
    SynthesisEngine destSynth = destination.unitBlockPort.getSynthesisEngine();
    if ((sourceSynth != destSynth) && (sourceSynth != null) && (destSynth != null)) {
        throw new RuntimeException("Connection between units on different synths.");
    }
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:PortBlockPart.java

示例10: setSynthesisEngine

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
/**
 * @param synthesisEngine the synthesisEngine to set
 */
public void setSynthesisEngine(SynthesisEngine synthesisEngine) {
    if ((this.synthesisEngine != null) && (this.synthesisEngine != synthesisEngine)) {
        throw new RuntimeException("Unit synthesisEngine already set.");
    }
    this.synthesisEngine = synthesisEngine;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:10,代码来源:UnitGenerator.java

示例11: setSynthesisEngine

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
public void setSynthesisEngine(SynthesisEngine engine) {
    super.setSynthesisEngine(engine);
    for (UnitGenerator unit : units) {
        unit.setSynthesisEngine(engine);
    }
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:Circuit.java

示例12: setVolume

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public void setVolume(double volume) {
    double min = SynthesisEngine.DB96;
    double max = 1.0;
    double ratio = max / min;
    double value = min * Math.pow(ratio, volume);
    volumeRamp.input.set(value);
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:MultiChannelSynthesizer.java

示例13: setUp

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();
    synthesisEngine = new SynthesisEngine();
    synthesisEngine.setRealTime(false);
    attackTime = 0.2;
    decayTime = 0.4;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:9,代码来源:TestEnvelopeAttackDecay.java

示例14: setUp

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();
    synthesisEngine = new SynthesisEngine();
    synthesisEngine.setRealTime(false);
    delayTime = 0.1;
    attackTime = 0.2;
    holdTime = 0.3;
    decayTime = 0.4;
    sustainLevel = 0.5;
    releaseTime = 0.6;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:13,代码来源:TestEnvelopeDAHDSR.java

示例15: uglyResetSynthesizer

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public static void uglyResetSynthesizer() {

        for(IComponent c : Register.mappingGenerator.keySet()){
            for(UnitGenerator ug : Register.mappingGenerator.get(c)){
                synthesizer.remove(ug);
            }
        }

        Register.mappingGenerator.clear();
        Register.mappingInput.clear();
        Register.mappingOutput.clear();

        ((SynthesisEngine) synthesizer).printConnections();


    }
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:17,代码来源:Factory.java


注:本文中的com.jsyn.engine.SynthesisEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。