mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2026-04-18 05:23:31 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38973810d7 | ||
|
|
be6a49e3bc | ||
|
|
76ed3320d3 | ||
|
|
8f630d52e7 | ||
|
|
174db162c8 | ||
|
|
c7a265fb33 | ||
|
|
8bb8336599 | ||
|
|
5b3f10c4b8 | ||
|
|
7022c5dacf | ||
|
|
5bb7eb9668 | ||
|
|
5e5a82f198 | ||
|
|
d8de82b90e | ||
|
|
5b4592f484 | ||
|
|
b2dd96abc4 |
18
README.md
18
README.md
@@ -147,19 +147,19 @@ sets many parameters in script format eg. ("Strip[0].Mute=1;Bus[3].Gain=3.6")
|
||||
|
||||
#### `vm.Register(o observer)`
|
||||
|
||||
register an object as an observer
|
||||
register an observer type as an observer
|
||||
|
||||
#### `vm.Deregister(o observer)`
|
||||
|
||||
deregister an object as an observer
|
||||
deregister an observer type as an observer
|
||||
|
||||
#### `vm.EventAdd(<event>)`
|
||||
#### `vm.EventAdd(<events>)`
|
||||
|
||||
adds an event to the pooler eg. vm.EventAdd("ldirty")
|
||||
adds a single or multiple events to the pooler. Accepts a string or slice of strings.
|
||||
|
||||
#### `vm.EventRemove(<event>)`
|
||||
#### `vm.EventRemove(<events>)`
|
||||
|
||||
removes an event to the pooler eg. vm.EventRemove("pdirty")
|
||||
removes a single or multiple events from the pooler. Accepts a string or slice of strings.
|
||||
|
||||
#### `vm.Pdirty()`
|
||||
|
||||
@@ -481,9 +481,11 @@ By default level updates are disabled. Any event may be enabled or disabled. The
|
||||
example:
|
||||
|
||||
```go
|
||||
vm.EventAdd("ldirty")
|
||||
events := []string{"ldirty", "mdirty", "pdirty"}
|
||||
|
||||
vm.EventRemove("pdirty")
|
||||
vm.EventAdd(events...)
|
||||
|
||||
vm.EventRemove(events...)
|
||||
```
|
||||
|
||||
### Run tests
|
||||
|
||||
4
base.go
4
base.go
@@ -315,7 +315,7 @@ func getDeviceDescription(i int, dir string) (string, uint64, string, error) {
|
||||
|
||||
// getLevel returns a single level value of type type_ for channel[i]
|
||||
func getLevel(type_, i int) (float64, error) {
|
||||
var val float64
|
||||
var val float32
|
||||
res, _, _ := vmGetLevelFloat.Call(
|
||||
uintptr(type_),
|
||||
uintptr(i),
|
||||
@@ -325,7 +325,7 @@ func getLevel(type_, i int) (float64, error) {
|
||||
err := fmt.Errorf("VBVMR_GetLevel returned %d", res)
|
||||
return 0, err
|
||||
}
|
||||
return val, nil
|
||||
return float64(val), nil
|
||||
}
|
||||
|
||||
// getMidiMessage gets midi channel, pitch and velocity for a single midi input
|
||||
|
||||
@@ -4,7 +4,7 @@ go 1.19
|
||||
|
||||
require (
|
||||
github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 h1:XBBHcIb256gUJtLmY22n99HaZTz+r2Z51xUPi01m3wg=
|
||||
github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203/go.mod h1:E1jcSv8FaEny+OP/5k9UxZVw9YFWGj7eI4KR/iOBqCg=
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0 h1:4LbPP9iUj/P6FPymYqyh94ysfdvOunex+i2wUDSDn6s=
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0/go.mod h1:bBWCYzL//4QmH4VL3TNpNIj9W89Oa+E6J5hgyt27mKg=
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1 h1:kpPN/cTYe1JG2aLUD+/m/bMUbp7wXrqrk1fL+sV8yko=
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1/go.mod h1:LayUoN/MWSqKXSOGQ7AcLvwoefsL+zQ9CjncLs3WqsU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
|
||||
@@ -5,7 +5,7 @@ go 1.18
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.2.0
|
||||
github.com/andreykaipov/goobs v0.10.0
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
)
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0 h1:4LbPP9iUj/P6FPymYqyh94ysfdvOunex+i2wUDSDn6s=
|
||||
github.com/onyx-and-iris/voicemeeter v1.9.0/go.mod h1:bBWCYzL//4QmH4VL3TNpNIj9W89Oa+E6J5hgyt27mKg=
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1 h1:kpPN/cTYe1JG2aLUD+/m/bMUbp7wXrqrk1fL+sV8yko=
|
||||
github.com/onyx-and-iris/voicemeeter v1.10.1/go.mod h1:LayUoN/MWSqKXSOGQ7AcLvwoefsL+zQ9CjncLs3WqsU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
|
||||
@@ -42,16 +42,11 @@ func (o observer) OnUpdate(subject string) {
|
||||
var val = o.vm.Midi.Get(current)
|
||||
fmt.Printf("Value of midi button %d: %d\n", current, val)
|
||||
} else if subject == "ldirty" {
|
||||
fmt.Printf("%v %v %v %v %v %v %v %v\n",
|
||||
o.vm.Bus[0].Levels().IsDirty(),
|
||||
o.vm.Bus[1].Levels().IsDirty(),
|
||||
o.vm.Bus[2].Levels().IsDirty(),
|
||||
o.vm.Bus[3].Levels().IsDirty(),
|
||||
o.vm.Bus[4].Levels().IsDirty(),
|
||||
o.vm.Bus[5].Levels().IsDirty(),
|
||||
o.vm.Bus[6].Levels().IsDirty(),
|
||||
o.vm.Bus[7].Levels().IsDirty(),
|
||||
)
|
||||
for _, bus := range o.vm.Bus {
|
||||
if bus.Levels().IsDirty() {
|
||||
fmt.Println(bus, bus.Levels().All())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,24 @@
|
||||
|
||||
A simple voicemeeter-cli program. Offers ability to toggle, get and set parameters.
|
||||
|
||||
## Install
|
||||
|
||||
First build and install it with `go install` (skip this step if using binary from [Releases](https://github.com/onyx-and-iris/voicemeeter/releases))
|
||||
|
||||
## Use
|
||||
|
||||
Toggle with `!` prefix, get by excluding `=` and set by including `=`. Mix and match arguments.
|
||||
|
||||
You may pass the following optional flags:
|
||||
|
||||
- -v: (-verbose) to toggle console output. Defaults to false.
|
||||
- -v: (-verbose) to toggle console output.
|
||||
- -i: (-interactive) to toggle interactive mode.
|
||||
- -k: (-kind) to set the kind of Voicemeeter. Defaults to banana.
|
||||
- -d: (-delay) to set a delay on the getters. Defaults to 20ms.
|
||||
|
||||
for example:
|
||||
|
||||
`go run .\main.go -v -k=potato -d=25 strip[0].mute=0 strip[0].mute !strip[0].mute strip[0].mute bus[0].gain=-8.8 command.lock=1`
|
||||
`vm-cli.exe -v -k=potato -d=25 strip[0].mute=0 strip[0].mute !strip[0].mute strip[0].mute bus[0].gain=-8.8 command.lock=1`
|
||||
|
||||
Expected output:
|
||||
|
||||
@@ -26,3 +31,5 @@ Value of strip[0].mute is: 1
|
||||
Running command bus[0].gain=-8.8
|
||||
Running command command.lock=1
|
||||
```
|
||||
|
||||
If running in interactive mode enter `q`, `quit` or `<Enter>` to exit.
|
||||
|
||||
@@ -1,28 +1,55 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/onyx-and-iris/voicemeeter"
|
||||
)
|
||||
|
||||
var (
|
||||
kind string
|
||||
delay int
|
||||
type (
|
||||
verbosePrinter struct {
|
||||
verbose bool
|
||||
}
|
||||
)
|
||||
|
||||
func newVerbosePrinter() *verbosePrinter {
|
||||
return &verbosePrinter{}
|
||||
}
|
||||
|
||||
func (v *verbosePrinter) printf(format string, a ...interface{}) {
|
||||
if v.verbose {
|
||||
fmt.Printf(format+"\n", a...)
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
vPrinter *verbosePrinter
|
||||
)
|
||||
|
||||
func init() {
|
||||
vPrinter = newVerbosePrinter()
|
||||
}
|
||||
|
||||
func main() {
|
||||
var (
|
||||
kind string
|
||||
delay int
|
||||
interactive bool
|
||||
)
|
||||
|
||||
flag.StringVar(&kind, "kind", "banana", "kind of voicemeeter")
|
||||
flag.StringVar(&kind, "k", "banana", "kind of voicemeeter (shorthand)")
|
||||
flag.IntVar(&delay, "delay", 20, "delay between commands")
|
||||
flag.IntVar(&delay, "d", 20, "delay between commands (shorthand)")
|
||||
flag.BoolVar(&verbose, "verbose", false, "toggle console output")
|
||||
flag.BoolVar(&verbose, "v", false, "toggle console output (shorthand)")
|
||||
flag.BoolVar(&vPrinter.verbose, "verbose", false, "toggle console output")
|
||||
flag.BoolVar(&vPrinter.verbose, "v", false, "toggle console output (shorthand)")
|
||||
flag.BoolVar(&interactive, "interactive", false, "toggle interactive mode")
|
||||
flag.BoolVar(&interactive, "i", false, "toggle interactive mode (shorthand)")
|
||||
flag.Parse()
|
||||
|
||||
vm, err := vmConnect(kind, delay)
|
||||
@@ -31,7 +58,7 @@ func main() {
|
||||
}
|
||||
defer vm.Logout()
|
||||
|
||||
err = runCommands(vm, verbose)
|
||||
err = runCommands(vm, interactive)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
@@ -51,46 +78,99 @@ func vmConnect(kind string, delay int) (*voicemeeter.Remote, error) {
|
||||
return vm, nil
|
||||
}
|
||||
|
||||
func runCommands(vm *voicemeeter.Remote, verbose bool) error {
|
||||
for _, arg := range flag.Args() {
|
||||
if arg[0] == '!' {
|
||||
val, err := vm.GetFloat(arg[1:])
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to toggle %s", arg[1:])
|
||||
func runCommands(vm *voicemeeter.Remote, interactive bool) error {
|
||||
if interactive {
|
||||
return interactiveMode(vm)
|
||||
}
|
||||
args := flag.Args()
|
||||
if len(args) == 0 {
|
||||
err := fmt.Errorf("must provide some commands to run")
|
||||
return err
|
||||
}
|
||||
vm.SetFloat(arg[1:], 1-val)
|
||||
if verbose {
|
||||
fmt.Println("Toggling", arg[1:])
|
||||
}
|
||||
} else {
|
||||
if strings.Contains(arg, "=") {
|
||||
if verbose {
|
||||
fmt.Println("Running command", arg)
|
||||
}
|
||||
err := vm.SendText(arg)
|
||||
for _, arg := range args {
|
||||
err := parse(vm, arg)
|
||||
if err != nil {
|
||||
vPrinter.printf(err.Error())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func interactiveMode(vm *voicemeeter.Remote) error {
|
||||
vPrinter.printf("running in interactive mode... waiting for input")
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
for scanner.Scan() {
|
||||
input := scanner.Text()
|
||||
if input == "q" || input == "quit" || input == "" {
|
||||
return nil
|
||||
}
|
||||
for _, cmd := range strings.Split(input, " ") {
|
||||
err := parse(vm, cmd)
|
||||
if err != nil {
|
||||
vPrinter.printf(err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
if scanner.Err() != nil {
|
||||
return scanner.Err()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parse(vm *voicemeeter.Remote, cmd string) error {
|
||||
if cmd[0] == '!' {
|
||||
err := toggleCmd(vm, cmd[1:])
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to set %s", arg)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
valF, err := vm.GetFloat(arg)
|
||||
if strings.Contains(cmd, "=") {
|
||||
err := setCmd(vm, cmd)
|
||||
if err != nil {
|
||||
valS, err := vm.GetString(arg)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to get %s", arg)
|
||||
return err
|
||||
}
|
||||
if verbose {
|
||||
fmt.Println("Value of", arg, "is:", valS)
|
||||
}
|
||||
} else {
|
||||
if verbose {
|
||||
fmt.Println("Value of", arg, "is:", valF)
|
||||
}
|
||||
}
|
||||
err := getCmd(vm, cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func toggleCmd(vm *voicemeeter.Remote, cmd string) error {
|
||||
val, err := vm.GetFloat(cmd)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to toggle %s", cmd)
|
||||
return err
|
||||
}
|
||||
vm.SetFloat(cmd, 1-val)
|
||||
vPrinter.printf("Toggling %s", cmd)
|
||||
return nil
|
||||
}
|
||||
|
||||
func setCmd(vm *voicemeeter.Remote, cmd string) error {
|
||||
vPrinter.printf("Running command %s", cmd)
|
||||
err := vm.SendText(cmd)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to set %s", cmd)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getCmd(vm *voicemeeter.Remote, cmd string) error {
|
||||
valF, err := vm.GetFloat(cmd)
|
||||
if err != nil {
|
||||
valS, err := vm.GetString(cmd)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("unable to get %s", cmd)
|
||||
return err
|
||||
}
|
||||
vPrinter.printf("Value of %s is: %s", cmd, valS)
|
||||
} else {
|
||||
vPrinter.printf("Value of %s is: %v", cmd, valF)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
16
publisher.go
16
publisher.go
@@ -2,6 +2,8 @@ package voicemeeter
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// observer defines the interface any registered observers must satisfy
|
||||
@@ -51,8 +53,9 @@ func newEvent() *event {
|
||||
return &event{true, true, true, false}
|
||||
}
|
||||
|
||||
func (e *event) Add(ev string) {
|
||||
switch ev {
|
||||
func (e *event) Add(events ...string) {
|
||||
for _, event := range events {
|
||||
switch event {
|
||||
case "pdirty":
|
||||
e.pdirty = true
|
||||
case "mdirty":
|
||||
@@ -62,10 +65,13 @@ func (e *event) Add(ev string) {
|
||||
case "ldirty":
|
||||
e.ldirty = true
|
||||
}
|
||||
log.Info(event, " added to the pooler")
|
||||
}
|
||||
}
|
||||
|
||||
func (e *event) Remove(ev string) {
|
||||
switch ev {
|
||||
func (e *event) Remove(events ...string) {
|
||||
for _, event := range events {
|
||||
switch event {
|
||||
case "pdirty":
|
||||
e.pdirty = false
|
||||
case "mdirty":
|
||||
@@ -75,6 +81,8 @@ func (e *event) Remove(ev string) {
|
||||
case "ldirty":
|
||||
e.ldirty = false
|
||||
}
|
||||
log.Info(event, " removed from the pooler")
|
||||
}
|
||||
}
|
||||
|
||||
// pooler continuously polls the dirty paramters
|
||||
|
||||
24
remote.go
24
remote.go
@@ -8,7 +8,7 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// A Remote type represents the API for a kind
|
||||
// Remote represents the API for a kind
|
||||
type Remote struct {
|
||||
Kind *kind
|
||||
Strip []iStrip
|
||||
@@ -85,7 +85,7 @@ func (r *Remote) Sync() {
|
||||
}
|
||||
}
|
||||
|
||||
// Gets a float parameter value
|
||||
// GetFloat gets a float parameter value
|
||||
func (r *Remote) GetFloat(name string) (float64, error) {
|
||||
val, err := getParameterFloat(name)
|
||||
if err != nil {
|
||||
@@ -94,7 +94,7 @@ func (r *Remote) GetFloat(name string) (float64, error) {
|
||||
return val, nil
|
||||
}
|
||||
|
||||
// Sets a float paramter value
|
||||
// SetFloat sets a float paramter value
|
||||
func (r *Remote) SetFloat(name string, value float64) error {
|
||||
err := setParameterFloat(name, value)
|
||||
if err != nil {
|
||||
@@ -103,7 +103,7 @@ func (r *Remote) SetFloat(name string, value float64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Gets a string parameter value
|
||||
// GetString gets a string parameter value
|
||||
func (r *Remote) GetString(name string) (string, error) {
|
||||
val, err := getParameterString(name)
|
||||
if err != nil {
|
||||
@@ -112,7 +112,7 @@ func (r *Remote) GetString(name string) (string, error) {
|
||||
return val, nil
|
||||
}
|
||||
|
||||
// Sets a string paramter value
|
||||
// SetString sets a string parameter value
|
||||
func (r *Remote) SetString(name, value string) error {
|
||||
err := setParameterString(name, value)
|
||||
if err != nil {
|
||||
@@ -140,14 +140,14 @@ func (r *Remote) Deregister(o observer) {
|
||||
r.pooler.Deregister(o)
|
||||
}
|
||||
|
||||
// EventAdd adds an event to the Pooler
|
||||
func (r *Remote) EventAdd(event string) {
|
||||
r.pooler.event.Add(event)
|
||||
// EventAdd adds events to the Pooler
|
||||
func (r *Remote) EventAdd(events ...string) {
|
||||
r.pooler.event.Add(events...)
|
||||
}
|
||||
|
||||
// EventRemove removes an event from the Pooler
|
||||
func (r *Remote) EventRemove(event string) {
|
||||
r.pooler.event.Remove(event)
|
||||
// EventRemove removes events from the Pooler
|
||||
func (r *Remote) EventRemove(events ...string) {
|
||||
r.pooler.event.Remove(events...)
|
||||
}
|
||||
|
||||
// remoteBuilder defines the interface builder types must satisfy
|
||||
@@ -165,7 +165,7 @@ type remoteBuilder interface {
|
||||
Get() *Remote
|
||||
}
|
||||
|
||||
// directory is responsible for directing the genericBuilder
|
||||
// director is responsible for directing the genericBuilder
|
||||
type director struct {
|
||||
builder remoteBuilder
|
||||
}
|
||||
|
||||
44
strip.go
44
strip.go
@@ -3,9 +3,11 @@ package voicemeeter
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// iStrip defines the interface bus types must satisfy
|
||||
// iStrip defines the interface strip types must satisfy
|
||||
type iStrip interface {
|
||||
String() string
|
||||
GetMute() bool
|
||||
@@ -179,14 +181,16 @@ func (p *physicalStrip) SetAudibility(val float64) {
|
||||
p.setter_float("Audibility", val)
|
||||
}
|
||||
|
||||
// GetMc panics reason invalid parameter
|
||||
// GetMc logs a warning reason invalid parameter
|
||||
// it always returns zero value
|
||||
func (p *physicalStrip) GetMc() bool {
|
||||
panic("invalid parameter MC for physicalStrip")
|
||||
log.Warn("invalid parameter MC for physicalStrip")
|
||||
return false
|
||||
}
|
||||
|
||||
// SetMc panics reason invalid parameter
|
||||
// SetMc logs a warning reason invalid parameter
|
||||
func (p *physicalStrip) SetMc(val bool) {
|
||||
panic("invalid parameter MC for physicalStrip")
|
||||
log.Warn("invalid parameter MC for physicalStrip")
|
||||
}
|
||||
|
||||
// virtualStrip represents a single virtual strip
|
||||
@@ -221,34 +225,40 @@ func (v *virtualStrip) SetMc(val bool) {
|
||||
v.setter_bool("MC", val)
|
||||
}
|
||||
|
||||
// GetComp panics reason invalid parameter
|
||||
// GetComp logs a warning reason invalid parameter
|
||||
// it always returns zero value
|
||||
func (v *virtualStrip) GetComp() float64 {
|
||||
panic("invalid parameter Comp for virtualStrip")
|
||||
log.Warn("invalid parameter Comp for virtualStrip")
|
||||
return 0
|
||||
}
|
||||
|
||||
// SetComp panics reason invalid parameter
|
||||
// SetComp logs a warning reason invalid parameter
|
||||
func (v *virtualStrip) SetComp(val float64) {
|
||||
panic("invalid parameter Comp for virtualStrip")
|
||||
log.Warn("invalid parameter Comp for virtualStrip")
|
||||
}
|
||||
|
||||
// GetGate panics reason invalid parameter
|
||||
// GetGate logs a warning reason invalid parameter
|
||||
// it always returns zero value
|
||||
func (v *virtualStrip) GetGate() float64 {
|
||||
panic("invalid parameter Gate for virtualStrip")
|
||||
log.Warn("invalid parameter Gate for virtualStrip")
|
||||
return 0
|
||||
}
|
||||
|
||||
// SetGate panics reason invalid parameter
|
||||
// SetGate logs a warning reason invalid parameter
|
||||
func (v *virtualStrip) SetGate(val float64) {
|
||||
panic("invalid parameter Gate for virtualStrip")
|
||||
log.Warn("invalid parameter Gate for virtualStrip")
|
||||
}
|
||||
|
||||
// GetAudibility panics reason invalid parameter
|
||||
// GetAudibility logs a warning reason invalid parameter
|
||||
// it always returns zero value
|
||||
func (v *virtualStrip) GetAudibility() float64 {
|
||||
panic("invalid parameter Audibility for virtualStrip")
|
||||
log.Warn("invalid parameter Audibility for virtualStrip")
|
||||
return 0
|
||||
}
|
||||
|
||||
// SetAudibility panics reason invalid parameter
|
||||
// SetAudibility logs a warning reason invalid parameter
|
||||
func (v *virtualStrip) SetAudibility(val float64) {
|
||||
panic("invalid parameter Audibility for virtualStrip")
|
||||
log.Warn("invalid parameter Audibility for virtualStrip")
|
||||
}
|
||||
|
||||
// AppGain sets the gain in db by val for the app matching name.
|
||||
|
||||
4
util.go
4
util.go
@@ -28,8 +28,8 @@ func roundFloat(val float64, precision uint) float64 {
|
||||
// convertLevel performs the necessary math for a channel level
|
||||
func convertLevel(i float64) float64 {
|
||||
if i > 0 {
|
||||
val := 20 * math.Log10(float64(i))
|
||||
return float64(roundFloat(float64(val), 1))
|
||||
val := 20 * math.Log10(i)
|
||||
return roundFloat(val, 1)
|
||||
}
|
||||
return -200.0
|
||||
}
|
||||
|
||||
21
vban.go
21
vban.go
@@ -1,6 +1,10 @@
|
||||
package voicemeeter
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// iVban defines the interface vban types must satisfy
|
||||
type iVban interface {
|
||||
@@ -105,7 +109,8 @@ func (v *vbanStream) SetBit(val int) {
|
||||
case 24:
|
||||
val = 2
|
||||
default:
|
||||
panic("expected value 16 or 24")
|
||||
log.Warn("expected value 16 or 24")
|
||||
return
|
||||
}
|
||||
v.setter_int("Bit", val)
|
||||
}
|
||||
@@ -139,19 +144,19 @@ func newVbanInStream(i int) iVban {
|
||||
return iVban(&vbi)
|
||||
}
|
||||
|
||||
// SetSr panics reason read only
|
||||
// SetSr logs a warning reason read only
|
||||
func (vbi *vbanInStream) SetSr(val int) {
|
||||
panic("SR is readonly for vban instreams")
|
||||
log.Warn("SR is readonly for vban instreams")
|
||||
}
|
||||
|
||||
// SetChannel panics reason read only
|
||||
// SetChannel logs a warning reason read only
|
||||
func (vbi *vbanInStream) SetChannel(val int) {
|
||||
panic("channel is readonly for vban instreams")
|
||||
log.Warn("channel is readonly for vban instreams")
|
||||
}
|
||||
|
||||
// SetBit panics reason read only
|
||||
// SetBit logs a warning reason read only
|
||||
func (vbi *vbanInStream) SetBit(val int) {
|
||||
panic("bit is readonly for vban instreams")
|
||||
log.Warn("bit is readonly for vban instreams")
|
||||
}
|
||||
|
||||
type vbanOutStream struct {
|
||||
|
||||
Reference in New Issue
Block a user