setFrequency method

  1. @override
void setFrequency(
  1. double frequency, {
  2. double? time,
})
override

Set the frequency for generator.

Implementation

@override
void setFrequency(final double frequency, {final double? time}) {
  if (time == null) {
    generator.frequency.value = frequency;
  } else {
    final startTime = context.currentTime.value;
    final endTime = startTime + time;
    generator.frequency.automate(
      startTime: startTime,
      startValue: generator.frequency.value,
      endTime: endTime,
      endValue: frequency,
    );
  }
}