Class SustainingInterpreter

java.lang.Object
com.softsynth.jmsl.Interpreter
com.softsynth.jmsl.SustainingInterpreter

public class SustainingInterpreter
extends Interpreter
SustainingInterpreter
An interpreter that interprets shape data, sustains that for some duration, then shuts it down.

Here is an example of defining interpret(), which turns ON an event, and interpretOff() which turns it OFF

        public double interpret(double playTime, double timeStretch, double dar[], Instrument ins) {
                // Turn note on (change this line for your needs)
                JMSL.out.println(this.getName() + " ON: " + dar[1] + " at time=" + playTime);
                
                // Schedule call to interpretOff.
                scheduleInterpretOff(playTime + (dar[3] * timeStretch), timeStretch, dar, ins );
                
                // Standard time interpretation.
                return playTime + (dar[0] * timeStretch);
        }
        
    // The noteoff you posted to SustainerFactory will call the method below when it is finished sustaining.
    public double interpretOff(double playTime, double timeStretch, double dar[], Instrument ins) {
        JMSL.out.println("   " + this.getName() + " OFF: " + dar[1] + " at time=" + playTime);
        return playTime;
    }
        
Author:
Phil Burk and Nick Didkovsky
See Also:
Interpreter, NoteInterpreter, NoteOnOffInterpreter, Instrument
  • Constructor Summary

    Constructors
    Constructor Description
    SustainingInterpreter()  
  • Method Summary

    Modifier and Type Method Description
    double interpret​(double playTime, double timeStretch, double[] dar, Instrument ins)
    Override this with your own custom "note on" method.
    Print a note number, and post its off time to the EventScheduler.
    double interpretOff​(double playTime, double timeStretch, double[] dar, Instrument ins)
    Override this with your own "note off" method.
    static void main​(java.lang.String[] args)
    Play a shape with a printing interpreter
    void scheduleInterpretOff​(double offTime, double timeStretch, double[] dar, Instrument ins)
    Schedule a call to the interpretOff method for this object.

    Methods inherited from class com.softsynth.jmsl.Interpreter

    getName

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SustainingInterpreter

      public SustainingInterpreter()
  • Method Details

    • scheduleInterpretOff

      public void scheduleInterpretOff​(double offTime, double timeStretch, double[] dar, Instrument ins)
      Schedule a call to the interpretOff method for this object.
    • interpret

      public double interpret​(double playTime, double timeStretch, double[] dar, Instrument ins)
      Override this with your own custom "note on" method.
      Print a note number, and post its off time to the EventScheduler.
      Overrides:
      interpret in class Interpreter
    • interpretOff

      public double interpretOff​(double playTime, double timeStretch, double[] dar, Instrument ins)
      Override this with your own "note off" method. This method is called when scheduled by a call to scheduleInterpretOff().
    • main

      public static void main​(java.lang.String[] args)
      Play a shape with a printing interpreter