[jmsl] Accessing SynthNotes allocated by SynthNoteAllPortsInstrument

jmsl at music.columbia.edu jmsl at music.columbia.edu
Fri Feb 1 08:07:48 EST 2008


Here's a trick that may be helpful...

Let's say you are using a polyphonic SynthNoteAllPorts instrument and 
you want to update the behavior of the SynthNotes it allocates after 
they have started their sound. Let's say instrument.update() is not 
appropriate because the update you require is at the Java level, not the 
synthesis level (otherwise passing new values to ins.update() would do 
the trick; as is well documented in 
jmslexamples.jsyn.TimbralControlApplet and 
jmsltestsuite.UpdateSynthNoteInstrumentTest).

To solve this issue, you can extend SynthNoteAllPortsInstrument and 
override doDeferred(SynthNote sn).  This method is called every time a 
SynthNote is allocated by the instrument. That's the key to tracking 
them.  Toss the new SynthNote in a Vector every time doDeferred() is 
called, for example, then you have a reference to all Synthnotes 
allocated by that instrument. Iterate through your allocated SynthNotes 
and change their values at the Java level when needed

Thanks to Mike Winter for posing this problem.

Nick Didkovsky


More information about the jmsl mailing list