Jamoma API  0.6.0.a19
TTAudioGraphOutput.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup audioGraphLibrary
4  *
5  * @brief Defines output interface at the bottom of an AudioGraph
6  *
7  * @details TTAudioGraphOutput is an audio object that serves as the destination and master (terminal obejct or sink) for a #TTAudioGraph graph. In Jamoma AudioGraph audio processing is driven from a from a ‘terminal object’ or ‘sink’ at the bottom of the chain.
8  * This strategy for processing an audio graph is known as the ‘pull’ method.
9  * Typically sinks may be used for audio output, recording to disk, or for monitoring purposes.
10  * Sinks may have other #TTAudioGraphObjects connected upstream, but can not be connected to further downstream TTAudioGraphObjects.
11  *
12  * @authors Timothy Place, Trond Lossius
13  *
14  * @copyright Copyright © 2010, Timothy Place @n
15  * This code is licensed under the terms of the "New BSD License" @n
16  * http://creativecommons.org/licenses/BSD/
17  */
18 
19 
20 #ifndef __TTAUDIOGRAPH_OUTPUT_H__
21 #define __TTAUDIOGRAPH_OUTPUT_H__
22 
23 #include "TTAudioGraph.h"
24 
25 
26 /******************************************************************************************/
27 
28 /** TTAudioGraphOutput is an audio object that serves as the destination and master for a TTAudioGraph graph. */
29 class TTAUDIOGRAPH_EXPORT TTAudioGraphOutput : public TTAudioObjectBase
30 {
32 
33 public:
34  TTObjectBasePtr mAudioEngine; ///< The audio engine that signals are output to.
35  TTAudioSignalPtr placeHolder; ///< An unused audio signal that we pass
36  TTAudioGraphObjectBasePtr owner; ///< The owning AudioGraph instance
37  TTValuePtr me;
39  TTSymbol mDevice; ///< Name of the audio interface
40  TTUInt64 mSampleStamp; ///< The current time in samples
41 
42  /** Start audio processing.
43  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
44  */
45  TTErr start();
46 
47 
48  /** Stop audio processing.
49  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
50  */
51  TTErr stop();
52 
53  /** This method is called by the audio engine every time a new vector of output is required.
54  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
55  */
56  TTErr audioEngineWillProcess();
57 
58 
59  /**
60  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
61  */
62  TTErr setOwner(TTValue& newOwner, TTValue&);
63 
64 
65  /** Get a list of available audio devices.
66  @param returnedDeviceNames Used to return a list of available devices.
67  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
68  */
69  TTErr getAvailableDeviceNames(const TTValue&, TTValue& returnedDeviceNames);
70 
71 
72  /** Get current CPU load for the system, monitoring how demanding current processing is on the processor.
73  @param returnedValue Used to return current CPU load in percents.
74  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
75  */
76  TTErr getCpuLoad(const TTValue&, TTValue& returnedValue);
77 
78 
79  // Attribute Accessors
80 
81  /** Set sample rate.
82  @param newValue The new value for sample rate.
83  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
84  */
85  TTErr setSampleRate(const TTValue& newValue);
86 
87 
88  /** Get current sample rate.
89  @param returnedValue Used to return current sample rate.
90  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
91  */
92  TTErr getSampleRate(TTValue& returnedValue);
93 
94 
95  /** Set vector size.
96  @param The new vector size.
97  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
98  */
99  TTErr setVectorSize(const TTValue& newValue);
100 
101 
102  /** Get current vector size
103  @param returnedValue Used to return the current vector size.
104  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
105  */
106  TTErr getVectorSize(TTValue& returnedValue);
107 
108 
109  /** Set what audio output device to use.
110  @param newValue The new audio output device to use.
111  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
112  */
113  TTErr setDevice(const TTValue& newValue);
114 
115 
116  /** Get the current audio output device.
117  @parsam returnedValue Used to return what audio output device is currently being used.
118  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
119  */
120  TTErr getDevice(TTValue& returnedValue);
121 
122 
123  /** A standard audio processing method as used by Jamoma DSP objects.
124  @param outputs Unused.
125  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
126  */
127  TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
128 };
129 
130 /** A pointer to a #TTAudioGraphOutput.
131  @ingroup typedefs
132  */
134 
135 
136 #endif // __TTAUDIOGRAPH_OUTPUT_H__
TTSymbol mDevice
Name of the audio interface.
std::uint64_t TTUInt64
64 bit unsigned integer
Definition: TTBase.h:180
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTAudioGraphOutput is an audio object that serves as the destination and master for a TTAudioGraph gr...
Registers classes for the primary AudioGraph library.
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
TTAudioGraphOutput * TTAudioGraphOutputPtr
A pointer to a TTAudioGraphOutput.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTAudioGraphObjectBasePtr owner
The owning AudioGraph instance.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
The TTAudioSignal class represents N vectors of audio samples for M channels.
Definition: TTAudioSignal.h:57
TTUInt64 mSampleStamp
The current time in samples.
TTObjectBasePtr mAudioEngine
The audio engine that signals are output to.
TTAudioSignalPtr placeHolder
An unused audio signal that we pass.
A simple container for an array of TTAudioSignal pointers.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
The TTAudioGraphObjectBase wraps a TTDSP object such that it is possible to build a dynamic graph of ...
[doxygenAppendixC_bitmaskExample]
Definition: TTAudioGraph.h:81
TTErr setSampleRate(const TTUInt32 &newSampleRate)
Convenience method for updating the sample-rate.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34