home
 
 index of namespace default
 
 index of project core
 
 index of module core

Class core.Envelope


SynopsisAn array of time/value pairs. 

  Base classes:
  Methods:
  Constants: Description:


Most of the methods assume that time is actually a number of ticks, i.e. an integer number.
The current time offset may be a fractional number resulting in a smooth interpolation of successive event values if the current interpolation function is set to something other than ENV_SHRESET or ENV_SH.


 
 top of page
Method get
Return (interpolated) value and reset new_event flag (SH, SHRESET).
Signature
get():float
Returns
floatInterpolated value

 
 top of page
Method getAndResetNew
Return (interpolated) value. Only reset new event flag if bResetNew is true.
Signature
getAndResetNew(boolean)
 :float
Arguments
boolean
Returns
floatInterpolated value

 
 top of page
Method getDeltaTime
Return delta time to the next event
Signature
getDeltaTime():float
Returns
floatDelta time to the next event

 
 top of page
Method getInterpolation
Return current interpolation function.
Signature
getInterpolation():int
Returns
intInterpolation function id. See ENV_xxx.

 
 top of page
Method getNextEventTimeAfter
Return absolute time of event after _t, or -1 if there is no event.
Signature
getNextEventTimeAfter(floatt)
 :float
Arguments
floattAbsolute time
Returns
floatAbsolute time of event after 't' or -1 if there is no event

 
 top of page
Method getSpeed
Return the current envelope base speed.
Signature
getSpeed():float
Returns
floatThe current envelope base speed.

 
 top of page
Method getTime
Return the current time offset.
Signature
getTime():float
Returns
floatThe current time offset

 
 top of page
Method indexToTime
Return the absolute time offset of the given event number.
Signature
indexToTime(intevent)
 :float
Arguments
inteventEvent number (array index / 2)
Returns
floatAbsolute time

 
 top of page
Method insertReplaceEvent
Insert or replace an event at the given time offset.
Signature
insertReplaceEvent(floatt,
  floatv,
  floatw 
  )  
Arguments
floattAbsolute time
floatvNew event value
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method insertReplaceEventLSB4
Insert or replace part of an (8bit) event at the given time offset (least significant nibble).
Signature
insertReplaceEventLSB4(floatt,
  bytev,
  floatw 
  )  
Arguments
floattAbsolute time
bytevNew event value (most significant nibble)
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method insertReplaceEventMSB4
Insert or replace part of an (8bit) event at the given time offset (most significant nibble).
Signature
insertReplaceEventMSB4(floatt,
  bytev,
  floatw 
  )  
Arguments
floattAbsolute time
bytevNew event value (most significant nibble)
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method insertReplaceEventPat1
Insert or replace part of an (7bit) event, formatted as '01A'..'32D' at the given time offset.
Signature
insertReplaceEventPat1(floatt,
  bytev,
  floatw 
  )  
Arguments
floattAbsolute time
bytevNew event value (first digit)
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method insertReplaceEventPat2
Insert or replace part of an (7bit) event, formatted as '01A'..'32D' at the given time offset.
Signature
insertReplaceEventPat2(floatt,
  bytev,
  floatw 
  )  
Arguments
floattAbsolute time
bytevNew event value (second digit)
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method insertReplaceEventPat3
Insert or replace part of an (7bit) event, formatted as '01A'..'32D' at the given time offset.
Signature
insertReplaceEventPat3(floatt,
  bytev,
  floatw 
  )  
Arguments
floattAbsolute time
bytevNew event value (third digit)
floatwTime window size
Description
Keep deltatime if event already exists within [t..t+w].

 
 top of page
Method isNewEvent
Check whether the last tickPrecise() call hit a new key event.
Signature
isNewEvent():boolean
Returns
booleantrue If a new event has been reached, false otherwise

 
 top of page
Method removeEvent
Remove event at the given time offset and shift all succeeding events.
Signature
removeEvent(floatt)
Arguments
floattAbsolute time

 
 top of page
Method removeRange
Remove all events within the given time window and shift the succeeding events.
Signature
removeRange(floatt,
  floatlen 
  )  
Arguments
floattAbsolute time (window start)
floatlenWindow size

 
 top of page
Method removeRangeSH
Remove range of sample&hold style envelope.
Signature
removeRangeSH(floatt,
  floatlen 
  )  
Arguments
floattAbsolute time (window start)
floatlenWindow size
Description

In contrary to removeRange(), events will only be delete if they are entirely with the given range. If only covered partly, their delta times will be adjusted.

 
 top of page
Method removeRangeUntilNext
Remove range until next event and keep abstime of following event (if any)
Signature
removeRangeUntilNext(floatt,
  floatlen,
  floatmaxT 
  )  
Arguments
floattAbsolute time (window start)
floatlenWindow size
floatmaxTDo not delete events after this point

 
 top of page
Method reset
Reset time offset
Signature
reset()

 
 top of page
Method rotateEvents
Rotate events within (startT..maxT) by delta time 'r'.
Signature
rotateEvents(floatr,
  floatstartT,
  floatmaxT 
  )  
Arguments
floatrRotation delta time
floatstartTRotation window start (must be >= 0)
floatmaxTRotation window end (must be > startT)

 
 top of page
Method setInterpolation
Set the interpolation function.
Signature
setInterpolation(intinterpol)
Arguments
intinterpolInterpolation function id. Must be one of ENV_SH, ENV_LINEAR, ENV_COSINE, ENV_QUADRATIC, ENV_CUBIC, ENV_QUINTIC, ENV_SHRESET.

 
 top of page
Method setSpeed
Set envelope base speed.
Signature
setSpeed(floatspeed)
Arguments
floatspeedBase time delta
Description

The default speed is 1.0f

 
 top of page
Method setTime
Seek to the current time offset.
Signature
setTime(floatt)
Arguments
floattNew (absolute) time offset

 
 top of page
Method shiftEvents
Shift all events after the given time offset by the given number of ticks.
Signature
shiftEvents(floatt,
  floatl 
  )  
Arguments
floattAbsolute time
floatlTime shift

 
 top of page
Method shiftNextEvent
Shift only next event and keep abstime of following event (if any / in range t..maxT)
Signature
shiftNextEvent(floatt,
  floatl,
  floatmaxT 
  )  
Arguments
floattAbsolute time
floatlTime shift
floatmaxTDo not shift event after this point

 
 top of page
Method tickPrecise
Increase time offset by the given time delta.
Signature
tickPrecise(floatdt)
Arguments
floatdtTime delta

 
 top of page
Method timeToIndex
Return the last event number (not array offset!) before the given time offset.
Signature
timeToIndex(floatt)
 :int
Arguments
floatt
Returns
intEvent number (array index / 2)

 
 top of page
Method valueAtTimeRaster
Return the value at the given absolute time offset in the given time window.
Signature
valueAtTimeRaster(floatt,
  floatres 
  )  
 :var
Arguments
floattAbsolute time
floatresWindow size
Returns
varEvent value or void if there is no event within the given window

 
 top of page
Method valueAtTimeSH
Return the value of the last event before the given point in time.
Signature
valueAtTimeSH(floatt)
 :var
Arguments
floattAbsolute time
Returns
varEvent value or void if there is no event before the given point in time

 
 top of page
Constant ENV_COSINE ()
Cosine interpolation 
Description

y = y1 + (y2 - y1) * (1 - cos(PI * x)) / 2
Constant ENV_CUBIC ()
Cubic interpolation 
Description

y = (y1 + y3 - (y0 + y2) * x3 + (2 * (y0 - y1) + y2 - y3) * x2 + (y2 - y0) * x + y1
Constant ENV_LINEAR ()
Linear interpolation. 
Description

y = y1 + (y2 - y1) * x
Constant ENV_QUADRATIC ()
Quadratic interpolation. 
Description

y = (y1 + (y2 - y1) * x) * (1 - x2) + (y2 + (y3 - y2) * (x - 1)) * x2
Constant ENV_QUINTIC ()
Quintic interpolation 
Description

y = 3 * (y1 + y3 - y2 - y4) * x5 + (8 * (y2 - y1) + 7 * (y4 - y3)) * x4 + (6 * (y1 - y2) + 4 * (y3 - y4)) * x3 + (y3 - y1) * x + y2
Constant ENV_SH ()
Sample and hold (no interpolation)
Constant ENV_SHRESET ()
Sample and hold + reset (no interpolation). 
Description

After reading a new key value, reset current value back to 0. Useful for one-shot triggers.

 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathClampf , mathClampi , mathDistancePointPlane2d , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathPowerf , mathPoweri , mathSmoothStepf , mathWrapf , mathWrapi , milliSeconds , psystem , putenv , srand , system , ucchar 
All Namespaces:default , ui 
All Projects:core , debugtext , tkfreetype2 , tkmath , tkmidi , tkopengl , tkportaudio , tksdl , tkui , tkunit 


auto-generated by "DOG", the TkScript document generator. Mon, 28/Dec/2015 13:15:54