diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 533c5e6f0..6d022b3e7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -7,6 +7,7 @@ on: paths: - '.github/workflows/rust.yml' - 'binding/rust/**' + - 'binding/rust/**/*.rs' - '!binding/rust/README.md' - 'lib/beaglebone/**' - 'lib/common/**' @@ -28,6 +29,7 @@ on: paths: - '.github/workflows/rust.yml' - 'binding/rust/**' + - 'binding/rust/**/*.rs' - '!binding/rust/README.md' - 'lib/beaglebone/**' - 'lib/common/**' diff --git a/README.md b/README.md index de913fc74..e7b2bb1f4 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ For more information about Go demos go to [demo/go](demo/go). ### Unity Demos -To run the Porcupine Unity demo, import the [Porcupine Unity package](binding/unity/porcupine-2.1.3.unitypackage) into your project, open the PorcupineDemo scene and hit play. To run on other platforms or in the player, go to _File > Build Settings_, choose your platform and hit the `Build and Run` button. +To run the Porcupine Unity demo, import the [Porcupine Unity package](binding/unity/porcupine-3.0.0.unitypackage) into your project, open the PorcupineDemo scene and hit play. To run on other platforms or in the player, go to _File > Build Settings_, choose your platform and hit the `Build and Run` button. To browse the demo source go to [demo/unity](demo/unity). @@ -778,7 +778,7 @@ porcupine.Delete() ### Unity -Import the [Porcupine Unity Package](binding/unity/porcupine-2.1.3.unitypackage) into your Unity project. +Import the [Porcupine Unity Package](binding/unity/porcupine-3.0.0.unitypackage) into your Unity project. The SDK provides two APIs: diff --git a/binding/rust/src/porcupine.rs b/binding/rust/src/porcupine.rs index aee47cc25..42f2a148e 100644 --- a/binding/rust/src/porcupine.rs +++ b/binding/rust/src/porcupine.rs @@ -152,7 +152,7 @@ type PvSampleRateFn = unsafe extern "C" fn() -> i32; type PvPorcupineFrameLengthFn = unsafe extern "C" fn() -> i32; type PvPorcupineVersionFn = unsafe extern "C" fn() -> *mut c_char; type PvGetErrorStackFn = - unsafe extern "C" fn(message_stack: *mut *mut *mut c_char, message_stack_depth: *mut i32); + unsafe extern "C" fn(message_stack: *mut *mut *mut c_char, message_stack_depth: *mut i32) -> PvStatus; type PvFreeErrorStackFn = unsafe extern "C" fn(message_stack: *mut *mut c_char); type PvSetSdkFn = unsafe extern "C" fn(sdk: *const c_char); @@ -350,11 +350,18 @@ fn check_fn_call_status( let mut message_stack_ptr_ptr = addr_of_mut!(message_stack_ptr); let mut message_stack_depth: i32 = 0; - (vtable.pv_get_error_stack)( + let err_status = (vtable.pv_get_error_stack)( addr_of_mut!(message_stack_ptr_ptr), addr_of_mut!(message_stack_depth), ); + if err_status != PvStatus::SUCCESS { + return Err(PorcupineError::new( + PorcupineErrorStatus::LibraryError(err_status), + "Unable to get Porcupine error state", + )); + }; + let mut message_stack = Vec::new(); for i in 0..message_stack_depth as usize { let message = CStr::from_ptr(*message_stack_ptr_ptr.add(i)); diff --git a/binding/unity/README.md b/binding/unity/README.md index dcaaa22ad..ab5996047 100644 --- a/binding/unity/README.md +++ b/binding/unity/README.md @@ -17,19 +17,17 @@ To learn more about Porcupine, see the [product](https://picovoice.ai/products/p ## Compatibility -[Porcupine unity package](porcupine-2.2.2.unitypackage) is for running Porcupine on **Unity 2017.4+** on the following platforms: +[Porcupine unity package](porcupine-3.0.0.unitypackage) is for running Porcupine on **Unity 2017.4+** on the following platforms: - Android 5.0+ (API 21+) (ARM only) -- iOS 11.0+ +- iOS 13.0+ - Windows (x86_64) - macOS (x86_64) - Linux (x86_64) -For running Porcupine on **macOS M1 (arm64)**, use the [Apple Silicon](porcupine-2.2.2-Apple-silicon.unitypackage) version on **Unity 2021.2+**. - ## Installation -The easiest way to install the Porcupine Unity SDK is to import [porcupine-2.2.2.unitypackage](porcupine-2.2.2.unitypackage) into your Unity projects by either dropping it into the Unity editor or going to _Assets>Import Package>Custom Package..._ +The easiest way to install the Porcupine Unity SDK is to import [porcupine-3.0.0.unitypackage](porcupine-3.0.0.unitypackage) into your Unity projects by either dropping it into the Unity editor or going to _Assets>Import Package>Custom Package..._ **NOTE:** On macOS, the Porcupine library may get flagged as having come from an unverified source if you've downloaded the `.unitypackage` directly from GitHub. This should only come up when running your project in the Editor. To disable this warning, go to Security & Preferences and choose to allow pv_porcupine.dylib to run. diff --git a/demo/unity/README.md b/demo/unity/README.md index 74c1454ae..fa9c8fba5 100644 --- a/demo/unity/README.md +++ b/demo/unity/README.md @@ -3,13 +3,13 @@ The Porcupine demo for Unity is a multi-platform demo that runs on: - Desktop Standalone (Windows, macOS and Linux x86_64) -- iOS 9.0+ -- Android 4.1+ +- iOS 13.0+ +- Android 5.0+ Additionally, you will need a version of Unity that is 2017.4 or higher. ## Usage -The easiest way to run the demo is to simply import the [Porcupine Unity package](../../binding/unity/porcupine-2.1.3.unitypackage) into your project, open the PorcupineDemo scene and hit play. To run on other platforms or in the player, go to _File > Build Settings_, choose your platform and hit the `Build and Run` button. +The easiest way to run the demo is to simply import the [Porcupine Unity package](../../binding/unity/porcupine-3.0.0.unitypackage) into your project, open the PorcupineDemo scene and hit play. To run on other platforms or in the player, go to _File > Build Settings_, choose your platform and hit the `Build and Run` button. Once the demo launches, press the `Start Listening` button and try out any of the listed wake words.