Jamoma API  0.6.0.a19
j.pack.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup implementationMaxExternalsAudioGraph
4  *
5  * @brief pack= : Max external packing several MSP audio signals onto one AudioGraph multichannel audio signal.
6  *
7  * @details This object functions as a source (generator) for #TTAudioSignal usable by a Jamoma AudioGraph dsp chain.
8  *
9  * @authors Tim Place, Trond Lossius, Nils Peters
10  *
11  * @copyright Copyright © 2008 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 
17 #include "maxAudioGraph.h"
18 
19 /** Data Structure for the j.pack= Max object.
20  */
21 struct Pack {
22  t_pxobject obj; ///< Pointer to Max object struct, this alwasy needs to be the first member of the struct.
23  TTAudioGraphObjectBasePtr audioGraphObject; ///< Pointer to an embedded Jamoma AudioGraph object serving as a generator for the downstream AudioGraph.
24  TTPtr audioGraphObjectOutlet; ///< Pointer to an embedded Jamoma AudioGraph outlet used to interface sith downstream AudioGraph objects.
25  TTUInt32 maxNumChannels; ///< The maximum number of MSP audio channels this object can pack onto an AudioGraph signal, set as an argument at object instantiation time.
26  TTUInt32 numChannels; ///< The actual number of channels to use. This is set by the #PackDsp64 method when the MSP processing chain is being compiled, based on what inlets of j.pack= that have incoming MSP audio signals connected.
27  TTUInt32 vectorSize; ///< The size of audio vectors to process, cached by the DSP method.
28 };
29 
30 typedef Pack* PackPtr; ///< Pointer to a j.pack= instance.
31 
32 
33 // Prototypes for methods
34 
35 /** Set up this class as a Max external the first time an object of this kind is instantiated.
36  @return Error message if the object fails to load.
37  */
38 int C74_EXPORT main(void);
39 
40 
41 /** Create a new instance of the j.in= object.
42  @param msg Message to the new instance at creation time.
43  @param argc The number of arguments to the object at instantiation.
44  @param argv Pointer to an array of atoms containing instantiation arguments.
45  @return Pointer to this instance if successfully instantiated.
46  */
47 PackPtr PackNew(t_symbol* msg, long argc, t_atom* argv);
48 
49 
50 /** Called when the object is freed (destroyed), ensuring that memory is properly freed up.
51  @param self Pointer to this instance of j.in=.
52  */
53 void PackFree(PackPtr self);
54 
55 
56 /** Provides assist strings in Max for object inlets and outlets.
57  @param self Pointer to this instance of j.in=.
58  @b Not used
59  @msg Is this a request for assistance regarding an inlet or outlet?
60  @arg Which inlet or outlet number is the request relating to?
61  @dst Destination that the assistance string is to be copied to.
62  */
63 void PackAssist(PackPtr self, void* b, long msg, long arg, char* dst);
64 
65 
66 /** Reset audio for this object.
67  @param self Pointer to this instance of j.in=.
68  @param vectorSize Not used currently.
69  */
70 TTErr PackReset(PackPtr self, long vectorSize);
71 
72 
73 /** This method is used internally by AudioGraph when configuring itself.
74  @param self Pointer to this instance of j.in=.
75  */
76 TTErr PackSetup(PackPtr self);
77 
78 
79 /** TODO: Do this method exist at all? It is lacking from j.pack.cpp...
80  @param self Pointer to this instance of j.in=.
81  */
82 TTErr PackObject(PackPtr self, TTAudioGraphObjectBasePtr audioSourceObject);
83 
84 
85 /** Performs the actual DSP processing on incomming MSP audio signals, packing them into a multichannel source for AudioGraph.
86  @param self Pointer to this instance of j.in=.
87  */
88 t_int* PackPerform(t_int* w);
89 
90 
91 /** Called when MSP is compiling the DSP chain, used to set up audio processing.
92  @param self Pointer to this instance of j.in=.
93  @param dsp64
94  @param count
95  @param samplerate
96  @param maxvectorsize
97  @param flags
98  */
99 void PackDsp64(PackPtr self, t_object* dsp64, short *count, double samplerate, long maxvectorsize, long flags);
100 //t_max_err PackSetGain(PackPtr self, void* attr, long argc, t_atom* argv);
101 
102 
103 // Globals
104 static t_class* sInClass;
105 
106 
107 
108 
TTPtr audioGraphObjectOutlet
Pointer to an embedded Jamoma AudioGraph outlet used to interface sith downstream AudioGraph objects...
Definition: j.pack.h:24
t_int * PackPerform(t_int *w)
Performs the actual DSP processing on incomming MSP audio signals, packing them into a multichannel s...
TTErr PackReset(PackPtr self, long vectorSize)
Reset audio for this object.
TTUInt32 vectorSize
The size of audio vectors to process, cached by the DSP method.
Definition: j.pack.h:27
void PackDsp64(PackPtr self, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags)
Called when MSP is compiling the DSP chain, used to set up audio processing.
Pack * PackPtr
Pointer to a j.pack= instance.
Definition: j.pack.h:30
TTAudioGraphObjectBasePtr audioGraphObject
Pointer to an embedded Jamoma AudioGraph object serving as a generator for the downstream AudioGraph...
Definition: j.pack.h:23
void PackFree(PackPtr self)
Called when the object is freed (destroyed), ensuring that memory is properly freed up...
t_pxobject obj
Pointer to Max object struct, this alwasy needs to be the first member of the struct.
Definition: j.pack.h:22
void * TTPtr
A generic pointer.
Definition: TTBase.h:248
PackPtr PackNew(t_symbol *msg, long argc, t_atom *argv)
Create a new instance of the j.in= object.
TTErr PackSetup(PackPtr self)
This method is used internally by AudioGraph when configuring itself.
TTUInt32 maxNumChannels
The maximum number of MSP audio channels this object can pack onto an AudioGraph signal, set as an argument at object instantiation time.
Definition: j.pack.h:25
TTErr PackObject(PackPtr self, TTAudioGraphObjectBasePtr audioSourceObject)
TODO: Do this method exist at all? It is lacking from j.pack.cpp...
A thin wrapper of Jamoma AudioGraph for use in the Cycling '74 Max/MSP environment.
int C74_EXPORT main(void)
Set up this class as a Max external the first time an object of this kind is instantiated.
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 ...
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTUInt32 numChannels
The actual number of channels to use. This is set by the PackDsp64 method when the MSP processing cha...
Definition: j.pack.h:26
Data Structure for the j.pack= Max object.
void PackAssist(PackPtr self, void *b, long msg, long arg, char *dst)
Provides assist strings in Max for object inlets and outlets.