Class DoubleEnvelope

All Implemented Interfaces:
AbstractClockedSignalSource, AbstractSignalSource, Component, DoubleClockedSignalSource, DoubleSignalSource, AbstractEnvelope, Process, DoubleSupplier

public class DoubleEnvelope extends DoubleStoredSignalSource implements AbstractEnvelope
Parameter function: piecewise defined (control-rate) function, for forming acoustic note events. Duration are given in seconds.
     \                              \ 
       \                              \
         \                              \
           \....limit                     \
                                  |dura_seg|
                          |..... dura_env..|

 change to next segment determined by ...
               out<=/>=fin    or    dt   
 increment value determined by ...
                   ==0   or  !=0 
                   =inc       =inc OR = fin/dt

               dt_inc    fin_inc
   dtSeg_inc   dt        inc    duration of this segment, inc given verbatim
   dtSeg_fin   dt        fin    duration of this segment, inc calculated 
                                                  as fin-out / dt
   dtEnv_inc   dt        inc    ends at time point of envelope, 
                                               inc given verbatim
   dtEnv_fin   dt        fin    ends at time point of envelope, 
                                               inc calculated as fin-out/dt
   inc_fin     inc       fin    inc and fin given verbatim

   dtSeg_inc   dt        =0     hold current value 
   dtEnv_inc   dt        =0     hold current value 
   dtSeg_fin   =0        fin    jump to out=v, start next segment immediately

   end,fermata ---       ---   array at this index does not change "out" value

 
  • Field Details

    • samplingPeriode

      protected double samplingPeriode
      Taken from the period duration of a ConstantRealtimeContext, thus in seconds.
    • dt_inc

      protected double[] dt_inc
    • fin_inc

      protected double[] fin_inc
    • ctr

      protected AbstractEnvelope.Mode[] ctr
    • initValue

      protected double initValue
    • endFerms

      protected int endFerms
    • loopMode

      protected boolean loopMode
    • increment

      protected double increment
    • finalValue

      protected double finalValue
    • now

      protected double now
      The time after the last reset = "start of note".
    • timer

      protected double timer
      The rest duration for the current segment
    • index

      protected int index
    • mode

    • writeIndex

      protected int writeIndex
  • Constructor Details

    • DoubleEnvelope

      public DoubleEnvelope(ConstantRealtimeContext ct, int segments)
    • DoubleEnvelope

      public DoubleEnvelope(ConstantRealtimeContext ct)
    • DoubleEnvelope

      public DoubleEnvelope()
    • DoubleEnvelope

      public DoubleEnvelope(int segments)
  • Method Details

    • endFerm

      public void endFerm()
    • setLoopMode

      public DoubleEnvelope setLoopMode(boolean loopMode)
    • setInitValue

      public DoubleEnvelope setInitValue(double initValue)
    • setRealtimeContext

      public void setRealtimeContext(RealtimeContext context)
      Description copied from class: AbstractProcess
      Sets the realtime context of this process.

      If the realtime context has been fixed at creation time, this implementation will not allow it to be set to a different reference.

      Specified by:
      setRealtimeContext in interface Process
      Overrides:
      setRealtimeContext in class AbstractProcess
      Parameters:
      context - the new realtime context of this process, or null if not specified
    • addSegment

      public void addSegment(double dt_inc, double fin_inc, AbstractEnvelope.Mode ctr)
    • setValues

      public void setValues(double[] dt_inc, double[] fin_inc, AbstractEnvelope.Mode[] ctr)
    • step

      public void step()
      Description copied from interface: Process
      Signals a time event, executing a transition step for this process to the next observable state.

      The state of the process after successful completion of this method should be the n-th observable state, if Process.step() has been invoked n times since the last initialization via Process.init(). The behavior of this method is unspecified if Process.init() has not been invoked before.

      FIXME: Process.setRealtimeContext(eu.bandm.sig.adlib2.RealtimeContext)

      If this method completes abruptly by throwing an error or unchecked exception, the process state should be considered invalid.

      Specified by:
      step in interface Process
    • doStep

      protected void doStep()
    • nextSegment

      protected void nextSegment()
      Enter the next segment, prepare all registers for the next invocation of "step()."
             mode        dt_inc        fin_inc
             dt<>_fin    timer         finalValue
             dtSeg_fin   0             finalValue
             dt<>_inc    timer         increment
             inc_fin     increment     finalValue
        
    • restart

      public void restart()
    • init

      public void init()
      Description copied from interface: Process
      Initializes the state of this process. The state is initialized such that the first subsequent call to Process.step() transitions to the first specified observable state.

      The default implementation does nothing.

      Specified by:
      init in interface Process
    • getRestarter

      public Process getRestarter(BooleanSignalSource reset)
    • dump

      protected void dump(PrintStream ps)