diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f589906c..8c846571 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 83284830..1d97070e 100644 --- a/README.md +++ b/README.md @@ -267,7 +267,7 @@ For more information about Go demos go to [demo/go](./demo/go). ### Unity Demos -To run the Rhino Unity demo, import the [Rhino Unity package](./binding/unity/rhino-2.1.4.unitypackage) into your project, open the RhinoDemo 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 Rhino Unity demo, import the [Rhino Unity package](./binding/unity/rhino-3.0.0.unitypackage) into your project, open the RhinoDemo 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). @@ -766,7 +766,7 @@ rhino.Delete() ### Unity -Import the [Rhino Unity Package](./binding/unity/rhino-2.1.4.unitypackage) into your Unity project. +Import the [Rhino Unity Package](./binding/unity/rhino-3.0.0.unitypackage) into your Unity project. The SDK provides two APIs: diff --git a/binding/rust/src/rhino.rs b/binding/rust/src/rhino.rs index 49293f72..f540ecc2 100644 --- a/binding/rust/src/rhino.rs +++ b/binding/rust/src/rhino.rs @@ -87,7 +87,7 @@ type PvRhinoVersionFn = unsafe extern "C" fn() -> *mut c_char; type PvRhinoFrameLengthFn = unsafe extern "C" fn() -> i32; type PvSampleRateFn = unsafe extern "C" fn() -> i32; 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); @@ -295,11 +295,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(RhinoError::new( + RhinoErrorStatus::LibraryError(err_status), + "Unable to get Rhino 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 f0bc8ae5..c741e3b9 100644 --- a/binding/unity/README.md +++ b/binding/unity/README.md @@ -23,19 +23,17 @@ Rhino is: ## Compatibility -[Rhino unity package](./rhino-2.2.2.unitypackage) is for running Rhino on **Unity 2017.4+** on the following platforms: +[Rhino unity package](./rhino-3.0.0.unitypackage) is for running Rhino on **Unity 2017.4+** on the following platforms: -- Android 4.4+ (API 19+) (ARM only) -- iOS 9.0+ +- Android 5.0+ (API 21+) (ARM only) +- iOS 13.0+ - Windows (x86_64) - macOS (x86_64) - Linux (x86_64) -For running Rhino on **macOS m1 (arm64)**, use the [Apple silicon](./rhino-2.2.2-Apple-silicon.unitypackage) version on **Unity 2021.2+**. - ## Installation -The easiest way to install the Rhino Unity SDK is to import the [Rhino Unity Package](./rhino-2.2.2.unitypackage) into your Unity project by either dropping it into the Unity editor or going to _Assets>Import Package>Custom Package..._ +The easiest way to install the Rhino Unity SDK is to import the [Rhino Unity Package](./rhino-3.0.0.unitypackage) into your Unity project by either dropping it into the Unity editor or going to _Assets>Import Package>Custom Package..._ **NOTE:** On macOS, the Rhino 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_rhino.dylib to run. diff --git a/demo/unity/README.md b/demo/unity/README.md index f4841fa3..b6371324 100644 --- a/demo/unity/README.md +++ b/demo/unity/README.md @@ -22,7 +22,7 @@ Replace the `AccessKey` in [`RhinoDemo.cs`](RhinoDemo.cs) with the `AccessKey` o private const string ACCESS_KEY = "${YOUR_ACCESS_KEY_HERE}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) ``` -The easiest way to run the demo is to simply import the [Rhino Unity package](../../binding/unity/rhino-2.1.4.unitypackage) into your project, open the RhinoDemo 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 [Rhino Unity package](../../binding/unity/rhino-3.0.0.unitypackage) into your project, open the RhinoDemo 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 you can say anything in the smart lighting context: