Jamoma API  0.6.0.a19
TTGraphObjectBase.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup graphLibrary
4  *
5  * @brief Jamoma Asynchronous Object Graph Layer
6  *
7  * @details Creates a wrapper for #TTObjectBase that can be used to build a control graph for asynchronous message passing
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 
17 #ifndef __TTGRAPH_OBJECT_H__
18 #define __TTGRAPH_OBJECT_H__
19 
20 #include "TTGraph.h"
21 #include "TTGraphInlet.h"
22 #include "TTGraphOutlet.h"
23 #include "TTGraphDescription.h"
24 
25 
26 /******************************************************************************************/
27 
28 /**
29  The #TTGraphObjectBase wraps a TTDSP object such that it is possible to
30  build a dynamic graph of audio processing units.
31 
32  It is implemented as a TTObjectBase so that it can receive dynamically bound messages,
33  incliding notifications from other objects.
34 */
35 class TTGRAPH_EXPORT TTGraphObjectBase : public TTDataObjectBase {
37 
38 protected:
39  TTGraphInletVector mInlets; ///< The inlets through which we pull audio from sources
40  TTGraphOutletVector mOutlets; ///< The inlets through which we pull audio from sources
41  TTDictionaryPtr mDictionary; /// our copy of the data, from which we pass out references to the outlets
42  TTGraphDescription mDescription; ///< Used to pr event feedback loops etc. when describing a graph
43 
44 public:
45  TTObject mKernel; ///< The actual TT object doing the processing.
46 
47 
48  TTErr push(const TTDictionary& aDictionary);
49 
50 
51  void prepareDescription();
52  void getDescription(TTGraphDescription& desc);
53 
54 
55  /** Clear the lists of connected objects. */
56  TTErr reset();
57 
58 
59  // Magic sauce used by the connect method to setup outlets
60 private:
61  TTErr handshake(TTGraphObjectBasePtr objectWhichIsBeingConnected, TTUInt16 fromOutletNumber, TTUInt16 toInletNumber);
62 public:
63 
64  /** Add a source to the list of objects from which to request audio.
65  @param anObject The lydbaer object which is supplying us with input.
66  @param anInletNumber If this object has a second input mechanism (e.g. a sidechain input), then that is indicated here.
67  Typically the value passed here will be 0, indicating the normal audio input.
68  @return An error code. */
69  TTErr connect(TTGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0);
70 
71 
72  /** Drop a source from the list of objects from which to request audio. In other words, disconnect.
73  @param anObject The lydbaer object which is supplying us with input.
74  @param anInletNumber If this object has a second input mechanism (e.g. a sidechain input), then that is indicated here.
75  Typically the value passed here will be 0, indicating the normal audio input.
76  @return An error code. */
77  TTErr drop(TTGraphObjectBasePtr anObject, TTUInt16 fromOutletNumber=0, TTUInt16 toInletNumber=0);
78 
79 
80  // TODO: Need unit tests
81 };
82 
83 
84 #endif // __TTGRAPH_OBJECT_H__
The TTGraphObjectBase wraps a TTDSP object such that it is possible to build a dynamic graph of audio...
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
Jamoma Asynchronous Object Graph Layer.
Create and use Jamoma object instances.
Definition: TTObject.h:29
TTDataObjectBase is the base class for all data generating and processing objects.
TTGraphInletVector mInlets
The inlets through which we pull audio from sources.
TTGraphDescription mDescription
our copy of the data, from which we pass out references to the outlets
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 TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
Jamoma Asynchronous Object Graph Layer.
Jamoma Asynchronous Object Graph Layer.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTObject mKernel
The actual TT object doing the processing.
TTGraphOutletVector mOutlets
The inlets through which we pull audio from sources.
This object represents a single 'outlet' from a TTGraphObjectBase.
Jamoma Asynchronous Object Graph Layer.