Jamoma API  0.6.0.a19
TTParameter.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup graphLibrary
4  *
5  * @brief Jamoma Class for representing parameters for modules, plug-ins, etc.
6  *
7  * @details
8  *
9  * @authors Timothy Place
10  *
11  * @copyright Copyright © 2010 by 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 #include "TTGraphObjectBase.h"
17 #include "TTParameter.h"
18 
19 #define thisTTClass TTParameter
20 #define thisTTClassName "parameter"
21 #define thisTTClassTags "plugtastic, parameter"
22 
23 
25  mOwner(NULL)
26 {
29  addAttribute(RangeBottom, kTypeFloat64);
30  addAttribute(RangeTop, kTypeFloat64);
31  addAttribute(Default, kTypeFloat64);
32  addAttribute(Style, kTypeSymbol);
33 
34  mDictionary.setSchema(TT("attribute"));
35 
36  setAttributeValue(TT("name"), TT("my parameter"));
37  setAttributeValue(TT("rangeBottom"), 0.0);
38  setAttributeValue(TT("rangeTop"), 1.0);
39  setAttributeValue(TT("default"), 0.5);
40  setAttributeValue(TT("style"), TT("generic"));
41  setAttributeValue(TT("value"), 0.0);
42 }
43 
44 
45 TTParameter::~TTParameter()
46 {
47  ;
48 }
49 
50 
51 TTErr TTParameter::setName(const TTValue& newValue)
52 {
53  mName = newValue;
54  mDictionary.remove(TT("name"));
55  mDictionary.append(TT("name"), newValue);
56  return kTTErrNone;
57 }
58 
59 
60 TTErr TTParameter::setValue(const TTValue& newValue)
61 {
62  mValue = newValue;
63  mDictionary.setValue(newValue);
64  return push(mDictionary);
65 }
66 
67 
68 TTErr TTParameter::setOwner(TTGraphObjectBasePtr newOwner)
69 {
70  mOwner = newOwner;
71  return kTTErrNone;
72 }
73 
74 
75 TTErr TTParameter::push(const TTDictionary& aDictionary)
76 {
77  if (mOwner) {
78  return mOwner->push(aDictionary);
79  }
80  else {
81  return kTTErrGeneric;
82  }
83 }
84 
The TTGraphObjectBase wraps a TTDSP object such that it is possible to build a dynamic graph of audio...
#define addAttribute(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter...
Definition: TTAttribute.h:29
Jamoma Asynchronous Object Graph Layer.
Symbol type.
Definition: TTBase.h:282
A type that represents the key as a C-String and the value as a pointer to the matching TTSymbol obje...
Definition: TTDictionary.h:47
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
Definition: TTSymbol.h:155
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
64-bit floating point
Definition: TTBase.h:272
Jamoma Class for representing parameters for modules, plug-ins, etc.
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
#define addAttributeWithSetter(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom setter...
Definition: TTAttribute.h:47
No Error.
Definition: TTBase.h:343
TT_OBJECT_CONSTRUCTOR
Constructor macro.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34