-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecInit.go
More file actions
31 lines (25 loc) · 735 Bytes
/
Copy pathrecInit.go
File metadata and controls
31 lines (25 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import "github.com/williamsharkey/rec/portaudio"
func recInit() (set *RecSettings, err error) {
const bufLen = 1024
recSlice := make([]int32, bufLen)
playSlice := make([]int16, bufLen)
recPAStream, err := portaudio.OpenDefaultStream(1, 0, 44100, bufLen, recSlice)
if err != nil {
return
}
playPAStream, err := portaudio.OpenDefaultStream(0, 2, 44100, bufLen, playSlice)
if err != nil {
return
}
return &RecSettings{
&AudioChan{false, make(chan int), make(chan int), make(chan [bufLen]int32), make(chan string), recPAStream},
&AudioChan{false, make(chan int), make(chan int), make(chan [bufLen]int32), make(chan string), playPAStream},
recSlice,
playSlice,
nil,
nil,
nil,
nil,
}, err
}