mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-21 20:30:55 +00:00
70d69f5599
example in readme updated. level pooler implemented, runs in its own goroutine. Remote type now exported observers example updated.
64 lines
1.3 KiB
Go
64 lines
1.3 KiB
Go
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(),
|
|
}
|
|
)
|