Closed zeozeozeo closed 1 year ago
Admittedly, I'm not too familiar with the internals of Kira, but to me, it would make more sense for set_volume
to take an Option<Tween>
(instead of a Tween
).
A None
tween value would indicate that the volume change should occur immediately without constructing a "hacky" tween like the one in @zeozeozeo's example.
Unless there's a specific requirement for always having a tween associated with a set volume command?
@zeozeozeo How short of a time are we talking? If it's around the 10-20 millisecond range, that's to be expected. No command from the gameplay thread will reach the audio thread immediately, because the audio thread only does its processing every 15ms or so (depending on the buffer size your audio system is using).
@lukecarr You always want volume changes to happen with a tween. If you change volumes instantly, you'll hear an unpleasant popping sound because of the discontinuity the volume change creates in the output waveform. The default tween duration is short enough to feel instant without creating a popping sound.
@tesselode thanks for the explanation, so there's currently no way of immediately setting the volume of the sound?
@zeozeozeo No, and there won't ever be one. That's inherent to how operating systems handle audio.
For example, if I write something like this:
the volume doesn't get applied instantly, for a very short time the volume is still at 1.0