-
Notifications
You must be signed in to change notification settings - Fork 2
/
kinds.go
63 lines (53 loc) · 1.27 KB
/
kinds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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(),
}
)