// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Plan attack, decay, sustain and release // Not compiled or tested in-world // Setup: Put in a spare owned prim. Set positive attack/decay/release, nonnegative hold and sustain0..1. Owner touch prints calculations only. // Stop / restore: Disable/remove. No prim motion or appearance is changed. // Notes: This models an animation envelope; it does not synthesize or play sound. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Motion planning only. float ATTACK=0.3; float DECAY=0.4; float HOLD=1.0; float RELEASE=0.8; float SUSTAIN=0.6; float ELAPSED=0.5; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(ATTACK<=0.0||DECAY<=0.0||HOLD<0.0||RELEASE<=0.0||SUSTAIN<0.0||SUSTAIN>1.0) { llOwnerSay("Invalid ADSR values."); return; } float t=ELAPSED; float value=0.0; if(t>=0.0) { if(t