event Add() and Remove() now variadic.

in strip, vban, log warning then return zero value instead of panic.

update readme
This commit is contained in:
onyx-and-iris
2022-10-10 18:51:30 +01:00
parent 76ed3320d3
commit be6a49e3bc
5 changed files with 86 additions and 63 deletions

21
vban.go
View File

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