mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-22 12:50:53 +00:00
694494e8d0
t_strip, t_bus implemented. parameter getter/setters added to custom strip, bus types.
86 lines
1.6 KiB
Go
86 lines
1.6 KiB
Go
package voicemeeter
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// A remote type represents the API for a kind,
|
|
// comprised of slices representing each member
|
|
type remote struct {
|
|
kind *kind
|
|
Strip []t_strip
|
|
Bus []t_bus
|
|
Button []button
|
|
}
|
|
|
|
// String implements the stringer interface
|
|
func (r *remote) String() string {
|
|
return fmt.Sprintf("Voicemeeter %s", r.kind)
|
|
}
|
|
|
|
func (r *remote) Login() {
|
|
login(r.kind.name)
|
|
}
|
|
|
|
func (r *remote) Logout() {
|
|
logout()
|
|
}
|
|
|
|
func (r *remote) Type() string {
|
|
return getVMType()
|
|
}
|
|
|
|
func (r *remote) Version() string {
|
|
return getVersion()
|
|
}
|
|
|
|
func (r *remote) SendText(script string) {
|
|
setParametersMulti(script)
|
|
}
|
|
|
|
// NewRemote returns a remote type of a kind,
|
|
// this is the interface entry point.
|
|
func NewRemote(kind_id string) *remote {
|
|
kindMap := map[string]*kind{
|
|
"basic": newBasicKind(),
|
|
"banana": newBananaKind(),
|
|
"potato": newPotatoKind(),
|
|
}
|
|
|
|
_kind, ok := kindMap[kind_id]
|
|
if !ok {
|
|
err := fmt.Errorf("unknown Voicemeeter kind '%s'", kind_id)
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
_strip := make([]t_strip, _kind.numStrip())
|
|
for i := 0; i < _kind.physIn+_kind.virtIn; i++ {
|
|
if i < _kind.physIn {
|
|
_strip[i] = newPhysicalStrip(i, _kind)
|
|
} else {
|
|
_strip[i] = newVirtualStrip(i, _kind)
|
|
}
|
|
}
|
|
_bus := make([]t_bus, _kind.numBus())
|
|
for i := 0; i < _kind.physOut+_kind.virtOut; i++ {
|
|
if i < _kind.physIn {
|
|
_bus[i] = newPhysicalBus(i, _kind)
|
|
} else {
|
|
_bus[i] = newVirtualBus(i, _kind)
|
|
}
|
|
}
|
|
_button := make([]button, 80)
|
|
for i := 0; i < 80; i++ {
|
|
_button[i] = newButton(i)
|
|
}
|
|
|
|
return &remote{
|
|
kind: _kind,
|
|
Strip: _strip,
|
|
Bus: _bus,
|
|
Button: _button,
|
|
}
|
|
}
|