From 7f992a1a875468186ba701c2ab8bbe998455bbfb Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:58:49 +0100 Subject: [PATCH] only check subject once per update --- examples/observer/main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/observer/main.go b/examples/observer/main.go index 4ac1938..6fe1f58 100644 --- a/examples/observer/main.go +++ b/examples/observer/main.go @@ -23,16 +23,13 @@ func (o observer) Deregister() { func (o observer) OnUpdate(subject string) { if subject == "pdirty" { fmt.Println("pdirty!") - } - if subject == "mdirty" { + } else if subject == "mdirty" { fmt.Println("mdirty!") - } - if subject == "midi" { + } else if subject == "midi" { var current = o.vm.Midi.Current() var val = o.vm.Midi.Get(current) fmt.Printf("Value of midi button %d: %d\n", current, val) - } - if subject == "ldirty" { + } else if subject == "ldirty" { fmt.Printf("%v %v %v %v %v %v %v %v\n", o.vm.Bus[0].Levels().IsDirty(), o.vm.Bus[1].Levels().IsDirty(),