List as Argument / Changing Data Types

Mike S's icon

Hello Java forum,

I've started tinkering around with Java as I need accurate timing to trigger some envelopes.

I have one global envelope which I set using the function objection. I want to copy this envelope (using the listdump message) to different mxj objects which can then be triggered independently.

I'm having trouble with data types. According to the documentation you need to have an Atom data type when handling lists as arguments. I then want to subtract values of the list to add to an array which will be output as a message to the line~ object.

// this may be a backwards way of initialising, still taking baby steps
Atom[] ramp = new Atom[9];
Atom[] line_message = new Atom[8];

public void set_ramp(Atom[] args)
{
for(int i = 0; i < args.length; i++)
{
//pass list to ramp array
ramp[i] = args[i];
}

// format line_message array
line_message[0] = ramp[0];
line_message[1] = ramp[3];
line_message[2] = ramp[2];
line_message[3] = ramp[5];
line_message[4] = ramp[4] - ramp[2];
line_message[5] = ramp[7];
line_message[6] = ramp[6] - ramp[4];
line_message[7] = ramp[9];
line_message[8] = ramp[8] - ramp[6];

} // end set_ramp function

I get a "- operator cannot be applied". There are a few things I've read online about changing data types, but I don't think Max's version of Java recognises them.

EDIT: code tags don't work!