web-audio-api-rs
web-audio-api-rs copied to clipboard
Cancel `AudioParam::set_target_at_time` when close enough to target value
trafficstars
from #20
set_target_at_timecan run forever as it as no "real" end time or value, a possible performance improvement would be to internally cancel the event whenintrisic_valueis close enough to the target (note that Chrome implements such strategy)
// 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
Fixed in #190