Jamoma API  0.6.0.a19
Linear3D.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspTrajectoryLib
4  *
5  * @brief Linear Function Unit in 3D for Jamoma DSP
6  *
7  * @details a simple linear function in two dimensions @n
8  *
9  * @authors Nils Peters
10  *
11  * @copyright Copyright © 2011 by Nils Peters @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 "Linear3D.h"
18 
19 
20 #define thisTTClass Linear3D
21 #define thisTTClassName "linear.3D"
22 #define thisTTClassTags "audio, trajectory"
23 
24 
25 TT_AUDIO_CONSTRUCTOR
28  setProcessMethod(processAudio);
29 // setCalculateMethod(calculateValue);
30 }
31 
32 
33 Linear3D::~Linear3D()
34 {
35  ;
36 }
37 
39 {
40  TTAudioSignal& out = outputs->getSignal(0);
41  TTChannelCount numOutputChannels = out.getNumChannelsAsInt();
42 
43  if (numOutputChannels != 3) {
44  TTValue v = 3;
45  out.setMaxNumChannels(v);
46  out.setNumChannels(v);
47  }
48 
49  TTAudioSignal& in0 = inputs->getSignal(0);
50 
51 
52  TTUInt16 vs = in0.getVectorSizeAsInt();
53 
54  TTSampleValuePtr inSampleX = in0.mSampleVectors[0];
55  TTSampleValuePtr outSampleX = out.mSampleVectors[0];
56  TTSampleValuePtr outSampleY = out.mSampleVectors[1];
57  TTSampleValuePtr outSampleZ = out.mSampleVectors[2];
58 
59  for (int i=0; i<vs; i++) {
60  outSampleX[i] = inSampleX[i]-1.0;
61  outSampleY[i] = mA * outSampleX[i];
62  outSampleZ[i] = mB * outSampleX[i];
63  }
64  return kTTErrNone;
65 }
66 
67 
68 
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
#define addAttribute(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter...
Definition: TTAttribute.h:29
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by Jamoma DSP objects.
Definition: Linear3D.cpp:38
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTErr setMaxNumChannels(const TTValue &newMaxNumChannels)
Attribute accessor.
64-bit floating point
Definition: TTBase.h:272
The TTAudioSignal class represents N vectors of audio samples for M channels.
Definition: TTAudioSignal.h:57
TTSampleValue ** mSampleVectors
An array of pointers to the first sample in each vector. Declared Public for fast access...
Definition: TTAudioSignal.h:74
TTUInt16 TTChannelCount
Data type used when counting the number of channels in multi-channel audio signals and processes...
Definition: TTAudioSignal.h:31
A simple container for an array of TTAudioSignal pointers.
Linear Function Unit in 3D for Jamoma DSP.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
No Error.
Definition: TTBase.h:343
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34