static void RunGame() { // init picovoice platform string keywordPath = $"pico_chess_{_platform}.ppn"; string contextPath = $"chess_{_platform}.rhn"; using Picovoice picovoice = new Picovoice(keywordPath, WakeWordCallback, contextPath, InferenceCallback); DrawBoard("\n"); // create and start recording short[] recordingBuffer = new short[picovoice.FrameLength]; ALCaptureDevice captureDevice = ALC.CaptureOpenDevice(null, picovoice.SampleRate, ALFormat.Mono16, picovoice.FrameLength * 2); { ALC.CaptureStart(captureDevice); while (!_quitGame) { int samplesAvailable = ALC.GetAvailableSamples(captureDevice); if (samplesAvailable > picovoice.FrameLength) { ALC.CaptureSamples(captureDevice, ref recordingBuffer[0], picovoice.FrameLength); picovoice.Process(recordingBuffer); } Thread.Yield(); } // stop and clean up resources Console.WriteLine("Bye!"); ALC.CaptureStop(captureDevice); ALC.CaptureCloseDevice(captureDevice); } }
public void TestInit() { _pv = new Picovoice(Porcupine.KEYWORD_PATHS["picovoice"], _wakeWordCallback, _contextPath, _inferenceCallback); _isWakeWordDetected = false; _inference = null; }