com.cycling74.msp
Class MSPBuffer

java.lang.Object
  extended by com.cycling74.msp.MSPBuffer

public class MSPBuffer
extends Object

Used to get or set pd array content. Please note that the channel parameter is added in the API to match Max/MSP MSPBuffer signature.


Method Summary
static int getChannel(String name)
          Return the number of channel for this array.
static long getSize(String name)
          Returns the array size
static float[] peek(String name)
          Returns the array content.
static float[] peek(String name, int channel)
          Returns the array content.
static float peek(String name, int channel, long index)
          Returns the array content value at a specific position.
static float[] peek(String name, int channel, long start, long length)
          Returns the array content.
static void poke(String name, float[] values)
          Sets array content.
static void poke(String name, int channel, float[] values)
          Sets array content.
static void poke(String name, int channel, long index, float value)
          Set a value in a array.
static void poke(String name, int channel, long start, float[] values)
          Sets array content.
static void setSize(String name, int numchannel, long size)
          Sets the array size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

peek

public static float[] peek(String name)
Returns the array content.

Parameters:
name - the array name
Returns:
the array contents

peek

public static float[] peek(String name,
                           int channel)
Returns the array content.

Parameters:
name - the array name
channel - not used in pd
Returns:
the array contents

peek

public static float[] peek(String name,
                           int channel,
                           long start,
                           long length)
Returns the array content.

Parameters:
name - the array name
channel - not used in pd
start - the start index of the array
length - the size of the array to return
Returns:
the array contents

peek

public static float peek(String name,
                         int channel,
                         long index)
Returns the array content value at a specific position.

Parameters:
name - the array name
channel - not used in pd
index - the start index of the array
Returns:
the value stored at index start

poke

public static void poke(String name,
                        float[] values)
Sets array content.

Parameters:
name - the array name
values - the array to set

poke

public static void poke(String name,
                        int channel,
                        float[] values)
Sets array content.

Parameters:
name - the array name
channel - not used in pd
values - the array to set

poke

public static void poke(String name,
                        int channel,
                        long start,
                        float[] values)
Sets array content.

Parameters:
name - the array name
channel - not used in pd
start - the start index of the array
values - the array to set

poke

public static void poke(String name,
                        int channel,
                        long index,
                        float value)
Set a value in a array.

Parameters:
name - the array name
channel - not used in pd
index - the index in the array to set
value - the value to set in the array

setSize

public static void setSize(String name,
                           int numchannel,
                           long size)
Sets the array size.

Parameters:
name - the array name
numchannel - not used in pd
size - the new array size;

getSize

public static long getSize(String name)
Returns the array size

Parameters:
name - the array name
Returns:
the array size or -1 if not found

getChannel

public static int getChannel(String name)
Return the number of channel for this array. Useless in PD cause there is no channels in a array.

Parameters:
name - array name.
Returns:
always returns 1 on pd; unless the name is not defined.


This API is based on mxj for Max/MSP by Cycling74. Please see original MXJ implementation.