Limit number of sustain points in [function]

Anthony Prechtl's icon

Is it possible to limit the number of sustain points in [function] (or ej.function) to just 1? I am trying to make an envelope and only want to allow one sustain point.

Luke Hall's icon

Create one sustain point usint command/ctrl+click then in the object inspector uncheck the "allow changing sustain by clicking" box. You can now add and remove points with the mouse but not edit the sustain point. Just be sure not to delete it accidentally (you can always use the "getsustain" message triggered by the rightmost outlet to check it still exists).

lh

Anthony Prechtl's icon

Brilliant. I had already thought of creating the sustain point myself and then disallowing changing the sustain, but as you mentioned, that would be a problem if someone deleted the sustain point. I wasn't aware of the getsustain message; it should be simple enough to allow changing the sustain when there are no sustain points, and disallow it when there are sustain points.

Thanks a lot Luke.