Jamoma API  0.6.0.a19
TTBase.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationLibrary
4  *
5  * @brief Jamoma's lowest-level base class and related infrastructure.
6  *
7  * @details The Jamoma base class.
8  *
9  * @author Timothy Place, Trond Lossius, Nils Peters
10  *
11  * @copyright Copyright © 2008, Timothy Place @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 #ifndef __TT_BASE_H__
17 #define __TT_BASE_H__
18 
19 // Platform Sniffing
20 // Ideally the platform would already be set with a -D option to gcc...
21 
22 #if defined( __APPLE__ )
23 // TARGET_OS_IPHONE is defined on the mac as 0, so use if, not ifdef below
24  #include "TargetConditionals.h"
25 
26  #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
27  #ifndef TT_PLATFORM_IOS
28  #define TT_PLATFORM_IOS
29  #endif
30  #else // TARGET_OS_MAC
31  #ifndef TT_PLATFORM_MAC
32  #define TT_PLATFORM_MAC
33  #endif
34  #endif
35 // win64 must come before win32
36 #elif (defined(_WIN64) || defined(_WIN32)) && !defined(__MINGW32__)
37  #ifndef TT_PLATFORM_WIN
38  #define TT_PLATFORM_WIN
39  #endif
40 #elif defined(__linux) || defined(__MINGW32__)
41  #if !defined(TT_PLATFORM_LINUX)
42  #define TT_PLATFORM_LINUX
43  #endif
44 #endif
45 
46 #ifndef TT_PLATFORM_LINUX
47  #ifndef TT_PLATFORM_IOS
48  #ifndef TT_PLATFORM_WIN
49  #ifdef WIN_VERSION
50  #define TT_PLATFORM_WIN
51  #else
52  #ifndef TT_PLATFORM_MAC
53  #define TT_PLATFORM_MAC
54  #endif
55  #endif
56  #endif
57  #endif
58 #endif
59 
60 #include <algorithm>
61 #include <cstring>
62 #include <cmath>
63 #include <cstdlib>
64 #include <cstdio>
65 #include <iostream>
66 #include <string>
67 #include <vector>
68 #include <complex>
69 #include <sstream>
70 #include <iterator>
71 #include <stdexcept>
72 #include <cstdint>
73 #include <atomic>
74 
75 #ifdef TT_PLATFORM_LINUX
76 #include <stdarg.h>
77 #include <time.h>
78 #endif
79 
80 #ifdef TT_PLATFORM_WIN
81  //#include "windows.h"
82  #include <time.h>
83 
84  #pragma warning(disable:4244) // to avoid possible data lost warning with MSVC
85 
86  #ifndef _CRT_SECURE_NO_WARNINGS
87  #define _CRT_SECURE_NO_WARNINGS
88  #endif
89  #define snprintf _snprintf
90  #ifdef TTFOUNDATION_EXPORTS
91  #define TTFOUNDATION_EXPORT __declspec(dllexport)
92  #else
93  #ifdef TTSTATIC
94  #define TTFOUNDATION_EXPORT
95  #else
96  #define TTFOUNDATION_EXPORT __declspec(dllimport)
97  #endif
98  #endif // _DLL_EXPORT
99 
100 #else // TT_PLATFORM_MAC
101  #ifdef TTFOUNDATION_EXPORTS
102  #define TTFOUNDATION_EXPORT __attribute__((visibility("default")))
103  #else
104  #define TTFOUNDATION_EXPORT
105  #endif
106 #endif
107 
108 
109 #ifndef NO
110 #define NO 0
111 #endif
112 
113 #ifndef YES
114 #define YES 1
115 #endif
116 
117 
118 #ifdef TT_DEBUG
119 #define TT_ENABLE_ASSERTIONS
120 #endif
121 
122 #ifdef TT_ENABLE_ASSERTIONS
123 #define TT_ASSERT(name, result) \
124  if (!result) {\
125  char* nullPtr = 0;\
126  TTLogError("%s:%ld ASSERTION %s FAILED\n", __FILE__, __LINE__, #name );\
127  *nullPtr = 1;\
128  }
129 #else
130 #define TT_ASSERT(name, result) ((void)(0));
131 #endif
132 
133 /** Supress warnings about use of deprecated methods.
134  This macro should be defined at the top of a file before any includes in order to be made active.
135  In general, the use of this macro should be viewed with suspicion.
136  If it used a comment should accompany its use to explain the special situation that warrants the usage.
137  */
138 #ifndef TT_NO_DEPRECATION_WARNINGS
139 #ifdef __GNUC__
140 #define TT_DEPRECATED(func) __attribute__ ((deprecated)) func
141 #elif defined(_MSC_VER)
142 #define TT_DEPRECATED(func) __declspec(deprecated) func
143 #endif
144 #endif // !TT_NO_DEPRECATION_WARNINGS
145 #ifndef TT_DEPRECATED
146 #define TT_DEPRECATED(func) func
147 #endif
148 
149 
150 /****************************************************************************************************/
151 // Memory alignment
152 
153 #if defined(_MSC_VER) || defined(__BORLANDC__)
154 //#define TT_ALIGN_16 __declspec(align(16))
155 #define TT_ALIGN_16
156 #else // assuming gcc
157 #define TT_ALIGN_16 __attribute__((aligned (16)))
158 #endif
159 
160 
161 
162 /****************************************************************************************************/
163 // Type Definitions
164 
165 // Note http://developer.apple.com/mac/library/documentation/Darwin/Conceptual/64bitPorting/MakingCode64-BitClean/MakingCode64-BitClean.html#//apple_ref/doc/uid/TP40001064-CH226-SW2
166 
167 typedef bool TTBoolean; ///< Boolean flag, same as Boolean on the Mac
168 typedef unsigned char TTByte; ///< Byte value
169 typedef TTByte* TTBytePtr; ///< Data is a pointer to some bytes
170 typedef char* TTCString;
171 typedef const char* TTImmutableCString;
172 
173 typedef signed char TTInt8; ///< 8 bit signed integer (char)
174 typedef unsigned char TTUInt8; ///< 8 bit unsigned integer (char)
175 typedef std::int16_t TTInt16; ///< 16 bit signed integer
176 typedef std::uint16_t TTUInt16; ///< 16 bit unsigned integer
177 typedef std::int32_t TTInt32; ///< 32 bit signed integer
178 typedef std::uint32_t TTUInt32; ///< 32 bit unsigned integer
179 typedef std::int64_t TTInt64; ///< 64 bit signed integer
180 typedef std::uint64_t TTUInt64; ///< 64 bit unsigned integer
181 
182 // can't do the follow -- conflicts on the mac with Carbon headers
183 //#ifndef uint
184 //#define uint unsigned int
185 //#endif
186 
187 typedef float TTFloat32; ///< 32 bit floating point number
188 typedef double TTFloat64; ///< 64 bit floating point number
189 typedef std::complex<double> TTComplex; ///< Complex number
190 
191 
192 /** @typedef TTRowID
193  Datatype for any number used to indicate a row index within a matrix.
194  Three typedefs ( #TTRowID, #TTColumnID & #TTElementID ) are used so that we can easily distinguish between these important matrix attributes,
195  have consistent datatypes throughout #TTMatrixBase and quickly change those datatypes should the need arise in the future.
196 
197  Although these values should always be positive, we have intentionally avoided unsigned numbers because of boundary checking considerations in the TTMatrixBase::makeInBounds() method.
198  Negative, signed integers have the potential to become very large numbers when casting to an unsigned integers.
199  This can cause errors during a boundary check, such as values clipping to the high boundary instead of the low boundary or numerous iterations of loop to bring a wrapped value back into the acceptable range.
200 
201  They can potentially be used to override functions that take the numbers in either order.
202  For example, linear algebra-related matrices will likely access elements in TTRowID, TTColumnID order.
203  However, video processing objects will likely access elements in TTColumnID, TTRowID order.
204 
205  @ingroup typedefs
206  */
207 typedef TTInt32 TTRowID;
208 
209 
210 /** @typedef TTColumnID
211  Datatype for any number used to indicate a column index within the matrix.
212 
213  @ingroup typedefs
214  @see TTRowID
215  */
217 
218 
219 /** @typedef TTElementID
220  @brief Datatype for any number used to indicate an element index within the matrix.
221  @see TTRowID
222  @ingroup typedefs
223  */
225 // TODO: should there be a similar typedef for results of math operations that combine these values, i.e. TTIndexMathType?
226 
227 
228 
229 /** A value representing a single audio sample. TTSampleValue should be used any place a sample value is what the value represents. This will enable us to change the type in the future if needed. For example, to use 64-bit floats. */
231 
232 /** A TTSampleVector is simply a pointer to the first of an array of TTSampleValues. */
233 typedef std::vector<TTSampleValue> TTSampleVector;
234 typedef TTSampleVector::iterator TTSampleIter;
235 
236 typedef TTSampleValue* TTSampleValuePtr;
237 typedef TTSampleVector* TTSampleVectorPtr;
238 
239 /** An integer that is the same size as a pointer. */
240 typedef long TTPtrSizedInt; // this works for both 32 and 64 bit code on the Mac
241 
242 /** An integer that can be used for atomic operations. */
243 typedef std::atomic<int32_t> TTAtomicInt;
244 typedef std::atomic<uint32_t> TTAtomicUInt;
245 
246 
247 /** A generic pointer. */
248 typedef void* TTPtr;
249 typedef TTPtr* TTHandle;
250 
251 /** A simple/generic function pointer with no args. */
252 typedef void (*TTFunctionPtr)();
253 
254 /** A simple/generic function pointer with one arg. */
255 typedef void (*TTFunctionWithArgPtr)(TTPtr);
256 
257 class TTValue;
258 typedef std::vector<TTValue> TTVector;
259 typedef TTVector::iterator TTVectorIter;
260 
261 /** Use for finding stuff in a list or a hash or a dictionary. */
262 typedef void (*TTFunctionMatch)(const TTValue& valueToCheck, TTPtr baton, TTBoolean& found);
263 
264 
265 /** \ingroup enums
266  TTBlue Data Types
267  Enumeration of data types used through out TTBlue, including the TTValue class and declaring the types of
268  TTAttribute objects. */
270  kTypeNone = 0,
271  kTypeFloat32, ///< 32-bit floating point
272  kTypeFloat64, ///< 64-bit floating point
273  kTypeInt8, ///< 8-bit signed integer, range is -128 through 127.
274  kTypeUInt8, ///< 8-bit unsigned integer, range is 0 through 255.
275  kTypeInt16, ///< 16-bit signed integer, range is −32,768 through 32,767.
276  kTypeUInt16, ///< 16-bit unsigned integer, range is 0 through 65,535.
277  kTypeInt32, ///< 32-bit signed integer, range is -2,147,483,648 through 2,147,483,647.
278  kTypeUInt32, ///< 32-bit unsigned integer, range is 0 through 4,294,967,295.
279  kTypeInt64, ///< 64-bit signed integer, ragne is −9,223,372,036,854,775,808 through 9,223,372,036,854,775,807
280  kTypeUInt64, ///< 64-bit unsigned integer, range is 0 through 18,446,744,073,709,551,615.
281  kTypeBoolean, ///< Boolean (1/0) or (true/false) flag.
282  kTypeSymbol, ///< Symbol type
283  kTypeObject, ///< Object type
284  kTypePointer, ///< Pointer type
285  kTypeString, ///< String type
286  kTypeLocalValue, ///< This is a special type used by TTAttribute to indicate that a value is a TTValue and is locally maintained.
287  kTypeMatrix, ///< An instance of a TTMatrix object
288  kTypeDictionary, ///< Dictionary type
289  kTypeError, ///< An error represented by TTErr
290  // TODO: JamomaCore #281 : review the use of TTAddress
291  //kTypeAddress,
292  kNumTTDataTypes
293 };
294 
295 
296 class TTSymbol; // forward declaration
297 class TTDataInfo;
298 typedef TTDataInfo* TTDataInfoPtr;
299 
300 /** An array, indexed by values from TTDataType, containing information about those data types. */
301 extern TTFOUNDATION_EXPORT TTDataInfoPtr ttDataTypeInfo[kNumTTDataTypes];
302 
303 
304 // from TTSymbolCache.h:
305 extern TTFOUNDATION_EXPORT TTSymbol kTTSymEmpty;
306 
307 class TTFOUNDATION_EXPORT TTDataInfo {
308 public:
309  TTSymbol* name; ///< Pointer to the name of type in global symbol table, e.g. float32, float64, etc.
310  TTBoolean isNumerical; ///< Is this type numeric?
311  TTInt8 bitdepth; ///< Negative numbers indicate dynamic or unknown bitdepth.
312 
313  TTDataInfo() :
314  name(NULL)
315  {;}
316 
317  static TTDataInfoPtr getInfoForType(TTDataType type)
318  {
319  return ttDataTypeInfo[type];
320  }
321 
322  static TTDataInfoPtr getInfoForType(TTSymbol& typeAsSymbol)
323  {
324  TTDataType type = matchSymbolToDataType(typeAsSymbol);
325  return getInfoForType(type);
326  }
327 
328  static TTBoolean getIsNumerical(TTDataType type)
329  {
330  return ttDataTypeInfo[type]->isNumerical;
331  }
332 
333  static void addDataInfoForType(TTDataType type);
334 
335  static TTDataType matchSymbolToDataType(TTSymbol& typeAsSymbol);
336 
337 };
338 
339 /** \ingroup enums
340  Jamoma Error Codes
341  Enumeration of error codes that might be returned by any of the TTBlue functions and methods. */
342 enum TTErr {
343  kTTErrNone = 0, ///< No Error.
344  kTTErrGeneric, ///< Something went wrong, but what exactly is not known. Typically used for context-specific problems.
345  kTTErrAllocFailed, ///< Couldn't get memory.
346  kTTErrFreeFailed, ///< Couldn't free memory.
347  kTTErrInvalidType, ///< Bad DataType for the context.
348  kTTErrInvalidAttribute, ///< Bad Attribute specified.
349  kTTErrInvalidValue, ///< An inappropriate value was specified for an attribute or variable.
350  kTTErrWrongNumValues, ///< The wrong number of values were passed to a method or attribute.
351  kTTErrMethodNotFound, ///< Method not found. Typically returned by the TTObject::sendMessage() function.
352  kTTErrValueNotFound, ///< A value was not found when doing a look up for it (in a TTHash, TTList, or other class).
353  kTTErrBadChannelConfig, ///< An invalid number of audio channels for a given context was encountered.
354  kTTErrReadOnly, ///< Attempted a write to a read-only entity.
355  kTTErrOutOfBounds, ///< Attempted to access memory outside a matrix or array (in a TTMatrix & TTSampleMatrix).
356  kTTErrInstantiateFailed,///< Couldn't instantiate the Jamoma object requested.
357  kTTErrInvalidFilepath ///< Couldn't resolve the filepath as submitted.
358 };
359 
360 /** A simple/generic function pointer with a baton as TTValueRef and the value to send back as a TTValueRef. */
362 
363 /****************************************************************************************************/
364 // Class Specifications
365 
366 
367 /** A TTBlue exception is thown with this object. */
368 class TTException {
369  TTImmutableCString reason;
370 public:
371  TTException(TTImmutableCString aReason)
372  : reason(aReason)
373  {}
374 
375  const char* getReason()
376  {
377  return reason;
378  }
379 };
380 
381 
382 #ifdef TT_PLATFORM_MAC
383  #include <libkern/OSAtomic.h>
384 #elif defined (TT_PLATFORM_WIN)
385  #pragma intrinsic (_InterlockedIncrement)
386  #pragma intrinsic (_InterlockedDecrement)
387  #pragma intrinsic (_InterlockedCompareExchange)
388 #endif
389 
390 
391 inline void TTAtomicIncrement(TTAtomicInt& value)
392 {
393  value++;
394 }
395 
396 
397 inline void TTAtomicIncrement(TTAtomicUInt& value)
398 {
399  value++;
400 }
401 
402 
403 inline void TTAtomicDecrement(TTAtomicInt& value)
404 {
405  value--;
406 }
407 
408 
409 inline void TTAtomicDecrement(TTAtomicUInt& value)
410 {
411  value--;
412 }
413 
414 
415 inline void TTAtomicIncrementWithBarrier(TTAtomicUInt& value)
416 {
417  value.fetch_add(1, std::memory_order_seq_cst);
418 }
419 
420 
421 inline void TTAtomicDecrementWithBarrier(TTAtomicUInt& value)
422 {
423  value.fetch_sub(1, std::memory_order_seq_cst);
424 }
425 
426 
427 inline void TTAtomicAssign(TTAtomicInt& value, const TTAtomicInt& newValue, const TTAtomicInt& oldValue)
428 {
429  auto oldVal = oldValue.load();
430  auto newVal = newValue.load();
431  value.compare_exchange_strong(oldVal, newVal);
432 }
433 
434 
435  /** Return the current system time in milliseconds.
436  Although it is a global kind of function, we include it as a method of TTBase
437  so that it can be defined in the header file and then inlined in other libraries. */
439 {
440  return (clock() * 1000.0) / CLOCKS_PER_SEC;
441 }
442 
443 
444  /** Return the current system time in microseconds. */
446 {
447  return (clock() * 1000000.0) / CLOCKS_PER_SEC;
448 }
449 
450 
451 /** Produces a random-valued 64-bit floating-point number in the range [0.0, 1.0] */
452 TTFOUNDATION_EXPORT TTFloat64 TTRandom64();
453 
454 
455 /** \ingroup consts
456  Equal Power lookup table, 512 elements
457  */
458 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupEqualPower[];
459 
460 /** \ingroup consts
461  Square Root lookup table, 512 elements
462  */
463 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupSquareRoot[];
464 
465 /** \ingroup consts
466  Equal Power lookup table with 0.701 at element 256
467  */
468 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupEqualPowerSymetric[];
469 
470 /** \ingroup consts
471  Square Root lookup table with 0.701 at element 256
472  */
473 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupSquareRootSymetric[];
474 
475 /** \ingroup consts
476  256 point window table (the first half of it)
477  */
478 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupHalfPaddedwWelch[];
479 
480 /** \ingroup consts
481  Quarter Sine lookup table
482  */
483 TTFOUNDATION_EXPORT extern const TTFloat32 kTTLookupQuarterSine[];
484 
485 //! [doxygenAppendixC_constExample]
486 /** \ingroup consts
487  Pre-calculated value of pi (3.1416).
488  */
489 TTFOUNDATION_EXPORT extern const TTFloat64 kTTPi;
490 
491 /** \ingroup consts
492  Pre-calculated value of pi/2.
493  */
494 TTFOUNDATION_EXPORT extern const TTFloat64 kTTHalfPi;
495 //! [doxygenAppendixC_constExample]
496 
497 /** \ingroup consts
498  Pre-calculated value of pi/4.
499  */
500 TTFOUNDATION_EXPORT extern const TTFloat64 kTTQuarterPi;
501 
502 /** \ingroup consts
503  Pre-calculated value of pi * 2.
504  */
505 TTFOUNDATION_EXPORT extern const TTFloat64 kTTTwoPi;
506 
507 /** \ingroup consts
508  Constant used by the ttantidenormal function.
509  */
510 TTFOUNDATION_EXPORT extern const TTFloat64 kTTAntiDenormalValue;
511 
512 /** \ingroup consts
513  Pre-calculated square-root of 2 (1.4142).
514  */
515 TTFOUNDATION_EXPORT extern const TTFloat64 kTTSqrt2;
516 
517 /** \ingroup consts
518  Pre-calculated value of sqrt(2)/2 (0.701).
519  */
520 TTFOUNDATION_EXPORT extern const TTFloat64 kTTHalfSqrt2;
521 
522 /** \ingroup consts
523  Pre-calculated value of 2 * sqrt(2) (2.8284).
524  */
525 TTFOUNDATION_EXPORT extern const TTFloat64 kTTTwoSqrt2;
526 
527 /** \ingroup consts
528  A very very small value, used for float equality comaprisments.
529  */
530 TTFOUNDATION_EXPORT extern const TTFloat64 kTTEpsilon;
531 
532 /** \ingroup consts
533  Factor constant for converting radians to degrees.
534  */
535 TTFOUNDATION_EXPORT extern const TTFloat64 kTTRadiansToDegrees;
536 
537 /** \ingroup consts
538  Factor constant for converting degrees to radians.
539  */
540 TTFOUNDATION_EXPORT extern const TTFloat64 kTTDegreesToRadians;
541 
542 /** \ingroup consts
543  Power constant used when calculating MID gain.
544  */
545 TTFOUNDATION_EXPORT extern const TTFloat64 kTTGainMidiPower;
546 
547 /** \ingroup consts
548  Invverse power constant used when calculating MID gain.
549  */
550 TTFOUNDATION_EXPORT extern const TTFloat64 kTTGainMidiPowerInv;
551 
552 /** \ingroup consts
553  Constant for color representation when converting from char8 to float representation.
554  */
555 TTFOUNDATION_EXPORT extern const TTFloat64 kTTInv255;
556 
557 /** Platform and host independent method for posting log messages.
558  @param message The message to post.
559  */
560 void TTFOUNDATION_EXPORT TTLogMessage(TTImmutableCString message, ...);
561 
562 /** Platform and host independent method for posting warnings.
563  @param message The message to post.
564  */
565 void TTFOUNDATION_EXPORT TTLogWarning(TTImmutableCString message, ...);
566 
567 /** Platform and host independent method for posting errors.
568  @param message The message to post.
569  */
570 void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message, ...);
571 
572 /** Platform and host independent method for posting messages only when debugging is enabled in the environment.
573  @param message The message to post.
574  */
575 void TTFOUNDATION_EXPORT TTLogDebug(TTImmutableCString message, ...);
576 
577 
578 
579 
580 /** Allocate memory from the heap aligned to 16-byte boundaries.
581  This memory MUST be freed using TTFree16().
582 
583  @see #TT_ALIGN_16
584  @see http://stackoverflow.com/questions/1919183/how-to-allocate-and-free-aligned-memory-in-c
585  @see http://bytes.com/topic/c/answers/591742-overload-new-delete-memalign-malloc
586 */
587 TTPtr TTFOUNDATION_EXPORT TTMalloc16(size_t numBytes);
588 
589 
590 /** Free memory allocated using TTMalloc16(). */
591 void TTFOUNDATION_EXPORT TTFree16(TTPtr ptr);
592 
593 
594 #endif // __TT_BASE_H__
TTFOUNDATION_EXPORT TTDataInfoPtr ttDataTypeInfo[kNumTTDataTypes]
An array, indexed by values from TTDataType, containing information about those data types...
Definition: TTBase.cpp:424
An instance of a TTMatrix object.
Definition: TTBase.h:287
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
void TTFOUNDATION_EXPORT TTFree16(TTPtr ptr)
Free memory allocated using TTMalloc16().
Definition: TTBase.cpp:647
An inappropriate value was specified for an attribute or variable.
Definition: TTBase.h:349
Couldn't resolve the filepath as submitted.
Definition: TTBase.h:357
Attempted to access memory outside a matrix or array (in a TTMatrix & TTSampleMatrix).
Definition: TTBase.h:355
Couldn't get memory.
Definition: TTBase.h:345
Couldn't free memory.
Definition: TTBase.h:346
TTFOUNDATION_EXPORT const TTFloat64 kTTAntiDenormalValue
Constant used by the ttantidenormal function.
Definition: TTBase.cpp:30
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupQuarterSine[]
Quarter Sine lookup table.
Definition: TTBase.cpp:401
std::atomic< int32_t > TTAtomicInt
An integer that can be used for atomic operations.
Definition: TTBase.h:243
std::uint64_t TTUInt64
64 bit unsigned integer
Definition: TTBase.h:180
void(* TTFunctionPtr)()
A simple/generic function pointer with no args.
Definition: TTBase.h:252
Couldn't instantiate the Jamoma object requested.
Definition: TTBase.h:356
8-bit unsigned integer, range is 0 through 255.
Definition: TTBase.h:274
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupSquareRootSymetric[]
Square Root lookup table with 0.701 at element 256.
Definition: TTBase.cpp:282
An invalid number of audio channels for a given context was encountered.
Definition: TTBase.h:353
TTFOUNDATION_EXPORT const TTFloat64 kTTInv255
Constant for color representation when converting from char8 to float representation.
Definition: TTBase.cpp:36
Object type.
Definition: TTBase.h:283
64-bit unsigned integer, range is 0 through 18,446,744,073,709,551,615.
Definition: TTBase.h:280
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupHalfPaddedwWelch[]
256 point window table (the first half of it)
Definition: TTBase.cpp:372
TTPtr TTFOUNDATION_EXPORT TTMalloc16(size_t numBytes)
Allocate memory from the heap aligned to 16-byte boundaries.
Definition: TTBase.cpp:641
TTFOUNDATION_EXPORT const TTFloat64 kTTQuarterPi
[doxygenAppendixC_constExample]
Definition: TTBase.cpp:29
Dictionary type.
Definition: TTBase.h:288
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoPi
Pre-calculated value of pi * 2.
Definition: TTBase.cpp:24
TTDataType
TTBlue Data Types Enumeration of data types used through out TTBlue, including the TTValue class and ...
Definition: TTBase.h:269
TTInt32 TTColumnID
Datatype for any number used to indicate a column index within the matrix.
Definition: TTBase.h:216
Bad DataType for the context.
Definition: TTBase.h:347
The wrong number of values were passed to a method or attribute.
Definition: TTBase.h:350
TTInt32 TTRowID
Datatype for any number used to indicate a row index within a matrix.
Definition: TTBase.h:207
std::complex< double > TTComplex
Complex number.
Definition: TTBase.h:189
Symbol type.
Definition: TTBase.h:282
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
This is a special type used by TTAttribute to indicate that a value is a TTValue and is locally maint...
Definition: TTBase.h:286
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoSqrt2
Pre-calculated value of 2 * sqrt(2) (2.8284).
Definition: TTBase.cpp:27
TTFloat64 TTGetTimeInMicroseconds()
Return the current system time in microseconds.
Definition: TTBase.h:445
16-bit unsigned integer, range is 0 through 65,535.
Definition: TTBase.h:276
An error represented by TTErr.
Definition: TTBase.h:289
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
std::int64_t TTInt64
64 bit signed integer
Definition: TTBase.h:179
std::int16_t TTInt16
16 bit signed integer
Definition: TTBase.h:175
TTFOUNDATION_EXPORT const TTFloat64 kTTGainMidiPowerInv
Invverse power constant used when calculating MID gain.
Definition: TTBase.cpp:35
TTFOUNDATION_EXPORT const TTFloat64 kTTRadiansToDegrees
Factor constant for converting radians to degrees.
Definition: TTBase.cpp:32
16-bit signed integer, range is −32,768 through 32,767.
Definition: TTBase.h:275
A TTBlue exception is thown with this object.
Definition: TTBase.h:368
64-bit floating point
Definition: TTBase.h:272
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message,...)
Platform and host independent method for posting errors.
Definition: TTBase.cpp:572
float TTFloat32
32 bit floating point number
Definition: TTBase.h:187
TTFloat64 TTGetTimeInMilliseconds()
Return the current system time in milliseconds.
Definition: TTBase.h:438
Boolean (1/0) or (true/false) flag.
Definition: TTBase.h:281
TTFOUNDATION_EXPORT const TTFloat64 kTTHalfSqrt2
Pre-calculated value of sqrt(2)/2 (0.701).
Definition: TTBase.cpp:26
A value was not found when doing a look up for it (in a TTHash, TTList, or other class).
Definition: TTBase.h:352
TTFOUNDATION_EXPORT const TTFloat64 kTTSqrt2
Pre-calculated square-root of 2 (1.4142).
Definition: TTBase.cpp:25
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
TTByte * TTBytePtr
Data is a pointer to some bytes.
Definition: TTBase.h:169
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupEqualPower[]
Equal Power lookup table, 512 elements.
Definition: TTBase.cpp:38
64-bit signed integer, ragne is −9,223,372,036,854,775,808 through 9,223,372,036,854,775,807
Definition: TTBase.h:279
32-bit floating point
Definition: TTBase.h:271
void(* TTFunctionMatch)(const TTValue &valueToCheck, TTPtr baton, TTBoolean &found)
Use for finding stuff in a list or a hash or a dictionary.
Definition: TTBase.h:262
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupEqualPowerSymetric[]
Equal Power lookup table with 0.701 at element 256.
Definition: TTBase.cpp:115
void TTFOUNDATION_EXPORT TTLogWarning(TTImmutableCString message,...)
Platform and host independent method for posting warnings.
Definition: TTBase.cpp:553
32-bit signed integer, range is -2,147,483,648 through 2,147,483,647.
Definition: TTBase.h:277
void TTFOUNDATION_EXPORT TTLogMessage(TTImmutableCString message,...)
Platform and host independent method for posting log messages.
Definition: TTBase.cpp:534
unsigned char TTByte
Byte value.
Definition: TTBase.h:168
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
Something went wrong, but what exactly is not known. Typically used for context-specific problems...
Definition: TTBase.h:344
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTInt16 TTElementID
Datatype for any number used to indicate an element index within the matrix.
Definition: TTBase.h:224
TTErr(* TTFunctionWithBatonAndValue)(const TTValue &, const TTValue &)
A simple/generic function pointer with a baton as TTValueRef and the value to send back as a TTValueR...
Definition: TTBase.h:361
signed char TTInt8
8 bit signed integer (char)
Definition: TTBase.h:173
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTFOUNDATION_EXPORT const TTFloat64 kTTDegreesToRadians
Factor constant for converting degrees to radians.
Definition: TTBase.cpp:33
Pointer type.
Definition: TTBase.h:284
void TTFOUNDATION_EXPORT TTLogDebug(TTImmutableCString message,...)
Platform and host independent method for posting messages only when debugging is enabled in the envir...
Definition: TTBase.cpp:591
TTFOUNDATION_EXPORT const TTFloat64 kTTHalfPi
Pre-calculated value of pi/2.
Definition: TTBase.cpp:28
32-bit unsigned integer, range is 0 through 4,294,967,295.
Definition: TTBase.h:278
8-bit signed integer, range is -128 through 127.
Definition: TTBase.h:273
No Error.
Definition: TTBase.h:343
TTFOUNDATION_EXPORT const TTFloat64 kTTGainMidiPower
Power constant used when calculating MID gain.
Definition: TTBase.cpp:34
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupSquareRoot[]
Square Root lookup table, 512 elements.
Definition: TTBase.cpp:205
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
Definition: TTBase.cpp:23
Method not found. Typically returned by the TTObject::sendMessage() function.
Definition: TTBase.h:351
String type.
Definition: TTBase.h:285
TTFOUNDATION_EXPORT const TTFloat64 kTTEpsilon
A very very small value, used for float equality comaprisments.
Definition: TTBase.cpp:31
TTFloat64 TTSampleValue
A value representing a single audio sample.
Definition: TTBase.h:230
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
Bad Attribute specified.
Definition: TTBase.h:348
void(* TTFunctionWithArgPtr)(TTPtr)
A simple/generic function pointer with one arg.
Definition: TTBase.h:255
unsigned char TTUInt8
8 bit unsigned integer (char)
Definition: TTBase.h:174
Attempted a write to a read-only entity.
Definition: TTBase.h:354
TTFOUNDATION_EXPORT TTFloat64 TTRandom64()
Produces a random-valued 64-bit floating-point number in the range [0.0, 1.0].
Definition: TTBase.cpp:611