Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0 rust #691

Merged
merged 7 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/rust-codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
override: true

- name: Local Porcupine dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Run clippy
Expand All @@ -71,6 +71,18 @@ jobs:
toolchain: stable
override: true

- name: Local Porcupine dependency
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Local dependency
run: cargo build
working-directory: sdk/rust

- name: Run clippy
run: cargo clippy -- -D warnings
working-directory: demo/rust/filedemo
Expand All @@ -93,6 +105,22 @@ jobs:
toolchain: stable
override: true

- name: Local Porcupine dependency
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Local dependency
run: cargo build
working-directory: sdk/rust

- name: Local dependency
run: cargo build
working-directory: sdk/rust

- name: Run clippy
run: cargo clippy -- -D warnings
working-directory: demo/rust/micdemo
24 changes: 24 additions & 0 deletions .github/workflows/rust-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ jobs:
toolchain: stable
override: true

- name: Local Porcupine dependency
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Local dependency
run: cargo build
working-directory: sdk/rust

- name: Rust build micdemo
run: cargo build --verbose
working-directory: demo/rust/micdemo
Expand Down Expand Up @@ -98,6 +110,18 @@ jobs:
toolchain: nightly
override: true

- name: Local Porcupine dependency
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Local dependency
run: cargo build
working-directory: sdk/rust

- name: Rust build micdemo
run: cargo build --verbose
working-directory: demo/rust/micdemo
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
override: true

- name: Local Porcupine dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Rust build
Expand All @@ -84,15 +84,15 @@ jobs:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: stable
override: true

- name: Local Porcupine dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/porcupine/binding/rust

- name: Local Rhino dependency
run: ./copy.sh
run: bash copy.sh && cargo build
working-directory: resources/rhino/binding/rust

- name: Rust build
Expand Down
2 changes: 1 addition & 1 deletion demo/rust/filedemo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2018"
clap = "3.2.3"
hound = "3.4.0"
itertools = "0.10.3"
picovoice = "=2.2.1"
picovoice = { path = "../../../sdk/rust" }
2 changes: 1 addition & 1 deletion demo/rust/micdemo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ clap = "3.2.3"
ctrlc = "3.1.9"
hound = "3.4.0"
itertools = "0.10.3"
picovoice = "=2.2.1"
picovoice = { path = "../../../sdk/rust" }
pv_recorder = "=1.2.1"
92 changes: 82 additions & 10 deletions sdk/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "picovoice"
version = "2.2.1"
version = "3.0.0"
edition = "2018"
description = "Rust SDK for Picovoice's voice recognition platform"
license = "Apache-2.0"
Expand All @@ -25,8 +25,8 @@ path = "src/lib.rs"
crate_type = ["lib"]

[dependencies]
pv_porcupine = "=2.2.1"
pv_rhino = "=2.2.1"
pv_porcupine = { path = "../../resources/porcupine/binding/rust" }
pv_rhino = { path = "../../resources/rhino/binding/rust" }

[dev-dependencies]
itertools = "0.10.1"
Expand Down
9 changes: 8 additions & 1 deletion sdk/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ where
let frame_length = porcupine.frame_length();

let version = format!(
"2.1.1 (Porcupine v{}) (Rhino v{})",
"3.0.0 (Porcupine v{}) (Rhino v{})",
porcupine.version(),
rhino.version()
);
Expand Down Expand Up @@ -287,6 +287,13 @@ where
Ok(())
}

pub fn reset(&mut self) -> Result<(), PicovoiceError> {
self.wake_word_detected = false;
self.rhino.reset().map_err(PicovoiceError::from_rhino)?;

Ok(())
}

pub fn frame_length(&self) -> u32 {
self.frame_length
}
Expand Down
Loading
Loading