Public Member Functions | Static Public Member Functions | List of all members
VariantBuffer Class Reference

A buffer of floating point data for use in scripted environments. More...

Inherits DynamicObject.

Public Member Functions

 VariantBuffer (float *externalData, int size_)
 Creates a buffer using preallocated data. More...
 
 VariantBuffer (VariantBuffer *otherBuffer, int offset=0, int numSamples=-1)
 Creates a buffer that operates on another buffer. More...
 
 VariantBuffer (int samples)
 Creates a new buffer with the given sample size. More...
 

Static Public Member Functions

static void sanitizeFloatArray (float **channels, int numChannels, int numSamples)
 Removes Nan numbers from a array of float data. More...
 

Detailed Description

A buffer of floating point data for use in scripted environments.

This class can be wrapped into a var and used like a primitive value. It is a one dimensional float array - if you want multiple channels, use an Array with multiple variant buffers.

It contains some handy overload operators to make working with this type more convenient:

b * 2.0f            // Applies the gain factor to all samples in the buffer
b * otherBuffer     // Multiplies the values of the buffers and store them into 'b'
b + 2.0f            // adds 2.0f to all samples
b + otherBuffer     // adds the other buffer

Important: Because all operations are inplace, these statements are aquivalent:

(b = b * 2.0f) == (b *= 2.0f) == (b *2.0f);

For copying and filling buffers, the '<<' and '>>' operators are used.

0.5f >> b           // fills the buffer with 0.5f (shovels 0.5f into the buffer...)
b << 0.5f           // same as 0.5f >> b
a >> b              // copies the buffer a into b;
a << b              // copies the buffer b into a;

If the Intel IPP library is used, the data will be allocated using the IPP allocators for aligned data

Constructor & Destructor Documentation

VariantBuffer ( float *  externalData,
int  size_ 
)

Creates a buffer using preallocated data.

VariantBuffer ( VariantBuffer otherBuffer,
int  offset = 0,
int  numSamples = -1 
)

Creates a buffer that operates on another buffer.

VariantBuffer ( int  samples)

Creates a new buffer with the given sample size.

The data will be initialised to 0.0f.

Member Function Documentation

static void sanitizeFloatArray ( float **  channels,
int  numChannels,
int  numSamples 
)
inlinestatic

Removes Nan numbers from a array of float data.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.