Max API  8.0.2
MSP

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.
 

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...
 

Macros

#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. More...
 
#define TWOPI
 Twice the pi constant. More...
 
#define PIOVERTWO
 Half of the pi constant. More...
 
#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 void * t_vptr
 A void pointer. More...
 
typedef void * vptr
 A void pointer. More...
 
typedef float t_float
 A float – always a 32 bit floating point number. More...
 
typedef double t_double
 A double – always a 64 bit floating point number. More...
 
typedef double t_sample
 A sample value – width determined by MSP version. More...
 

Enumerations

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

Functions

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

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. More...
 

Detailed Description

Macro Definition Documentation

◆ PI

#define PI

The pi constant.

◆ PIOVERTWO

#define PIOVERTWO

Half of the pi constant.

◆ TWOPI

#define TWOPI

Twice the pi constant.

Typedef Documentation

◆ t_double

typedef double t_double

A double – always a 64 bit floating point number.

◆ t_float

typedef float t_float

A float – always a 32 bit floating point number.

◆ t_sample

typedef double t_sample

A sample value – width determined by MSP version.

◆ t_vptr

typedef void* t_vptr

A void pointer.

◆ vptr

typedef void* vptr

A void pointer.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

MSP System Properties.

Enumerator
SYS_MAXBLKSIZE 

a good number for a maximum signal vector size

Function Documentation

◆ class_dspinit()

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()

◆ 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()

◆ dsp_add()

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

◆ dsp_addv()

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

◆ sys_getblksize()

int sys_getblksize ( void  )

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

Returns
The current global vector size for the MSP environment.

◆ sys_getdspobjdspstate()

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.

◆ sys_getdspstate()

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.

◆ sys_getmaxblksize()

int sys_getmaxblksize ( void  )

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

Returns
The maximum global vector size for the MSP environment.

◆ sys_getsr()

float sys_getsr ( void  )

Query MSP for the global sample rate.

Returns
The global sample rate of the MSP environment.

◆ z_dsp_free()

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

◆ z_dsp_setup()

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

◆ t_perfroutine

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.