Skip to content
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
51 changes: 43 additions & 8 deletions .github/workflows/c-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
pv_recorder_platform: "linux"
- os: windows-latest
pv_recorder_platform: "windows-amd64"
- os: macos-latest
pv_recorder_platform: "mac-arm64"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -B ./build
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"

- name: Build micdemo
run: cmake --build ./build --target rhino_demo_mic
Expand All @@ -65,18 +72,33 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
make_file: ["Unix Makefiles"]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]
include:
- machine: rpi3-32
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi3"
- machine: rpi3-64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi3-64"
- machine: rpi4-32
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi4"
- machine: rpi4-64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi4-64"
- machine: rpi5-64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi5-64"
- machine: pv-windows-arm64
make_file: "MinGW Makefiles"
pv_recorder_platform: "windows-arm64"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -G "${{ matrix.make_file }}" -B ./build
run: cmake -G "${{ matrix.make_file }}" -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"

- name: Build micdemo
run: cmake --build ./build --target rhino_demo_mic
Expand All @@ -91,12 +113,15 @@ jobs:
- os: ubuntu-latest
platform: linux
arch: x86_64
pv_recorder_platform: "linux"
- os: windows-latest
platform: windows
arch: amd64
pv_recorder_platform: "windows-amd64"
- os: macos-latest
platform: mac
arch: arm64
pv_recorder_platform: "mac-arm64"

steps:
- uses: actions/checkout@v3
Expand All @@ -109,7 +134,7 @@ jobs:
python-version: '3.10'

- name: Create build directory
run: cmake -B ./build
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"

- name: Build filedemo
run: cmake --build ./build --target rhino_demo_file
Expand All @@ -125,36 +150,46 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
make_file: ["Unix Makefiles"]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]
include:
- machine: rpi3-32
platform: raspberry-pi
arch: cortex-a53
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi3"
- machine: rpi3-64
platform: raspberry-pi
arch: cortex-a53-aarch64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi3-64"
- machine: rpi4-32
platform: raspberry-pi
arch: cortex-a72
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi4"
- machine: rpi4-64
platform: raspberry-pi
arch: cortex-a72-aarch64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi4-64"
- machine: rpi5-64
platform: raspberry-pi
arch: cortex-a76-aarch64
make_file: "Unix Makefiles"
pv_recorder_platform: "raspberry-pi5-64"
- machine: pv-windows-arm64
platform: windows
arch: arm64
make_file: "MinGW Makefiles"
pv_recorder_platform: "windows-arm64"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -G "${{ matrix.make_file }}" -B ./build
run: cmake -G "${{ matrix.make_file }}" -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"

- name: Build filedemo
run: cmake --build ./build --target rhino_demo_file
Expand Down
4 changes: 2 additions & 2 deletions demo/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(rhino_demo_c)

set(CMAKE_C_STANDARD 99)
set(CMAKE_BUILD_TYPE Release)
add_subdirectory(pvrecorder)
add_subdirectory(pvrecorder/project)

set(COMMON_LIBS dl)
set(MIC_LIBS pthread m)
Expand All @@ -14,7 +14,7 @@ add_executable(
rhino_demo_mic
rhino_demo_mic.c
$<TARGET_OBJECTS:pv_recorder_object>)
target_include_directories(rhino_demo_mic PRIVATE pvrecorder/include)
target_include_directories(rhino_demo_mic PRIVATE pvrecorder/project/include)

add_executable(
rhino_demo_file
Expand Down
16 changes: 13 additions & 3 deletions demo/c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
You need a C99-compatible compiler to build these demos.

## Requirements

- The demo requires [CMake](https://cmake.org/) version 3.13 or higher.
- **For Windows Only**: [MinGW](https://www.mingw-w64.org/) is required to build the demo.

Expand All @@ -17,15 +18,21 @@ Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get you
## Build Linux/MacOS

```console
cmake -S demo/c/. -B demo/c/build && cmake --build demo/c/build --target rhino_demo_mic
cmake -S demo/c/. -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM}
cmake --build demo/c/build --target rhino_demo_mic
```

The {PV_RECORDER_PLATFORM} variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.

## Build Windows

```console
cmake -S demo/c/. -B demo/c/build -G "MinGW Makefiles" && cmake --build demo/c/build --target rhino_demo_mic
cmake -S demo/c/. -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} -G "MinGW Makefiles"
cmake --build demo/c/build --target rhino_demo_mic
```

The {PV_RECORDER_PLATFORM} variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.

## Run

### Usage
Expand Down Expand Up @@ -120,9 +127,12 @@ If understood correctly, the following prints to the console:
## Build

```console
cmake -S demo/c/. -B demo/c/build && cmake --build demo/c/build --target rhino_demo_file
cmake -S demo/c/. -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM}
cmake --build demo/c/build --target rhino_demo_file
```

The {PV_RECORDER_PLATFORM} variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.

## Run

### Usage
Expand Down
2 changes: 1 addition & 1 deletion demo/c/pvrecorder
Submodule pvrecorder updated 184 files
8 changes: 4 additions & 4 deletions demo/c/rhino_demo_mic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2023 Picovoice Inc.
Copyright 2018-2025 Picovoice Inc.

You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
file accompanying this source.
Expand Down Expand Up @@ -112,7 +112,7 @@ void show_audio_devices(void) {
char **devices = NULL;
int32_t count = 0;

pv_recorder_status_t status = pv_recorder_get_audio_devices(&count, &devices);
pv_recorder_status_t status = pv_recorder_get_available_devices(&count, &devices);
if (status != PV_RECORDER_STATUS_SUCCESS) {
fprintf(stderr, "Failed to get audio devices with: %s.\n", pv_recorder_status_to_string(status));
exit(1);
Expand All @@ -123,7 +123,7 @@ void show_audio_devices(void) {
fprintf(stdout, "index: %d, name: %s\n", i, devices[i]);
}

pv_recorder_free_device_list(count, devices);
pv_recorder_free_available_devices(count, devices);
}

void print_error_message(char **message_stack, int32_t message_stack_depth) {
Expand Down Expand Up @@ -323,7 +323,7 @@ int picovoice_main(int argc, char *argv[]) {

const int32_t frame_length = pv_rhino_frame_length_func();
pv_recorder_t *recorder = NULL;
pv_recorder_status_t recorder_status = pv_recorder_init(device_index, frame_length, 100, true, true, &recorder);
pv_recorder_status_t recorder_status = pv_recorder_init(frame_length, device_index, 100, &recorder);
if (recorder_status != PV_RECORDER_STATUS_SUCCESS) {
fprintf(stderr, "Failed to initialize device with %s.\n", pv_recorder_status_to_string(recorder_status));
exit(1);
Expand Down