process method

Future<void> process()

Opens audio input stream and sends audio frames to Rhino until a inference result is sent via inference callback Throws a PvAudioException if there was a problem starting the audio engine

Implementation

Future<void> process() async {
  if (_rhino == null || _voiceProcessor == null) {
    throw new PvStateError(
        "Cannot start RhinoManager - resources have already been released");
  }

  if (await _voiceProcessor?.hasRecordAudioPermission() == true) {
    try {
      await _voiceProcessor!.start();
    } on PlatformException {
      throw new PvAudioException(
          "Audio engine failed to start. Hardware may not be supported.");
    }
  } else {
    throw new PvAudioException(
        "User did not give permission to record audio.");
  }
}