22 #if defined( __APPLE__ )
24 #include "TargetConditionals.h"
26 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
27 #ifndef TT_PLATFORM_IOS
28 #define TT_PLATFORM_IOS
30 #else // TARGET_OS_MAC
31 #ifndef TT_PLATFORM_MAC
32 #define TT_PLATFORM_MAC
36 #elif (defined(_WIN64) || defined(_WIN32)) && !defined(__MINGW32__)
37 #ifndef TT_PLATFORM_WIN
38 #define TT_PLATFORM_WIN
40 #elif defined(__linux) || defined(__MINGW32__)
41 #if !defined(TT_PLATFORM_LINUX)
42 #define TT_PLATFORM_LINUX
46 #ifndef TT_PLATFORM_LINUX
47 #ifndef TT_PLATFORM_IOS
48 #ifndef TT_PLATFORM_WIN
50 #define TT_PLATFORM_WIN
52 #ifndef TT_PLATFORM_MAC
53 #define TT_PLATFORM_MAC
75 #ifdef TT_PLATFORM_LINUX
80 #ifdef TT_PLATFORM_WIN
84 #pragma warning(disable:4244) // to avoid possible data lost warning with MSVC
86 #ifndef _CRT_SECURE_NO_WARNINGS
87 #define _CRT_SECURE_NO_WARNINGS
89 #define snprintf _snprintf
90 #ifdef TTFOUNDATION_EXPORTS
91 #define TTFOUNDATION_EXPORT __declspec(dllexport)
94 #define TTFOUNDATION_EXPORT
96 #define TTFOUNDATION_EXPORT __declspec(dllimport)
100 #else // TT_PLATFORM_MAC
101 #ifdef TTFOUNDATION_EXPORTS
102 #define TTFOUNDATION_EXPORT __attribute__((visibility("default")))
104 #define TTFOUNDATION_EXPORT
119 #define TT_ENABLE_ASSERTIONS
122 #ifdef TT_ENABLE_ASSERTIONS
123 #define TT_ASSERT(name, result) \
126 TTLogError("%s:%ld ASSERTION %s FAILED\n", __FILE__, __LINE__, #name );\
130 #define TT_ASSERT(name, result) ((void)(0));
138 #ifndef TT_NO_DEPRECATION_WARNINGS
140 #define TT_DEPRECATED(func) __attribute__ ((deprecated)) func
141 #elif defined(_MSC_VER)
142 #define TT_DEPRECATED(func) __declspec(deprecated) func
144 #endif // !TT_NO_DEPRECATION_WARNINGS
145 #ifndef TT_DEPRECATED
146 #define TT_DEPRECATED(func) func
153 #if defined(_MSC_VER) || defined(__BORLANDC__)
156 #else // assuming gcc
157 #define TT_ALIGN_16 __attribute__((aligned (16)))
170 typedef char* TTCString;
171 typedef const char* TTImmutableCString;
234 typedef TTSampleVector::iterator TTSampleIter;
244 typedef std::atomic<uint32_t> TTAtomicUInt;
249 typedef TTPtr* TTHandle;
258 typedef std::vector<TTValue> TTVector;
259 typedef TTVector::iterator TTVectorIter;
298 typedef TTDataInfo* TTDataInfoPtr;
301 extern TTFOUNDATION_EXPORT TTDataInfoPtr
ttDataTypeInfo[kNumTTDataTypes];
305 extern TTFOUNDATION_EXPORT
TTSymbol kTTSymEmpty;
307 class TTFOUNDATION_EXPORT TTDataInfo {
317 static TTDataInfoPtr getInfoForType(
TTDataType type)
322 static TTDataInfoPtr getInfoForType(
TTSymbol& typeAsSymbol)
324 TTDataType type = matchSymbolToDataType(typeAsSymbol);
325 return getInfoForType(type);
333 static void addDataInfoForType(
TTDataType type);
369 TTImmutableCString reason;
375 const char* getReason()
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)
397 inline void TTAtomicIncrement(TTAtomicUInt& value)
409 inline void TTAtomicDecrement(TTAtomicUInt& value)
415 inline void TTAtomicIncrementWithBarrier(TTAtomicUInt& value)
417 value.fetch_add(1, std::memory_order_seq_cst);
421 inline void TTAtomicDecrementWithBarrier(TTAtomicUInt& value)
423 value.fetch_sub(1, std::memory_order_seq_cst);
429 auto oldVal = oldValue.load();
430 auto newVal = newValue.load();
431 value.compare_exchange_strong(oldVal, newVal);
440 return (clock() * 1000.0) / CLOCKS_PER_SEC;
447 return (clock() * 1000000.0) / CLOCKS_PER_SEC;
560 void TTFOUNDATION_EXPORT
TTLogMessage(TTImmutableCString message, ...);
565 void TTFOUNDATION_EXPORT
TTLogWarning(TTImmutableCString message, ...);
570 void TTFOUNDATION_EXPORT
TTLogError(TTImmutableCString message, ...);
575 void TTFOUNDATION_EXPORT
TTLogDebug(TTImmutableCString message, ...);
594 #endif // __TT_BASE_H__
TTFOUNDATION_EXPORT TTDataInfoPtr ttDataTypeInfo[kNumTTDataTypes]
An array, indexed by values from TTDataType, containing information about those data types...
An instance of a TTMatrix object.
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
std::uint16_t TTUInt16
16 bit unsigned integer
void TTFOUNDATION_EXPORT TTFree16(TTPtr ptr)
Free memory allocated using TTMalloc16().
An inappropriate value was specified for an attribute or variable.
Couldn't resolve the filepath as submitted.
Attempted to access memory outside a matrix or array (in a TTMatrix & TTSampleMatrix).
TTFOUNDATION_EXPORT const TTFloat64 kTTAntiDenormalValue
Constant used by the ttantidenormal function.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupQuarterSine[]
Quarter Sine lookup table.
std::atomic< int32_t > TTAtomicInt
An integer that can be used for atomic operations.
std::uint64_t TTUInt64
64 bit unsigned integer
void(* TTFunctionPtr)()
A simple/generic function pointer with no args.
Couldn't instantiate the Jamoma object requested.
8-bit unsigned integer, range is 0 through 255.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupSquareRootSymetric[]
Square Root lookup table with 0.701 at element 256.
An invalid number of audio channels for a given context was encountered.
TTFOUNDATION_EXPORT const TTFloat64 kTTInv255
Constant for color representation when converting from char8 to float representation.
64-bit unsigned integer, range is 0 through 18,446,744,073,709,551,615.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupHalfPaddedwWelch[]
256 point window table (the first half of it)
TTPtr TTFOUNDATION_EXPORT TTMalloc16(size_t numBytes)
Allocate memory from the heap aligned to 16-byte boundaries.
TTFOUNDATION_EXPORT const TTFloat64 kTTQuarterPi
[doxygenAppendixC_constExample]
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoPi
Pre-calculated value of pi * 2.
TTDataType
TTBlue Data Types Enumeration of data types used through out TTBlue, including the TTValue class and ...
TTInt32 TTColumnID
Datatype for any number used to indicate a column index within the matrix.
Bad DataType for the context.
The wrong number of values were passed to a method or attribute.
TTInt32 TTRowID
Datatype for any number used to indicate a row index within a matrix.
std::complex< double > TTComplex
Complex number.
double TTFloat64
64 bit floating point number
This is a special type used by TTAttribute to indicate that a value is a TTValue and is locally maint...
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoSqrt2
Pre-calculated value of 2 * sqrt(2) (2.8284).
TTFloat64 TTGetTimeInMicroseconds()
Return the current system time in microseconds.
16-bit unsigned integer, range is 0 through 65,535.
An error represented by TTErr.
void * TTPtr
A generic pointer.
std::int64_t TTInt64
64 bit signed integer
std::int16_t TTInt16
16 bit signed integer
TTFOUNDATION_EXPORT const TTFloat64 kTTGainMidiPowerInv
Invverse power constant used when calculating MID gain.
TTFOUNDATION_EXPORT const TTFloat64 kTTRadiansToDegrees
Factor constant for converting radians to degrees.
16-bit signed integer, range is −32,768 through 32,767.
A TTBlue exception is thown with this object.
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message,...)
Platform and host independent method for posting errors.
float TTFloat32
32 bit floating point number
TTFloat64 TTGetTimeInMilliseconds()
Return the current system time in milliseconds.
Boolean (1/0) or (true/false) flag.
TTFOUNDATION_EXPORT const TTFloat64 kTTHalfSqrt2
Pre-calculated value of sqrt(2)/2 (0.701).
A value was not found when doing a look up for it (in a TTHash, TTList, or other class).
TTFOUNDATION_EXPORT const TTFloat64 kTTSqrt2
Pre-calculated square-root of 2 (1.4142).
std::int32_t TTInt32
32 bit signed integer
TTByte * TTBytePtr
Data is a pointer to some bytes.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupEqualPower[]
Equal Power lookup table, 512 elements.
64-bit signed integer, ragne is −9,223,372,036,854,775,808 through 9,223,372,036,854,775,807
void(* TTFunctionMatch)(const TTValue &valueToCheck, TTPtr baton, TTBoolean &found)
Use for finding stuff in a list or a hash or a dictionary.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupEqualPowerSymetric[]
Equal Power lookup table with 0.701 at element 256.
void TTFOUNDATION_EXPORT TTLogWarning(TTImmutableCString message,...)
Platform and host independent method for posting warnings.
32-bit signed integer, range is -2,147,483,648 through 2,147,483,647.
void TTFOUNDATION_EXPORT TTLogMessage(TTImmutableCString message,...)
Platform and host independent method for posting log messages.
unsigned char TTByte
Byte value.
long TTPtrSizedInt
An integer that is the same size as a pointer.
Something went wrong, but what exactly is not known. Typically used for context-specific problems...
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
TTInt16 TTElementID
Datatype for any number used to indicate an element index within the matrix.
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...
signed char TTInt8
8 bit signed integer (char)
std::uint32_t TTUInt32
32 bit unsigned integer
TTFOUNDATION_EXPORT const TTFloat64 kTTDegreesToRadians
Factor constant for converting degrees to radians.
void TTFOUNDATION_EXPORT TTLogDebug(TTImmutableCString message,...)
Platform and host independent method for posting messages only when debugging is enabled in the envir...
TTFOUNDATION_EXPORT const TTFloat64 kTTHalfPi
Pre-calculated value of pi/2.
32-bit unsigned integer, range is 0 through 4,294,967,295.
8-bit signed integer, range is -128 through 127.
TTFOUNDATION_EXPORT const TTFloat64 kTTGainMidiPower
Power constant used when calculating MID gain.
TTFOUNDATION_EXPORT const TTFloat32 kTTLookupSquareRoot[]
Square Root lookup table, 512 elements.
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
Method not found. Typically returned by the TTObject::sendMessage() function.
TTFOUNDATION_EXPORT const TTFloat64 kTTEpsilon
A very very small value, used for float equality comaprisments.
TTFloat64 TTSampleValue
A value representing a single audio sample.
[doxygenAppendixC_copyExample]
void(* TTFunctionWithArgPtr)(TTPtr)
A simple/generic function pointer with one arg.
unsigned char TTUInt8
8 bit unsigned integer (char)
Attempted a write to a read-only entity.
TTFOUNDATION_EXPORT TTFloat64 TTRandom64()
Produces a random-valued 64-bit floating-point number in the range [0.0, 1.0].