Examples of AdvancerRegistry


Examples of de.maramuse.soundcomp.util.AdvancerRegistry

   * Creates a sawtooth signal and a "duty cycle modulated cosine", both with constant pitch "a2" (880Hz). Both signals
   * are subject to a 50Hz sync with a varying sync phase.
   */
  public void testTS9() {
  try{
    AdvancerRegistry advancerRegistry=new AdvancerRegistry();
    advancerRegistry.clear();
    globalParameters.setSampleRate(44100);
    ProcessElement pe=new InputFile("javasrc/de/maramuse/soundcomp/test/testfiles/hh-o.wav");
    advancerRegistry.registerAdvancer(pe);
    OutputFile ws=new OutputFile(1);
    advancerRegistry.registerAdvancer(ws);
    ws.setSource(0, pe, OUT.i);
    for(double time=0; time<1.5; time+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    }
    File f=new File("hh-o.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    ws.setFormat(FileFormats.FMT_WAVE_S16);
    ws.write(fos);
    fos.close();
    advancerRegistry.unregisterAdvancer(pe);
    advancerRegistry.unregisterAdvancer(ws);
    NativeObjects.unregisterNativeObject(pe);
    NativeObjects.unregisterNativeObject(ws);
  }catch(Exception ex){
    fail(ex.getMessage());
  }
View Full Code Here

Examples of de.maramuse.soundcomp.util.AdvancerRegistry

   * Succeeds immediately if the file is missing to not disturb automatized tests.
   */
  public void testTS10() {
  try{
    if(!new File("flanger-in.wav").exists())return;
    AdvancerRegistry advancerRegistry=new AdvancerRegistry();
    advancerRegistry.clear();
    globalParameters.setSampleRate(44100);
    ProcessElement in=new InputFile("flanger-in.wav");
    Flanger fl=new Flanger();
    mul _mul1=new mul(), _mul2=new mul();
    _mul1.setSource(IN.i, fl, OUT.i);
    _mul1.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    _mul2.setSource(IN.i, fl, OUT_IMAG.i);
    _mul2.setSource(IN_IMAG.i, ConstStream.c(0.5), OUT.i);
    OutputFile of=new OutputFile(2);
    advancerRegistry.registerAdvancer(of);
    advancerRegistry.registerAdvancer(fl);
    advancerRegistry.registerAdvancer(in);
    advancerRegistry.registerAdvancer(_mul1);
    advancerRegistry.registerAdvancer(_mul2);
    of.setSource(0, _mul1, OUT.i);
    of.setSource(-1, _mul2, OUT.i);
    fl.setSource(IN.i, in, OUT.i);
    fl.setSource(FREQUENCY.i, ConstStream.c(0.366), OUT.i);
    fl.setSource(DEPTH.i, ConstStream.c(0.0025), OUT.i);
    fl.setSource(MAXDELAY.i, ConstStream.c(0.0075), OUT.i);
    fl.setSource(DELAY.i, ConstStream.c(0.0033), OUT.i);
    for(double time=0; time==0||in.getValue(GATE.i)>0; time+=1/globalParameters.getSampleRate()){
    advancerRegistry.advanceAll();
    }
    File f=new File("flanger-out.wav");
    BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream(f), fileBufferSize);
    of.setFormat(FileFormats.FMT_WAVE_S16);
    of.write(fos);
    fos.close();
    advancerRegistry.unregisterAdvancer(in);
    advancerRegistry.unregisterAdvancer(of);
    advancerRegistry.unregisterAdvancer(_mul1);
    advancerRegistry.unregisterAdvancer(_mul2);
    advancerRegistry.unregisterAdvancer(fl);
    NativeObjects.unregisterNativeObject(in);
    NativeObjects.unregisterNativeObject(of);
    NativeObjects.unregisterNativeObject(_mul1);
    NativeObjects.unregisterNativeObject(_mul2);
    NativeObjects.unregisterNativeObject(fl);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.