fade method

  1. @override
void fade({
  1. required double length,
  2. double endGain = 0.0,
  3. double? startGain,
  4. double preFade = 0.0,
})
override

Fade the generator.

Implementation

@override
void fade({
  required final double length,
  final double endGain = 0.0,
  final double? startGain,
  final double preFade = 0.0,
}) {
  final startTime = context.currentTime.value;
  final endTime = startTime + length;
  generator.gain.automate(
    startTime: startTime,
    startValue: startGain ?? gain,
    endTime: endTime,
    endValue: endGain,
  );
}