diff --git a/README.md b/README.md index 1037b0a..448487e 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,7 @@ import ( ) func main() { - vm, err := voicemeeter.NewRemote("banana", 15) - if err != nil { - log.Fatal(err) - } - - err = vm.Login() + vm, err := vmConnect() if err != nil { log.Fatal(err) } @@ -57,6 +52,20 @@ func main() { vm.Strip[0].SetMute(true) fmt.Printf("Strip 0 (%s) mute was set to %v\n", vm.Strip[0].GetLabel(), vm.Strip[0].GetMute()) } + +func vmConnect() (*voicemeeter.Remote, error) { + vm, err := voicemeeter.NewRemote("banana", 15) + if err != nil { + return nil, err + } + + err = vm.Login() + if err != nil { + return nil, err + } + + return vm, nil +} ``` ## `voicemeeter.NewRemote(, )`