Jamoma API 0.6.0.a19
We will begin our introduction of the Jamoma environment by looking at the basic data types. All other aspects of the environment, creating objects, writing extensions, etc., all require some knowledge about how data is represented.
To begin, Jamoma Foundation defines a variety of basic types for representing integers and a floating-point numbers with various degrees of resolution, and in signed or unsigned variants. The following table lists the basic numeric types according to their properties.
In addition to these types for representing numbers, there are basic types for representing booleans (true/false values), TTBoolean.
Strings can be represented in several different ways in Jamoma. Of course, arrays of the standard char type is a well understood way to work with text in C. The TTString type is similar to the C++ std::string and follows most of the conventions of the string provided by the C++ standard library. Unlike std::string, however, the characters of a TTString are guaranteed to be contiguous in memory and not subject to problems of ambiguous byte alignment.
In addition to TTString, there is also a TTSymbol type. A symbol is simply a wrapper around a string that is cached in a fast lookup table. While comparing TTString values is relatively slow, comparing TTSymbol values is extremely fast.
The use of symbols is so ubiquitous in Jamoma that we have defined a macro, TT, to create a symbol from a C-string.
In fact, often the use of the TT macro is not even needed, as C-strings and TTStrings both can be promoted to symbols implicitly in many cases.
While is important to have defined the basic data types for numbers, strings, and booleans, this is not the way that values are typically passed in Jamoma. Instead, values are passed using a special container type called TTValue. TTValue is a generic type that can hold any of the number, string, boolean, or a few other types that we use in Jamoma. In fact, it can even hold a mixed array of values made up of these various types. The following example shows several assignments using TTValue.