mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-15 17:40:51 +00:00
Merge branch 'dev' of https://github.com/onyx-and-iris/voicemeeter-api-go into dev
This commit is contained in:
commit
10d7cea523
@ -8,7 +8,7 @@ Toggle with `!` prefix, get by excluding `=` and set by including `=`. Mix and m
|
|||||||
|
|
||||||
You may pass an optional flag -kind to set the kind of Voicemeeter. Defaults to banana.
|
You may pass an optional flag -kind to set the kind of Voicemeeter. Defaults to banana.
|
||||||
|
|
||||||
You may pass an optional flag -delay to set a delay on the getters. Defaults to 15ms.
|
You may pass an optional flag -delay to set a delay on the getters. Defaults to 20ms.
|
||||||
|
|
||||||
for example:
|
for example:
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
kindId := flag.String("kind", "banana", "kind of voicemeeter")
|
kindId := flag.String("kind", "banana", "kind of voicemeeter")
|
||||||
delay := flag.Int("delay", 15, "delay between commands")
|
delay := flag.Int("delay", 20, "delay between commands")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
vm, err := vmConnect(kindId, delay)
|
vm, err := vmConnect(kindId, delay)
|
||||||
@ -20,7 +20,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer vm.Logout()
|
defer vm.Logout()
|
||||||
|
|
||||||
err = run_commands(vm)
|
err = runCommands(vm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ func vmConnect(kindId *string, delay *int) (*voicemeeter.Remote, error) {
|
|||||||
return vm, nil
|
return vm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func run_commands(vm *voicemeeter.Remote) error {
|
func runCommands(vm *voicemeeter.Remote) error {
|
||||||
for _, arg := range flag.Args() {
|
for _, arg := range flag.Args() {
|
||||||
if arg[0] == '!' {
|
if arg[0] == '!' {
|
||||||
val, err := vm.GetFloat(arg[1:])
|
val, err := vm.GetFloat(arg[1:])
|
||||||
@ -59,16 +59,16 @@ func run_commands(vm *voicemeeter.Remote) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val_f, err := vm.GetFloat(arg)
|
valF, err := vm.GetFloat(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
val_s, err := vm.GetString(arg)
|
valS, err := vm.GetString(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("unable to get %s", arg)
|
err = fmt.Errorf("unable to get %s", arg)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println("Value of", arg, "is:", val_s)
|
fmt.Println("Value of", arg, "is:", valS)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Value of", arg, "is:", val_f)
|
fmt.Println("Value of", arg, "is:", valF)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user