mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-21 20:30:55 +00:00
run o.Listen() in goroutine.
run main thread for 30 seconds
This commit is contained in:
parent
a846c59e72
commit
632cd9049f
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
@ -16,8 +17,7 @@ type observer struct {
|
|||||||
|
|
||||||
// newObserver returns an observer type
|
// newObserver returns an observer type
|
||||||
func newObserver(vm *voicemeeter.Remote) *observer {
|
func newObserver(vm *voicemeeter.Remote) *observer {
|
||||||
o := &observer{vm, make(chan string)}
|
return &observer{vm, make(chan string)}
|
||||||
return o
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnUpdate satisfies the observer interface defined in publisher.go
|
// OnUpdate satisfies the observer interface defined in publisher.go
|
||||||
@ -49,7 +49,7 @@ func init() {
|
|||||||
|
|
||||||
func runObserver(vm *voicemeeter.Remote) {
|
func runObserver(vm *voicemeeter.Remote) {
|
||||||
o := newObserver(vm)
|
o := newObserver(vm)
|
||||||
o.Listen()
|
go o.Listen()
|
||||||
}
|
}
|
||||||
|
|
||||||
// main connects to Voiceemeter, registers observer for updates
|
// main connects to Voiceemeter, registers observer for updates
|
||||||
@ -62,6 +62,8 @@ func main() {
|
|||||||
defer vm.Logout()
|
defer vm.Logout()
|
||||||
|
|
||||||
runObserver(vm)
|
runObserver(vm)
|
||||||
|
|
||||||
|
time.Sleep(time.Duration(30) * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
// vmConnect connects to Voicemeeter potato and logs into the API
|
// vmConnect connects to Voicemeeter potato and logs into the API
|
||||||
|
Loading…
Reference in New Issue
Block a user