strip comp added to higher

function signatures in strip fixed
This commit is contained in:
onyx-and-iris 2022-06-30 22:20:18 +01:00
parent 9ac8fb5e7e
commit 232f8561de
4 changed files with 169 additions and 25 deletions

12
CHANGELOG.md Normal file
View File

@ -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]

121
README.md
View File

@ -2,7 +2,9 @@
# A Go Wrapper for Voicemeeter API # 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 ## Tested against
@ -14,3 +16,120 @@ A WIP...
- [Voicemeeter](https://voicemeeter.com/) - [Voicemeeter](https://voicemeeter.com/)
- Go 1.18 or greater - 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)

View File

@ -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) { func TestStrip5Mc(t *testing.T) {
//t.Skip("skipping test") //t.Skip("skipping test")
vmRem.Strip[5].SetMc(true) vmRem.Strip[5].SetMc(true)

View File

@ -20,12 +20,12 @@ type t_strip interface {
SetGain(val float32) SetGain(val float32)
GetMc() bool GetMc() bool
SetMc(val bool) SetMc(val bool)
GetComp() bool GetComp() float64
SetComp(val bool) SetComp(val float32)
GetGate() bool GetGate() float64
SetGate(val bool) SetGate(val float32)
GetAudibility() bool GetAudibility() float64
SetAudibility(val bool) SetAudibility(val float32)
GainLayer() []gainLayer GainLayer() []gainLayer
Levels() *levels Levels() *levels
t_outputs t_outputs
@ -130,33 +130,33 @@ func (p *physicalStrip) String() string {
} }
// GetComp returns the value of the Comp parameter // GetComp returns the value of the Comp parameter
func (p *physicalStrip) GetComp() bool { func (p *physicalStrip) GetComp() float64 {
return p.getter_bool("Comp") return p.getter_float("Comp")
} }
// SetComp sets the value of the Comp parameter // SetComp sets the value of the Comp parameter
func (p *physicalStrip) SetComp(val bool) { func (p *physicalStrip) SetComp(val float32) {
p.setter_bool("Comp", val) p.setter_float("Comp", val)
} }
// GetGate returns the value of the Gate parameter // GetGate returns the value of the Gate parameter
func (p *physicalStrip) GetGate() bool { func (p *physicalStrip) GetGate() float64 {
return p.getter_bool("Gate") return p.getter_float("Gate")
} }
// SetGate sets the value of the Gate parameter // SetGate sets the value of the Gate parameter
func (p *physicalStrip) SetGate(val bool) { func (p *physicalStrip) SetGate(val float32) {
p.setter_bool("Gate", val) p.setter_float("Gate", val)
} }
// GetAudibility returns the value of the Audibility parameter // GetAudibility returns the value of the Audibility parameter
func (p *physicalStrip) GetAudibility() bool { func (p *physicalStrip) GetAudibility() float64 {
return p.getter_bool("Audibility") return p.getter_float("Audibility")
} }
// SetAudibility sets the value of the Audibility parameter // SetAudibility sets the value of the Audibility parameter
func (p *physicalStrip) SetAudibility(val bool) { func (p *physicalStrip) SetAudibility(val float32) {
p.setter_bool("Audibility", val) p.setter_float("Audibility", val)
} }
// GetMc panics reason invalid parameter // GetMc panics reason invalid parameter
@ -200,32 +200,32 @@ func (v *virtualStrip) SetMc(val bool) {
} }
// GetComp panics reason invalid parameter // GetComp panics reason invalid parameter
func (v *virtualStrip) GetComp() bool { func (v *virtualStrip) GetComp() float64 {
panic("invalid parameter Comp for virtualStrip") panic("invalid parameter Comp for virtualStrip")
} }
// SetComp panics reason invalid parameter // SetComp panics reason invalid parameter
func (v *virtualStrip) SetComp(val bool) { func (v *virtualStrip) SetComp(val float32) {
panic("invalid parameter Comp for virtualStrip") panic("invalid parameter Comp for virtualStrip")
} }
// GetGate panics reason invalid parameter // GetGate panics reason invalid parameter
func (v *virtualStrip) GetGate() bool { func (v *virtualStrip) GetGate() float64 {
panic("invalid parameter Gate for virtualStrip") panic("invalid parameter Gate for virtualStrip")
} }
// SetGate panics reason invalid parameter // SetGate panics reason invalid parameter
func (v *virtualStrip) SetGate(val bool) { func (v *virtualStrip) SetGate(val float32) {
panic("invalid parameter Gate for virtualStrip") panic("invalid parameter Gate for virtualStrip")
} }
// GetAudibility panics reason invalid parameter // GetAudibility panics reason invalid parameter
func (v *virtualStrip) GetAudibility() bool { func (v *virtualStrip) GetAudibility() float64 {
panic("invalid parameter Audibility for virtualStrip") panic("invalid parameter Audibility for virtualStrip")
} }
// SetAudibility panics reason invalid parameter // SetAudibility panics reason invalid parameter
func (v *virtualStrip) SetAudibility(val bool) { func (v *virtualStrip) SetAudibility(val float32) {
panic("invalid parameter Audibility for virtualStrip") panic("invalid parameter Audibility for virtualStrip")
} }