Class SigSequencer

java.lang.Object
eu.bandm.sighkn.SigSequencer
All Implemented Interfaces:
CompilableControlFlow, Realtime, SequencerPanel.AbstractSequencer, Runnable

public class SigSequencer extends Object implements Realtime, SequencerPanel.AbstractSequencer
Sequencer for sig data. Usage is one-shot: construct and load data. Then multiple playing possible.

One Sequencer maintains SigSequencer.Column objects. These serve as (passive) Data source.
The run() method counts down time and updates the values returned by each SigSequencer.Column. This method updates the internal now and uses rowIndex to determine whether to switch to the next row number.

FIXME loop ist ZEIT gesteuert "atEnd" aber zeilennummerngesteuert. Keine zwangs-synchronisierung!?!?
  • Field Details

    • columnCount

      protected final int columnCount
    • outputClasses

      protected final Class[] outputClasses
    • columns

      protected final SigSequencer.Column[] columns
    • rowIndex

      protected final TreeMap<Float,Integer> rowIndex
    • index2when

      protected final List<Float> index2when
    • frequency

      protected final float frequency
    • period

      protected final float period
    • currentRowNumber

      protected int currentRowNumber
    • currentLocalTime

      protected float currentLocalTime
    • tempoFactor

      protected float tempoFactor
    • loaded

      protected boolean loaded
    • running

      protected boolean running
    • loopMode

      protected boolean loopMode
    • atEnd

      protected boolean atEnd
    • loopStart

      protected float loopStart
    • loopEnd

      protected float loopEnd
    • lineListeners

      protected List<SigSequencer.Reaction> lineListeners
    • endListeners

      protected List<SigSequencer.Reaction> endListeners
    • x_now

      protected float x_now
    • x_row

      protected int x_row
    • pattern_upto_dquote

      static final Pattern pattern_upto_dquote
    • pattern_upto_squote

      static final Pattern pattern_upto_squote
  • Constructor Details

    • SigSequencer

      public SigSequencer(float frequency, Class... outputClasses)
      Parameters:
      float - frequency of execution, needed for duration calculation.
      outputClasses - list of classes, describing the columns of the data
  • Method Details

    • postLoad

      public void postLoad()
    • load

      public void load(Object[][] data)
    • timeToRowNumber

      public int timeToRowNumber(float time)
      time in msec
    • rowNumberToTime

      public float rowNumberToTime(int num)
      time in msec
    • isLoaded

      public boolean isLoaded()
      Specified by:
      isLoaded in interface SequencerPanel.AbstractSequencer
    • getMaxPosition_msec

      public float getMaxPosition_msec()
      Specified by:
      getMaxPosition_msec in interface SequencerPanel.AbstractSequencer
    • getPosition_msec

      public float getPosition_msec()
      Specified by:
      getPosition_msec in interface SequencerPanel.AbstractSequencer
    • setPosition_msec

      public void setPosition_msec(float newpos)
      Specified by:
      setPosition_msec in interface SequencerPanel.AbstractSequencer
    • addNextLineListener

      public void addNextLineListener(SigSequencer.Reaction r)
      Will be executed whenever a new data line is entered.
    • addEndReachedListener

      public void addEndReachedListener(SigSequencer.Reaction r)
      Will be executed whenever the last data line is finished.
    • loadTextLines

      public void loadTextLines(File file) throws FileNotFoundException, IOException
      ASSUME time is given as delta-duration in milli-seconds
           1_500    1 1 1 
           2_500    2 2 2 
       
      ... reads as:
      Starting with now=0.0, the data triple "1 1 1" is valid vor 1.5 seconds;
      then, from now=1.5 to now=4.0, the data triple "2 2 2" is valid.
      It stays valid thereafter if the file is ended.
      (=> the very last duration has no significance at all.)
      FIXME Scanner.nextLine benutzen! LineNumberReader kann raus.
      Throws:
      FileNotFoundException
      IOException
    • dump

      public void dump()
    • startLoadingAll

      public void startLoadingAll(int i)
    • load_duration

      public void load_duration(float deltaT)
    • stop

      public void stop()
      FOR GUI SEE projekte2017/.../klarduos/KlarDuosWS
      USES eu.bandm.music.midi.SequencerPanel (( FIXME abstract to other sequencer types !?!))
      USES javax.sound.midi.Sequencer

      Nomenklatur GUI PLAY PAUSE
      Nomenklatur javax.midi: sequencer.stop .start .setMicrosecondPosition
      Specified by:
      stop in interface SequencerPanel.AbstractSequencer
    • start

      public void start()
      Specified by:
      start in interface SequencerPanel.AbstractSequencer
    • setLoop

      public void setLoop(float from, float to)
    • noLoop

      public void noLoop()
    • jumpTo

      public void jumpTo(float f)
      f in msec
    • setTempo

      public void setTempo(float f)
      additional factor with which all durationas are multiplied.
    • run

      public void run()
      Description copied from interface: Realtime
      Processes an event.

      Any implementation of this method should complete promptly and normally. In particular it must not block indefinitely.

      Specified by:
      run in interface Realtime
      Specified by:
      run in interface Runnable
    • _do_run

      protected void _do_run(float newTime)
      ASSUME running => loaded =>
    • checkColumn

      protected void checkColumn(int i)
    • floatColumn

      public SigSequencer.FloatColumn floatColumn(int i)
    • intColumn

      public SigSequencer.IntColumn intColumn(int i)
    • stringColumn

      public SigSequencer.StringColumn stringColumn(int i)