Hi, sorry if I missed an existing thread about this - didn’t find one.
I’m following the docs to do fade in/out on streaming sounds for music transitions:
var samples = SecondsToSamples(duration);
AssertOk(channel.getVolume(out var currentVolume));
AssertOk(channel.getDSPClock(out _, out var parentclock));
AssertOk(channel.addFadePoint(parentclock, currentVolume));
AssertOk(channel.addFadePoint(parentclock + samples, volume));
This generally seems to work, however it seems like if the stream channel’s volume reaches 0, the channel becomes replaced with a virtual silence DSP (visible in the core profiler) and the DSP clock stops ticking, so my attempts to fade back up from 0 don’t succeed.
Is this a correct understanding of what’s going on? Is there a workaround other than never fading volume down to 0?
It also appears that getVolume does not work when used with fade points - after using a fade point to drop the volume to 0.001 (working around this dsp clock bug), getVolume still seems to return a value of 1. So if I use getVolume as shown in the code snippet above, instead of a smooth fade I get a near instant ramp from the current fade point to 1.0.
It also appears that even if you have send DSPs configured to feed a channel or channelgroup’s unattenuated output to a return, the channels will be replaced with a virtual silence dsp if the main output volume is 0. This makes it seemingly impossible to capture the FFT spectrum of a channel or channelgroup if the player has muted game audio.
I got help via another channel figuring this out, the ultimate problem was that initializing via FMOD Studio was turning on vol0 virtualization without me requesting it. The solution is to set the priority of the stuff I want to fade to 0 (highest) - once I do that everything seems to work how I expect.
It was complicated by not realizing that getVolume/setVolume and fade points are separate, so using a mix of the two would leave a channel in a mixed state like ‘volume 0, fade point 1’ or ‘volume 1, fade point 0’.
You can close this since it was user error, though it might be awesome to make it clearer in the documentation that fade points and get/setVolume are separate. In particular, the user of fade points needs to maintain their own shadow ‘fade point volume’ in order to interact with fade points correctly for most purposes, which surprised me a little.
It would also be great to document that fmod studio turns on vol0 virtualization when it initializes fmod, since that took me a long time to figure out.