2022-06-22 20:51:25 +01:00
|
|
|
package voicemeeter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
type t_bus interface {
|
2022-06-25 01:18:20 +01:00
|
|
|
String() string
|
2022-06-23 10:42:11 +01:00
|
|
|
GetMute() bool
|
|
|
|
SetMute(val bool)
|
|
|
|
GetEq() bool
|
|
|
|
SetEq(val bool)
|
|
|
|
GetMono() bool
|
|
|
|
SetMono(val bool)
|
|
|
|
GetLabel() string
|
|
|
|
SetLabel(val string)
|
|
|
|
GetGain() float64
|
|
|
|
SetGain(val float32)
|
2022-06-28 17:32:03 +01:00
|
|
|
Mode() t_busMode
|
2022-06-30 20:08:46 +01:00
|
|
|
Levels() *levels
|
2022-06-22 20:51:25 +01:00
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
// bus represents a bus channel
|
|
|
|
type bus struct {
|
2022-06-23 14:03:00 +01:00
|
|
|
iRemote
|
2022-06-28 17:32:03 +01:00
|
|
|
mode busMode
|
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 (b *bus) GetMute() bool {
|
|
|
|
return b.getter_bool("Mute")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMute sets the value of the Mute parameter
|
|
|
|
func (b *bus) SetMute(val bool) {
|
|
|
|
b.setter_bool("Mute", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetEq returns the value of the Eq.On parameter
|
|
|
|
func (b *bus) GetEq() bool {
|
|
|
|
return b.getter_bool("Eq.On")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetEq sets the value of the Eq.On parameter
|
|
|
|
func (b *bus) SetEq(val bool) {
|
|
|
|
b.setter_bool("Eq.On", val)
|
|
|
|
}
|
2022-06-23 10:42:11 +01:00
|
|
|
|
|
|
|
// GetMono returns the value of the Mute parameter
|
|
|
|
func (b *bus) GetMono() bool {
|
|
|
|
return b.getter_bool("Mono")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetMono sets the value of the Mute parameter
|
|
|
|
func (b *bus) SetMono(val bool) {
|
|
|
|
b.setter_bool("Mono", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetLabel returns the value of the MC parameter
|
|
|
|
func (b *bus) GetLabel() string {
|
|
|
|
return b.getter_string("Label")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetLabel sets the value of the MC parameter
|
|
|
|
func (b *bus) SetLabel(val string) {
|
|
|
|
b.setter_string("Label", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetGain returns the value of the Gain parameter
|
|
|
|
func (b *bus) GetGain() float64 {
|
|
|
|
return b.getter_float("Gain")
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetGain sets the value of the Gain parameter
|
|
|
|
func (b *bus) SetGain(val float32) {
|
|
|
|
b.setter_float("Gain", val)
|
|
|
|
}
|
|
|
|
|
2022-06-28 17:32:03 +01:00
|
|
|
// Mode returns address of a busMode struct
|
|
|
|
func (b *bus) Mode() t_busMode {
|
|
|
|
return &b.mode
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
// Levels returns the gainlayer field
|
|
|
|
func (b *bus) Levels() *levels {
|
|
|
|
return &b.levels
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
type physicalBus struct {
|
|
|
|
bus
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
func newPhysicalBus(i int, k *kind) t_bus {
|
|
|
|
b := newBusMode(i)
|
|
|
|
l := newBusLevels(i, k)
|
|
|
|
pb := physicalBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}, b, l}}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
return t_bus(&pb)
|
|
|
|
}
|
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// String implements the fmt.stringer interface
|
2022-06-25 01:18:20 +01:00
|
|
|
func (p *physicalBus) String() string {
|
|
|
|
return fmt.Sprintf("PhysicalBus%d", p.index)
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:42:11 +01:00
|
|
|
type virtualBus struct {
|
|
|
|
bus
|
|
|
|
}
|
|
|
|
|
2022-06-30 20:08:46 +01:00
|
|
|
func newVirtualBus(i int, k *kind) t_bus {
|
|
|
|
b := newBusMode(i)
|
|
|
|
l := newBusLevels(i, k)
|
|
|
|
vb := virtualBus{bus{iRemote{fmt.Sprintf("bus[%d]", i), i}, b, l}}
|
2022-06-23 10:42:11 +01:00
|
|
|
return t_bus(&vb)
|
|
|
|
}
|
2022-06-25 01:18:20 +01:00
|
|
|
|
2022-06-26 01:36:32 +01:00
|
|
|
// String implements the fmt.stringer interface
|
2022-06-25 01:18:20 +01:00
|
|
|
func (v *virtualBus) String() string {
|
|
|
|
return fmt.Sprintf("VirtualBus%d", v.index)
|
|
|
|
}
|
2022-06-28 17:32:03 +01:00
|
|
|
|
|
|
|
type t_busMode interface {
|
|
|
|
SetNormal(val bool)
|
|
|
|
GetNormal() bool
|
|
|
|
SetAmix(val bool)
|
|
|
|
GetAmix() bool
|
|
|
|
SetBmix(val bool)
|
|
|
|
GetBmix() bool
|
|
|
|
SetRepeat(val bool)
|
|
|
|
GetRepeat() bool
|
|
|
|
SetComposite(val bool)
|
|
|
|
GetComposite() bool
|
|
|
|
SetTvMix(val bool)
|
|
|
|
GetTvMix() bool
|
|
|
|
SetUpMix21(val bool)
|
|
|
|
GetUpMix21() bool
|
|
|
|
SetUpMix41(val bool)
|
|
|
|
GetUpMix41() bool
|
|
|
|
SetUpMix61(val bool)
|
|
|
|
GetUpMix61() bool
|
|
|
|
SetCenterOnly(val bool)
|
|
|
|
GetCenterOnly() bool
|
|
|
|
SetLfeOnly(val bool)
|
|
|
|
GetLfeOnly() bool
|
|
|
|
SetRearOnly(val bool)
|
|
|
|
GetRearOnly() bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type busMode struct {
|
|
|
|
iRemote
|
|
|
|
}
|
|
|
|
|
2022-06-28 19:30:37 +01:00
|
|
|
func newBusMode(i int) busMode {
|
|
|
|
return busMode{iRemote{fmt.Sprintf("bus[%d].mode", i), i}}
|
|
|
|
}
|
|
|
|
|
2022-06-28 17:32:03 +01:00
|
|
|
func (bm *busMode) SetNormal(val bool) {
|
|
|
|
bm.setter_bool("Normal", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetNormal() bool {
|
|
|
|
return bm.getter_bool("Normal")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetAmix(val bool) {
|
|
|
|
bm.setter_bool("Amix", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetAmix() bool {
|
|
|
|
return bm.getter_bool("Amix")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetBmix(val bool) {
|
|
|
|
bm.setter_bool("Bmix", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetBmix() bool {
|
|
|
|
return bm.getter_bool("Bmix")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetRepeat(val bool) {
|
|
|
|
bm.setter_bool("Repeat", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetRepeat() bool {
|
|
|
|
return bm.getter_bool("Repeat")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetComposite(val bool) {
|
|
|
|
bm.setter_bool("Composite", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetComposite() bool {
|
|
|
|
return bm.getter_bool("Composite")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetTvMix(val bool) {
|
|
|
|
bm.setter_bool("TvMix", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetTvMix() bool {
|
|
|
|
return bm.getter_bool("TvMix")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetUpMix21(val bool) {
|
|
|
|
bm.setter_bool("UpMix21", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetUpMix21() bool {
|
|
|
|
return bm.getter_bool("UpMix21")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetUpMix41(val bool) {
|
|
|
|
bm.setter_bool("UpMix41", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetUpMix41() bool {
|
|
|
|
return bm.getter_bool("UpMix41")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetUpMix61(val bool) {
|
|
|
|
bm.setter_bool("UpMix61", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetUpMix61() bool {
|
|
|
|
return bm.getter_bool("UpMix61")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetCenterOnly(val bool) {
|
|
|
|
bm.setter_bool("CenterOnly", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetCenterOnly() bool {
|
|
|
|
return bm.getter_bool("CenterOnly")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetLfeOnly(val bool) {
|
|
|
|
bm.setter_bool("LfeOnly", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetLfeOnly() bool {
|
|
|
|
return bm.getter_bool("LfeOnly")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) SetRearOnly(val bool) {
|
|
|
|
bm.setter_bool("RearOnly", val)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bm *busMode) GetRearOnly() bool {
|
|
|
|
return bm.getter_bool("RearOnly")
|
|
|
|
}
|
2022-06-30 20:08:46 +01:00
|
|
|
|
|
|
|
func newBusLevels(i int, k *kind) levels {
|
2022-06-30 23:09:26 +01:00
|
|
|
init := i * 8
|
2022-07-09 19:01:58 +01:00
|
|
|
return levels{iRemote{fmt.Sprintf("bus[%d]", i), i}, k, init, 8, "bus"}
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (l *levels) All() []float32 {
|
|
|
|
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.busLevels[i]))
|
2022-06-30 20:08:46 +01:00
|
|
|
}
|
|
|
|
return levels
|
|
|
|
}
|