From 717c73858310ab1d791783084c34e46b199d4c4b Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sun, 26 Jun 2022 01:41:05 +0100 Subject: [PATCH] remove export publisher, pooler --- voicemeeter/publisher.go | 18 +++++++++--------- voicemeeter/remote.go | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/voicemeeter/publisher.go b/voicemeeter/publisher.go index 278c78d..d6d3aef 100644 --- a/voicemeeter/publisher.go +++ b/voicemeeter/publisher.go @@ -6,17 +6,17 @@ type observer interface { } // Publisher defines methods that support observers -type Publisher struct { +type publisher struct { observerList []observer } // Register adds an observer to observerList -func (p *Publisher) Register(o observer) { +func (p *publisher) Register(o observer) { p.observerList = append(p.observerList, o) } // Deregister removes an observer from observerList -func (p *Publisher) Deregister(o observer) { +func (p *publisher) Deregister(o observer) { var indexToRemove int for i, observer := range p.observerList { @@ -30,7 +30,7 @@ func (p *Publisher) Deregister(o observer) { } // notify updates observers of any changes -func (p *Publisher) notify(subject string) { +func (p *publisher) notify(subject string) { for _, observer := range p.observerList { observer.OnUpdate(subject) } @@ -38,20 +38,20 @@ func (p *Publisher) notify(subject string) { // Pooler continuously polls the dirty paramters // it is expected to be run in a goroutine -type Pooler struct { +type pooler struct { run bool - Publisher + publisher } -func newPooler() *Pooler { - p := &Pooler{ +func newPooler() *pooler { + p := &pooler{ run: true, } go p.runner() return p } -func (p *Pooler) runner() { +func (p *pooler) runner() { for p.run { if pdirty() { p.notify("pdirty") diff --git a/voicemeeter/remote.go b/voicemeeter/remote.go index b10de8c..7b357c9 100644 --- a/voicemeeter/remote.go +++ b/voicemeeter/remote.go @@ -15,7 +15,7 @@ type remote struct { Command *command Vban *vban - Pooler *Pooler + pooler *pooler } // String implements the fmt.stringer interface @@ -26,14 +26,14 @@ func (r *remote) String() string { // Login logs into the API // then it intializes the pooler func (r *remote) Login() { - r.Pooler = newPooler() + r.pooler = newPooler() login(r.kind.name) } // Logout logs out of the API // it also terminates the pooler func (r *remote) Logout() { - r.Pooler.run = false + r.pooler.run = false logout() } @@ -51,12 +51,12 @@ func (r *remote) SendText(script string) { // Register forwards the register method to Pooler func (r *remote) Register(o observer) { - r.Pooler.Register(o) + r.pooler.Register(o) } // Register forwards the deregister method to Pooler func (r *remote) Deregister(o observer) { - r.Pooler.Deregister(o) + r.pooler.Deregister(o) } type remoteBuilder interface {