playString method

  1. @override
SynthizerSound playString({
  1. required String string,
  2. bool keepAlive = false,
  3. double gain = 0.7,
  4. bool looping = false,
  5. double pitchBend = 1.0,
})
override

Play a sound from the given string.

Implementation

@override
SynthizerSound playString({
  required final String string,
  final bool keepAlive = false,
  final double gain = 0.7,
  final bool looping = false,
  final double pitchBend = 1.0,
}) {
  final buffer = Buffer.fromString(synthizer, string);
  final generator = context.createBufferGenerator()
    ..gain.value = gain
    ..looping.value = looping
    ..pitchBend.value = pitchBend
    ..buffer.value = buffer;
  source.addGenerator(generator);
  configureLinger(generator: generator, keepAlive: keepAlive);
  return SynthizerSound(
    backend: backend,
    channel: this,
    keepAlive: keepAlive,
    generator: generator,
  );
}