update docstrings in observer example

This commit is contained in:
onyx-and-iris 2022-12-15 00:41:57 +00:00
parent 195ee326a0
commit a23a9f8598

View File

@ -20,8 +20,7 @@ func newObserver(vm *voicemeeter.Remote) *observer {
return &observer{vm, make(chan string)} return &observer{vm, make(chan string)}
} }
// OnUpdate satisfies the observer interface defined in publisher.go // Listen registers the observer channel and listens for udpates.
// for each event type an action is triggered when the event occurs.
func (o observer) Listen() { func (o observer) Listen() {
o.vm.Register(o.events) o.vm.Register(o.events)
@ -47,6 +46,7 @@ func init() {
log.SetLevel(log.InfoLevel) log.SetLevel(log.InfoLevel)
} }
// runObserver initiates a single observer and starts its Listen() function.
func runObserver(vm *voicemeeter.Remote) { func runObserver(vm *voicemeeter.Remote) {
o := newObserver(vm) o := newObserver(vm)
go o.Listen() go o.Listen()
@ -67,6 +67,7 @@ func main() {
} }
// vmConnect connects to Voicemeeter potato and logs into the API // vmConnect connects to Voicemeeter potato and logs into the API
// it also add ldirty to event updates.
func vmConnect() (*voicemeeter.Remote, error) { func vmConnect() (*voicemeeter.Remote, error) {
vm, err := voicemeeter.NewRemote("basic", 0) vm, err := voicemeeter.NewRemote("basic", 0)
if err != nil { if err != nil {