Jamoma API  0.6.0.a19
TTInput.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularLibrary
4  *
5  * @brief Handles any signal input
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue
10  *
11  * @copyright © 2010, Théo de la Hogue @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 __TT_INPUT_H__
18 #define __TT_INPUT_H__
19 
20 #include "TTModularIncludes.h"
21 #include "TTOutput.h"
22 
23 /** TTInput ... TODO : an explanation
24 
25 
26  */
27 
28 class TTOutput;
29 typedef TTOutput* TTOutputPtr;
30 
31 class TTMODULAR_EXPORT TTInput : public TTObjectBase
32 {
33  TTCLASS_SETUP(TTInput)
34 
35 public: // use public for quick acces during signal processing
36 
37  TTSymbol mType; ///< ATTRIBUTE : the type of the input signal (like audio, video, ...)
38  TTAddress mOutputAddress; ///< ATTRIBUTE : address of the output to bind
39 
40  TTBoolean mMute; ///< ATTRIBUTE : to mute signal
41  TTBoolean mBypass; ///< ATTRIBUTE : to pass signal directly to a TTOutput object
42 
43  // In the below a "signal" is any kind item in a stream of data that is flowing through this object
44  // Sometimes we just use TTValue (for simple numbers)
45  // Sometimes we need more complex structures (like audio signal)s
46  // When it is just a TTValue we don't use these below -- they are used for e.g. the audio signal case
47 
48  TTObject mSignalIn; ///< any data structure to receive complex signal
49 
50  TTList mSignalCache; ///< a list of any data structure to deal with others complex signals (like mixing, dubbing, ...)
51  ///< this is used to receive audio e.g. from many jcom.send~ objects pointing to our object
52  ///< note that the senders also have object caches that point back to us if appropriate
53 
54  TTObject mSignalOut; ///< any data structure to send complex signal
55  ///< mirrors the input to the model
56 
57  TTObject mSignalZero; ///< a zero signal -- used when e.g. muted
58 
59  TTObject mOutputObject; ///< TTOutput object to which to forward is we are linked to a TTOutput object
60 
61 private:
62 
63  TTObject mReturnSignalCallback; ///< a way to return back signal to the owner of this input
64  TTObject mAddressObserver; ///< to observe mOutputAddress creation/destruction
65 
66  TTValue mSignal; ///< ATTRIBUTE : dummy variable -- unused by the attribute but here because the macro expects it
67  TTAttributePtr mSignalAttr; ///< optimization: cache the pointer to the above attribute for direct access to the
68  ///< signal preview attribute to notify observers
69 
70 
71  /** Send signal. The mIndex have to be choosen before
72 
73  If you have a link (see below) then this forwards the received message to the linked output object.
74  (not used in the case of the TTInputAudio subclass)
75 
76  @param inputValue message coming into the input, e.g. a "jit_matrix foo" message
77  @param outputValue unused
78  */
79  TTErr Send(const TTValue& inputValue, TTValue& outputValue);
80 
81  /** Set outputObject that is to be linked with this input to create a pair (e.g. for mixing, bypassing, etc.)
82  There can only zero or one links from an input/output.
83  If you try to create a link without first unlinking the previous link is overwritten.
84  */
85  TTErr Link(const TTValue& inputValue, TTValue& outputValue);
86 
87  /** Remove outputObject */
88  TTErr Unlink();
89 
90 
91  /** Set the outputAddress attribute
92  When we set this we observe the namespace to know when an output object is registered or unregistered at this address.
93  When this address exists it will automatically link us by calling the Link method (above).
94  */
95  TTErr setOutputAddress(const TTValue& value);
96 
97 
98  /** Notify signal observer
99  Messages go to TTReceiver (e.g. j.receive)
100  */
101  TTErr notifySignalObserver(const TTValue& value);
102 
103  friend TTErr TTMODULAR_EXPORT TTInputDirectoryCallback(const TTValue& baton, const TTValue& data);
104 
105 };
106 
107 typedef TTInput* TTInputPtr;
108 
109 /**
110  @param baton ..
111  @param data ..
112  @return an error code */
113 TTErr TTMODULAR_EXPORT TTInputDirectoryCallback(const TTValue& baton, const TTValue& data);
114 
115 
116 #endif // __TT_INPUT_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTModular Library.
The TTAddress class is used to represent a string and efficiently pass and compare that string...
Definition: TTAddress.h:29
Create and use Jamoma object instances.
Definition: TTObject.h:29
This class represents a single attribute, as used by the TTObjectBase class.
Definition: TTAttribute.h:79
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr TTMODULAR_EXPORT TTInputDirectoryCallback(const TTValue &baton, const TTValue &data)
Definition: TTInput.cpp:163
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
Handles any signal output.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34