2022-06-25 20:11:15 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/onyx-and-iris/voicemeeter-api-go/voicemeeter"
|
|
|
|
)
|
|
|
|
|
2022-06-25 20:36:34 +01:00
|
|
|
type observer struct {
|
|
|
|
i int
|
|
|
|
}
|
2022-06-25 20:11:15 +01:00
|
|
|
|
|
|
|
func (o observer) OnUpdate(subject string) {
|
2022-06-25 20:36:34 +01:00
|
|
|
fmt.Println(o.i, subject)
|
2022-06-25 20:11:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
vmRem := voicemeeter.GetRemote("banana")
|
|
|
|
vmRem.Login()
|
|
|
|
|
2022-06-25 20:36:34 +01:00
|
|
|
o := observer{1}
|
|
|
|
o2 := observer{2}
|
|
|
|
o3 := observer{3}
|
|
|
|
o4 := observer{4}
|
2022-06-26 01:36:32 +01:00
|
|
|
vmRem.Register(o)
|
|
|
|
vmRem.Register(o2)
|
|
|
|
vmRem.Register(o3)
|
|
|
|
vmRem.Register(o4)
|
2022-06-25 20:36:34 +01:00
|
|
|
|
|
|
|
time.Sleep(5 * time.Second)
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
vmRem.Deregister(o2)
|
2022-06-25 20:11:15 +01:00
|
|
|
|
2022-06-25 20:36:34 +01:00
|
|
|
time.Sleep(5 * time.Second)
|
2022-06-25 20:11:15 +01:00
|
|
|
|
|
|
|
vmRem.Logout()
|
|
|
|
}
|