/**
 * Created on Oct 31, 2004
 *
 * Copyright (c) Hans-Christoph Steiner
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * See file LICENSE for further informations on licensing terms.
 *
 * This program 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 for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package typist;

import java.applet.Applet;

import com.softsynth.jsyn.*;
import com.softsynth.jsyn.view11x.SoundTester;

/**
 * @author hans
 */
public class KeyPressSynthNoteTester extends Applet {
    SynthNote mySynthNote; 
    LineOut myOut;

    /* set up GUI */
    public void init() {
    }
    
    /* Setup synthesis */    
    public void start() {
        Synth.initialize();
        Synth.start(Synth.FLAG_AUTO_STOP);
        mySynthNote = new KeyPressSynthNote();
        myOut = new LineOut();
        
        SoundTester soundTesterPanel = new SoundTester(mySynthNote);
        add(soundTesterPanel);
        
        mySynthNote.output.connect( 0, myOut.input, 0 );
        mySynthNote.output.connect( 0, myOut.input, 1 );
        
        myOut.start();
        
        getParent().validate();
        getToolkit().sync();
    }
    
    public static void main(String[] args) {
        KeyPressSynthNoteTester applet = new KeyPressSynthNoteTester();
        AppletFrame frame = new AppletFrame("Play a SynthNote", applet);
        frame.setSize(600, 400);
        
        frame.show();
        /*
         * Begin test after frame opened so that DirectSound will use Java
         * window.
         */
        frame.test(); // short for applet.init(); applet.start();
        applet.setSize(600, 400);
    }
}

