ChucK Standard Libraries API
these libraries are provide by default with ChucK - new ones can also
be imported with ChucK dynamic linking (soon to be documented...). The
existing libraries are organized by namespaces in ChucK. They are as
follows.
namespace: Std
Std is a standard library in ChucK, which includes utility functions random number generation,
unit conversions, and absolute value.
[example]
/* a simple example... */
// infinite time-loop
while( true )
{
// generate random float (and print)
<<< Std.rand2f( 100.0, 1000.0 ) >>>;
// wait a bit
50::ms => now;
}
[function]:
float rand2f ( float min, float max );
[function]:
int setenv ( string key, string value );
namespace: Machine
Machine is ChucK runtime interface to the virtual machine. this interface can
be used to manage shreds. They are similar to the On-the-fly Programming Commands,
except these are invoked from within a ChucK program, and are subject to the timing mechanism.
----------
namespace: Math
Math contains the standard math functions. all trignometric functions expects angles
to be in radians.
[example]
// print sine of pi/2
<<<< Math.sin( pi / 2.0 ) >>>;
Next: Chuck Standard Unit Generators
Return to Programming Guide
|