Creation and management of objects with and mxj (connection problem)

...'s icon

Hey everyone,

I am currently implementing a java external that will be used to create, delete/remove, move around, connect and disconnect objects. The way it works is very similar to the way this is achieved (to create and delete objects) in Max by using JS.

I have a problem on my mxj object... When connected a flonum with a cycle~ and then the cycle~ to an ezdac~ I was changing the number inside the number box but I got no sound. Then I tried to turn off and then again on the ezdac~ and I got sound... BUT, when disconnected the cycle~ from the ezdac~ (while the ezdac~ was still on) I could still hear sound. It seems that the connection and disconnection doesn't work properly (although the visual part of connection and disconnection in the patch works properly). I do all the process of creation, connection/disconnection, and change of the number box (I have tried changing the number with my mouse and keyboard too, but it didn't "trigger" anything), as well as the on/off process of the ezdac~ from my mxj external.

The code that I use to connect and disconnect looks like this:

if(connection) {
patch.connect(firstObject, outletNumber, secondObject, inletNumber);
} else if(!connection) {
patch.disconnect(firstObject, outletNumber, secondObject, inletNumber);
}

Where, the variable patch equals to this.getParentPatcher().

I have also tried the exact same thing but this time by connecting a toggle to the flonum and vice versa and everything works fine. It seems that the problem appears when I have to deal with MSP Objects. I have also made another post (reactivision and max crash it is called and if you think you could help me on that too, I would be really glad to hear what you have to suggest) all the problems seem to arise when it comes to the MSP part of Max. Please let me know if there is anything I am missing or misunderstanding, 'cause it is really frustrating to me, as I am new to java and generally programming.

Thanks again,

Achilles.