Jamoma API  0.6.0.a19
PlugtasticOutput.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup audioGraphPlugtastic
4  *
5  * @brief Manage output signals from Plugtastic
6  *
7  * @details
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 #include "PlugtasticOutput.h"
17 
18 #define thisTTClass PlugtasticOutput
19 #define thisTTClassName "plugtastic.output"
20 #define thisTTClassTags "audio, output, plugtastic"
21 
22 
23 TT_AUDIO_CONSTRUCTOR
24 {
25  registerAttribute(TT("linearGain"), kTypeFloat64, &mGain);
28 
29  // Set Defaults...
30  setAttributeValue(TT("linearGain"), 1.0);
31  setProcessMethod(processAudio);
32 }
33 
34 
35 PlugtasticOutput::~PlugtasticOutput()
36 {
37  ;
38 }
39 
40 
42 {
43  mGain = TTDecibelsToLinearGain(newValue);
44  return kTTErrNone;
45 }
46 
47 
49 {
51  return kTTErrNone;
52 }
53 
54 
56 {
57  mGain = TTMidiToLinearGain(newValue);
58  return kTTErrNone;
59 }
60 
61 
63 {
64  value = TTLinearGainToMidi(mGain);
65  return kTTErrNone;
66 }
67 
68 
70 {
71  TTAudioSignal& in = inputs->getSignal(0);
72  TTAudioSignal& out = outputs->getSignal(0);
73  TTUInt16 vs;
74  TTSampleValue *inSample,
75  *outSample;
77  TTChannelCount channel;
78 
79  for (channel=0; channel<numchannels; channel++) {
80  inSample = in.mSampleVectors[channel];
81  outSample = out.mSampleVectors[channel];
82  vs = in.getVectorSizeAsInt();
83 
84  while (vs--)
85  *outSample++ = (*inSample++) * mGain;
86  }
87  return kTTErrNone;
88 }
89 
TTFloat64 TTDecibelsToLinearGain(TTFloat64 value)
Convert decibels into linear ampliude.
TTErr(TTObjectBase::* TTSetterMethod)(const TTAttribute &attribute, const TTValue &value)
A type that can be used to store a pointer to a message for an object.
Definition: TTObjectBase.h:78
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTFloat64 TTLinearGainToDecibels(const TTFloat64 value)
Convert linear amplitude into deciBels.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTErr getMidiGain(TTValue &value)
retreive the gain in midi units.
TTFloat64 TTLinearGainToMidi(TTFloat64 value)
Convert linear amplitude into midi.
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
Definition: TTSymbol.h:155
64-bit floating point
Definition: TTBase.h:272
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by Jamoma DSP objects.
TTErr setMidiGain(const TTValue &newValue)
set the gain using midi units.
static TTChannelCount getMinChannelCount(const TTAudioSignal &signal1, const TTAudioSignal &signal2)
Use this class method to determine the least number of channels the two signals have in common...
The TTAudioSignal class represents N vectors of audio samples for M channels.
Definition: TTAudioSignal.h:57
TTFloat64 mGain
linear gain to be applied to the input signal
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
TTErr setGain(const TTValue &newValue)
setter for converting gain input from db to linear.
TTFloat64 TTMidiToLinearGain(TTFloat64 value)
Convert midi into linear amplitude.
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
No Error.
Definition: TTBase.h:343
TTErr getGain(TTValue &value)
getter for converting gain input from linear to db.
TTErr(TTObjectBase::* TTGetterMethod)(const TTAttribute &attribute, TTValue &value)
A type that can be used to store a pointer to a message for an object.
Definition: TTObjectBase.h:73
Manage output signals from Plugtastic.
TTFloat64 TTSampleValue
A value representing a single audio sample.
Definition: TTBase.h:230
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34