Compare commits
2 Commits
9b1bf9c252
...
97a1f901b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97a1f901b4 | ||
|
|
09945be4ac |
@ -101,7 +101,7 @@ func (au *Audio) ProcessInput(conn *ircevent.Connection, channel string) error {
|
|||||||
defer stream.Stop()
|
defer stream.Stop()
|
||||||
|
|
||||||
data := make([]byte, 480)
|
data := make([]byte, 480)
|
||||||
debounce := 0
|
// debounce := 0
|
||||||
for frame := range inChan {
|
for frame := range inChan {
|
||||||
C.rnnoise_process_frame(
|
C.rnnoise_process_frame(
|
||||||
st,
|
st,
|
||||||
@ -109,14 +109,14 @@ func (au *Audio) ProcessInput(conn *ircevent.Connection, channel string) error {
|
|||||||
(*C.float)(unsafe.Pointer(&frame[0])),
|
(*C.float)(unsafe.Pointer(&frame[0])),
|
||||||
)
|
)
|
||||||
|
|
||||||
if rms(frame) < 0.02 {
|
// if rms(frame) < 0.02 {
|
||||||
debounce++
|
// debounce++
|
||||||
if debounce >= 10 {
|
// if debounce >= 10 {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
debounce = 0
|
// debounce = 0
|
||||||
}
|
// }
|
||||||
|
|
||||||
n, err := enc.EncodeFloat32(frame, data)
|
n, err := enc.EncodeFloat32(frame, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
4
main.go
4
main.go
@ -158,6 +158,10 @@ func (m model) Init() tea.Cmd {
|
|||||||
delete(m.users, e.Nick())
|
delete(m.users, e.Nick())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
m.conn.AddCallback("QUIT", func(e ircmsg.Message) {
|
||||||
|
delete(m.users, e.Nick())
|
||||||
|
})
|
||||||
|
|
||||||
m.conn.Join(m.channel)
|
m.conn.Join(m.channel)
|
||||||
|
|
||||||
return tea.Batch(tick())
|
return tea.Batch(tick())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user