User Guide

Ruby Component
To call this from FlowBotics Studio we need to use a Ruby component and the Win32API class. See the earlier section on External DLLs for
more information about using Win32API.
We use a circular buffer for the delay and this together with the current buffer index needs to be managed on the FlowBotics Studio side. For
the buffer we use a Frame object.
You can see from the C code of the external DLL that the function is called delayFrame and it takes 5 ints followed by two pointer inputs.
In the Call method we pass ints directly. So the size of the frame, the current index and the delay amount are all passed without any need for
conversion. The other two int values are pointers to the Frame data for the current frame and the circular buffer. These are accessed via the
data method of the Frame class. This method gives you a Ruby int value which is the memory address of the raw sample data. By doing this
we don't need to convert between the underlying sample data and Ruby which is much more efficient.
The remaining two inputs are Float values. Floats are not handles explicitly by Win32API so you need to pack them into 32 bit floats.
That's all there is to it. The call is made and the external function updates the data in the current Frame object and the circular buffer.
NOTE: if you want to create a standalone that uses a dll in this way then see the External DLLs section for details on what you have to
include in your distributiion.
169 of 212