Remote Kind field now exported.

Kind fields/methods now exported

vmRem renamed vm in examples/tests. prefer short variable name.

minor version bump
This commit is contained in:
onyx-and-iris 2022-07-18 16:23:15 +01:00
parent 1af67bb219
commit 76e6d3cba7
11 changed files with 154 additions and 154 deletions

View File

@ -48,15 +48,15 @@ import (
func main() { func main() {
kindId := "banana" kindId := "banana"
vmRem := voicemeeter.NewRemote(kindId) vm := voicemeeter.NewRemote(kindId)
vmRem.Login() vm.Login()
vmRem.Strip[0].SetLabel("rode podmic") vm.Strip[0].SetLabel("rode podmic")
vmRem.Strip[0].SetMute(true) vm.Strip[0].SetMute(true)
fmt.Printf("Strip 0 (%s) mute was set to %v\n", vmRem.Strip[0].GetLabel(), vmRem.Strip[0].GetMute()) fmt.Printf("Strip 0 (%s) mute was set to %v\n", vm.Strip[0].GetLabel(), vm.Strip[0].GetMute())
vmRem.Logout() vm.Logout()
} }
``` ```
@ -70,59 +70,59 @@ Pass the kind of Voicemeeter as an argument. kindId may be:
## `Remote Type` ## `Remote Type`
#### `vmRem.Strip` #### `vm.Strip`
[]t_strip slice containing both physicalStrip and virtualStrip types []t_strip slice containing both physicalStrip and virtualStrip types
#### `vmRem.Bus` #### `vm.Bus`
[]t_bus slice containing both physicalBus and virtualBus types []t_bus slice containing both physicalBus and virtualBus types
#### `vmRem.Button` #### `vm.Button`
[]button slice containing button types, one for each macrobutton []button slice containing button types, one for each macrobutton
#### `vmRem.Command` #### `vm.Command`
pointer to command type, represents action type functions pointer to command type, represents action type functions
#### `vmRem.Vban` #### `vm.Vban`
pointer to vban type, containing both vbanInStream and vbanOutStream slices pointer to vban type, containing both vbanInStream and vbanOutStream slices
#### `vmRem.Device` #### `vm.Device`
pointer to device type, represents physical input/output hardware devices pointer to device type, represents physical input/output hardware devices
#### `vmRem.Recorder` #### `vm.Recorder`
pointer to recorder type, represents the recorder pointer to recorder type, represents the recorder
#### `vmRem.Type()` #### `vm.Type()`
returns the type of Voicemeeter as a string returns the type of Voicemeeter as a string
#### `vmRem.Version()` #### `vm.Version()`
returns the version of Voicemeeter as a string returns the version of Voicemeeter as a string
#### `vmRem.SendText(<script>)` #### `vm.SendText(<script>)`
sets many parameters in script format eg. ("Strip[0].Mute=1;Bus[3].Gain=3.6") sets many parameters in script format eg. ("Strip[0].Mute=1;Bus[3].Gain=3.6")
#### `vmRem.Register(o observer)` #### `vm.Register(o observer)`
register an object as an observer register an object as an observer
#### `vmRem.Deregister(o observer)` #### `vm.Deregister(o observer)`
deregister an object as an observer deregister an object as an observer
#### `vmRem.Pdirty()` #### `vm.Pdirty()`
returns True iff a GUI parameter has changed returns True iff a GUI parameter has changed
#### `vmRem.Mdirty()` #### `vm.Mdirty()`
returns True iff a macrobutton paramter has changed returns True iff a macrobutton paramter has changed
@ -158,14 +158,14 @@ The following methods are available
example: example:
```go ```go
vmRem.Strip[3].SetGain(3.7) vm.Strip[3].SetGain(3.7)
fmt.Println(vmRem.Strip[0].GetLabel()) fmt.Println(vm.Strip[0].GetLabel())
vmRem.Strip[4].SetA1(true) vm.Strip[4].SetA1(true)
``` ```
##### Gainlayers ##### Gainlayers
- `vmRem.Strip[i].GainLayer()[j]` - `vm.Strip[i].GainLayer()[j]`
The following methods are available The following methods are available
@ -175,12 +175,12 @@ The following methods are available
example: example:
```go ```go
vmRem.Strip[6].GainLayer()[3].Set(-13.6) vm.Strip[6].GainLayer()[3].Set(-13.6)
``` ```
##### Levels ##### Levels
- `vmRem.Strip[i].Levels()` - `vm.Strip[i].Levels()`
The following methods are available The following methods are available
@ -191,7 +191,7 @@ The following methods are available
example: example:
```go ```go
fmt.Println(vmRem.Strip[5].Levels().PreFader()) fmt.Println(vm.Strip[5].Levels().PreFader())
``` ```
### Bus ### Bus
@ -211,13 +211,13 @@ The following methods are available
- `SetGain(val float32)` from -60.0 to 12.0 - `SetGain(val float32)` from -60.0 to 12.0
```go ```go
vmRem.Bus[3].SetEq(true) vm.Bus[3].SetEq(true)
fmt.Println(vmRem.Bus[0].GetLabel()) fmt.Println(vm.Bus[0].GetLabel())
``` ```
##### Modes ##### Modes
- `vmRem.Bus[i].Mode()` - `vm.Bus[i].Mode()`
The following methods are available The following methods are available
@ -249,13 +249,13 @@ The following methods are available
example: example:
```go ```go
vmRem.Bus[3].Mode().SetAmix(true) vm.Bus[3].Mode().SetAmix(true)
vmRem.Bus[4].Mode().SetCenterOnly(true) vm.Bus[4].Mode().SetCenterOnly(true)
``` ```
##### Levels ##### Levels
- `vmRem.Bus[i].Levels()` - `vm.Bus[i].Levels()`
The following methods are available The following methods are available
@ -264,7 +264,7 @@ The following methods are available
example: example:
```go ```go
fmt.Println(vmRem.Bus[1].Levels().All()) fmt.Println(vm.Bus[1].Levels().All())
``` ```
### Button ### Button
@ -281,8 +281,8 @@ The following methods are available
example: example:
```go ```go
vmRem.Button[37].SetState(true) vm.Button[37].SetState(true)
fmt.Println(vmRem.Button[64].GetStateOnly()) fmt.Println(vm.Button[64].GetStateOnly())
``` ```
### Command ### Command
@ -298,17 +298,17 @@ The following methods are available
example: example:
```go ```go
vmRem.Command.Restart() vm.Command.Restart()
vmRem.Command.Show() vm.Command.Show()
``` ```
### VBAN ### VBAN
- `vmRem.Vban.Enable()` `vmRem.Vban.Disable()` Turn VBAN on or off - `vm.Vban.Enable()` `vm.Vban.Disable()` Turn VBAN on or off
##### Instream | Outstream ##### Instream | Outstream
- `vmRem.Vban.InStream` `vmRem.Vban.OutStream` - `vm.Vban.InStream` `vm.Vban.OutStream`
The following methods are available The following methods are available
@ -335,13 +335,13 @@ example:
```go ```go
# turn VBAN on # turn VBAN on
vmRem.Vban.Enable() vm.Vban.Enable()
// turn on vban instream 0 // turn on vban instream 0
vmRem.Vban.InStream[0].SetOn(true) vm.Vban.InStream[0].SetOn(true)
// set bit property for outstream 3 to 24 // set bit property for outstream 3 to 24
vmRem.Vban.OutStream[3].SetBit(24) vm.Vban.OutStream[3].SetBit(24)
``` ```
### Device ### Device
@ -356,8 +356,8 @@ The following methods are available
example: example:
```go ```go
for i := 0; i < int(vmRem.Device.Ins()); i++ { for i := 0; i < int(vm.Device.Ins()); i++ {
fmt.Println(vmRem.Device.Input(i)) fmt.Println(vm.Device.Input(i))
} }
``` ```
@ -376,14 +376,14 @@ The following methods are available
example: example:
```go ```go
vmRem.Recorder.Play() vm.Recorder.Play()
vmRem.Recorder.Stop() vm.Recorder.Stop()
# Enable loop play # Enable loop play
vmRem.Recorder.Loop(true) vm.Recorder.Loop(true)
# Disable recorder out channel B2 # Disable recorder out channel B2
vmRem.Recorder.SetB2(false) vm.Recorder.SetB2(false)
``` ```
### Run tests ### Run tests

10
base.go
View File

@ -115,18 +115,18 @@ func mdirty() bool {
// ldirty returns true iff a level value has changed // ldirty returns true iff a level value has changed
func ldirty(k *kind) bool { func ldirty(k *kind) bool {
_levelCache.stripLevelsBuff = make([]float32, (2*k.physIn)+(8*k.virtIn)) _levelCache.stripLevelsBuff = make([]float32, (2*k.PhysIn)+(8*k.VirtIn))
_levelCache.busLevelsBuff = make([]float32, 8*k.numBus()) _levelCache.busLevelsBuff = make([]float32, 8*k.NumBus())
for i := 0; i < (2*k.physIn)+(8*k.virtIn); i++ { for i := 0; i < (2*k.PhysIn)+(8*k.VirtIn); i++ {
_levelCache.stripLevelsBuff[i] = float32(getLevel(_levelCache.stripMode, i)) _levelCache.stripLevelsBuff[i] = float32(getLevel(_levelCache.stripMode, i))
_levelCache.stripComp[i] = _levelCache.stripLevelsBuff[i] == _levelCache.stripLevels[i] _levelCache.stripComp[i] = _levelCache.stripLevelsBuff[i] == _levelCache.stripLevels[i]
} }
for i := 0; i < 8*k.numBus(); i++ { for i := 0; i < 8*k.NumBus(); i++ {
_levelCache.busLevelsBuff[i] = float32(getLevel(3, i)) _levelCache.busLevelsBuff[i] = float32(getLevel(3, i))
_levelCache.busComp[i] = _levelCache.busLevelsBuff[i] == _levelCache.busLevels[i] _levelCache.busComp[i] = _levelCache.busLevelsBuff[i] == _levelCache.busLevels[i]
} }
return !(allTrue(_levelCache.stripComp, (2*k.physIn)+(8*k.virtIn)) && allTrue(_levelCache.busComp, 8*k.numBus())) return !(allTrue(_levelCache.stripComp, (2*k.PhysIn)+(8*k.VirtIn)) && allTrue(_levelCache.busComp, 8*k.NumBus()))
} }
// getVMType returns the type of Voicemeeter, as a string // getVMType returns the type of Voicemeeter, as a string

View File

@ -34,13 +34,13 @@ func (o observer) OnUpdate(subject string) {
} }
func main() { func main() {
vmRem := voicemeeter.NewRemote("potato") vm := voicemeeter.NewRemote("potato")
vmRem.Login() vm.Login()
o := observer{vmRem} o := observer{vm}
vmRem.Register(o) vm.Register(o)
time.Sleep(30 * time.Second) time.Sleep(30 * time.Second)
vmRem.Deregister(o) vm.Deregister(o)
vmRem.Logout() vm.Logout()
} }

View File

@ -9,25 +9,25 @@ var basic, banana, potato *kind
// A kind represents a Voicemeeter kinds layout // A kind represents a Voicemeeter kinds layout
type kind struct { type kind struct {
name string Name string
physIn, virtIn, physOut, virtOut, vbanIn, vbanOut int PhysIn, VirtIn, PhysOut, VirtOut, VbanIn, VbanOut int
} }
// numStrip returns the total number of strips for a kind // numStrip returns the total number of strips for a kind
func (k *kind) numStrip() int { func (k *kind) NumStrip() int {
n := k.physIn + k.virtIn n := k.PhysIn + k.VirtIn
return n return n
} }
// numBus returns the total number of buses for a kind // numBus returns the total number of buses for a kind
func (k *kind) numBus() int { func (k *kind) NumBus() int {
n := k.physOut + k.virtOut n := k.PhysOut + k.VirtOut
return n return n
} }
// String implements the fmt.stringer interface // String implements the fmt.stringer interface
func (k *kind) String() string { func (k *kind) String() string {
return fmt.Sprintf("%s%s", strings.ToUpper(k.name[:1]), k.name[1:]) return fmt.Sprintf("%s%s", strings.ToUpper(k.Name[:1]), k.Name[1:])
} }
// newBasicKind returns a basic kind struct address // newBasicKind returns a basic kind struct address

View File

@ -35,10 +35,10 @@ type levelCache struct {
// newLevelCache returns a levelCache struct address // newLevelCache returns a levelCache struct address
func newLevelCache(k *kind) *levelCache { func newLevelCache(k *kind) *levelCache {
stripLevels := make([]float32, (2*k.physIn)+(8*k.virtIn)) stripLevels := make([]float32, (2*k.PhysIn)+(8*k.VirtIn))
busLevels := make([]float32, 8*k.numBus()) busLevels := make([]float32, 8*k.NumBus())
stripComp := make([]bool, (2*k.physIn)+(8*k.virtIn)) stripComp := make([]bool, (2*k.PhysIn)+(8*k.VirtIn))
busComp := make([]bool, 8*k.numBus()) busComp := make([]bool, 8*k.NumBus())
if _levelCache == nil { if _levelCache == nil {
_levelCache = &levelCache{stripMode: 0, stripLevels: stripLevels, busLevels: busLevels, stripComp: stripComp, busComp: busComp} _levelCache = &levelCache{stripMode: 0, stripLevels: stripLevels, busLevels: busLevels, stripComp: stripComp, busComp: busComp}
} }

View File

@ -75,8 +75,8 @@ func (p *pooler) levels() {
for p.run { for p.run {
if ldirty(p.k) { if ldirty(p.k) {
update(_levelCache.stripLevels, _levelCache.stripLevelsBuff, (2*p.k.physIn)+(8*p.k.virtIn)) update(_levelCache.stripLevels, _levelCache.stripLevelsBuff, (2*p.k.PhysIn)+(8*p.k.VirtIn))
update(_levelCache.busLevels, _levelCache.busLevelsBuff, 8*p.k.numBus()) update(_levelCache.busLevels, _levelCache.busLevelsBuff, 8*p.k.NumBus())
p.notify("ldirty") p.notify("ldirty")
} }
time.Sleep(33 * time.Millisecond) time.Sleep(33 * time.Millisecond)

View File

@ -7,7 +7,7 @@ import (
// A Remote type represents the API for a kind // A Remote type represents the API for a kind
type Remote struct { type Remote struct {
kind *kind Kind *kind
Strip []iStrip Strip []iStrip
Bus []iBus Bus []iBus
Button []button Button []button
@ -21,14 +21,14 @@ type Remote struct {
// String implements the fmt.stringer interface // String implements the fmt.stringer interface
func (r *Remote) String() string { func (r *Remote) String() string {
return fmt.Sprintf("Voicemeeter %s", r.kind) return fmt.Sprintf("Voicemeeter %s", r.Kind)
} }
// Login logs into the API // Login logs into the API
// then it intializes the pooler // then it intializes the pooler
func (r *Remote) Login() { func (r *Remote) Login() {
login(r.kind.name) login(r.Kind.Name)
r.pooler = newPooler(r.kind) r.pooler = newPooler(r.Kind)
} }
// Logout logs out of the API // Logout logs out of the API
@ -115,7 +115,7 @@ type genericBuilder struct {
// setKind sets the kind for a builder of a kind // setKind sets the kind for a builder of a kind
func (b *genericBuilder) setKind() remoteBuilder { func (b *genericBuilder) setKind() remoteBuilder {
b.r.kind = b.k b.r.Kind = b.k
return b return b
} }
@ -123,9 +123,9 @@ func (b *genericBuilder) setKind() remoteBuilder {
// []iStrip comprises of both physical and virtual strip types // []iStrip comprises of both physical and virtual strip types
func (b *genericBuilder) makeStrip() remoteBuilder { func (b *genericBuilder) makeStrip() remoteBuilder {
fmt.Println("building strip") fmt.Println("building strip")
_strip := make([]iStrip, b.k.numStrip()) _strip := make([]iStrip, b.k.NumStrip())
for i := 0; i < b.k.numStrip(); i++ { for i := 0; i < b.k.NumStrip(); i++ {
if i < b.k.physIn { if i < b.k.PhysIn {
_strip[i] = newPhysicalStrip(i, b.k) _strip[i] = newPhysicalStrip(i, b.k)
} else { } else {
_strip[i] = newVirtualStrip(i, b.k) _strip[i] = newVirtualStrip(i, b.k)
@ -139,9 +139,9 @@ func (b *genericBuilder) makeStrip() remoteBuilder {
// []t_bus comprises of both physical and virtual bus types // []t_bus comprises of both physical and virtual bus types
func (b *genericBuilder) makeBus() remoteBuilder { func (b *genericBuilder) makeBus() remoteBuilder {
fmt.Println("building bus") fmt.Println("building bus")
_bus := make([]iBus, b.k.numBus()) _bus := make([]iBus, b.k.NumBus())
for i := 0; i < b.k.numBus(); i++ { for i := 0; i < b.k.NumBus(); i++ {
if i < b.k.physOut { if i < b.k.PhysOut {
_bus[i] = newPhysicalBus(i, b.k) _bus[i] = newPhysicalBus(i, b.k)
} else { } else {
_bus[i] = newVirtualBus(i, b.k) _bus[i] = newVirtualBus(i, b.k)
@ -236,7 +236,7 @@ func NewRemote(kindId string) *Remote {
} }
director := director{} director := director{}
switch _kind.name { switch _kind.Name {
case "basic": case "basic":
director.SetBuilder(&basicBuilder{genericBuilder{_kind, Remote{}}}) director.SetBuilder(&basicBuilder{genericBuilder{_kind, Remote{}}})
case "banana": case "banana":

View File

@ -292,11 +292,11 @@ func (gl *gainLayer) Set(val float32) {
func newStripLevels(i int, k *kind) levels { func newStripLevels(i int, k *kind) levels {
var init int var init int
var os int var os int
if i < k.physIn { if i < k.PhysIn {
init = i * 2 init = i * 2
os = 2 os = 2
} else { } else {
init = (k.physIn * 2) + ((i - k.physIn) * 8) init = (k.PhysIn * 2) + ((i - k.PhysIn) * 8)
os = 8 os = 8
} }
return levels{iRemote{fmt.Sprintf("strip[%d]", i), i}, k, init, os, "strip"} return levels{iRemote{fmt.Sprintf("strip[%d]", i), i}, k, init, os, "strip"}

View File

@ -9,18 +9,18 @@ import (
) )
var ( var (
vmRem = voicemeeter.NewRemote("potato") vm = voicemeeter.NewRemote("potato")
) )
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
vmRem.Login() vm.Login()
code := m.Run() code := m.Run()
vmRem.Logout() vm.Logout()
os.Exit(code) os.Exit(code)
} }
func sync() { func sync() {
time.Sleep(30 * time.Millisecond) time.Sleep(30 * time.Millisecond)
for vmRem.Pdirty() || vmRem.Mdirty() { for vm.Pdirty() || vm.Mdirty() {
} }
} }

View File

@ -8,206 +8,206 @@ import (
func TestStrip0Mute(t *testing.T) { func TestStrip0Mute(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[0].SetMute(true) vm.Strip[0].SetMute(true)
sync() sync()
t.Run("Should return true when SetMute(true)", func(t *testing.T) { t.Run("Should return true when SetMute(true)", func(t *testing.T) {
assert.True(t, vmRem.Strip[0].GetMute()) assert.True(t, vm.Strip[0].GetMute())
}) })
vmRem.Strip[0].SetMute(false) vm.Strip[0].SetMute(false)
sync() sync()
t.Run("Should return false when SetMute(false)", func(t *testing.T) { t.Run("Should return false when SetMute(false)", func(t *testing.T) {
assert.False(t, vmRem.Strip[0].GetMute()) assert.False(t, vm.Strip[0].GetMute())
}) })
} }
func TestStrip3A1(t *testing.T) { func TestStrip3A1(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[3].SetA1(true) vm.Strip[3].SetA1(true)
sync() sync()
t.Run("Should return true when SetA1(true)", func(t *testing.T) { t.Run("Should return true when SetA1(true)", func(t *testing.T) {
assert.True(t, vmRem.Strip[3].GetA1()) assert.True(t, vm.Strip[3].GetA1())
}) })
vmRem.Strip[3].SetA1(false) vm.Strip[3].SetA1(false)
sync() sync()
t.Run("Should return false when SetA1(false)", func(t *testing.T) { t.Run("Should return false when SetA1(false)", func(t *testing.T) {
assert.False(t, vmRem.Strip[3].GetA1()) assert.False(t, vm.Strip[3].GetA1())
}) })
} }
func TestStrip2Limit(t *testing.T) { func TestStrip2Limit(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[2].SetLimit(-8) vm.Strip[2].SetLimit(-8)
sync() sync()
t.Run("Should return -8 when SetLimit(-8)", func(t *testing.T) { t.Run("Should return -8 when SetLimit(-8)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[2].GetLimit(), -8) assert.Equal(t, vm.Strip[2].GetLimit(), -8)
}) })
vmRem.Strip[2].SetLimit(-32) vm.Strip[2].SetLimit(-32)
sync() sync()
t.Run("Should return -32 when SetLimit(-8)", func(t *testing.T) { t.Run("Should return -32 when SetLimit(-8)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[2].GetLimit(), -32) assert.Equal(t, vm.Strip[2].GetLimit(), -32)
}) })
} }
func TestStrip4Label(t *testing.T) { func TestStrip4Label(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[4].SetLabel("test0") vm.Strip[4].SetLabel("test0")
sync() sync()
t.Run("Should return test0 when SetLimit('test0')", func(t *testing.T) { t.Run("Should return test0 when SetLimit('test0')", func(t *testing.T) {
assert.Equal(t, "test0", vmRem.Strip[4].GetLabel()) assert.Equal(t, "test0", vm.Strip[4].GetLabel())
}) })
vmRem.Strip[4].SetLabel("test1") vm.Strip[4].SetLabel("test1")
sync() sync()
t.Run("Should return test1 when SetLimit('test1')", func(t *testing.T) { t.Run("Should return test1 when SetLimit('test1')", func(t *testing.T) {
assert.Equal(t, "test1", vmRem.Strip[4].GetLabel()) assert.Equal(t, "test1", vm.Strip[4].GetLabel())
}) })
} }
func TestStrip5Gain(t *testing.T) { func TestStrip5Gain(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[4].SetGain(-20.8) vm.Strip[4].SetGain(-20.8)
sync() sync()
t.Run("Should return -20.8 when SetGain(-20.8)", func(t *testing.T) { t.Run("Should return -20.8 when SetGain(-20.8)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[4].GetGain(), -20.8) assert.Equal(t, vm.Strip[4].GetGain(), -20.8)
}) })
vmRem.Strip[4].SetGain(-3.6) vm.Strip[4].SetGain(-3.6)
sync() sync()
t.Run("Should return -3.6 when SetGain(-3.6)", func(t *testing.T) { t.Run("Should return -3.6 when SetGain(-3.6)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[4].GetGain(), -3.6) assert.Equal(t, vm.Strip[4].GetGain(), -3.6)
}) })
} }
func TestStrip3Comp(t *testing.T) { func TestStrip3Comp(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[4].SetComp(8.1) vm.Strip[4].SetComp(8.1)
sync() sync()
t.Run("Should return 8.1 when SetGain(8.1)", func(t *testing.T) { t.Run("Should return 8.1 when SetGain(8.1)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[4].GetComp(), 8.1) assert.Equal(t, vm.Strip[4].GetComp(), 8.1)
}) })
vmRem.Strip[4].SetComp(1.6) vm.Strip[4].SetComp(1.6)
sync() sync()
t.Run("Should return 1.6 when SetGain(1.6)", func(t *testing.T) { t.Run("Should return 1.6 when SetGain(1.6)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[4].GetComp(), 1.6) assert.Equal(t, vm.Strip[4].GetComp(), 1.6)
}) })
} }
func TestStrip5Mc(t *testing.T) { func TestStrip5Mc(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[5].SetMc(true) vm.Strip[5].SetMc(true)
sync() sync()
t.Run("Should return true when SetMc(true)", func(t *testing.T) { t.Run("Should return true when SetMc(true)", func(t *testing.T) {
assert.True(t, vmRem.Strip[5].GetMc()) assert.True(t, vm.Strip[5].GetMc())
}) })
vmRem.Strip[5].SetMc(false) vm.Strip[5].SetMc(false)
sync() sync()
t.Run("Should return false when SetMc(false)", func(t *testing.T) { t.Run("Should return false when SetMc(false)", func(t *testing.T) {
assert.False(t, vmRem.Strip[5].GetMc()) assert.False(t, vm.Strip[5].GetMc())
}) })
} }
func TestStrip2GainLayer3(t *testing.T) { func TestStrip2GainLayer3(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[2].GainLayer()[3].Set(-18.3) vm.Strip[2].GainLayer()[3].Set(-18.3)
sync() sync()
t.Run("Should return -18.3 when SetMc(true)", func(t *testing.T) { t.Run("Should return -18.3 when SetMc(true)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[2].GainLayer()[3].Get(), -18.3) assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -18.3)
}) })
vmRem.Strip[2].GainLayer()[3].Set(-25.6) vm.Strip[2].GainLayer()[3].Set(-25.6)
sync() sync()
t.Run("Should return -25.6 when SetMc(true)", func(t *testing.T) { t.Run("Should return -25.6 when SetMc(true)", func(t *testing.T) {
assert.Equal(t, vmRem.Strip[2].GainLayer()[3].Get(), -25.6) assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -25.6)
}) })
} }
func TestBus3Eq(t *testing.T) { func TestBus3Eq(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Bus[3].SetEq(true) vm.Bus[3].SetEq(true)
sync() sync()
t.Run("Should return true when SetEq(true)", func(t *testing.T) { t.Run("Should return true when SetEq(true)", func(t *testing.T) {
assert.True(t, vmRem.Bus[3].GetEq()) assert.True(t, vm.Bus[3].GetEq())
}) })
vmRem.Bus[3].SetEq(false) vm.Bus[3].SetEq(false)
sync() sync()
t.Run("Should return false when SetEq(false)", func(t *testing.T) { t.Run("Should return false when SetEq(false)", func(t *testing.T) {
assert.False(t, vmRem.Bus[3].GetEq()) assert.False(t, vm.Bus[3].GetEq())
}) })
} }
func TestBus4Label(t *testing.T) { func TestBus4Label(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Bus[4].SetLabel("test0") vm.Bus[4].SetLabel("test0")
sync() sync()
t.Run("Should return test0 when SetEq('test0')", func(t *testing.T) { t.Run("Should return test0 when SetEq('test0')", func(t *testing.T) {
assert.Equal(t, "test0", vmRem.Bus[4].GetLabel()) assert.Equal(t, "test0", vm.Bus[4].GetLabel())
}) })
vmRem.Bus[4].SetLabel("test1") vm.Bus[4].SetLabel("test1")
sync() sync()
t.Run("Should return test1 when SetEq('test1')", func(t *testing.T) { t.Run("Should return test1 when SetEq('test1')", func(t *testing.T) {
assert.Equal(t, "test1", vmRem.Bus[4].GetLabel()) assert.Equal(t, "test1", vm.Bus[4].GetLabel())
}) })
} }
func TestBus3ModeAmix(t *testing.T) { func TestBus3ModeAmix(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Bus[3].Mode().SetAmix(true) vm.Bus[3].Mode().SetAmix(true)
sync() sync()
t.Run("Should return true when Mode().SetAmix(true)", func(t *testing.T) { t.Run("Should return true when Mode().SetAmix(true)", func(t *testing.T) {
assert.True(t, vmRem.Bus[3].Mode().GetAmix()) assert.True(t, vm.Bus[3].Mode().GetAmix())
}) })
} }
func TestVbanInStream0On(t *testing.T) { func TestVbanInStream0On(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Vban.InStream[0].SetOn(true) vm.Vban.InStream[0].SetOn(true)
sync() sync()
t.Run("Should return true when SetOn(true)", func(t *testing.T) { t.Run("Should return true when SetOn(true)", func(t *testing.T) {
assert.True(t, vmRem.Vban.InStream[0].GetOn()) assert.True(t, vm.Vban.InStream[0].GetOn())
}) })
vmRem.Vban.InStream[0].SetOn(false) vm.Vban.InStream[0].SetOn(false)
sync() sync()
t.Run("Should return false when SetOn(false)", func(t *testing.T) { t.Run("Should return false when SetOn(false)", func(t *testing.T) {
assert.False(t, vmRem.Vban.InStream[0].GetOn()) assert.False(t, vm.Vban.InStream[0].GetOn())
}) })
} }
func TestVbanOutStream6On(t *testing.T) { func TestVbanOutStream6On(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Vban.OutStream[6].SetOn(true) vm.Vban.OutStream[6].SetOn(true)
sync() sync()
t.Run("Should return true when SetOn(true)", func(t *testing.T) { t.Run("Should return true when SetOn(true)", func(t *testing.T) {
assert.True(t, vmRem.Vban.OutStream[6].GetOn()) assert.True(t, vm.Vban.OutStream[6].GetOn())
}) })
vmRem.Vban.OutStream[6].SetOn(false) vm.Vban.OutStream[6].SetOn(false)
sync() sync()
t.Run("Should return false when SetOn(false)", func(t *testing.T) { t.Run("Should return false when SetOn(false)", func(t *testing.T) {
assert.False(t, vmRem.Vban.OutStream[6].GetOn()) assert.False(t, vm.Vban.OutStream[6].GetOn())
}) })
} }
func TestVbanOutStream3Name(t *testing.T) { func TestVbanOutStream3Name(t *testing.T) {
t.Skip("skipping test") t.Skip("skipping test")
vmRem.Vban.OutStream[3].SetName("test0") vm.Vban.OutStream[3].SetName("test0")
sync() sync()
t.Run("Should return test0 when SetName('test0')", func(t *testing.T) { t.Run("Should return test0 when SetName('test0')", func(t *testing.T) {
assert.Equal(t, "test0", vmRem.Vban.OutStream[3].GetName()) assert.Equal(t, "test0", vm.Vban.OutStream[3].GetName())
}) })
vmRem.Vban.OutStream[3].SetName("test1") vm.Vban.OutStream[3].SetName("test1")
sync() sync()
t.Run("Should return test1 when SetName('test1')", func(t *testing.T) { t.Run("Should return test1 when SetName('test1')", func(t *testing.T) {
assert.Equal(t, "test1", vmRem.Vban.OutStream[3].GetName()) assert.Equal(t, "test1", vm.Vban.OutStream[3].GetName())
}) })
} }
@ -219,21 +219,21 @@ func TestVbanInStream4Bit(t *testing.T) {
t.Error("expected panic") t.Error("expected panic")
} }
}() }()
vmRem.Vban.InStream[4].SetBit(16) vm.Vban.InStream[4].SetBit(16)
}) })
} }
func TestVbanOutStream4Bit(t *testing.T) { func TestVbanOutStream4Bit(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Vban.OutStream[4].SetBit(16) vm.Vban.OutStream[4].SetBit(16)
sync() sync()
t.Run("Should return 16 when SetBit(16)", func(t *testing.T) { t.Run("Should return 16 when SetBit(16)", func(t *testing.T) {
assert.Equal(t, vmRem.Vban.OutStream[4].GetBit(), 16) assert.Equal(t, vm.Vban.OutStream[4].GetBit(), 16)
}) })
vmRem.Vban.OutStream[4].SetBit(24) vm.Vban.OutStream[4].SetBit(24)
sync() sync()
t.Run("Should return 24 when SetBit(24)", func(t *testing.T) { t.Run("Should return 24 when SetBit(24)", func(t *testing.T) {
assert.Equal(t, vmRem.Vban.OutStream[4].GetBit(), 24) assert.Equal(t, vm.Vban.OutStream[4].GetBit(), 24)
}) })
} }

View File

@ -169,12 +169,12 @@ type vban struct {
} }
func newVban(k *kind) *vban { func newVban(k *kind) *vban {
_vbanIn := make([]iVban, k.vbanIn) _vbanIn := make([]iVban, k.VbanIn)
for i := 0; i < k.vbanIn; i++ { for i := 0; i < k.VbanIn; i++ {
_vbanIn[i] = newVbanInStream(i) _vbanIn[i] = newVbanInStream(i)
} }
_vbanOut := make([]iVban, k.vbanOut) _vbanOut := make([]iVban, k.VbanOut)
for i := 0; i < k.vbanOut; i++ { for i := 0; i < k.VbanOut; i++ {
_vbanOut[i] = newVbanOutStream(i) _vbanOut[i] = newVbanOutStream(i)
} }
return &vban{ return &vban{