initialize method

Future<void> initialize({
  1. int nChannels = 1,
  2. int sampleRate = 16000,
  3. PCMType pcmType = PCMType.pcm16,
})

Initializes the player The nChannels should either be 1 or 2 to indicate the number of channels

The sampleRate is the sample rate for output

The pcmType determines the raw PCM format

Implementation

Future<void> initialize({
  int nChannels = 1,
  int sampleRate = 16000,
  PCMType pcmType = PCMType.pcm16,
}) async {
  release();

  await _channel.invokeMethod("initialize", {
    'nChannels': nChannels,
    'sampleRate': sampleRate,
    'pcmType': pcmType.index,
  });
  _playState = PlayState.stopped;
  _isInited = true;
}