The whole point of the new method was to play out the loop. I see I misinterpreted your original issue, where you said ‘it only loops until the AHDSR executes’ which isn’t true. The AHDSR jumps straight to the Sustain point and stays there until stop is called by the game. This means the parameter value should be staying at 1.0 until stop is called.
Both methods above do NOT require sending a parameter from the game. The whole point is you call stop, and the R part of the envelope triggers, which makes it automatically exit the loop. There is no game code required.
I thought originally you didn’t want it prematurely leaving the loop, so the new method lets the loop play out, which is perfect for something like gunfire.
If you want it breaking out in the middle of a loop, because your loop has multiple sounds in it, then that’s what the original method is for.
If you need to to break out of a loop at a specific point because you’re not looping a single bang noise, but say 4 bang noises per loop, that’s what quantization is for, you can set it in milliseconds, inside a transition region.
edit: better than a region in this case, is 4 transition markers instead of a region, then it will break out wherever you want it to.