1
- // Copyright 2021 Picovoice Inc.
1
+ // Copyright 2021-2023 Picovoice Inc.
2
2
//
3
3
// You may not use this file except in compliance with the license. A copy of the license is
4
4
// located in the "LICENSE" file accompanying this source.
@@ -21,7 +21,7 @@ import (
21
21
"strings"
22
22
23
23
porcupine "github.com/Picovoice/porcupine/binding/go/v2"
24
- pvrecorder "github.com/Picovoice/pvrecorder/sdk /go"
24
+ pvrecorder "github.com/Picovoice/pvrecorder/binding /go"
25
25
"github.com/go-audio/wav"
26
26
)
27
27
@@ -139,12 +139,8 @@ func main() {
139
139
defer outputWav .Close ()
140
140
}
141
141
142
- recorder := pvrecorder.PvRecorder {
143
- DeviceIndex : * audioDeviceIndex ,
144
- FrameLength : porcupine .FrameLength ,
145
- BufferSizeMSec : 1000 ,
146
- LogOverflow : 0 ,
147
- }
142
+ recorder := pvrecorder .NewPvRecorder (porcupine .FrameLength )
143
+ recorder .DeviceIndex = * audioDeviceIndex
148
144
149
145
if err := recorder .Init (); err != nil {
150
146
log .Fatalf ("Error: %s.\n " , err .Error ())
@@ -200,7 +196,7 @@ waitLoop:
200
196
}
201
197
202
198
func printAudioDevices () {
203
- if devices , err := pvrecorder .GetAudioDevices (); err != nil {
199
+ if devices , err := pvrecorder .GetAvailableDevices (); err != nil {
204
200
log .Fatalf ("Error: %s.\n " , err .Error ())
205
201
} else {
206
202
for i , device := range devices {
0 commit comments