From 0fb0daf558acef4ca4ac2b1cb920564f66b2f33b Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Tue, 28 Jun 2022 17:32:03 +0100 Subject: [PATCH] bus mode implemented bus mode test added to higher #3 --- tests/higher_test.go | 8 +++ voicemeeter/bus.go | 145 ++++++++++++++++++++++++++++++++++++++++++- voicemeeter/strip.go | 1 - 3 files changed, 150 insertions(+), 4 deletions(-) diff --git a/tests/higher_test.go b/tests/higher_test.go index fdb3c45..85526f7 100644 --- a/tests/higher_test.go +++ b/tests/higher_test.go @@ -98,6 +98,14 @@ func TestBus4Label(t *testing.T) { }) } +func TestBus3ModeAmix(t *testing.T) { + //t.Skip("skipping test") + vmRem.Bus[3].Mode().SetAmix(true) + t.Run("Should return true when Mode().SetAmix(true)", func(t *testing.T) { + assert.True(t, vmRem.Bus[3].Mode().GetAmix()) + }) +} + func TestVbanInStream0On(t *testing.T) { //t.Skip("skipping test") vmRem.Vban.InStream[0].SetOn(true) diff --git a/voicemeeter/bus.go b/voicemeeter/bus.go index 1a3c8ed..42cb320 100644 --- a/voicemeeter/bus.go +++ b/voicemeeter/bus.go @@ -16,12 +16,13 @@ type t_bus interface { SetLabel(val string) GetGain() float64 SetGain(val float32) + Mode() t_busMode } // bus represents a bus channel -// embeds channel struct type bus struct { iRemote + mode busMode } // GetMute returns the value of the Mute parameter @@ -74,12 +75,20 @@ func (b *bus) SetGain(val float32) { b.setter_float("Gain", val) } +// Mode returns address of a busMode struct +func (b *bus) Mode() t_busMode { + return &b.mode +} + type physicalBus struct { bus } func newPhysicalBus(i int) t_bus { - pb := physicalBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}}} + pb := physicalBus{bus{ + iRemote{fmt.Sprintf("bus[%d]", i), i}, + busMode{iRemote{fmt.Sprintf("bus[%d].mode", i), i}}, + }} return t_bus(&pb) } @@ -93,7 +102,10 @@ type virtualBus struct { } func newVirtualBus(i int) t_bus { - vb := virtualBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}}} + vb := virtualBus{bus{ + iRemote{fmt.Sprintf("bus[%d]", i), i}, + busMode{iRemote{fmt.Sprintf("bus[%d].mode", i), i}}, + }} return t_bus(&vb) } @@ -101,3 +113,130 @@ func newVirtualBus(i int) t_bus { func (v *virtualBus) String() string { return fmt.Sprintf("VirtualBus%d", v.index) } + +type t_busMode interface { + SetNormal(val bool) + GetNormal() bool + SetAmix(val bool) + GetAmix() bool + SetBmix(val bool) + GetBmix() bool + SetRepeat(val bool) + GetRepeat() bool + SetComposite(val bool) + GetComposite() bool + SetTvMix(val bool) + GetTvMix() bool + SetUpMix21(val bool) + GetUpMix21() bool + SetUpMix41(val bool) + GetUpMix41() bool + SetUpMix61(val bool) + GetUpMix61() bool + SetCenterOnly(val bool) + GetCenterOnly() bool + SetLfeOnly(val bool) + GetLfeOnly() bool + SetRearOnly(val bool) + GetRearOnly() bool +} + +type busMode struct { + iRemote +} + +func (bm *busMode) SetNormal(val bool) { + bm.setter_bool("Normal", val) +} + +func (bm *busMode) GetNormal() bool { + return bm.getter_bool("Normal") +} + +func (bm *busMode) SetAmix(val bool) { + bm.setter_bool("Amix", val) +} + +func (bm *busMode) GetAmix() bool { + return bm.getter_bool("Amix") +} + +func (bm *busMode) SetBmix(val bool) { + bm.setter_bool("Bmix", val) +} + +func (bm *busMode) GetBmix() bool { + return bm.getter_bool("Bmix") +} + +func (bm *busMode) SetRepeat(val bool) { + bm.setter_bool("Repeat", val) +} + +func (bm *busMode) GetRepeat() bool { + return bm.getter_bool("Repeat") +} + +func (bm *busMode) SetComposite(val bool) { + bm.setter_bool("Composite", val) +} + +func (bm *busMode) GetComposite() bool { + return bm.getter_bool("Composite") +} + +func (bm *busMode) SetTvMix(val bool) { + bm.setter_bool("TvMix", val) +} + +func (bm *busMode) GetTvMix() bool { + return bm.getter_bool("TvMix") +} + +func (bm *busMode) SetUpMix21(val bool) { + bm.setter_bool("UpMix21", val) +} + +func (bm *busMode) GetUpMix21() bool { + return bm.getter_bool("UpMix21") +} + +func (bm *busMode) SetUpMix41(val bool) { + bm.setter_bool("UpMix41", val) +} + +func (bm *busMode) GetUpMix41() bool { + return bm.getter_bool("UpMix41") +} + +func (bm *busMode) SetUpMix61(val bool) { + bm.setter_bool("UpMix61", val) +} + +func (bm *busMode) GetUpMix61() bool { + return bm.getter_bool("UpMix61") +} + +func (bm *busMode) SetCenterOnly(val bool) { + bm.setter_bool("CenterOnly", val) +} + +func (bm *busMode) GetCenterOnly() bool { + return bm.getter_bool("CenterOnly") +} + +func (bm *busMode) SetLfeOnly(val bool) { + bm.setter_bool("LfeOnly", val) +} + +func (bm *busMode) GetLfeOnly() bool { + return bm.getter_bool("LfeOnly") +} + +func (bm *busMode) SetRearOnly(val bool) { + bm.setter_bool("RearOnly", val) +} + +func (bm *busMode) GetRearOnly() bool { + return bm.getter_bool("RearOnly") +} diff --git a/voicemeeter/strip.go b/voicemeeter/strip.go index f8c4bf3..734952a 100644 --- a/voicemeeter/strip.go +++ b/voicemeeter/strip.go @@ -30,7 +30,6 @@ type t_strip interface { } // strip represents a strip channel -// embeds channel struct type strip struct { iRemote outputs