2022-06-25 20:11:15 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2022-07-09 19:01:58 +01:00
|
|
|
"strings"
|
2022-06-25 20:11:15 +01:00
|
|
|
"time"
|
|
|
|
|
2022-07-09 19:01:58 +01:00
|
|
|
"github.com/onyx-and-iris/voicemeeter-api-go"
|
2022-06-25 20:11:15 +01:00
|
|
|
)
|
|
|
|
|
2022-06-25 20:36:34 +01:00
|
|
|
type observer struct {
|
2022-07-09 19:01:58 +01:00
|
|
|
vm *voicemeeter.Remote
|
2022-06-25 20:36:34 +01:00
|
|
|
}
|
2022-06-25 20:11:15 +01:00
|
|
|
|
|
|
|
func (o observer) OnUpdate(subject string) {
|
2022-07-09 19:01:58 +01:00
|
|
|
if strings.Compare(subject, "pdirty") == 0 {
|
|
|
|
fmt.Println("pdirty!")
|
|
|
|
}
|
|
|
|
if strings.Compare(subject, "mdirty") == 0 {
|
|
|
|
fmt.Println("mdirty!")
|
|
|
|
}
|
|
|
|
if strings.Compare(subject, "ldirty") == 0 {
|
|
|
|
fmt.Printf("%v %v %v %v %v %v %v %v\n",
|
|
|
|
o.vm.Bus[0].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[1].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[2].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[3].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[4].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[5].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[6].Levels().IsDirty(),
|
|
|
|
o.vm.Bus[7].Levels().IsDirty(),
|
|
|
|
)
|
|
|
|
}
|
2022-06-25 20:11:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2022-07-10 23:08:14 +01:00
|
|
|
vmRem := voicemeeter.NewRemote("potato")
|
2022-06-25 20:11:15 +01:00
|
|
|
vmRem.Login()
|
|
|
|
|
2022-07-09 19:01:58 +01:00
|
|
|
o := observer{vmRem}
|
2022-06-26 01:36:32 +01:00
|
|
|
vmRem.Register(o)
|
2022-07-09 19:01:58 +01:00
|
|
|
time.Sleep(30 * time.Second)
|
|
|
|
vmRem.Deregister(o)
|
2022-06-25 20:11:15 +01:00
|
|
|
|
|
|
|
vmRem.Logout()
|
|
|
|
}
|