From 85f1853e003ac6f415dad4c278e14767c5f82370 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 20 Jul 2023 13:05:29 -0700 Subject: [PATCH] avp patch --- .../OctopusDemo/octopus-demo-app/build.gradle | 2 +- .../picovoice/octopusdemo/MainActivity.java | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/demo/android/OctopusDemo/octopus-demo-app/build.gradle b/demo/android/OctopusDemo/octopus-demo-app/build.gradle index 994907d..f3120a7 100644 --- a/demo/android/OctopusDemo/octopus-demo-app/build.gradle +++ b/demo/android/OctopusDemo/octopus-demo-app/build.gradle @@ -63,7 +63,7 @@ dependencies { implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.1' implementation 'ai.picovoice:octopus-android:1.2.2' - implementation 'ai.picovoice:android-voice-processor:1.0.1' + implementation 'ai.picovoice:android-voice-processor:1.0.2' // Espresso UI Testing androidTestImplementation 'androidx.test.ext:junit:1.1.3' diff --git a/demo/android/OctopusDemo/octopus-demo-app/src/main/java/ai/picovoice/octopusdemo/MainActivity.java b/demo/android/OctopusDemo/octopus-demo-app/src/main/java/ai/picovoice/octopusdemo/MainActivity.java index 7ac955a..ba7a3da 100644 --- a/demo/android/OctopusDemo/octopus-demo-app/src/main/java/ai/picovoice/octopusdemo/MainActivity.java +++ b/demo/android/OctopusDemo/octopus-demo-app/src/main/java/ai/picovoice/octopusdemo/MainActivity.java @@ -61,6 +61,7 @@ public class MainActivity extends AppCompatActivity { private static final String ACCESS_KEY = "{YOUR_ACCESS_KEY_HERE}"; + private static final int MAX_RECORDING_SEC = 120; private final VoiceProcessor voiceProcessor = VoiceProcessor.getInstance(); @@ -262,19 +263,19 @@ public void run() { setUIInteractivity(false); setUIState(UIState.INDEXING); - taskExecutor.execute(() -> { - try { - voiceProcessor.stop(); - } catch (VoiceProcessorException e) { - displayError(e.toString(), Toast.LENGTH_LONG); - return; - } + try { + voiceProcessor.stop(); + } catch (VoiceProcessorException e) { + displayError(e.toString(), Toast.LENGTH_LONG); + return; + } - short[] pcmDataArray = new short[pcmData.size()]; - for (int i = 0; i < pcmData.size(); ++i) { - pcmDataArray[i] = pcmData.get(i); - } + short[] pcmDataArray = new short[pcmData.size()]; + for (int i = 0; i < pcmData.size(); ++i) { + pcmDataArray[i] = pcmData.get(i); + } + taskExecutor.execute(() -> { try { metadata = octopus.indexAudioData(pcmDataArray); } catch (OctopusException e) {