-
Notifications
You must be signed in to change notification settings - Fork 0
/
recNew.go
59 lines (48 loc) · 822 Bytes
/
recNew.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
)
func recNew(rs *RecSettings) (err error) {
recArr := [1024]int32{}
s := rs.Rec
err = s.PAStream.Start()
if err != nil {
return
}
rs.Rec.Print <- "started recording"
for {
select {
case x := <-s.Kill:
s.PAStream.Stop()
//if err != nil {
// return
//}
s.Print <- fmt.Sprintf("killed with %d", x)
s.Complete <- 1
return
//case <-sig:
// s.PAStream.Stop()
// //if err != nil {
// // return
// //}
// s.Print <- "killed with os sig"
//
// s.Complete <- 1
// break recloop
default:
}
err = s.PAStream.Read()
if err != nil {
s.PAStream.Stop()
//if err != nil {
// return
//}
s.Print <- "rec err " + err.Error()
s.Complete <- 1
return
}
copy(recArr[:], rs.RecSlice[:])
s.Buffer <- recArr
}
return
}