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-07-18 16:23:15 +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-07-18 16:23:15 +01:00
|
|
|
func (k *kind) NumStrip() int {
|
|
|
|
n := k.PhysIn + k.VirtIn
|
2022-06-22 20:51:25 +01:00
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// numBus returns the total number of buses for a kind
|
2022-07-18 16:23:15 +01:00
|
|
|
func (k *kind) NumBus() int {
|
|
|
|
n := k.PhysOut + k.VirtOut
|
2022-06-22 20:51:25 +01:00
|
|
|
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 {
|
2022-07-18 16:23:15 +01:00
|
|
|
return fmt.Sprintf("%s%s", strings.ToUpper(k.Name[:1]), k.Name[1:])
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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(),
|
|
|
|
}
|
|
|
|
)
|