setVolume method
Sets the volume for the sound on the specified channelId
.
channelId
: The ID of the channel whose volume is to be set.volume
: The desired volume, typically ranging from 0.0 (silent) to 1.0 (full volume). This value is applied to the gain node of the channel.
Implementation
void setVolume(int channelId, double volume) {
var channel = _channels[channelId];
channel
..volume = volume
..gainNode.gain.value = volume;
}