diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3cfbb7f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +Before any major/minor/patch bump all unit tests will be run to verify they pass. + +## [Unreleased] + +- [x] diff --git a/README.md b/README.md index 3590908..9b32922 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ # A Go Wrapper for Voicemeeter API -A WIP... +This package offers a Go interface for the Voicemeeter Remote C API. + +For an outline of past/future changes refer to: [CHANGELOG](CHANGELOG.md) ## Tested against @@ -14,3 +16,120 @@ A WIP... - [Voicemeeter](https://voicemeeter.com/) - Go 1.18 or greater + +## Installation + +Add to your go.mod file: + +`require github.com/onyx-and-iris/voicemeeter-api-go v1.0.0` + +Install voicemeeter-api-go package from your console + +`go get github.com/onyx-and-iris/voicemeeter-api-go` + +## `Use` + +#### `main.go` + +```go +package main + +import ( + "fmt" + + "github.com/onyx-and-iris/voicemeeter-api-go/voicemeeter" +) + +func main() { + kindId := "banana" + vmRem := voicemeeter.GetRemote(kindId) + + vmRem.Login() + + vmRem.Strip[0].SetLabel("rode podmic") + vmRem.Strip[0].SetMute(true) + fmt.Printf("Strip 0 (%s) mute was set to %v\n", vmRem.Strip[0].GetLabel(), vmRem.Strip[0].GetMute()) + + vmRem.Logout() +} +``` + + +## `kindId` + +Pass the kind of Voicemeeter as an argument. kindId may be: + +- `basic` +- `banana` +- `potato` + +## `Remote Type` +#### `vmRem.Strip` +[]t_strip slice containing both physicalStrip and virtualStrip types +#### `vmRem.Bus` +[]t_bus slice containing both physicalBus and virtualBus types +#### `vmRem.Button` +[]button slice containing button types, one for each macrobutton +#### `vmRem.Command` +pointer to command type, represents action type functions +#### `vmRem.Vban` +pointer to vban type, containing both vbanInStream and vbanOutStream slices +#### `vmRem.Device` +pointer to device type, represents physical input/output hardware devices +#### `vmRem.Recorder` +pointer to recorder type, represents the recorder + +#### `vmRem.Type` +returns the type of Voicemeeter as a string +#### `vmRem.Version` +returns the version of Voicemeeter as a string +#### `vmRem.SendText` +sets many parameters in script format ("Strip[0].Mute=1;Bus[3].Gain=3.6") +#### `vmRem.Register` +register an object as an observer +#### `vmRem.Deregister` +deregister an object as an observer + + +## `Available commands` + +### Strip + +The following functions are available + +- `GetMute() bool` +- `SetMute(val bool)` +- `GetMono() bool` +- `SetMono(val bool)` +- `GetSolo() bool` +- `SetSolo(val bool)` +- `GetLimit() int` +- `SetLimit(val int)` from -40 to 12 +- `GetLabel() string` +- `SetLabel(val string)` +- `GetGain() float64` +- `SetGain(val float32)` from -60.0 to 12.0 +- `GetMc() bool` +- `SetMc(val bool)` +- `GetComp() float64` +- `SetComp(val float32)` from 0.0 to 10.0 +- `GetGate() float64` +- `SetGate(val float32)` from 0.0 to 10.0 +- `GetAudibility() float64` +- `SetAudibility(val float32)` from 0.0 to 10.0 +- `GetA1() bool - GetA5() bool` +- `SetA1(val bool) - SetA5(val bool)` + + + +### Run tests + +To run all tests: + +``` +go run test ./... +``` + +### Official Documentation + +- [Voicemeeter Remote C API](https://github.com/onyx-and-iris/Voicemeeter-SDK/blob/main/VoicemeeterRemoteAPI.pdf) diff --git a/tests/higher_test.go b/tests/higher_test.go index 25bb85d..e6a8873 100644 --- a/tests/higher_test.go +++ b/tests/higher_test.go @@ -59,6 +59,19 @@ func TestStrip5Gain(t *testing.T) { }) } +func TestStrip3Comp(t *testing.T) { + //t.Skip("skipping test") + vmRem.Strip[4].SetComp(8.1) + t.Run("Should return 8.1 when SetGain(8.1)", func(t *testing.T) { + assert.Equal(t, vmRem.Strip[4].GetComp(), 8.1) + }) + + vmRem.Strip[4].SetComp(1.6) + t.Run("Should return 1.6 when SetGain(1.6)", func(t *testing.T) { + assert.Equal(t, vmRem.Strip[4].GetComp(), 1.6) + }) +} + func TestStrip5Mc(t *testing.T) { //t.Skip("skipping test") vmRem.Strip[5].SetMc(true) diff --git a/voicemeeter/strip.go b/voicemeeter/strip.go index d03af2f..a0b9c0a 100644 --- a/voicemeeter/strip.go +++ b/voicemeeter/strip.go @@ -20,12 +20,12 @@ type t_strip interface { SetGain(val float32) GetMc() bool SetMc(val bool) - GetComp() bool - SetComp(val bool) - GetGate() bool - SetGate(val bool) - GetAudibility() bool - SetAudibility(val bool) + GetComp() float64 + SetComp(val float32) + GetGate() float64 + SetGate(val float32) + GetAudibility() float64 + SetAudibility(val float32) GainLayer() []gainLayer Levels() *levels t_outputs @@ -130,33 +130,33 @@ func (p *physicalStrip) String() string { } // GetComp returns the value of the Comp parameter -func (p *physicalStrip) GetComp() bool { - return p.getter_bool("Comp") +func (p *physicalStrip) GetComp() float64 { + return p.getter_float("Comp") } // SetComp sets the value of the Comp parameter -func (p *physicalStrip) SetComp(val bool) { - p.setter_bool("Comp", val) +func (p *physicalStrip) SetComp(val float32) { + p.setter_float("Comp", val) } // GetGate returns the value of the Gate parameter -func (p *physicalStrip) GetGate() bool { - return p.getter_bool("Gate") +func (p *physicalStrip) GetGate() float64 { + return p.getter_float("Gate") } // SetGate sets the value of the Gate parameter -func (p *physicalStrip) SetGate(val bool) { - p.setter_bool("Gate", val) +func (p *physicalStrip) SetGate(val float32) { + p.setter_float("Gate", val) } // GetAudibility returns the value of the Audibility parameter -func (p *physicalStrip) GetAudibility() bool { - return p.getter_bool("Audibility") +func (p *physicalStrip) GetAudibility() float64 { + return p.getter_float("Audibility") } // SetAudibility sets the value of the Audibility parameter -func (p *physicalStrip) SetAudibility(val bool) { - p.setter_bool("Audibility", val) +func (p *physicalStrip) SetAudibility(val float32) { + p.setter_float("Audibility", val) } // GetMc panics reason invalid parameter @@ -200,32 +200,32 @@ func (v *virtualStrip) SetMc(val bool) { } // GetComp panics reason invalid parameter -func (v *virtualStrip) GetComp() bool { +func (v *virtualStrip) GetComp() float64 { panic("invalid parameter Comp for virtualStrip") } // SetComp panics reason invalid parameter -func (v *virtualStrip) SetComp(val bool) { +func (v *virtualStrip) SetComp(val float32) { panic("invalid parameter Comp for virtualStrip") } // GetGate panics reason invalid parameter -func (v *virtualStrip) GetGate() bool { +func (v *virtualStrip) GetGate() float64 { panic("invalid parameter Gate for virtualStrip") } // SetGate panics reason invalid parameter -func (v *virtualStrip) SetGate(val bool) { +func (v *virtualStrip) SetGate(val float32) { panic("invalid parameter Gate for virtualStrip") } // GetAudibility panics reason invalid parameter -func (v *virtualStrip) GetAudibility() bool { +func (v *virtualStrip) GetAudibility() float64 { panic("invalid parameter Audibility for virtualStrip") } // SetAudibility panics reason invalid parameter -func (v *virtualStrip) SetAudibility(val bool) { +func (v *virtualStrip) SetAudibility(val float32) { panic("invalid parameter Audibility for virtualStrip") }