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

Class core.FloatArray


Synopsis: An 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
floatf–Float value
Returns
boolean–true 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
floatf1–First float value
floatf2–Second float value
Returns
boolean–true 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
floatf1–First float value
floatf2–Second float value
floatf3–Third float value
Returns
boolean–true 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
floatf1–First float value
floatf2–Second float value
floatf3–Third float value
floatf4–Fourth float value
Returns
boolean–true 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
Objectarray–Array-like object
intoff–Source offset
intlen–Number of elements
Returns
boolean–true 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
intnum–Number of elements to add
Returns
int–New 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
intargb32–Packed ARGB32 color
Returns
boolean–true 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
intmax–New total number of elements
Returns
boolean–true 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
intnum–Number of elements
floatf–Fill value
Returns
boolean–true 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
floatx0–Start point x
floaty0–Start point y
floatx1–Control point #1 x
floaty1–Control point #1 y
floatx2–Control point #2 x
floaty2–Control point #2 y
floatx3–End point x
floaty3–End point y
floatscaleX–x scaling factor
floatscaleY–y scaling factor
intrecMax–recursion limit
floatthresholdB–bendiness threshold (max distance between bezier midpoint and plane (p3-p0 and perpendicular normal)
floatthresholdP–position 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
FloatArrayfaIn–Input samples (may be the same array)
inttype–Filter type, 1=LPF, 2=HPF, 3=BPF, 4=BRF, 5=PEQ, 6=LSH, 7=HSH
floatdbGain–Gain
floatfreq–Cutoff frequency (0..1)
floatres–Resonance (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
FloatArrayb–Other array
floatweight–Scale 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
FloatArraya–First array
FloatArrayb–Second array
floatweight–Blend 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
floatf–Element value to look for
Returns
boolean–true 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–
intoff–Source offset in source array
intlen–Number of elements to copy
intdestOff–Destination offset in this array

 
→ top of page
Method delete
Delete element at the given index.
Signature
delete(intindex)
 :boolean
Arguments
intindex–Which element to delete
Returns
boolean–true 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
intindex–First element index
Returns
boolean–true 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
intindex–First element index
Returns
boolean–true 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
intindex–First element index
Returns
boolean–true 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
floatf–Fill value

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

 
→ top of page
Method fillRegion
Fill a range of elements with a constant value.
Signature
fillRegion(intoff,
  intlen,
  floatval 
  )  
Arguments
intoff–Start offset (element index)
intlen–Number of elements
floatval–Fill 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
int–index

 
→ 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
floatx–Point x
intoff–Element start offset
intstride–Element advance (must be >0)
floatmaxDist–Maximum distance
Returns
int–Index 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
floatx–Point x
floaty–Point y
intoff–Element start offset
intstride–Element advance (must be >0)
floatmaxDist–Maximum distance
floataspect–Aspect ratio (width/height) of graphical representation
Returns
int–Index 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
intindex–Which element to return
Returns
float–Element 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
float–Maximum value

See also:  


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

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

See also:  


 
→ top of page
Method getAbsMin
Return smallest element value, not regarding sign.
Signature
getAbsMin():float
Returns
float–Minimum 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
intindex–Array index
floatdef–Default value (when index is out of bounds)
Returns
float–Array element or default value

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

 
→ top of page
Method getLast
Return last used array element.
Signature
getLast():float
Returns
float–Last 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
float–Maximum value

See also:  


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

See also:  


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

See also:  


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

See also:  


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

See also:  


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

See also:  


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

See also:  


 
→ top of page
Method getRev
Return element value at (numElements - 1 - index).
Signature
getRev(intindex)
 :float
Arguments
intindex–Which element to return (starting from numElements)
Returns
float–Element 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
float–RMS

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

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

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

 
→ top of page
Method getString3
Return (x;y;z) tuple string representation of this array.
Signature
getString3():String
Returns
String–new 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
floatf–Value to look for
intoff–Start index
Returns
int–Index 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
floatf–Value to look for
intoff–Start index
Returns
int–Index of element, -1 if not found.

 
→ top of page
Method insert
Insert new element before the given index.
Signature
insert(intindex,
  floatf 
  )  
 :boolean
Arguments
intindex–Where to insert the new element
floatf–Value to insert
Returns
boolean–true 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
intnumDestCh–Number of channels (in this array)
intdestCh–Destination channel index (in this array)
FloatArraysrc–Source buffer
intnumSrcCh–Number of source channels
intsrcCh–Source channel index
intnumCh–Number of channels to copy
intnumElem–Number 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
FloatArrayo–Other array
Returns
boolean–true if the array contents are equal

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

 
→ top of page
Method loadFromStreamFloat32
Read 24bit IEEE floats from stream.
Signature
loadFromStreamFloat32(Streams,
  intnum 
  )  
 :boolean
Arguments
Streams–
intnum–Number of samples to read
Returns
boolean–true 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–
intnum–Number of samples to read
Returns
boolean–true 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–
intnum–Number of samples to read
Returns
boolean–true 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–
intnum–Number of samples to read
Returns
boolean–true 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
FloatArrayfa–Other array
floatskipVal–Array 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
Streamifs–Input stream
intnum–Number of elements to read
intdestOff–Destination offset in this array
Returns
int–Number 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
Streamifs–Input stream
intnum–Number of elements to read
intdestOff–Destination offset in this array
Returns
int–Number of elements read

 
→ top of page
Method realloc
Reallocate array to given size.
Signature
realloc(intmax)
 :boolean
Arguments
intmax–New total number of elements
Returns
boolean–true 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
IntArrayorder–Holds the new element array
Returns
boolean–true 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–
intnumElements–Number of values to write. 0=write entire array
Returns
boolean–true 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–
intnumElements–Number of values to write. 0=write entire array
Returns
boolean–true 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–
floats–Scale 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
intindex–Array index
floatval–New 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
intnum–New number of used elements

See also:  


 
→ top of page
Method setRev
Set element at "numElements - 1 - index" to "val".
Signature
setRev(intindex,
  floatval 
  )  
Arguments
intindex–Array index (starting from numElements)
floatval–New 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
IntArrayorder–Receives the new element order

 
→ top of page
Method sum
Sum elements
Signature
sum(intoff,
  intnum 
  )  
 :float
Arguments
intoff–Index of first element
intnum–Number of elements to sum
Returns
float–Sum

 
→ top of page
Method sumPathLen1d
Sum element deltas
Signature
sumPathLen1d(intoff,
  intnum 
  )  
 :float
Arguments
intoff–Index of first element
intnum–Number of elements to sum
Returns
float–Path length

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

 
→ top of page
Method swap
Swap two array elements.
Signature
swap(intindexA,
  intindexB 
  )  
 :boolean
Arguments
intindexA–Index of first element
intindexB–Index of second element
Returns
boolean–true 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
FloatArraysrc–Source 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
FloatArraysrc–Source array
intoff–Source offset
intlen–Number of elements

 
→ top of page
Method winCosine
Return cosine interpolation of elements.
Signature
winCosine(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value

See also:  


 
→ top of page
Method winCubic
Return cubic interpolation of elements.
Signature
winCubic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value

See also:  


 
→ top of page
Method winLinear
Return linear interpolation of elements.
Signature
winLinear(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value

See also:  


 
→ top of page
Method winQuadratic
Return quadratic interpolation of elements.
Signature
winQuadratic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated value

See also:  


 
→ top of page
Method winQuintic
Return quintic interpolation of elements.
Signature
winQuintic(floatindex)
 :float
Arguments
floatindex–Element index
Returns
float–Interpolated 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
Streamofs–Output stream
intnum–Number of elements to write
intsrcOff–Source offset in this array
Returns
int–Number 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
Streamofs–Output stream
intnum–Number of elements to write
intsrcOff–Source offset in this array
Returns
int–Number 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. Tue, 3/Mar/2026 18:10:17