Class JSynSimpleUnitVoiceInstrument

java.lang.Object
com.softsynth.jmsl.InstrumentAdapter
com.softsynth.jmsl.jsyn2.JSynSimpleUnitVoiceInstrument
All Implemented Interfaces:
Instrument, Namable, OutputProvider, Transposable, AttributeBuildable, Tunable
Direct Known Subclasses:
JSynUnitVoiceInstrument, SamplePlayingInstrument

public class JSynSimpleUnitVoiceInstrument
extends InstrumentAdapter
implements AttributeBuildable, Tunable
  • Constructor Details

    • JSynSimpleUnitVoiceInstrument

      public JSynSimpleUnitVoiceInstrument()
    • JSynSimpleUnitVoiceInstrument

      public JSynSimpleUnitVoiceInstrument​(java.lang.String className, int polyphony, int preset)
    • JSynSimpleUnitVoiceInstrument

      public JSynSimpleUnitVoiceInstrument​(java.lang.String className, int polyphony)
  • Method Details

    • getNumOutputs

      public int getNumOutputs()
      Specified by:
      getNumOutputs in interface OutputProvider
      Overrides:
      getNumOutputs in class InstrumentAdapter
      Returns:
      0
    • getOutput

      public java.lang.Object getOutput()
      Description copied from interface: OutputProvider
      get this output (SynthOutput in the case of a JSyn Instrument, for example
      Specified by:
      getOutput in interface OutputProvider
      Overrides:
      getOutput in class InstrumentAdapter
      Returns:
      null
    • getOutput

      public java.lang.Object getOutput​(int partNumber)
      Specified by:
      getOutput in interface OutputProvider
      Overrides:
      getOutput in class InstrumentAdapter
      Returns:
      null
    • getPolyphony

      public int getPolyphony()
    • setPolyphony

      public void setPolyphony​(int polyphony)
    • getPreset

      public int getPreset()
      Returns:
      the preset index
    • setPreset

      public void setPreset​(int preset)
      Parameters:
      preset - the preset to set
    • buildFromAttributes

      public void buildFromAttributes()
      Specified by:
      buildFromAttributes in interface AttributeBuildable
    • isSignalProcessor

      public boolean isSignalProcessor()
      Returns:
      true if this Instrument contains UnitSinks capable of accepting signal inputs
    • addSignalSource

      public void addSignalSource​(java.lang.Object signalSource)
    • removeAllSignalSources

      public void removeAllSignalSources()
    • getUnitVoiceArray

      public UnitVoiceArray getUnitVoiceArray()
      Returns:
      a list of all instantiated voices
    • getTuning

      public Tuning getTuning()
      Specified by:
      getTuning in interface Tunable
    • setTuning

      public void setTuning​(Tuning tuning)
      Specified by:
      setTuning in interface Tunable
    • getUnitVoiceClassName

      public java.lang.String getUnitVoiceClassName()
    • setUnitVoiceClassName

      public void setUnitVoiceClassName​(java.lang.String unitVoiceClassName)
    • play

      public double play​(double playTime, double timeStretch, double[] dar)
      Description copied from class: InstrumentAdapter
      You can override this play() method with your own custom code, if you don't want to use an interpreter. Be sure to return same or updated playTime!
      Source of default implementation of play():
              public double play(double playTime, double timeStretch, double dar[])
              {
                      if (interpreter != null) playTime = interpreter.interpret(playTime, timeStretch, dar, this );
                      return playTime; // note: if interpreter == null, this will return a playTime with no time delay.
              }       
              
      IMPORTANT: A typical return would be return playTime + dar[0] * timeStretch; which follows a convention of putting duration value in dar[0]. If you don't add something to playTime, play() will be scheduled as though it took no time (unless interpreter returns a later playTime).

      RE-EMPHASIS: This return comment assumes that there is no interpreter returning an updated playTime. A stock Instrument does set its Interpreter to a default printing Interpreter which does update playTime, using dar[0] as duration. So the default Instrument.play() shown above will schedule itself as expected.
      Specified by:
      play in interface Instrument
      Overrides:
      play in class InstrumentAdapter
    • getVoiceAllocator

      public com.jsyn.util.VoiceAllocator getVoiceAllocator()
    • main

      public static void main​(java.lang.String[] args)