jmslexamples.jsyn
Class PlayLurkingJSynInstrument

java.lang.Object
  extended by com.softsynth.jmsl.InstrumentAdapter
      extended by com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
          extended by com.softsynth.jmsl.jsyn.TunedSynthNoteInstrument
              extended by com.softsynth.jmsl.jsyn.JSynInsFromClassName
                  extended by com.softsynth.jmsl.jsyn.SynthNoteAllPortsInstrument
                      extended by jmslexamples.jsyn.PlayLurkingJSynInstrument
All Implemented Interfaces:
Instrument, Namable, OutputProvider, PlayLurker, Transposable, AttributeBuildable

public class PlayLurkingJSynInstrument
extends SynthNoteAllPortsInstrument
implements PlayLurker

This behaves just like a SynthNoteAllPortsInstrument playing a com.softsynth.jsyn.circuits.FilteredSawtoothBL, adding the PlayLurker interface so that it can be notified of elements being played by other objects. This could be used to create an arpeggiating instrument, for example, that listens to notes being played by a MusicShape or a MusicList or a JMSL Score Track.

COMPLETE SOURCE:

 package jmslexamples.jsyn;
 
 import com.softsynth.jmsl.*;
 import com.softsynth.jmsl.score.jsyn.SynthNoteAllPortsInstrument;
 import com.softsynth.jsyn.*;
 
 public class PlayLurkingFSBLInstrument extends SynthNoteAllPortsInstrument implements PlayLurker {
 
     public PlayLurkingFSBLInstrument() {
         super(8, com.softsynth.jsyn.circuits.FilteredSawtoothBL.class.getName());
     }
 
     public void notify(double playTime, com.softsynth.jmsl.MusicJob job, int index) {
         System.out.println("PlayLurkingFSBLInstrument being notified of index " + index + " being played");
     }
 
     public static void main(String args[]) {
         try {
             Synth.startEngine(0);
             String filename = "PlayLurkingFSBLInstrument.xml";
             PlayLurkingFSBLInstrument ins = new PlayLurkingFSBLInstrument();
             ins.setName("Play Lurking FilteredSawtoothBL ins");
             java.io.PrintWriter pout = new java.io.PrintWriter(new java.io.FileOutputStream(filename));
             (new com.softsynth.jmsl.score.util.SimpleXMLSaver(ins, "jmslscoreinstrument")).writeXML(pout);
             pout.close();
             System.out.println("Wrote " + filename);
             Synth.stopEngine();
         } catch (java.io.IOException e) {
             System.out.println("ERROR in main: " + e);
         }
     }
 
 }
 
 
 

Author:
Nick Didkovsky, July 23, 2002, (c) 2002 Nick Didkovsky all rights reserved

Field Summary
 
Fields inherited from class com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
insNum
 
Constructor Summary
PlayLurkingJSynInstrument()
          Hard coded to call super(8, com.softsynth.jsyn.circuits.FilteredSawtoothBL.class.getName());
 
Method Summary
static void main(java.lang.String[] args)
          Just instantiate an instrument and write out an XML file so it can be loaded into JMSL Score
 void notifyPlayLurker(double playTime, MusicJob job, int index)
          PlayLurker interface.
 
Methods inherited from class com.softsynth.jmsl.jsyn.SynthNoteAllPortsInstrument
buildDimensionNameSpace, buildFromAttributes, on, toString, update
 
Methods inherited from class com.softsynth.jmsl.jsyn.JSynInsFromClassName
getSynthContext, getSynthNoteClassName, setSynthContext, setSynthNoteClassName
 
Methods inherited from class com.softsynth.jmsl.jsyn.TunedSynthNoteInstrument
getTuning, setTuning
 
Methods inherited from class com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
close, getAllocator, getMaxVoices, getName, getNumOutputs, getOutput, getOutput, getPolyphonic, getUpdateDimension, off, off, open, play, setAllocator, setMaxVoices, setName, setSynthNote, setUpdateDimension
 
Methods inherited from class com.softsynth.jmsl.InstrumentAdapter
getDimensionNameSpace, getInterpreter, getMixerClassName, getMusicDevice, getTransposition, noteOff, noteOn, noteOnFor, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, setTransposition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlayLurkingJSynInstrument

public PlayLurkingJSynInstrument()
Hard coded to call super(8, com.softsynth.jsyn.circuits.FilteredSawtoothBL.class.getName());

Method Detail

notifyPlayLurker

public void notifyPlayLurker(double playTime,
                             MusicJob job,
                             int index)
PlayLurker interface. notify() is called by any MusicShape or MusicList which has this object in its list of PlayLurkers

Specified by:
notifyPlayLurker in interface PlayLurker

main

public static void main(java.lang.String[] args)
Just instantiate an instrument and write out an XML file so it can be loaded into JMSL Score