Jamoma API  0.6.0.a19
TTAudioGraphGenerator.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup audioGraphLibrary
4  *
5  * @brief Generates the AudioGraph structure
6  *
7  * @details
8  *
9  * @authors Timothy Place, Trond Lossius
10  *
11  * @copyright Copyright © 2010, 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 #include "TTAudioGraphGenerator.h"
18 
19 #define thisTTClass TTAudioGraphGenerator
20 #define thisTTClassName "audio.generator"
21 #define thisTTClassTags "audioGraphLibrary, audio, graph, generator"
22 
23 TT_AUDIO_CONSTRUCTOR,
24  mBuffer(NULL)
25 {
26  // arguments is the number of inlets (not the number of channels)
27  TTObjectBaseInstantiate(kTTSym_audiosignal, &mBuffer, arguments);
28 
30  addUpdates(MaxNumChannels);
31  addUpdates(SampleRate);
32 
33  setAttributeValue(kTTSym_vectorSize, 64);
34  setAttributeValue(TT("maxNumChannels"), 1);
35  setProcessMethod(processAudio);
36 }
37 
38 
39 TTAudioGraphGenerator::~TTAudioGraphGenerator()
40 {
42 }
43 
44 
46 {
47  mVectorSize = newVectorSize;
48  return mBuffer->setAttributeValue(TT("vectorSize"), mVectorSize);
49 }
50 
51 
53 {
54  mBuffer->setAttributeValue(TT("maxNumChannels"), mMaxNumChannels);
55  mBuffer->setAttributeValue(TT("numChannels"), mMaxNumChannels);
56  return mBuffer->sendMessage(TT("alloc"));
57 }
58 
59 
61 {
62  return kTTErrNone;
63 }
64 
65 
67 {
68  TTAudioSignal& out = outputs->getSignal(0);
69  return TTAudioSignal::copy(*mBuffer, out);
70 }
71 
72 
TTErr sendMessage(const TTSymbol name)
TODO: Document this function.
TTErr TTObjectBaseRelease(TTObjectBasePtr *anObject)
DEPRECATED.
Generates the AudioGraph structure.
TTChannelCount mMaxNumChannels
This is the maximum number of channels that can be guaranteed to work.
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by Jamoma DSP objects.
TTErr updateSampleRate(const TTValue &oldSampleRate, TTValue &)
Update the sample rate.
TTErr updateMaxNumChannels(const TTValue &oldMaxNumChannels, TTValue &)
Update the maximum number of channels to process.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTErr setAttributeValue(const TTSymbol name, TTValue &value)
Set an attribute value for an object.
16-bit unsigned integer, range is 0 through 65,535.
Definition: TTBase.h:276
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
Definition: TTSymbol.h:155
TTErr TTObjectBaseInstantiate(const TTSymbol className, TTObjectBasePtr *returnedObjectPtr, const TTValue arguments)
DEPRECATED.
The TTAudioSignal class represents N vectors of audio samples for M channels.
Definition: TTAudioSignal.h:57
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
TTErr setVectorSize(const TTValue &newVectorSize)
Set the vector size for audio processing.
#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
static TTErr copy(const TTAudioSignal &source, TTAudioSignal &dest, TTChannelCount channelOffset=0)
Copy the audio from one signal into another.
TTAudioSignalPtr mBuffer
Storage for the audioSignal that we provide.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
#define addUpdates(updateName)
An 'update' is a message sent to a subclass instance from its parent class.
Definition: TTMessage.h:44