diff --git a/voicemeeter/bus.go b/voicemeeter/bus.go index 9cd977f..7d8e3cd 100644 --- a/voicemeeter/bus.go +++ b/voicemeeter/bus.go @@ -4,15 +4,23 @@ import ( "fmt" ) -// custom bus type, struct forwarding channel -type bus struct { - channel +type t_bus interface { + GetMute() bool + SetMute(val bool) + GetEq() bool + SetEq(val bool) + GetMono() bool + SetMono(val bool) + GetLabel() string + SetLabel(val string) + GetGain() float64 + SetGain(val float32) } -// newBus returns a strip type -// it also initializes embedded channel type -func newBus(i int, k *kind) bus { - return bus{channel{"bus", i, *k}} +// bus represents a bus channel +// embeds channel struct +type bus struct { + channel } // String implements the stringer interface @@ -42,3 +50,51 @@ func (b *bus) GetEq() bool { func (b *bus) SetEq(val bool) { b.setter_bool("Eq.On", val) } + +// GetMono returns the value of the Mute parameter +func (b *bus) GetMono() bool { + return b.getter_bool("Mono") +} + +// SetMono sets the value of the Mute parameter +func (b *bus) SetMono(val bool) { + b.setter_bool("Mono", val) +} + +// GetLabel returns the value of the MC parameter +func (b *bus) GetLabel() string { + return b.getter_string("Label") +} + +// SetLabel sets the value of the MC parameter +func (b *bus) SetLabel(val string) { + b.setter_string("Label", val) +} + +// GetGain returns the value of the Gain parameter +func (b *bus) GetGain() float64 { + return b.getter_float("Gain") +} + +// SetGain sets the value of the Gain parameter +func (b *bus) SetGain(val float32) { + b.setter_float("Gain", val) +} + +type physicalBus struct { + bus +} + +func newPhysicalBus(i int, k *kind) t_bus { + pb := physicalBus{bus{channel{"bus", i, *k}}} + return t_bus(&pb) +} + +type virtualBus struct { + bus +} + +func newVirtualBus(i int, k *kind) t_bus { + vb := virtualBus{bus{channel{"bus", i, *k}}} + return t_bus(&vb) +} diff --git a/voicemeeter/remote.go b/voicemeeter/remote.go index 375316e..fb0775a 100644 --- a/voicemeeter/remote.go +++ b/voicemeeter/remote.go @@ -9,8 +9,8 @@ import ( // comprised of slices representing each member type remote struct { kind *kind - Strip []strip - Bus []bus + Strip []t_strip + Bus []t_bus Button []button } @@ -40,8 +40,8 @@ func (r *remote) SendText(script string) { } // NewRemote returns a remote type of a kind, -// this exported method is the interface entry point. -func NewRemote(kind_id string) remote { +// this is the interface entry point. +func NewRemote(kind_id string) *remote { kindMap := map[string]*kind{ "basic": newBasicKind(), "banana": newBananaKind(), @@ -55,20 +55,28 @@ func NewRemote(kind_id string) remote { os.Exit(1) } - _strip := make([]strip, _kind.numStrip()) + _strip := make([]t_strip, _kind.numStrip()) for i := 0; i < _kind.physIn+_kind.virtIn; i++ { - _strip[i] = newStrip(i, _kind) + if i < _kind.physIn { + _strip[i] = newPhysicalStrip(i, _kind) + } else { + _strip[i] = newVirtualStrip(i, _kind) + } } - _bus := make([]bus, _kind.numBus()) + _bus := make([]t_bus, _kind.numBus()) for i := 0; i < _kind.physOut+_kind.virtOut; i++ { - _bus[i] = newBus(i, _kind) + 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{ + return &remote{ kind: _kind, Strip: _strip, Bus: _bus, diff --git a/voicemeeter/strip.go b/voicemeeter/strip.go index e968a73..b5fb2ab 100644 --- a/voicemeeter/strip.go +++ b/voicemeeter/strip.go @@ -4,14 +4,33 @@ import ( "fmt" ) -// custom strip type, struct forwarding channel -type strip struct { - channel +type t_strip interface { + GetMute() bool + SetMute(val bool) + GetMono() bool + SetMono(val bool) + GetSolo() bool + SetSolo(val bool) + GetLimit() int + SetLimit(val int) + GetLabel() string + SetLabel(val string) + GetGain() float64 + SetGain(val float32) + GetMc() bool + SetMc(val bool) + GetComp() bool + SetComp(val bool) + GetGate() bool + SetGate(val bool) + GetAudibility() bool + SetAudibility(val bool) } -// constructor method for strip -func newStrip(i int, k *kind) strip { - return strip{channel{"strip", i, *k}} +// strip represents a strip channel +// embeds channel struct +type strip struct { + channel } // implement stringer interface in fmt @@ -32,6 +51,26 @@ func (s *strip) SetMute(val bool) { s.setter_bool("Mute", val) } +// GetMono returns the value of the Mute parameter +func (s *strip) GetMono() bool { + return s.getter_bool("Mono") +} + +// SetMono sets the value of the Mute parameter +func (s *strip) SetMono(val bool) { + s.setter_bool("Mono", val) +} + +// GetSolo returns the value of the Mute parameter +func (s *strip) GetSolo() bool { + return s.getter_bool("Solo") +} + +// SetSolo sets the value of the Mute parameter +func (s *strip) SetSolo(val bool) { + s.setter_bool("Solo", val) +} + // GetLimit returns the value of the Limit parameter func (s *strip) GetLimit() int { return s.getter_int("Limit") @@ -42,22 +81,12 @@ func (s *strip) SetLimit(val int) { s.setter_int("Limit", val) } -// GetMc returns the value of the MC parameter -func (s *strip) GetMc() bool { - return s.getter_bool("MC") -} - -// SetMc sets the value of the MC parameter -func (s *strip) SetMc(val bool) { - s.setter_bool("MC", val) -} - -// GetMc returns the value of the MC parameter +// GetLabel returns the value of the MC parameter func (s *strip) GetLabel() string { return s.getter_string("Label") } -// SetMc sets the value of the MC parameter +// SetLabel sets the value of the MC parameter func (s *strip) SetLabel(val string) { s.setter_string("Label", val) } @@ -71,3 +100,101 @@ func (s *strip) GetGain() float64 { func (s *strip) SetGain(val float32) { s.setter_float("Gain", val) } + +type physicalStrip struct { + strip +} + +func newPhysicalStrip(i int, k *kind) t_strip { + ps := physicalStrip{strip{channel{"strip", i, *k}}} + return t_strip(&ps) +} + +// GetComp returns the value of the Mute parameter +func (p *physicalStrip) GetComp() bool { + return p.getter_bool("Comp") +} + +// SetComp sets the value of the Mute parameter +func (p *physicalStrip) SetComp(val bool) { + p.setter_bool("Comp", val) +} + +// GetGate returns the value of the Mute parameter +func (p *physicalStrip) GetGate() bool { + return p.getter_bool("Gate") +} + +// SetGate sets the value of the Mute parameter +func (p *physicalStrip) SetGate(val bool) { + p.setter_bool("Gate", val) +} + +// GetAudibility returns the value of the Mute parameter +func (p *physicalStrip) GetAudibility() bool { + return p.getter_bool("Audibility") +} + +// SetAudibility sets the value of the Mute parameter +func (p *physicalStrip) SetAudibility(val bool) { + p.setter_bool("Audibility", val) +} + +// GetMc panics reason invalid parameter +func (p *physicalStrip) GetMc() bool { + panic("invalid parameter MC for physicalStrip") +} + +// SetMc panics reason invalid parameter +func (p *physicalStrip) SetMc(val bool) { + panic("invalid parameter MC for physicalStrip") +} + +type virtualStrip struct { + strip +} + +func newVirtualStrip(i int, k *kind) t_strip { + vs := virtualStrip{strip{channel{"strip", i, *k}}} + return t_strip(&vs) +} + +// GetMc returns the value of the MC parameter +func (v *virtualStrip) GetMc() bool { + return v.getter_bool("MC") +} + +// SetMc sets the value of the MC parameter +func (v *virtualStrip) SetMc(val bool) { + v.setter_bool("MC", val) +} + +// GetComp panics reason invalid parameter +func (v *virtualStrip) GetComp() bool { + panic("invalid parameter Comp for virtualStrip") +} + +// SetComp panics reason invalid parameter +func (v *virtualStrip) SetComp(val bool) { + panic("invalid parameter Comp for virtualStrip") +} + +// GetGate panics reason invalid parameter +func (v *virtualStrip) GetGate() bool { + panic("invalid parameter Gate for virtualStrip") +} + +// SetGate panics reason invalid parameter +func (v *virtualStrip) SetGate(val bool) { + panic("invalid parameter Gate for virtualStrip") +} + +// GetAudibility panics reason invalid parameter +func (v *virtualStrip) GetAudibility() bool { + panic("invalid parameter Audibility for virtualStrip") +} + +// SetAudibility panics reason invalid parameter +func (v *virtualStrip) SetAudibility(val bool) { + panic("invalid parameter Audibility for virtualStrip") +}