Skip to content

Commit 3d84f5e

Browse files
authored
Merge pull request #77 from Picovoice/update-pvrecorder-version
update cmake and pvrecorder versions
2 parents 2fa61da + e477d66 commit 3d84f5e

File tree

5 files changed

+63
-21
lines changed

5 files changed

+63
-21
lines changed

.github/workflows/c-demos.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@ jobs:
3838
strategy:
3939
matrix:
4040
os: [ubuntu-latest, windows-latest, macos-latest]
41+
include:
42+
- os: ubuntu-latest
43+
pv_recorder_platform: "linux"
44+
- os: windows-latest
45+
pv_recorder_platform: "windows-amd64"
46+
- os: macos-latest
47+
pv_recorder_platform: "mac-arm64"
4148

4249
steps:
4350
- uses: actions/checkout@v3
4451
with:
4552
submodules: recursive
4653

4754
- name: Create build directory
48-
run: cmake -B ./build
55+
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"
4956

5057
- name: Build micdemo
5158
run: cmake --build ./build --target koala_demo_mic
@@ -55,20 +62,34 @@ jobs:
5562

5663
strategy:
5764
matrix:
58-
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
59-
make_file: ["Unix Makefiles"]
65+
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]
6066
include:
61-
- machine: pv-windows-arm64
62-
make_file: "MinGW Makefiles"
63-
67+
- machine: rpi3-32
68+
make_file: "Unix Makefiles"
69+
pv_recorder_platform: "raspberry-pi3"
70+
- machine: rpi3-64
71+
make_file: "Unix Makefiles"
72+
pv_recorder_platform: "raspberry-pi3-64"
73+
- machine: rpi4-32
74+
make_file: "Unix Makefiles"
75+
pv_recorder_platform: "raspberry-pi4"
76+
- machine: rpi4-64
77+
make_file: "Unix Makefiles"
78+
pv_recorder_platform: "raspberry-pi4-64"
79+
- machine: rpi5-64
80+
make_file: "Unix Makefiles"
81+
pv_recorder_platform: "raspberry-pi5-64"
82+
- machine: pv-windows-arm64
83+
make_file: "MinGW Makefiles"
84+
pv_recorder_platform: "windows-arm64"
6485

6586
steps:
6687
- uses: actions/checkout@v3
6788
with:
6889
submodules: recursive
6990

7091
- name: Create build directory
71-
run: cmake -B ./build
92+
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"
7293

7394
- name: Build micdemo
7495
run: cmake --build ./build --target koala_demo_mic
@@ -83,12 +104,15 @@ jobs:
83104
- os: ubuntu-latest
84105
platform: linux
85106
arch: x86_64
107+
pv_recorder_platform: "linux"
86108
- os: windows-latest
87109
platform: windows
88110
arch: amd64
111+
pv_recorder_platform: "windows-amd64"
89112
- os: macos-latest
90113
platform: mac
91114
arch: arm64
115+
pv_recorder_platform: "mac-arm64"
92116

93117
steps:
94118
- uses: actions/checkout@v3
@@ -101,7 +125,7 @@ jobs:
101125
python-version: '3.10'
102126

103127
- name: Create build directory
104-
run: cmake -B ./build
128+
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"
105129

106130
- name: Build filedemo
107131
run: cmake --build ./build --target koala_demo_file
@@ -115,35 +139,45 @@ jobs:
115139
strategy:
116140
matrix:
117141
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
118-
make_files: ["Unix Makefiles"]
119142
include:
120143
- machine: rpi3-32
121144
platform: raspberry-pi
122145
arch: cortex-a53
146+
make_file: "Unix Makefiles"
147+
pv_recorder_platform: "raspberry-pi3"
123148
- machine: rpi3-64
124149
platform: raspberry-pi
125150
arch: cortex-a53-aarch64
151+
make_file: "Unix Makefiles"
152+
pv_recorder_platform: "raspberry-pi3-64"
126153
- machine: rpi4-32
127154
platform: raspberry-pi
128155
arch: cortex-a72
156+
make_file: "Unix Makefiles"
157+
pv_recorder_platform: "raspberry-pi4"
129158
- machine: rpi4-64
130159
platform: raspberry-pi
131160
arch: cortex-a72-aarch64
161+
make_file: "Unix Makefiles"
162+
pv_recorder_platform: "raspberry-pi4-64"
132163
- machine: rpi5-64
133164
platform: raspberry-pi
134165
arch: cortex-a76-aarch64
166+
make_file: "Unix Makefiles"
167+
pv_recorder_platform: "raspberry-pi5-64"
135168
- machine: pv-windows-arm64
136169
platform: windows
137170
arch: arm64
138171
make_file: "MinGW Makefiles"
172+
pv_recorder_platform: "windows-arm64"
139173

140174
steps:
141175
- uses: actions/checkout@v3
142176
with:
143177
submodules: recursive
144178

145179
- name: Create build directory
146-
run: cmake -B ./build
180+
run: cmake -B ./build -DPV_RECORDER_PLATFORM="${{ matrix.pv_recorder_platform }}"
147181

148182
- name: Build filedemo
149183
run: cmake --build ./build --target koala_demo_file

demo/c/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cmake_minimum_required(VERSION 3.4)
1+
cmake_minimum_required(VERSION 3.13)
22
project(koala_demo_c)
33

44
set(CMAKE_C_STANDARD 99)
55
set(CMAKE_BUILD_TYPE Release)
6-
add_subdirectory(pvrecorder)
6+
add_subdirectory(pvrecorder/project)
77

88
set(COMMON_LIBS dl m)
99
include_directories("${PROJECT_SOURCE_DIR}/../../include")
@@ -17,7 +17,7 @@ add_executable(
1717
koala_demo_mic
1818
koala_demo_mic.c
1919
$<TARGET_OBJECTS:pv_recorder_object>)
20-
target_include_directories(koala_demo_mic PRIVATE dr_libs pvrecorder/include)
20+
target_include_directories(koala_demo_mic PRIVATE dr_libs pvrecorder/project/include)
2121

2222

2323
if (NOT WIN32)

demo/c/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get you
1313

1414
## Requirements
1515

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

1919
# Microphone Demo
@@ -28,9 +28,12 @@ noise suppression engine and stored in a `.wav` file.
2828
Use CMake to build the Koala microphone demo target:
2929

3030
```console
31-
cmake -S demo/c/ -B demo/c/build && cmake --build demo/c/build --target koala_demo_mic
31+
cmake -S demo/c/ -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM}
32+
cmake --build demo/c/build --target koala_demo_mic
3233
```
3334

35+
The {PV_RECORDER_PLATFORM} variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.
36+
3437
## Usage
3538

3639
Running the executable without any command-line arguments prints the usage info to the console:
@@ -70,9 +73,12 @@ linear PCM encoding.
7073
Use CMake to build the Koala file demo target:
7174

7275
```console
73-
cmake -S demo/c/ -B demo/c/build && cmake --build demo/c/build --target koala_demo_file
76+
cmake -S demo/c/ -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM}
77+
cmake --build demo/c/build --target koala_demo_file
7478
```
7579

80+
The {PV_RECORDER_PLATFORM} variable will set the compilation flags for the given platform. Exclude this variable to get a list of possible values.
81+
7682
## Usage
7783

7884
Run the demo:

demo/c/koala_demo_mic.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2023 Picovoice Inc.
2+
Copyright 2023-2025 Picovoice Inc.
33
44
You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
55
file accompanying this source.
@@ -30,6 +30,8 @@
3030

3131
#endif
3232

33+
#define DR_WAV_IMPLEMENTATION
34+
3335
#include "dr_wav.h"
3436

3537
#include "pv_koala.h"
@@ -120,7 +122,7 @@ static void show_audio_devices(void) {
120122
char **devices = NULL;
121123
int32_t count = 0;
122124

123-
pv_recorder_status_t status = pv_recorder_get_audio_devices(&count, &devices);
125+
pv_recorder_status_t status = pv_recorder_get_available_devices(&count, &devices);
124126
if (status != PV_RECORDER_STATUS_SUCCESS) {
125127
fprintf(stderr, "Failed to get audio devices with: %s.\n", pv_recorder_status_to_string(status));
126128
exit(EXIT_FAILURE);
@@ -131,7 +133,7 @@ static void show_audio_devices(void) {
131133
fprintf(stdout, "index: %d, name: %s\n", i, devices[i]);
132134
}
133135

134-
pv_recorder_free_device_list(count, devices);
136+
pv_recorder_free_available_devices(count, devices);
135137
}
136138

137139
static void print_vu_meter(const int16_t *pcm_buffer, int32_t num_samples) {
@@ -343,7 +345,7 @@ int picovoice_main(int argc, char *argv[]) {
343345

344346
const int32_t frame_length = pv_koala_frame_length_func();
345347
pv_recorder_t *recorder = NULL;
346-
pv_recorder_status_t recorder_status = pv_recorder_init(device_index, frame_length, 100, true, true, &recorder);
348+
pv_recorder_status_t recorder_status = pv_recorder_init(frame_length, device_index, 100, &recorder);
347349
if (recorder_status != PV_RECORDER_STATUS_SUCCESS) {
348350
fprintf(stderr, "Failed to initialize device with %s.\n", pv_recorder_status_to_string(recorder_status));
349351
exit(EXIT_FAILURE);

demo/c/pvrecorder

Submodule pvrecorder updated 181 files

0 commit comments

Comments
 (0)