start method
Opens audio input stream and sends audio frames to Porcupine
Throws a PvAudioException
if there was a problem starting the audio engine
Implementation
Future<void> start() async {
if (_porcupine == null || _voiceProcessor == null) {
throw new PvStateError(
"Cannot start Porcupine - resources have already been released");
}
if (await _voiceProcessor?.hasRecordAudioPermission() ?? false) {
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.");
}
}