MSP
+ Collaboration diagram for MSP:

Data Structures

struct  t_pxdata
 Common struct for MSP objects. More...
struct  t_pxobject
 Header for any non-ui signal processing object. More...
struct  t_signal
 The signal data structure. More...
struct  t_pxjbox
 Header for any ui signal processing object. More...

Modules

 Buffers
 

Your object can access shared data stored in an MSP buffer~ object.


 PFFT
 

When an object is instantiated, it is possible to determine if it is being created in pfft~ context in the new method.


 Poly
 

If your object is instatiated as a voice of a poly~ object, it is possible both to determine this context and to determine information about the specific voice.


Defines

#define Z_NO_INPLACE
 flag indicating the object doesn't want signals in place
#define Z_PUT_LAST
 when list of ugens is resorted, put this object at end
#define Z_PUT_FIRST
 when list of ugens is resorted, put this object at beginning
#define PI
 The pi constant.
#define TWOPI
 Twice the pi constant.
#define PIOVERTWO
 Half of the pi constant.
#define dsp_setup
 This is commonly used rather than directly calling z_dsp_setup() in MSP objects.
#define dsp_free
 This is commonly used rather than directly calling z_dsp_free() in MSP objects.

Typedefs

typedef int t_int
 An integer.
typedef void * t_vptr
 A void pointer.
typedef void * vptr
 A void pointer.
typedef float t_float
 A float -- always a 32 bit floating point number.
typedef double t_double
 A double -- always a 64 bit floating point number.
typedef double t_sample
 A sample value -- width determined by MSP version.

Enumerations

enum  { SYS_MAXBLKSIZE, SYS_MAXSIGS }
 MSP System Properties. More...

Functions

int sys_getmaxblksize (void)
 Query MSP for the maximum global vector (block) size.
int sys_getblksize (void)
 Query MSP for the current global vector (block) size.
float sys_getsr (void)
 Query MSP for the global sample rate.
int sys_getdspstate (void)
 Query MSP to determine whether or not it is running.
int sys_getdspobjdspstate (t_object *o)
 Query MSP to determine whether or not a given audio object is in a running dsp chain.
void dsp_add (t_perfroutine f, int n,...)
 Call this function in your MSP object's dsp method.
void dsp_addv (t_perfroutine f, int n, void **vector)
 Call this function in your MSP object's dsp method.
void z_dsp_setup (t_pxobject *x, long nsignals)
 Call this routine after creating your object in the new instance routine with object_alloc().
void z_dsp_free (t_pxobject *x)
 This function disposes of any memory used by proxies allocated by dsp_setup().
void class_dspinit (t_class *c)
 This routine must be called in your object's initialization routine.
void class_dspinitjbox (t_class *c)
 This routine must be called in your object's initialization routine.

Variables

BEGIN_USING_C_LINKAGE typedef
t_int *(* 
t_perfroutine )(t_int *args)
 A function pointer for the audio perform routine used by MSP objects to process blocks of samples.

Define Documentation

#define PI

The pi constant.

#define PIOVERTWO

Half of the pi constant.

#define TWOPI

Twice the pi constant.


Typedef Documentation

typedef double t_double

A double -- always a 64 bit floating point number.

typedef float t_float

A float -- always a 32 bit floating point number.

typedef int t_int

An integer.

typedef double t_sample

A sample value -- width determined by MSP version.

typedef void* t_vptr

A void pointer.

typedef void* vptr

A void pointer.


Enumeration Type Documentation

anonymous enum

MSP System Properties.

Enumerator:
SYS_MAXBLKSIZE 

a good number for a maximum signal vector size

SYS_MAXSIGS 

number of signal inlets you can have in an object


Function Documentation

void class_dspinit ( t_class c)

This routine must be called in your object's initialization routine.

It adds a set of methods to your object's class that are called by MSP to build the DSP call chain. These methods function entirely transparently to your object so you don't have to worry about them. However, you should avoid binding anything to their names: signal, userconnect, nsiginlets, and enable.

This routine is for non-user-interface objects only (where the first item in your object's struct is a t_pxobject). It must be called prior to calling class_register() for your class.

Parameters:
cThe class to make dsp-ready.
See also:
class_dspinitjbox()
void class_dspinitjbox ( t_class c)

This routine must be called in your object's initialization routine.

It adds a set of methods to your object's class that are called by MSP to build the DSP call chain. These methods function entirely transparently to your object so you don't have to worry about them. However, you should avoid binding anything to their names: signal, userconnect, nsiginlets, and enable.

This routine is for user-interface objects only (where the first item in your object's struct is a t_jbox).

Parameters:
cThe class to make dsp-ready.
See also:
class_dspinit()
void dsp_add ( t_perfroutine  f,
int  n,
  ... 
)

Call this function in your MSP object's dsp method.

This function adds your object's perform method to the DSP call chain and specifies the arguments it will be passed. n, the number of arguments to your perform method, should be followed by n additional arguments, all of which must be the size of a pointer or a long.

Parameters:
fThe perform routine to use for processing audio.
nThe number of arguments that will follow
...The arguments that will be passed to the perform routine.
See also:
The DSP Method and Perform Routine
Using Connection Information
void dsp_addv ( t_perfroutine  f,
int  n,
void **  vector 
)

Call this function in your MSP object's dsp method.

Use dsp_addv() to add your object's perform routine to the DSP call chain and specify its arguments in an array rather than as arguments to a function.

Parameters:
fThe perform routine to use for processing audio.
nThe number of arguments that will follow in the vector parameter.
vectorThe arguments that will be passed to the perform routine.
See also:
The DSP Method and Perform Routine
Using Connection Information
int sys_getblksize ( void  )

Query MSP for the current global vector (block) size.

Returns:
The current global vector size for the MSP environment.
int sys_getdspobjdspstate ( t_object o)

Query MSP to determine whether or not a given audio object is in a running dsp chain.

This is preferable over sys_getdspstate() since global audio can be on but an object could be in a patcher that is not running.

Returns:
Returns true if the MSP object is in a patcher that has audio on, otherwise returns false.
int sys_getdspstate ( void  )

Query MSP to determine whether or not it is running.

Returns:
Returns true if the DSP is turned on, otherwise returns false.
int sys_getmaxblksize ( void  )

Query MSP for the maximum global vector (block) size.

Returns:
The maximum global vector size for the MSP environment.
float sys_getsr ( void  )

Query MSP for the global sample rate.

Returns:
The global sample rate of the MSP environment.
void z_dsp_free ( t_pxobject x)

This function disposes of any memory used by proxies allocated by dsp_setup().

It also notifies the signal compiler that the DSP call chain needs to be rebuilt if signal processing is active. You should be sure to call this before de-allocating any memory that might be in use by your object’s perform routine, in the event that signal processing is on when your object is freed.

Parameters:
xThe object to free.
See also:
dsp_free
void z_dsp_setup ( t_pxobject x,
long  nsignals 
)

Call this routine after creating your object in the new instance routine with object_alloc().

Cast your object to t_pxobject as the first argument, then specify the number of signal inputs your object will have. dsp_setup() initializes fields of the t_pxobject header and allocates any proxies needed (if num_signal_inputs is greater than 1).

Some signal objects have no inputs; you should pass 0 for num_signal_inputs in this case. After calling dsp_setup(), you can create additional non-signal inlets using intin(), floatin(), or inlet_new().

Parameters:
xYour object's pointer.
nsignalsThe number of signal/proxy inlets to create for the object.
See also:
dsp_setup

Variable Documentation

BEGIN_USING_C_LINKAGE typedef t_int*(* t_perfroutine)(t_int *args)

A function pointer for the audio perform routine used by MSP objects to process blocks of samples.