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

Class core.FloatArray


SynopsisAn arraylist of 32bit floating point values.

  Base classes:
  Derived classes:
  Methods:
See also:  



Method add
Add the given float value to this array.
Signature
add(floatf)
 :boolean
Arguments
floatfFloat value
Returns
booleantrue if the value has been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add2
Add the given float values to this array.
Signature
add2(floatf1,
  floatf2 
  )  
 :boolean
Arguments
floatf1First float value
floatf2Second float value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add3
Add the given float values to this array.
Signature
add3(floatf1,
  floatf2,
  floatf3 
  )  
 :boolean
Arguments
floatf1First float value
floatf2Second float value
floatf3Third float value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method add4
Add the given float values to this array.
Signature
add4(floatf1,
  floatf2,
  floatf3,
  floatf4 
  )  
 :boolean
Arguments
floatf1First float value
floatf2Second float value
floatf3Third float value
floatf4Fourth float value
Returns
booleantrue if the values have been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method addArray
Add the given array like object to this array.
Signature
addArray(Objectarray,
  intoff,
  intlen 
  )  
 :boolean
Arguments
ObjectarrayArray-like object
intoffSource offset
intlenNumber of elements
Returns
booleantrue if the array has been added successfully, false otherwise.
Description

Resize array if necessary.

See also:  


 
 top of page
Method addEmpty
Increase the number of used elements.
Signature
addEmpty(intnum)
 :int
Arguments
intnumNumber of elements to add
Returns
intNew number of elements
Description

This will not resize the array!

See also:  


 
 top of page
Method addFromARGB32
Add normalized R,G,B,A floats from packed ARGB32 integer.
Signature
addFromARGB32(intargb32)
 :boolean
Arguments
intargb32Packed ARGB32 color
Returns
booleantrue if the R,G,B,A float values have been added successfully, false otherwise.

 
 top of page
Method alloc
Allocate the given number of array elements.
Signature
alloc(intmax)
 :boolean
Arguments
intmaxNew total number of elements
Returns
booleantrue if the allocation succeeded, false otherwise.
Description

The number of used elements, numElements, will be reset to 0.

See also:  


 
 top of page
Method allocAndFill
Allocate and set all used array elements to value "f".
Signature
allocAndFill(intnum,
  floatf 
  )  
 :boolean
Arguments
intnumNumber of elements
floatfFill value
Returns
booleantrue when allocation succeeded

See also:  


 
 top of page
Method bezierCubicDeCasteljau2d
Calculate bezier curve using the de Casteljau algorithm.
Signature
bezierCubicDeCasteljau2d(floatx0,
  floaty0,
  floatx1,
  floaty1,
  floatx2,
  floaty2,
  floatx3,
  floaty3,
  floatscaleX,
  floatscaleY,
  intrecMax,
  floatthresholdB,
  floatthresholdP,
  FloatArrayretT 
  )  
Arguments
floatx0Start point x
floaty0Start point y
floatx1Control point #1 x
floaty1Control point #1 y
floatx2Control point #2 x
floaty2Control point #2 y
floatx3End point x
floaty3End point y
floatscaleXx scaling factor
floatscaleYy scaling factor
intrecMaxrecursion limit
floatthresholdBbendiness threshold (max distance between bezier midpoint and plane (p3-p0 and perpendicular normal)
floatthresholdPposition threshold (max distance between start and end point)
FloatArrayretT
Description

Note: the array will first be emptied and then filled with the resulting vertices (check numElements afterwards).

 
 top of page
Method biquad
Apply biquad filter to input samples and store result in this array.
Signature
biquad(FloatArrayfaIn,
  inttype,
  floatdbGain,
  floatfreq,
  floatres 
  )  
Arguments
FloatArrayfaInInput samples (may be the same array)
inttypeFilter type, 1=LPF, 2=HPF, 3=BPF, 4=BRF, 5=PEQ, 6=LSH, 7=HSH
floatdbGainGain
floatfreqCutoff frequency (0..1)
floatresResonance (0..1)
Description

Caller must resize this array if necessary.

 
 top of page
Method blend
Blend with other array and write to this array.
Signature
blend(FloatArrayb,
  floatweight 
  )  
Arguments
FloatArraybOther array
floatweightScale factor for deltas. Range is 0..1
Description

Scale delta (otherValue-thisValue) by "weight" and write to this array.

See also:  


 
 top of page
Method blendAB
Blend two arrays and write to this array.
Signature
blendAB(FloatArraya,
  FloatArrayb,
  floatweight 
  )  
Arguments
FloatArrayaFirst array
FloatArraybSecond array
floatweightBlend factor. Range is 0..1
Description

Scale delta (bValue-aValue) by "weight" and write to this array.

See also:  


 
 top of page
Method contains
Check whether array contains the given value.
Signature
contains(floatf)
 :boolean
Arguments
floatfElement value to look for
Returns
booleantrue if an element with value "f" was found, false otherwise.

 
 top of page
Method copyFrom
Copy elements from source array.
Signature
copyFrom(FloatArraysrc,
  intoff,
  intlen,
  intdestOff 
  )  
Arguments
FloatArraysrc
intoffSource offset in source array
intlenNumber of elements to copy
intdestOffDestination offset in this array

 
 top of page
Method delete
Delete element at the given index.
Signature
delete(intindex)
 :boolean
Arguments
intindexWhich element to delete
Returns
booleantrue if the element was deleted, false otherwise.

See also:  


 
 top of page
Method delete2
Delete two elements at the given index.
Signature
delete2(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method delete3
Delete three elements at the given index.
Signature
delete3(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method delete4
Delete four elements at the given index.
Signature
delete4(intindex)
 :boolean
Arguments
intindexFirst element index
Returns
booleantrue if the element has been deleted, false otherwise.

See also:  


 
 top of page
Method empty
Reset the number of used elements, numElements, to 0.
Signature
empty()

See also:  


 
 top of page
Method fill
Set all used elements to the given value.
Signature
fill(floatf)
Arguments
floatfFill value

 
 top of page
Method fillFromARGB32
Unpack ARGB32 integer and fill used_elements in R,G,B,A order.
Signature
fillFromARGB32(intargb32)
Arguments
intargb32Packed ARGB32 integer

 
 top of page
Method fillRegion
Fill a range of elements with a constant value.
Signature
fillRegion(intoff,
  intlen,
  floatval 
  )  
Arguments
intoffStart offset (element index)
intlenNumber of elements
floatvalFill value
Description

The region start/end will be clipped to (0;numElements).

See also:  


 
 top of page
Method findIdxBefore
Find index of last element that is smaller than 'f'.
Signature
findIdxBefore(floatf)
 :int
Arguments
floatf
Returns
intindex

 
 top of page
Method findNearestIdx1d
Find index of x-element that has the smallest distance to point x.
Signature
findNearestIdx1d(floatx,
  intoff,
  intstride,
  floatmaxDist 
  )  
 :int
Arguments
floatxPoint x
intoffElement start offset
intstrideElement advance (must be >0)
floatmaxDistMaximum distance
Returns
intIndex of element or -1 if the point is too far away

 
 top of page
Method findNearestIdx2d
Treat elements as x/y 2d vectors and find index of x-element that has the smallest distance to point (x,y).
Signature
findNearestIdx2d(floatx,
  floaty,
  intoff,
  intstride,
  floatmaxDist,
  floataspect 
  )  
 :int
Arguments
floatxPoint x
floatyPoint y
intoffElement start offset
intstrideElement advance (must be >0)
floatmaxDistMaximum distance
floataspectAspect ratio (width/height) of graphical representation
Returns
intIndex of element (x-component of 2d vector) or -1 if the point is too far away

 
 top of page
Method fixNaNToZero
Replace NaN values by 0
Signature
fixNaNToZero()

 
 top of page
Method free
Free all array elements.
Signature
free()

 
 top of page
Method get
Return element value at the given index.
Signature
get(intindex)
 :float
Arguments
intindexWhich element to return
Returns
floatElement value
Description

Silently return 0.0f if "index" is out of bounds.

 
 top of page
Method getAbsMax
Return biggest element value, not regarding sign.
Signature
getAbsMax():float
Returns
floatMaximum value

See also:  


 
 top of page
Method getAbsMaxDiff
Return absolute maximum difference of 'o' to this array.
Signature
getAbsMaxDiff(FloatArrayo)
 :float
Arguments
FloatArrayoOther array
Returns
floatAbsolute maximum difference (o - this)

 
 top of page
Method getAbsMean
Return average element value, not regarding sign.
Signature
getAbsMean():float
Returns
floatAverage value

See also:  


 
 top of page
Method getAbsMin
Return smallest element value, not regarding sign.
Signature
getAbsMin():float
Returns
floatMinimum value

See also:  


 
 top of page
Method getDefault
Return array element at 'index', or return 'def' when index is out of bounds.
Signature
getDefault(intindex,
  floatdef 
  )  
 :float
Arguments
intindexArray index
floatdefDefault value (when index is out of bounds)
Returns
floatArray element or default value

 
 top of page
Method getFirst
Return first array element.
Signature
getFirst():float
Returns
floatFirst array element or 0.0f if the array is empty.

 
 top of page
Method getLast
Return last used array element.
Signature
getLast():float
Returns
floatLast used array element (numElements - 1) or 0.0f if the array is empty.

 
 top of page
Method getMax
Return biggest element value.
Signature
getMax():float
Returns
floatMaximum value

See also:  


 
 top of page
Method getMaxElements
Return total number of elements.
Signature
getMaxElements():int
Returns
intTotal number of elements.

See also:  


 
 top of page
Method getMaxIdx
Return index of biggest element value.
Signature
getMaxIdx():int
Returns
intMaximum value index

See also:  


 
 top of page
Method getMean
Return average element value.
Signature
getMean():float
Returns
floatAverage value

See also:  


 
 top of page
Method getMin
Return smallest element value.
Signature
getMin():float
Returns
floatMinimum value

See also:  


 
 top of page
Method getMinIdx
Return index of smallest element value.
Signature
getMinIdx():int
Returns
intMinimum value index

See also:  


 
 top of page
Method getNumElements
Return number of used elements.
Signature
getNumElements():int
Returns
intNumber of used elements

See also:  


 
 top of page
Method getRev
Return element value at (numElements - 1 - index).
Signature
getRev(intindex)
 :float
Arguments
intindexWhich element to return (starting from numElements)
Returns
floatElement value
Description

Silently return 0.0f if resulting index is out of bounds.

 
 top of page
Method getRms
Return RMS (root mean square) for all values in the array.
Signature
getRms():float
Returns
floatRMS

 
 top of page
Method getRmsMax
Return maximum RMS (root mean square).
Signature
getRmsMax():float
Returns
floatPeak RMS

 
 top of page
Method getString
Return string representation of this array.
Signature
getString():String
Returns
Stringnew String

 
 top of page
Method getString2
Return (x;y) pair string representation of this array.
Signature
getString2():String
Returns
Stringnew String

 
 top of page
Method getString3
Return (x;y;z) tuple string representation of this array.
Signature
getString3():String
Returns
Stringnew String

 
 top of page
Method indexOf
Return index of element with value "f". -1 if no matching element was found.
Signature
indexOf(floatf,
  intoff 
  )  
 :int
Arguments
floatfValue to look for
intoffStart index
Returns
intIndex of element, -1 if not found.

 
 top of page
Method indexOfNot
Return index of element that does not have value "f". -1 if no matching element was found.
Signature
indexOfNot(floatf,
  intoff 
  )  
 :int
Arguments
floatfValue to look for
intoffStart index
Returns
intIndex of element, -1 if not found.

 
 top of page
Method insert
Insert new element before the given index.
Signature
insert(intindex,
  floatf 
  )  
 :boolean
Arguments
intindexWhere to insert the new element
floatfValue to insert
Returns
booleantrue if the new elements was inserted successfully, false otherwise.
Description

Resize the array if required.

See also:  


 
 top of page
Method interleave
Copy interleaved elements from multi-channel array.
Signature
interleave(intnumDestCh,
  intdestCh,
  FloatArraysrc,
  intnumSrcCh,
  intsrcCh,
  intnumCh,
  intnumElem 
  )  
Arguments
intnumDestChNumber of channels (in this array)
intdestChDestination channel index (in this array)
FloatArraysrcSource buffer
intnumSrcChNumber of source channels
intsrcChSource channel index
intnumChNumber of channels to copy
intnumElemNumber of elements/frames to copy

 
 top of page
Method isEmpty
Check if array is empty (numElements == 0).
Signature
isEmpty():boolean
Returns
boolean

 
 top of page
Method isEqual
Compare to other array and return true if the array contents are equal.
Signature
isEqual(FloatArrayo)
 :boolean
Arguments
FloatArrayoOther array
Returns
booleantrue if the array contents are equal

 
 top of page
Method join
Join arrays 'a' and 'b'.
Signature
join(Objecta,
  Objectb 
  )  
Arguments
ObjectaOther array (or this, or null)
ObjectbOther array (or this, or null)

 
 top of page
Method loadFromStreamFloat32
Read 24bit IEEE floats from stream.
Signature
loadFromStreamFloat32(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams
intnumNumber of samples to read
Returns
booleantrue if the samples have been loaded successfully

 
 top of page
Method loadFromStreamSigned16
Read signed 16bit integers from stream, convert to float and normalize.
Signature
loadFromStreamSigned16(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams
intnumNumber of samples to read
Returns
booleantrue if the samples have been loaded successfully

 
 top of page
Method loadFromStreamSigned24
Read signed 24bit integers from stream, convert to float and normalize.
Signature
loadFromStreamSigned24(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams
intnumNumber of samples to read
Returns
booleantrue if the samples have been loaded successfully

 
 top of page
Method loadFromStreamUnsigned8
Read unsigned 8bit integers from stream, convert to float and normalize.
Signature
loadFromStreamUnsigned8(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams
intnumNumber of samples to read
Returns
booleantrue if the samples have been loaded successfully

 
 top of page
Method mergeArraySkipVal
Replace elements in this array by arrays from other array which do not equal 'skipVal'.
Signature
mergeArraySkipVal(FloatArrayfa,
  floatskipVal 
  )  
Arguments
FloatArrayfaOther array
floatskipValArray value not to be merged

 
 top of page
Method read32
Read 32bit floating point values from the given input stream.
Signature
read32(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
StreamifsInput stream
intnumNumber of elements to read
intdestOffDestination offset in this array
Returns
intNumber of elements read

 
 top of page
Method read64
Read 64bit floating point values from the given input stream and truncate to 32bit.
Signature
read64(Streamifs,
  intnum,
  intdestOff 
  )  
 :int
Arguments
StreamifsInput stream
intnumNumber of elements to read
intdestOffDestination offset in this array
Returns
intNumber of elements read

 
 top of page
Method realloc
Reallocate array to given size.
Signature
realloc(intmax)
 :boolean
Arguments
intmaxNew total number of elements
Returns
booleantrue if the reallocation succeeded, false otherwise.
Description

Discard/add new elements as required.

See also:  


 
 top of page
Method rearrange
Rearrange array elements according to the given IntArray.
Signature
rearrange(IntArrayorder)
 :boolean
Arguments
IntArrayorderHolds the new element array
Returns
booleantrue if the elements have been re-arranged successfully, false otherwise.

 
 top of page
Method reverse
Reverse element order
Signature
reverse()

 
 top of page
Method saveToStreamSigned12FrameEnc
Write signed 12bit integers to stream (clip to -2048..+2047).
Signature
saveToStreamSigned12FrameEnc(Streams,
  intnumElements 
  )  
 :boolean
Arguments
Streams
intnumElementsNumber of values to write. 0=write entire array
Returns
booleantrue if the samples have been written successfully
Description
Encode in 8-value frames (4, 8, 16 bit deltas, or 16bit raw values)

 
 top of page
Method saveToStreamSigned16
Write signed 16bit integers to stream (clip to -32768..+32767)
Signature
saveToStreamSigned16(Streams,
  intnumElements 
  )  
 :boolean
Arguments
Streams
intnumElementsNumber of values to write. 0=write entire array
Returns
booleantrue if the samples have been written successfully

 
 top of page
Method scale
Read elements from source array, scale by s and write to this array.
Signature
scale(Objectsrc,
  floats 
  )  
Arguments
Objectsrc
floatsScale factor
Description

Lazy-allocate elements as required.
@todo Use operator =>

 
 top of page
Method set
Set element at "index" to "val".
Signature
set(intindex,
  floatval 
  )  
Arguments
intindexArray index
floatvalNew value
Description
Updates numElements when index exceeds it (>=).
Silently do nothing when index exceed array size (>= maxElements).

 
 top of page
Method setNumElements
Set the number of used elements to the given value.
Signature
setNumElements(intnum)
Arguments
intnumNew number of used elements

See also:  


 
 top of page
Method setRev
Set element at "numElements - 1 - index" to "val".
Signature
setRev(intindex,
  floatval 
  )  
Arguments
intindexArray index (starting from numElements)
floatvalNew value
Description

Silently do nothing when index exceed array size (<0 || >= maxElements).

 
 top of page
Method sortByValue
Sort elements by value and write new element order to the given IntArray.
Signature
sortByValue(IntArrayorder)
Arguments
IntArrayorderReceives the new element order

 
 top of page
Method sum
Sum elements
Signature
sum(intoff,
  intnum 
  )  
 :float
Arguments
intoffIndex of first element
intnumNumber of elements to sum
Returns
floatSum

 
 top of page
Method sumPathLen1d
Sum element deltas
Signature
sumPathLen1d(intoff,
  intnum 
  )  
 :float
Arguments
intoffIndex of first element
intnumNumber of elements to sum
Returns
floatPath length

 
 top of page
Method sumPathLen2d
Treat elements as x/y 2d vectors and calculate path length.
Signature
sumPathLen2d(intoff,
  intnum 
  )  
 :float
Arguments
intoffIndex of first vector (float element offset / 2)
intnumNumber of vectors to sum (number of float elements / 2)
Returns
floatPath length

 
 top of page
Method swap
Swap two array elements.
Signature
swap(intindexA,
  intindexB 
  )  
 :boolean
Arguments
intindexAIndex of first element
intindexBIndex of second element
Returns
booleantrue if the elements have been swapped successfully, false otherwise.

 
 top of page
Method unlinkFrom
Grab elements from 'src' and transfer elements ownership to this object.
Signature
unlinkFrom(FloatArraysrc)
Arguments
FloatArraysrcSource array

 
 top of page
Method useAll
Mark all array elements used, i.e. set numElements = maxElements.
Signature
useAll()

 
 top of page
Method visit
Create a view into the given FloatArray.
Signature
visit(FloatArraysrc,
  intoff,
  intlen 
  )  
Arguments
FloatArraysrcSource array
intoffSource offset
intlenNumber of elements

 
 top of page
Method winCosine
Return cosine interpolation of elements.
Signature
winCosine(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value

See also:  


 
 top of page
Method winCubic
Return cubic interpolation of elements.
Signature
winCubic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value

See also:  


 
 top of page
Method winLinear
Return linear interpolation of elements.
Signature
winLinear(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value

See also:  


 
 top of page
Method winQuadratic
Return quadratic interpolation of elements.
Signature
winQuadratic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value

See also:  


 
 top of page
Method winQuintic
Return quintic interpolation of elements.
Signature
winQuintic(floatindex)
 :float
Arguments
floatindexElement index
Returns
floatInterpolated value

See also:  


 
 top of page
Method write32
Write 32bit floating point values to the given output stream.
Signature
write32(Streamofs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
StreamofsOutput stream
intnumNumber of elements to write
intsrcOffSource offset in this array
Returns
intNumber of elements written

 
 top of page
Method write64
Write 64bit floating point values to the given output stream.
Signature
write64(Streamofs,
  intnum,
  intsrcOff 
  )  
 :int
Arguments
StreamofsOutput stream
intnumNumber of elements to write
intsrcOffSource offset in this array
Returns
intNumber of elements written

 
 top of page
 

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 , LFSR , LFSR_NR , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Process , 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 , mathCerpf , mathClampf , mathClampi , mathDistancePointPlane2d , mathFoldf , mathFoldi , mathGCD , mathLerpCyclicf , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathNextCyclicf , mathPowerf , mathPowerfC , mathPoweri , mathSerpf , mathSmoothStepf , mathSmoothStepNf , mathWrapf , mathWrapi , milliSeconds , milliSecondsDouble , psystem , putenv , srand , system , ucchar 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:41:59