/* * Created on Nov 10, 2012 by Nick * */ package jmslexamples.jsyn2.unitvoices; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import com.jsyn.JSyn; import com.jsyn.Synthesizer; import com.jsyn.swing.SoundTweaker; import com.jsyn.unitgen.*; public class UnitSourceTester { public static void test(UnitSource unitSource) { final Synthesizer synth = JSyn.createSynthesizer(); synth.start(); synth.add((UnitGenerator) unitSource); LineOut out = new LineOut(); synth.add(out); out.start(); unitSource.getOutput().connect(0, out.input, 0); unitSource.getOutput().connect(0, out.input, 1); JFrame jf = new JFrame(unitSource.getClass().getName()); SoundTweaker tweaker = new SoundTweaker(synth, "Test this sound", unitSource); jf.add(tweaker); jf.pack(); jf.setVisible(true); jf.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { synth.stop(); System.exit(0); } }); } }