2022-06-22 20:51:25 +01:00
|
|
|
package voicemeeter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2022-06-25 01:18:20 +01:00
|
|
|
var basic, banana, potato *kind
|
|
|
|
|
2022-06-22 20:51:25 +01:00
|
|
|
// A kind represents a Voicemeeter kinds layout
|
|
|
|
type kind struct {
|
2022-06-24 14:54:17 +01:00
|
|
|
name string
|
|
|
|
physIn, virtIn, physOut, virtOut, vbanIn, vbanOut int
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// numStrip returns the total number of strips for a kind
|
2022-06-22 20:51:25 +01:00
|
|
|
func (k *kind) numStrip() int {
|
|
|
|
n := k.physIn + k.virtIn
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// numBus returns the total number of buses for a kind
|
2022-06-22 20:51:25 +01:00
|
|
|
func (k *kind) numBus() int {
|
|
|
|
n := k.physOut + k.virtOut
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// String implements the fmt.stringer interface
|
2022-06-22 20:51:25 +01:00
|
|
|
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 {
|
2022-06-25 01:18:20 +01:00
|
|
|
if basic == nil {
|
|
|
|
basic = &kind{"basic", 2, 1, 1, 1, 4, 4}
|
|
|
|
}
|
|
|
|
return basic
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// newBananaKind returns a banana kind struct address
|
|
|
|
func newBananaKind() *kind {
|
2022-06-25 01:18:20 +01:00
|
|
|
if banana == nil {
|
|
|
|
banana = &kind{"banana", 3, 2, 3, 2, 8, 8}
|
|
|
|
}
|
|
|
|
return banana
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// newPotatoKind returns a potato kind struct address
|
|
|
|
func newPotatoKind() *kind {
|
2022-06-25 01:18:20 +01:00
|
|
|
if potato == nil {
|
|
|
|
potato = &kind{"potato", 5, 3, 5, 3, 8, 8}
|
|
|
|
}
|
|
|
|
return potato
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
2022-06-24 14:54:17 +01:00
|
|
|
|
|
|
|
var (
|
|
|
|
kindMap = map[string]*kind{
|
|
|
|
"basic": newBasicKind(),
|
|
|
|
"banana": newBananaKind(),
|
|
|
|
"potato": newPotatoKind(),
|
|
|
|
}
|
|
|
|
)
|