Jamoma API  0.6.0.a19
TTAudioEngine.cpp
Go to the documentation of this file.
1 /** @file
2 
3  @ingroup dspLibrary
4 
5  @brief The #TTAudioEngine class is the Audio Engine of Jamoma DSP
6 
7  @details #TTAudioEngine is a class that is used to drive realtime audio and scheduling operations in the Jamoma DSP environment.
8  It is currently implemented as a wrapper around PortAudio.
9 
10  QUESTIONS
11 
12  - Should this be a singleton, like the environment object? Can be associated with a key in the global dictionary namespace
13  - How do we properly clean-up the environment from something like Max? I guess we need a quittask?
14 
15  THOUGHTS
16 
17  - A #TTAudioOutput class will work by writing to the #TTAudioEngine's output buffer.
18  - Likewise a #TTAudioInput class will work by retrieving from the #TTAudioEngine's input buffer.
19  - The scheduler, and others like the Jamoma AudioGraph output class, will subscribe to this class for notifications on each call from PortAudio.
20 
21  - PortAudio doesn't work on iOS, so perhaps PortAudio should be separated from the AudioEngine and provide audio driver classes to it.
22 
23  @authors Tim Place, Nathan Wolek, Trond Lossius
24 
25  @copyright Copyright © 2008 by Timothy Place @n
26  This code is licensed under the terms of the "New BSD License" @n
27  http://creativecommons.org/licenses/BSD/
28  */
29 
30 
31 #include "TTAudioEngine.h"
32 
33 #define thisTTClass TTAudioEngine
34 #define thisTTClassName "AudioEngine"
35 #define thisTTClassDescription "Provide an interface to audio input and output services of the OS"
36 #define thisTTClassTags "audio, engine, singleton"
37 
38 TTObjectBasePtr TTAudioEngine::sSingletonInstance = NULL;
40 
41 
42 extern "C" TT_EXTENSION_EXPORT TTErr TTLoadJamomaExtension_AudioEngine(void)
43 {
44  TTDSPInit();
45  thisTTClass :: registerClass();
46 
47  // create the global instance
48 
49  TTAudioEngine::sDictionary = new TTDictionary("j@m0m@_audioengine");
50  TTPtr engine = TTAudioEngine::create();
51 
52  TTAudioEngine::sDictionary->setValue(engine);
53 
54  return kTTErrNone;
55 }
56 
57 
59  mNumInputChannels(2),
60  mNumOutputChannels(2),
61  mVectorSize(64),
62  mSampleRate(44100),
63  mStream(NULL),
64  mInputDeviceInfo(NULL),
65  mOutputDeviceInfo(NULL),
66  mInputDeviceIndex(0),
67  mOutputDeviceIndex(0),
68  mIsRunning(false),
69  mInputBuffer(NULL),
70  mOutputBuffer(NULL)
71 {
72  if (sSingletonInstance)
73  throw TTException("cannot instantiate multiple copies of a singleton class");
74 
75  mCallbackObservers = new TTList;
76  mCallbackObservers->setThreadProtection(NO); // ... because we make calls into this at every audio vector calculation ...
77 
78  TTObjectBaseInstantiate(kTTSym_audiosignal, &mInputBuffer, 1);
79  TTObjectBaseInstantiate(kTTSym_audiosignal, &mOutputBuffer, 1);
80 
81  // numChannels should be readonly -- how do we do that?
82  addAttribute(NumInputChannels, kTypeUInt16);
83  addAttribute(NumOutputChannels, kTypeUInt16);
84 
87  addAttributeWithSetter(InputDevice, kTypeSymbol);
88  addAttributeWithSetter(OutputDevice, kTypeSymbol);
89 
90  addMessage(start);
91  addMessage(stop);
92  addMessageWithArguments(getCpuLoad);
93 
94  addMessageWithArguments(getAvailableInputDeviceNames);
95  addMessageWithArguments(getAvailableOutputDeviceNames);
96 
97  addMessageWithArguments(addCallbackObserver);
98  addMessageProperty(addCallbackObserver, hidden, YES);
99  addMessageWithArguments(removeCallbackObserver);
100  addMessageProperty(removeCallbackObserver, hidden, YES);
101 
102  addMessageWithArguments(getInputSignalReference);
103  addMessageWithArguments(getOutputSignalReference);
104 
105  // Set defaults -- there are no devices actually named 'default', so we set the values directly
106  mInputDevice = "default";
107  mOutputDevice = "default";
108 }
109 
110 
111 TTAudioEngine::~TTAudioEngine()
112 {
113  PaError err;
114 
115  if (mStream) {
116  if (mIsRunning)
117  stop();
118 
119  err = Pa_CloseStream(mStream);
120  if (err != paNoError)
121  TTLogError("PortAudio error freeing engine: %s", Pa_GetErrorText(err));
122  }
123  delete mCallbackObservers;
124  TTObjectBaseRelease(&mInputBuffer);
125  TTObjectBaseRelease(&mOutputBuffer);
126 }
127 
128 
130 {
131  PaError err;
132  TTBoolean shouldRun = mIsRunning;
133 
134  if (mIsRunning)
135  stop();
136 
137  if (mStream) {
138  Pa_CloseStream(mStream);
139  mStream = NULL;
140  }
141 
142  if ((mInputDevice == "default" || mInputDevice == kTTSymEmpty) && (mOutputDevice == "default" || mOutputDevice == kTTSymEmpty)) {
143  err = Pa_OpenDefaultStream(&mStream,
146  paFloat32,
147  mSampleRate,
148  mVectorSize,
150  this);
151  }
152  else {
153  PaStreamParameters outputParameters;
154  PaStreamParameters inputParameters;
155 
156  inputParameters.channelCount = mNumInputChannels;
157  inputParameters.device = mInputDeviceIndex;
158  inputParameters.hostApiSpecificStreamInfo = NULL;
159  inputParameters.sampleFormat = paFloat32;
160  inputParameters.suggestedLatency = Pa_GetDeviceInfo(mInputDeviceIndex)->defaultLowInputLatency;
161 
162  outputParameters.channelCount = mNumOutputChannels;
163  outputParameters.device = mOutputDeviceIndex;
164  outputParameters.hostApiSpecificStreamInfo = NULL;
165  outputParameters.sampleFormat = paFloat32;
166  outputParameters.suggestedLatency = Pa_GetDeviceInfo(mOutputDeviceIndex)->defaultLowOutputLatency;
167 
168  err = Pa_OpenStream(
169  &mStream,
170  &inputParameters,
171  &outputParameters,
172  mSampleRate,
173  mVectorSize,
174  paNoFlag, //flags that can be used to define dither, clip settings and more
175  TTAudioEngineStreamCallback, //your callback function
176  this);
177 
178  }
179 
180  if (err != paNoError )
181  TTLogError("PortAudio error creating TTAudioEngine: %s", Pa_GetErrorText(err));
182 
183 
184  // Now that the stream is initialized, we need to setup our own buffers for reading and writing.
185  mInputBuffer->setMaxNumChannels(mNumInputChannels);
186  mInputBuffer->setNumChannels(mNumInputChannels);
187  mInputBuffer->setVectorSizeWithInt(mVectorSize);
188  mInputBuffer->alloc();
189 
190  mOutputBuffer->setMaxNumChannels(mNumOutputChannels);
191  mOutputBuffer->setNumChannels(mNumOutputChannels);
192  mOutputBuffer->setVectorSizeWithInt(mVectorSize);
193  mOutputBuffer->alloc();
194 
195  if (shouldRun)
196  start();
197 
198  return (TTErr)err;
199 }
200 
201 
203 {
204  PaError err = paNoError;
205 
206  if (!mIsRunning) {
207  if (!mStream)
208  initStream();
209 
210  err = Pa_StartStream(mStream);
211  if (err != paNoError)
212  TTLogError("PortAudio error starting engine: %s", Pa_GetErrorText(err));
213 
214  mIsRunning = true;
215  }
216  return (TTErr)err;
217 }
218 
219 
221 {
222  PaError err = paNoError;
223 
224  if (mStream) {
225  err = Pa_StopStream(mStream);
226  if (err != paNoError)
227  TTLogError("PortAudio error stopping engine: %s", Pa_GetErrorText(err));
228  }
229  mIsRunning = false;
230  return (TTErr)err;
231 }
232 
233 
234 TTErr TTAudioEngine::getCpuLoad(const TTValue& unusedInput, TTValue& returnedValue)
235 {
236  TTFloat64 cpuLoad = Pa_GetStreamCpuLoad(mStream);
237 
238  returnedValue = cpuLoad;
239  return kTTErrNone;
240 }
241 
242 
243 TTErr TTAudioEngine::getAvailableInputDeviceNames(const TTValue& unusedInput, TTValue& returnedDeviceNames)
244 {
245  const PaDeviceInfo* deviceInfo;
246  int numDevices;
247 
248  returnedDeviceNames.clear();
249 
250  numDevices = Pa_GetDeviceCount();
251  if (numDevices < 0) {
252  printf("ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
253  return kTTErrGeneric;
254  }
255 
256  for (int i=0; i<numDevices; i++) {
257  deviceInfo = Pa_GetDeviceInfo(i);
258  if (deviceInfo->maxInputChannels)
259  returnedDeviceNames.append(deviceInfo->name);
260  }
261  return kTTErrNone;
262 }
263 
264 
265 TTErr TTAudioEngine::getAvailableOutputDeviceNames(const TTValue& unusedInput, TTValue& returnedDeviceNames)
266 {
267  const PaDeviceInfo* deviceInfo;
268  int numDevices;
269 
270  returnedDeviceNames.clear();
271 
272  numDevices = Pa_GetDeviceCount();
273  if (numDevices < 0) {
274  printf("ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
275  return kTTErrGeneric;
276  }
277 
278  for (int i=0; i<numDevices; i++) {
279  deviceInfo = Pa_GetDeviceInfo(i);
280  if (deviceInfo->maxOutputChannels)
281  returnedDeviceNames.append(deviceInfo->name);
282  }
283  return kTTErrNone;
284 }
285 
286 
288 {
289  TTSymbol newDevice = newDeviceName;
290  const PaDeviceInfo* deviceInfo;
291  int numDevices;
292 
293  if (newDevice != mInputDevice) {
294  numDevices = Pa_GetDeviceCount();
295  for (int i=0; i<numDevices; i++) {
296  deviceInfo = Pa_GetDeviceInfo(i);
297  if (newDevice == TTSymbol(deviceInfo->name)) {
298  mInputDeviceInfo = deviceInfo;
299  mInputDeviceIndex = i;
300  mNumInputChannels = mInputDeviceInfo->maxInputChannels;
301 
302  mInputDevice = newDevice;
303  if (mIsRunning)
304  return initStream();
305  else if (mStream) {
306  Pa_CloseStream(mStream);
307  mStream = NULL;
308  }
309  return kTTErrNone;
310  }
311  }
312  return kTTErrGeneric;
313  }
314  return kTTErrNone;
315 }
316 
317 
319 {
320  TTSymbol newDevice = newDeviceName;
321  const PaDeviceInfo* deviceInfo;
322  int numDevices;
323 
324  if (newDevice != mOutputDevice) {
325  numDevices = Pa_GetDeviceCount();
326  for (int i=0; i<numDevices; i++) {
327  deviceInfo = Pa_GetDeviceInfo(i);
328  if (newDevice == TTSymbol(deviceInfo->name)) {
329  mOutputDeviceInfo = deviceInfo;
330  mOutputDeviceIndex = i;
331  mNumOutputChannels = mOutputDeviceInfo->maxOutputChannels;
332 
333  mOutputDevice = newDevice;
334  if (mIsRunning)
335  return initStream();
336  else if (mStream) {
337  Pa_CloseStream(mStream);
338  mStream = NULL;
339  }
340  return kTTErrNone;
341  }
342  }
343  return kTTErrGeneric;
344  }
345  return kTTErrNone;
346 }
347 
348 
350 {
351  if (TTUInt16(newVectorSize) != mVectorSize) {
352  mVectorSize = newVectorSize;
353  if (mIsRunning)
354  return initStream();
355  }
356  return kTTErrNone;
357 }
358 
359 
361 {
362  if (TTUInt32(newSampleRate) != mSampleRate) {
363  mSampleRate = newSampleRate;
364  if (mIsRunning)
365  return initStream();
366  }
367  return kTTErrNone;
368 }
369 
370 
371 TTErr TTAudioEngine::addCallbackObserver(const TTValue& objectToReceiveNotifications, TTValue& unusedOutput)
372 {
373  mCallbackObservers->append(objectToReceiveNotifications);
374  return kTTErrNone;
375 }
376 
377 
378 TTErr TTAudioEngine::removeCallbackObserver(const TTValue& objectCurrentlyReceivingNotifications, TTValue& unusedOutput)
379 {
380  mCallbackObservers->remove(objectCurrentlyReceivingNotifications);
381  return kTTErrNone;
382 }
383 
384 
386  TTFloat32* output,
387  TTUInt32 frameCount,
388  const PaStreamCallbackTimeInfo* timeInfo,
389  PaStreamCallbackFlags statusFlags)
390 {
391  mInputBuffer->clear();
392  mOutputBuffer->clear();
393 
394  // right now we copy all of the channels, regardless of whether or not they are actually being used
395  // TODO: only copy the channels that actually contain new audio samples
396  for (unsigned int i=0; i<frameCount; i++) {
397  for (TTChannelCount channel=0; channel<mNumInputChannels; channel++)
398  mInputBuffer->mSampleVectors[channel][i] = *input++;
399  }
400 
401  // notify any observers that we are about to process a vector
402  // for example, an audio graph will do all of its processing in response to this
403  // also, the scheduler will be serviced as a result of this
404  mCallbackObservers->iterateObjectsSendingMessage("audioEngineWillProcess");
405 
406  // right now we copy all of the channels, regardless of whether or not they are actually being used
407  // TODO: only copy the channels that actually contain new audio samples
408  for (unsigned int i=0; i<frameCount; i++) {
409  for (TTChannelCount channel=0; channel<mNumOutputChannels; channel++)
410  *output++ = TTClip(mOutputBuffer->mSampleVectors[channel][i], -1.0, 1.0);
411  }
412  return 0;
413 }
414 
415 
416 TTErr TTAudioEngine::getInputSignalReference(TTValue& anUnusedInput, TTValue& aReturnedAudioSignalPtr)
417 {
418  aReturnedAudioSignalPtr = (TTPtr)TTObjectBaseReference(mInputBuffer);
419  return kTTErrNone;
420 }
421 
422 
423 TTErr TTAudioEngine::getOutputSignalReference(TTValue& anUnusedInput, TTValue& aReturnedAudioSignalPtr)
424 {
425  aReturnedAudioSignalPtr = (TTPtr)TTObjectBaseReference(mOutputBuffer);
426  return kTTErrNone;
427 }
428 
429 
430 #if 0
431 #pragma mark -
432 #pragma mark class methods
433 #endif
434 
435 
436 
437 TTObjectBasePtr TTAudioEngine::create()
438 {
439  PaError paErr;
440  TTErr err = kTTErrNone;
441 
442  if (!sSingletonInstance) {
443  paErr = Pa_Initialize();
444  if (paErr == paNoError)
445  err = TTObjectBaseInstantiate(thisTTClassName, &sSingletonInstance, kTTValNONE);
446  else {
447  TTLogError("PortAudio error: %s", Pa_GetErrorText(paErr));
448  TT_ASSERT("PortAudio initialized", false);
449  }
450  }
451  if (!err)
452  return TTObjectBaseReference(sSingletonInstance);
453  else
454  return NULL;
455 }
456 
457 
459 {
460  if (sSingletonInstance->getReferenceCount() == 1) {
461  PaError err = Pa_Terminate();
462  if (err != paNoError)
463  TTLogError("PortAudio error: %s\n", Pa_GetErrorText( err ) );
464  }
465  return TTObjectBaseRelease((TTObjectBasePtr*)&sSingletonInstance);
466 }
467 
468 
469 int TTAudioEngineStreamCallback(const void* input,
470  void* output,
471  unsigned long frameCount,
472  const PaStreamCallbackTimeInfo* timeInfo,
473  PaStreamCallbackFlags statusFlags,
474  void* userData )
475 {
476  TTAudioEnginePtr engine = TTAudioEnginePtr(userData);
477  return engine->callback((const TTFloat32*)input, (TTFloat32*)output, frameCount, timeInfo, statusFlags);
478 }
479 
PaError Pa_Initialize(void)
Library initialization function - call this before using PortAudio.
static TTErr destroy()
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
std::uint16_t TTUInt16
16 bit unsigned integer
Definition: TTBase.h:176
TTErr getOutputSignalReference(TTValue &anUnusedInput, TTValue &aReturnedAudioSignalPtr)
Get the reference pointer for the output signal.
TTErr TTObjectBaseRelease(TTObjectBasePtr *anObject)
DEPRECATED.
PaDeviceIndex Pa_GetDeviceCount(void)
Retrieve the number of available devices.
#define addAttribute(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter...
Definition: TTAttribute.h:29
PaError Pa_StopStream(PaStream *stream)
Terminates audio processing.
TTErr start()
Start audio processing.
const PaDeviceInfo * mInputDeviceInfo
A structure providing information and capabilities of PortAudio devices, including information on lat...
Definition: TTAudioEngine.h:55
A structure providing information and capabilities of PortAudio devices.
Definition: portaudio.h:444
TTErr setOutputDevice(TTValue &newDeviceName)
Set what audio output device to use.
TTErr stop()
Stop audio processing.
PaError Pa_OpenStream(PaStream **stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData)
Opens a stream for either input, output or both.
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
TTUInt32 mSampleRate
Sample rate.
Definition: TTAudioEngine.h:50
Symbol type.
Definition: TTBase.h:282
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTBoolean mIsRunning
A flag indicating if audio is currently being processed.
Definition: TTAudioEngine.h:59
TTErr getAvailableInputDeviceNames(const TTValue &unusedInput, TTValue &returnedDeviceNames)
Get the names of all available input devices.
16-bit unsigned integer, range is 0 through 65,535.
Definition: TTBase.h:276
A type that represents the key as a C-String and the value as a pointer to the matching TTSymbol obje...
Definition: TTDictionary.h:47
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
#define paNoFlag
Definition: portaudio.h:600
PaError Pa_StartStream(PaStream *stream)
Commences audio processing.
TTErr getCpuLoad(const TTValue &unusedInput, TTValue &returnedValue)
Monitor how taxing current audio processing is on the CPU.
void * hostApiSpecificStreamInfo
An optional pointer to a host api specific data structure containing additional information for devic...
Definition: portaudio.h:523
TTUInt16 mVectorSize
Vector size (frames per buffer)
Definition: TTAudioEngine.h:49
static TTDictionaryPtr sDictionary
We use a dictionary to map the singleton instance to a symbol.
Definition: TTAudioEngine.h:75
#define paFloat32
Definition: portaudio.h:431
TTErr clear()
Zero out all of the sample values in the audio signal.
TTErr setMaxNumChannels(const TTValue &newMaxNumChannels)
Attribute accessor.
A TTBlue exception is thown with this object.
Definition: TTBase.h:368
The TTAudioEngine class is the Audio Engine of Jamoma DSP.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message,...)
Platform and host independent method for posting errors.
Definition: TTBase.cpp:572
TTErr setVectorSize(TTValue &newVectorSize)
Set vector size.
TTSymbol mInputDevice
The audio device used for audio input.
Definition: TTAudioEngine.h:53
int TTAudioEngineStreamCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
A C-function used for the callback from PortAudio.
float TTFloat32
32 bit floating point number
Definition: TTBase.h:187
TTErr TTObjectBaseInstantiate(const TTSymbol className, TTObjectBasePtr *returnedObjectPtr, const TTValue arguments)
DEPRECATED.
TTErr getInputSignalReference(TTValue &anUnusedInput, TTValue &aReturnedAudioSignalPtr)
Get the reference pointer for the input signal.
PaSampleFormat sampleFormat
The sample format of the buffer provided to the stream callback, a_ReadStream() or Pa_WriteStream()...
Definition: portaudio.h:503
#define addMessageWithArguments(name)
A convenience macro to be used by subclasses for registering messages.
Definition: TTMessage.h:27
int PaError
Error codes returned by PortAudio functions.
Definition: portaudio.h:69
TTSymbol mOutputDevice
The audio device used for audio output.
Definition: TTAudioEngine.h:54
TTSampleValue ** mSampleVectors
An array of pointers to the first sample in each vector. Declared Public for fast access...
Definition: TTAudioSignal.h:74
PaTime suggestedLatency
The desired latency in seconds.
Definition: portaudio.h:516
std::int32_t TTInt32
32 bit signed integer
Definition: TTBase.h:177
void TTDSP_EXPORT TTDSPInit(const char *pathToBinaries=NULL)
Initialise the Jamoma DSP library, as well as Jamoma Foundation foundation if needed.
Definition: TTDSP.cpp:30
Parameters for one direction (input or output) of a stream.
Definition: portaudio.h:482
unsigned long PaStreamCallbackFlags
Flag bit constants for the statusFlags to PaStreamCallback.
Definition: portaudio.h:652
TTUInt16 TTChannelCount
Data type used when counting the number of channels in multi-channel audio signals and processes...
Definition: TTAudioSignal.h:31
const PaDeviceInfo * mOutputDeviceInfo
A structure providing information and capabilities of PortAudio devices, including information on lat...
Definition: TTAudioEngine.h:56
#define TT_BASE_OBJECT_CONSTRUCTOR
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:44
TTErr setSampleRate(TTValue &newSampleRate)
Set the sample rate.
PaError Pa_OpenDefaultStream(PaStream **stream, int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat, double sampleRate, unsigned long framesPerBuffer, PaStreamCallback *streamCallback, void *userData)
A simplified version of Pa_OpenStream() that opens the default input and/or output devices...
void clear()
Clear all values from the vector, leaving with size of 0.
Definition: TTValue.h:131
TTErr addCallbackObserver(const TTValue &objectToReceiveNotifications, TTValue &unusedOutput)
TTErr setValue(const TTValue aNewValue)
TODO: Add documentation.
Definition: TTDictionary.h:191
TTErr removeCallbackObserver(const TTValue &objectCurrentlyReceivingNotifications, TTValue &unusedOutput)
Something went wrong, but what exactly is not known. Typically used for context-specific problems...
Definition: TTBase.h:344
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
const PaDeviceInfo * Pa_GetDeviceInfo(PaDeviceIndex device)
Retrieve a pointer to a PaDeviceInfo structure containing information about the specified device...
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
PaDeviceIndex device
A valid device index in the range 0 to (Pa_GetDeviceCount()-1) specifying the device to be used or th...
Definition: portaudio.h:490
TTAudioEngine * TTAudioEnginePtr
A pointer to a TTAudioEngine.
TTInt32 callback(const TTFloat32 *input, TTFloat32 *output, TTUInt32 frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
This is called repeatedly by PortAudio every time a new vector of audio is needed.
#define addAttributeWithSetter(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom setter...
Definition: TTAttribute.h:47
#define addMessage(name)
A convenience macro to be used by subclasses for registering messages.
Definition: TTMessage.h:19
TTObjectBasePtr TTObjectBaseReference(TTObjectBasePtr anObject)
DEPRECATED.
32-bit unsigned integer, range is 0 through 4,294,967,295.
Definition: TTBase.h:278
No Error.
Definition: TTBase.h:343
The TTAudioEngine class is the Audio Engine of Jamoma DSP.
Definition: TTAudioEngine.h:42
TTChannelCount mNumInputChannels
The number of input channels.
Definition: TTAudioEngine.h:47
const char * Pa_GetErrorText(PaError errorCode)
Translate the supplied PortAudio error code into a human readable message.
int channelCount
The number of channels of sound to be delivered to the stream callback or accessed by Pa_ReadStream()...
Definition: portaudio.h:497
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTErr alloc()
Allocate memory for all channels at the current vectorsize.
TTErr setInputDevice(TTValue &newDeviceName)
Set what audio input device to use.
PaError Pa_CloseStream(PaStream *stream)
Closes an audio stream.
TTUInt16 getReferenceCount()
Query an object to get its current reference count.
Definition: TTObjectBase.h:144
PaError Pa_Terminate(void)
Library termination function - call this when finished using PortAudio.
Timing information for the buffers passed to the stream callback.
Definition: portaudio.h:639
double Pa_GetStreamCpuLoad(PaStream *stream)
Retrieve CPU usage information for the specified stream.
#define addMessageProperty(messageName, propertyName, initialValue)
A convenience macro to be used for registering properties of messages.
Definition: TTMessage.h:37
TTErr getAvailableOutputDeviceNames(const TTValue &unusedInput, TTValue &returnedDeviceNames)
Get the names of all available output devices.
TTChannelCount mNumOutputChannels
The number of output channels.
Definition: TTAudioEngine.h:48