web-audio-api-rs icon indicating copy to clipboard operation
web-audio-api-rs copied to clipboard

Cancel `AudioParam::set_target_at_time` when close enough to target value

Open b-ma opened this issue 3 years ago • 1 comments
trafficstars

from #20

set_target_at_time can run forever as it as no "real" end time or value, a possible performance improvement would be to internally cancel the event when intrisic_value is close enough to the target (note that Chrome implements such strategy)

b-ma avatar Apr 21 '22 14:04 b-ma

// at the end of the block, avoid doing this for each sample
let diff = target - intrisic_value;
if diff.is_subnormal() {
    intrisic_value = target;
    // insert `set_value` event in timeline at next block
}

could do the trick

b-ma avatar Jul 30 '22 08:07 b-ma

Fixed in #190

b-ma avatar Aug 05 '22 13:08 b-ma