2022-06-22 20:51:25 +01:00
|
|
|
package voicemeeter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
type t_strip interface {
|
2022-06-25 01:18:20 +01:00
|
|
|
String() string
|
2022-06-23 10:42:11 +01:00
|
|
|
GetMute() bool
|
|
|
|
SetMute(val bool)
|
|
|
|
GetMono() bool
|
|
|
|
SetMono(val bool)
|
|
|
|
GetSolo() bool
|
|
|
|
SetSolo(val bool)
|
|
|
|
GetLimit() int
|
|
|
|
SetLimit(val int)
|
|
|
|
GetLabel() string
|
|
|
|
SetLabel(val string)
|
|
|
|
GetGain() float64
|
|
|
|
SetGain(val float32)
|
|
|
|
GetMc() bool
|
|
|
|
SetMc(val bool)
|
2022-06-30 22:20:18 +01:00
|
|
|
GetComp() float64
|
|
|
|
SetComp(val float32)
|
|
|
|
GetGate() float64
|
|
|
|
SetGate(val float32)
|
|
|
|
GetAudibility() float64
|
|
|
|
SetAudibility(val float32)
|
2022-06-28 19:30:37 +01:00
|
|
|
GainLayer() []gainLayer
|
2022-06-30 20:08:46 +01:00
|
|
|
Levels() *levels
|
2022-06-25 04:01:19 +01:00
|
|
|
t_outputs
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
// strip represents a strip channel
|
|
|
|
type strip struct {
|
2022-06-23 14:03:00 +01:00
|
|
|
iRemote
|
2022-06-25 04:01:19 +01:00
|
|
|
outputs
|
2022-06-28 19:30:37 +01:00
|
|
|
gainLayer []gainLayer
|
2022-06-30 20:08:46 +01:00
|
|
|
levels
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetMute returns the value of the Mute parameter
|
|
|
|
func (s *strip) GetMute() bool {
|
|
|
|
return s.getter_bool("Mute")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMute sets the value of the Mute parameter
|
|
|
|
func (s *strip) SetMute(val bool) {
|
|
|
|
s.setter_bool("Mute", val)
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetMono returns the value of the Mono parameter
|
2022-06-23 10:42:11 +01:00
|
|
|
func (s *strip) GetMono() bool {
|
|
|
|
return s.getter_bool("Mono")
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetMono sets the value of the Mono parameter
|
2022-06-23 10:42:11 +01:00
|
|
|
func (s *strip) SetMono(val bool) {
|
|
|
|
s.setter_bool("Mono", val)
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetSolo returns the value of the Solo parameter
|
2022-06-23 10:42:11 +01:00
|
|
|
func (s *strip) GetSolo() bool {
|
|
|
|
return s.getter_bool("Solo")
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetSolo sets the value of the Solo parameter
|
2022-06-23 10:42:11 +01:00
|
|
|
func (s *strip) SetSolo(val bool) {
|
|
|
|
s.setter_bool("Solo", val)
|
|
|
|
}
|
|
|
|
|
2022-06-22 20:51:25 +01:00
|
|
|
// GetLimit returns the value of the Limit parameter
|
|
|
|
func (s *strip) GetLimit() int {
|
|
|
|
return s.getter_int("Limit")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetLimit sets the value of the Limit parameter
|
|
|
|
func (s *strip) SetLimit(val int) {
|
|
|
|
s.setter_int("Limit", val)
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetLabel returns the value of the Label parameter
|
2022-06-22 20:51:25 +01:00
|
|
|
func (s *strip) GetLabel() string {
|
|
|
|
return s.getter_string("Label")
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetLabel sets the value of the Label parameter
|
2022-06-22 20:51:25 +01:00
|
|
|
func (s *strip) SetLabel(val string) {
|
|
|
|
s.setter_string("Label", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetGain returns the value of the Gain parameter
|
|
|
|
func (s *strip) GetGain() float64 {
|
|
|
|
return s.getter_float("Gain")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetGain sets the value of the Gain parameter
|
|
|
|
func (s *strip) SetGain(val float32) {
|
|
|
|
s.setter_float("Gain", val)
|
|
|
|
}
|
2022-06-23 10:42:11 +01:00
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
// GainLayer returns the gainlayer field
|
2022-06-28 19:30:37 +01:00
|
|
|
func (s *strip) GainLayer() []gainLayer {
|
|
|
|
return s.gainLayer
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
// Levels returns the gainlayer field
|
|
|
|
func (s *strip) Levels() *levels {
|
|
|
|
return &s.levels
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
type physicalStrip struct {
|
|
|
|
strip
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
func newPhysicalStrip(i int, k *kind) t_strip {
|
2022-07-01 01:35:54 +01:00
|
|
|
o := newOutputs(fmt.Sprintf("strip[%d]", i), i)
|
2022-06-28 19:30:37 +01:00
|
|
|
gl := make([]gainLayer, 8)
|
|
|
|
for j := 0; j < 8; j++ {
|
|
|
|
gl[j] = newGainLayer(i, j)
|
|
|
|
}
|
2022-06-30 20:08:46 +01:00
|
|
|
l := newStripLevels(i, k)
|
|
|
|
ps := physicalStrip{strip{iRemote{fmt.Sprintf("strip[%d]", i), i}, o, gl, l}}
|
2022-06-23 10:42:11 +01:00
|
|
|
return t_strip(&ps)
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// implement fmt.stringer interface in fmt
|
2022-06-25 01:18:20 +01:00
|
|
|
func (p *physicalStrip) String() string {
|
|
|
|
return fmt.Sprintf("PhysicalStrip%d", p.index)
|
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetComp returns the value of the Comp parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) GetComp() float64 {
|
|
|
|
return p.getter_float("Comp")
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetComp sets the value of the Comp parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) SetComp(val float32) {
|
|
|
|
p.setter_float("Comp", val)
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetGate returns the value of the Gate parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) GetGate() float64 {
|
|
|
|
return p.getter_float("Gate")
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetGate sets the value of the Gate parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) SetGate(val float32) {
|
|
|
|
p.setter_float("Gate", val)
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// GetAudibility returns the value of the Audibility parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) GetAudibility() float64 {
|
|
|
|
return p.getter_float("Audibility")
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
2022-06-24 14:54:17 +01:00
|
|
|
// SetAudibility sets the value of the Audibility parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (p *physicalStrip) SetAudibility(val float32) {
|
|
|
|
p.setter_float("Audibility", val)
|
2022-06-23 10:42:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetMc panics reason invalid parameter
|
|
|
|
func (p *physicalStrip) GetMc() bool {
|
|
|
|
panic("invalid parameter MC for physicalStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMc panics reason invalid parameter
|
|
|
|
func (p *physicalStrip) SetMc(val bool) {
|
|
|
|
panic("invalid parameter MC for physicalStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
type virtualStrip struct {
|
|
|
|
strip
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
func newVirtualStrip(i int, k *kind) t_strip {
|
2022-07-01 01:35:54 +01:00
|
|
|
o := newOutputs(fmt.Sprintf("strip[%d]", i), i)
|
2022-06-28 19:30:37 +01:00
|
|
|
gl := make([]gainLayer, 8)
|
|
|
|
for j := 0; j < 8; j++ {
|
|
|
|
gl[j] = newGainLayer(i, j)
|
|
|
|
}
|
2022-06-30 20:08:46 +01:00
|
|
|
l := newStripLevels(i, k)
|
|
|
|
vs := virtualStrip{strip{iRemote{fmt.Sprintf("strip[%d]", i), i}, o, gl, l}}
|
2022-06-23 10:42:11 +01:00
|
|
|
return t_strip(&vs)
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// implement fmt.stringer interface in fmt
|
2022-06-25 01:18:20 +01:00
|
|
|
func (v *virtualStrip) String() string {
|
|
|
|
return fmt.Sprintf("VirtualStrip%d", v.index)
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
// GetMc returns the value of the MC parameter
|
|
|
|
func (v *virtualStrip) GetMc() bool {
|
|
|
|
return v.getter_bool("MC")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMc sets the value of the MC parameter
|
|
|
|
func (v *virtualStrip) SetMc(val bool) {
|
|
|
|
v.setter_bool("MC", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetComp panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) GetComp() float64 {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Comp for virtualStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetComp panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) SetComp(val float32) {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Comp for virtualStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetGate panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) GetGate() float64 {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Gate for virtualStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetGate panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) SetGate(val float32) {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Gate for virtualStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetAudibility panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) GetAudibility() float64 {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Audibility for virtualStrip")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAudibility panics reason invalid parameter
|
2022-06-30 22:20:18 +01:00
|
|
|
func (v *virtualStrip) SetAudibility(val float32) {
|
2022-06-23 10:42:11 +01:00
|
|
|
panic("invalid parameter Audibility for virtualStrip")
|
|
|
|
}
|
2022-06-28 19:30:37 +01:00
|
|
|
|
|
|
|
type gainLayer struct {
|
|
|
|
iRemote
|
|
|
|
index int
|
|
|
|
}
|
|
|
|
|
|
|
|
func newGainLayer(i, j int) gainLayer {
|
|
|
|
return gainLayer{iRemote{fmt.Sprintf("strip[%d]", i), i}, j}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gl *gainLayer) Get() float64 {
|
|
|
|
return gl.getter_float(fmt.Sprintf("gainlayer[%d]", gl.index))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gl *gainLayer) Set(val float32) {
|
|
|
|
gl.setter_float(fmt.Sprintf("gainlayer[%d]", gl.index), val)
|
|
|
|
}
|
2022-06-30 20:08:46 +01:00
|
|
|
|
|
|
|
func newStripLevels(i int, k *kind) levels {
|
|
|
|
var init int
|
|
|
|
var os int
|
|
|
|
if i < k.physIn {
|
|
|
|
init = i * 2
|
|
|
|
os = 2
|
|
|
|
} else {
|
|
|
|
init = (k.physIn * 2) + ((i - k.physIn) * 8)
|
|
|
|
os = 8
|
|
|
|
}
|
2022-07-09 19:01:58 +01:00
|
|
|
return levels{iRemote{fmt.Sprintf("strip[%d]", i), i}, k, init, os, "strip"}
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *levels) PreFader() []float32 {
|
2022-07-09 19:01:58 +01:00
|
|
|
_levelCache.stripMode = 0
|
2022-06-30 20:08:46 +01:00
|
|
|
var levels []float32
|
|
|
|
for i := l.init; i < l.init+l.offset; i++ {
|
2022-07-09 19:01:58 +01:00
|
|
|
levels = append(levels, l.convertLevel(_levelCache.stripLevels[i]))
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
return levels
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *levels) PostFader() []float32 {
|
2022-07-09 19:01:58 +01:00
|
|
|
_levelCache.stripMode = 1
|
2022-06-30 20:08:46 +01:00
|
|
|
var levels []float32
|
|
|
|
for i := l.init; i < l.init+l.offset; i++ {
|
2022-07-09 19:01:58 +01:00
|
|
|
levels = append(levels, l.convertLevel(_levelCache.stripLevels[i]))
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
return levels
|
|
|
|
}
|
|
|
|
|
|
|
|
func (l *levels) PostMute() []float32 {
|
2022-07-09 19:01:58 +01:00
|
|
|
_levelCache.stripMode = 2
|
2022-06-30 20:08:46 +01:00
|
|
|
var levels []float32
|
|
|
|
for i := l.init; i < l.init+l.offset; i++ {
|
2022-07-09 19:01:58 +01:00
|
|
|
levels = append(levels, l.convertLevel(_levelCache.stripLevels[i]))
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
return levels
|
|
|
|
}
|
2022-07-09 19:01:58 +01:00
|
|
|
|
|
|
|
func (l *levels) IsDirty() bool {
|
|
|
|
var vals []bool
|
|
|
|
if l.id == "strip" {
|
|
|
|
vals = _levelCache.stripComp[l.init : l.init+l.offset]
|
|
|
|
} else if l.id == "bus" {
|
|
|
|
vals = _levelCache.busComp[l.init : l.init+l.offset]
|
|
|
|
}
|
|
|
|
return !allTrue(vals, l.offset)
|
|
|
|
}
|