setVolume method

void setVolume(
  1. OutputTypes outputType,
  2. num value
)

Set the volume to an absolute value.

Used by adjustVolume.

Implementation

void setVolume(OutputTypes outputType, num value) {
  AudioNode output;
  if (outputType == OutputTypes.sound) {
    soundVolume = value;
    output = soundOutput;
  } else if (outputType == OutputTypes.ambience) {
    ambienceVolume = value;
    output = ambienceOutput;
  } else {
    musicVolume = value;
    if (music != null) {
      output = music.gain;
    }
  }
  if (output != null) {
    (output as GainNode).gain.value = value;
  }
}