emitTone method

void emitTone(
  1. int count, {
  2. double amplitude = 0.5,
})

Publishes count frames at a steady amplitude from 0 to 1.

The usual way to make a fake visualizer show something.

Implementation

void emitTone(int count, {double amplitude = 0.5}) {
  final peak = (amplitude.clamp(0.0, 1.0) * 32767).round();
  for (var i = 0; i < count; i++) {
    emit((min: -peak, max: peak, rms: (peak * 0.707).round()));
  }
}