package module moved into root of repository.

example in readme updated.

level pooler implemented, runs in its own goroutine.

Remote type now exported

observers example updated.
This commit is contained in:
onyx-and-iris
2022-07-09 19:01:58 +01:00
parent f16bed893f
commit 70d69f5599
32 changed files with 179 additions and 75 deletions

63
kinds.go Normal file
View File

@@ -0,0 +1,63 @@
package voicemeeter
import (
"fmt"
"strings"
)
var basic, banana, potato *kind
// A kind represents a Voicemeeter kinds layout
type kind struct {
name string
physIn, virtIn, physOut, virtOut, vbanIn, vbanOut int
}
// numStrip returns the total number of strips for a kind
func (k *kind) numStrip() int {
n := k.physIn + k.virtIn
return n
}
// numBus returns the total number of buses for a kind
func (k *kind) numBus() int {
n := k.physOut + k.virtOut
return n
}
// String implements the fmt.stringer interface
func (k *kind) String() string {
return fmt.Sprintf("%s%s", strings.ToUpper(k.name[:1]), k.name[1:])
}
// newBasicKind returns a basic kind struct address
func newBasicKind() *kind {
if basic == nil {
basic = &kind{"basic", 2, 1, 1, 1, 4, 4}
}
return basic
}
// newBananaKind returns a banana kind struct address
func newBananaKind() *kind {
if banana == nil {
banana = &kind{"banana", 3, 2, 3, 2, 8, 8}
}
return banana
}
// newPotatoKind returns a potato kind struct address
func newPotatoKind() *kind {
if potato == nil {
potato = &kind{"potato", 5, 3, 5, 3, 8, 8}
}
return potato
}
var (
kindMap = map[string]*kind{
"basic": newBasicKind(),
"banana": newBananaKind(),
"potato": newPotatoKind(),
}
)