Forums > Java

deferring a new operation of buf.Op

January 29, 2008 | 1:48 pm

Hi there,

I’d like to implement a new operation for buf.Op.
I want this operation deferred like Copyinto or Copyfrom are.

I try this script

public void fade(final int start_index){
MaxSystem.deferlow(new Executable() {
public void execute(){
float val1=0;
float val2=0;
for (int c=start_index; c< (start_index+220);c++)
{
val1 = MSPBuffer.peek(bufname, 1, c)*((c-start_index)/220);
val2 = MSPBuffer.peek(bufname, 2, c)*((c-start_index)/220);
MSPBuffer.poke(bufname, 1, c, val1 );
MSPBuffer.poke(bufname, 2, c, val2 );
}
}
}
);
}

This script gave me a compilation error I don’t understand :

/Applications/MaxMSP 4.6/Cycling ’74/java/classes/buf/Op.java[ 127 ] cannot find symbol
symbol : method deferlow()
location: class com.cycling74.max.MaxSystem
MaxSystem.deferlow(new Executable() {
^
1 error
[ 29 janv. 2008 14:36:20 ]
compilation of /Applications/MaxMSP 4.6/Cycling ’74/java/classes/buf/Op.java failed.

I use the same code as the copyinto or copyfrom method.
Does any of you have an idea ?
Thanks for your help.

NB: I’d like to defer this one as, I’ll call this method when I’ll read the same buffer. The aim is to make a fade of 5 ms at a given index.


January 29, 2008 | 2:42 pm

On 29 janv. 08, at 14:48, taprik wrote:

> I use the same code as the copyinto or copyfrom method.
> Does any of you have an idea ?
> Thanks for your help.

Make sure that you respect the case: it’s MaxSystem.deferLow() not
MaxSystem.deferlow().

HTH,
ej


January 29, 2008 | 3:17 pm

Yes ! You’re right.
Thanks Emmanuel.

And I made an other mistake with the type.
The correct script is

public void fade(final int start_index){
MaxSystem.deferLow(new Executable() {
public void execute(){
float val1=0;
float val2=0;
for (int c=start_index; c< (start_index+221);c++)
{
val1 = MSPBuffer.peek(bufname, 1, c)*(float)((c-start_index)/220.0);
val2 = MSPBuffer.peek(bufname, 2, c)*(float)((c-start_index)/220.0);
MSPBuffer.poke(bufname, 1, c, val1 );
MSPBuffer.poke(bufname, 2, c, val2 );
}
}
}
);
}


Viewing 3 posts - 1 through 3 (of 3 total)