mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-12-04 02:10:46 +00:00
higher methods/functions now accept/return float64
update tests update readme, changelog
This commit is contained in:
parent
67cb8509b4
commit
a4b84f289e
10
CHANGELOG.md
10
CHANGELOG.md
@ -11,6 +11,16 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
|
|||||||
|
|
||||||
- [x]
|
- [x]
|
||||||
|
|
||||||
|
## [1.6.0] - 2022-09-14
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- vm.Sync() can now be used to force the dirty parameters to clear.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- higher level methods/functions now accept/return float64
|
||||||
|
|
||||||
## [1.5.0] - 2022-09-07
|
## [1.5.0] - 2022-09-07
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
25
README.md
25
README.md
@ -56,6 +56,7 @@ func main() {
|
|||||||
|
|
||||||
vm.Strip[0].SetLabel("rode podmic")
|
vm.Strip[0].SetLabel("rode podmic")
|
||||||
vm.Strip[0].SetMute(true)
|
vm.Strip[0].SetMute(true)
|
||||||
|
vm.Sync()
|
||||||
fmt.Printf("Strip 0 (%s) mute was set to %v\n", vm.Strip[0].GetLabel(), vm.Strip[0].GetMute())
|
fmt.Printf("Strip 0 (%s) mute was set to %v\n", vm.Strip[0].GetLabel(), vm.Strip[0].GetMute())
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -154,6 +155,10 @@ returns True iff a GUI parameter has changed
|
|||||||
|
|
||||||
returns True iff a macrobutton parameter has changed
|
returns True iff a macrobutton parameter has changed
|
||||||
|
|
||||||
|
#### `vm.Sync()`
|
||||||
|
|
||||||
|
Use this to force dirty parameters to clear before continuing. Useful for slowing down getters.
|
||||||
|
|
||||||
## `Available commands`
|
## `Available commands`
|
||||||
|
|
||||||
### Strip
|
### Strip
|
||||||
@ -171,15 +176,15 @@ The following methods are available
|
|||||||
- `GetLabel() string`
|
- `GetLabel() string`
|
||||||
- `SetLabel(val string)`
|
- `SetLabel(val string)`
|
||||||
- `GetGain() float64`
|
- `GetGain() float64`
|
||||||
- `SetGain(val float32)` from -60.0 to 12.0
|
- `SetGain(val float64)` from -60.0 to 12.0
|
||||||
- `GetMc() bool`
|
- `GetMc() bool`
|
||||||
- `SetMc(val bool)`
|
- `SetMc(val bool)`
|
||||||
- `GetComp() float64`
|
- `GetComp() float64`
|
||||||
- `SetComp(val float32)` from 0.0 to 10.0
|
- `SetComp(val float64)` from 0.0 to 10.0
|
||||||
- `GetGate() float64`
|
- `GetGate() float64`
|
||||||
- `SetGate(val float32)` from 0.0 to 10.0
|
- `SetGate(val float64)` from 0.0 to 10.0
|
||||||
- `GetAudibility() float64`
|
- `GetAudibility() float64`
|
||||||
- `SetAudibility(val float32)` from 0.0 to 10.0
|
- `SetAudibility(val float64)` from 0.0 to 10.0
|
||||||
- `GetA1() bool - GetA5() bool`
|
- `GetA1() bool - GetA5() bool`
|
||||||
- `SetA1(val bool) - SetA5(val bool)`
|
- `SetA1(val bool) - SetA5(val bool)`
|
||||||
|
|
||||||
@ -198,7 +203,7 @@ vm.Strip[4].SetA1(true)
|
|||||||
The following methods are available
|
The following methods are available
|
||||||
|
|
||||||
- `Get() float64`
|
- `Get() float64`
|
||||||
- `Set(val float32)`
|
- `Set(val float64)`
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
@ -212,9 +217,9 @@ vm.Strip[6].GainLayer()[3].Set(-13.6)
|
|||||||
|
|
||||||
The following methods are available
|
The following methods are available
|
||||||
|
|
||||||
- `PreFader() []float32`
|
- `PreFader() []float64`
|
||||||
- `PostFader() []float32`
|
- `PostFader() []float64`
|
||||||
- `PostMute() []float32`
|
- `PostMute() []float64`
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
@ -236,7 +241,7 @@ The following methods are available
|
|||||||
- `GetLabel() string`
|
- `GetLabel() string`
|
||||||
- `SetLabel(val string)`
|
- `SetLabel(val string)`
|
||||||
- `GetGain() float64`
|
- `GetGain() float64`
|
||||||
- `SetGain(val float32)` from -60.0 to 12.0
|
- `SetGain(val float64)` from -60.0 to 12.0
|
||||||
|
|
||||||
```go
|
```go
|
||||||
vm.Bus[3].SetEq(true)
|
vm.Bus[3].SetEq(true)
|
||||||
@ -287,7 +292,7 @@ vm.Bus[4].Mode().SetCenterOnly(true)
|
|||||||
|
|
||||||
The following methods are available
|
The following methods are available
|
||||||
|
|
||||||
- `All() []float32`
|
- `All() []float64`
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
|
16
base.go
16
base.go
@ -115,8 +115,8 @@ func mdirty() bool {
|
|||||||
|
|
||||||
// ldirty returns true iff a level value has changed
|
// ldirty returns true iff a level value has changed
|
||||||
func ldirty(k *kind) bool {
|
func ldirty(k *kind) bool {
|
||||||
_levelCache.stripLevelsBuff = make([]float32, (2*k.PhysIn)+(8*k.VirtIn))
|
_levelCache.stripLevelsBuff = make([]float64, (2*k.PhysIn)+(8*k.VirtIn))
|
||||||
_levelCache.busLevelsBuff = make([]float32, 8*k.NumBus())
|
_levelCache.busLevelsBuff = make([]float64, 8*k.NumBus())
|
||||||
|
|
||||||
for i := 0; i < (2*k.PhysIn)+(8*k.VirtIn); i++ {
|
for i := 0; i < (2*k.PhysIn)+(8*k.VirtIn); i++ {
|
||||||
val, _ := getLevel(_levelCache.stripMode, i)
|
val, _ := getLevel(_levelCache.stripMode, i)
|
||||||
@ -165,9 +165,9 @@ func getParameterFloat(name string) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setParameterFloat sets the value of a float parameter
|
// setParameterFloat sets the value of a float parameter
|
||||||
func setParameterFloat(name string, value float32) error {
|
func setParameterFloat(name string, value float64) error {
|
||||||
b1 := append([]byte(name), 0)
|
b1 := append([]byte(name), 0)
|
||||||
b2 := math.Float32bits(value)
|
b2 := math.Float32bits(float32(value))
|
||||||
res, _, _ := vmSetParamFloat.Call(
|
res, _, _ := vmSetParamFloat.Call(
|
||||||
uintptr(unsafe.Pointer(&b1[0])),
|
uintptr(unsafe.Pointer(&b1[0])),
|
||||||
uintptr(b2),
|
uintptr(b2),
|
||||||
@ -224,7 +224,7 @@ func setParametersMulti(script string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getMacroStatus gets a macrobutton value
|
// getMacroStatus gets a macrobutton value
|
||||||
func getMacroStatus(id, mode int) (float32, error) {
|
func getMacroStatus(id, mode int) (float64, error) {
|
||||||
var state float32
|
var state float32
|
||||||
res, _, _ := vmGetMacroStatus.Call(
|
res, _, _ := vmGetMacroStatus.Call(
|
||||||
uintptr(id),
|
uintptr(id),
|
||||||
@ -235,7 +235,7 @@ func getMacroStatus(id, mode int) (float32, error) {
|
|||||||
err := fmt.Errorf("VBVMR_MacroButton_GetStatus returned %d", res)
|
err := fmt.Errorf("VBVMR_MacroButton_GetStatus returned %d", res)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return state, nil
|
return float64(state), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setMacroStatus sets a macrobutton value
|
// setMacroStatus sets a macrobutton value
|
||||||
@ -297,8 +297,8 @@ func getDeviceDescription(i int, dir string) (string, uint64, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getLevel returns a single level value of type type_ for channel[i]
|
// getLevel returns a single level value of type type_ for channel[i]
|
||||||
func getLevel(type_, i int) (float32, error) {
|
func getLevel(type_, i int) (float64, error) {
|
||||||
var val float32
|
var val float64
|
||||||
res, _, _ := vmGetLevelFloat.Call(
|
res, _, _ := vmGetLevelFloat.Call(
|
||||||
uintptr(type_),
|
uintptr(type_),
|
||||||
uintptr(i),
|
uintptr(i),
|
||||||
|
12
bus.go
12
bus.go
@ -17,7 +17,7 @@ type iBus interface {
|
|||||||
GetLabel() string
|
GetLabel() string
|
||||||
SetLabel(val string)
|
SetLabel(val string)
|
||||||
GetGain() float64
|
GetGain() float64
|
||||||
SetGain(val float32)
|
SetGain(val float64)
|
||||||
Mode() iBusMode
|
Mode() iBusMode
|
||||||
Levels() *levels
|
Levels() *levels
|
||||||
FadeTo(target float32, time_ int)
|
FadeTo(target float32, time_ int)
|
||||||
@ -77,7 +77,7 @@ func (b *bus) GetGain() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGain sets the value of the Gain parameter
|
// SetGain sets the value of the Gain parameter
|
||||||
func (b *bus) SetGain(val float32) {
|
func (b *bus) SetGain(val float64) {
|
||||||
b.setter_float("Gain", val)
|
b.setter_float("Gain", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ func (b *bus) FadeBy(change float32, time_ int) {
|
|||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
//physicalBus represents a single physical bus
|
// physicalBus represents a single physical bus
|
||||||
type physicalBus struct {
|
type physicalBus struct {
|
||||||
bus
|
bus
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ func (p *physicalBus) String() string {
|
|||||||
return fmt.Sprintf("PhysicalBus%d", p.index)
|
return fmt.Sprintf("PhysicalBus%d", p.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtualBus represents a single virtual bus
|
// virtualBus represents a single virtual bus
|
||||||
type virtualBus struct {
|
type virtualBus struct {
|
||||||
bus
|
bus
|
||||||
}
|
}
|
||||||
@ -305,8 +305,8 @@ func newBusLevels(i int, k *kind) levels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All returns the level values for a bus
|
// All returns the level values for a bus
|
||||||
func (l *levels) All() []float32 {
|
func (l *levels) All() []float64 {
|
||||||
var levels []float32
|
var levels []float64
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := l.init; i < l.init+l.offset; i++ {
|
||||||
levels = append(levels, convertLevel(_levelCache.busLevels[i]))
|
levels = append(levels, convertLevel(_levelCache.busLevels[i]))
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package voicemeeter
|
package voicemeeter
|
||||||
|
|
||||||
//command represents command (action) type parameters
|
// command represents command (action) type parameters
|
||||||
type command struct {
|
type command struct {
|
||||||
iRemote
|
iRemote
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ func (c *command) Restart() {
|
|||||||
|
|
||||||
// Lock locks or unlocks the Voiceemeter GUI
|
// Lock locks or unlocks the Voiceemeter GUI
|
||||||
func (c *command) Lock(val bool) {
|
func (c *command) Lock(val bool) {
|
||||||
var value float32
|
var value float64
|
||||||
if val {
|
if val {
|
||||||
value = 1
|
value = 1
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,7 +35,7 @@ func (ir *iRemote) setter_bool(p string, v bool) {
|
|||||||
} else {
|
} else {
|
||||||
value = 0
|
value = 0
|
||||||
}
|
}
|
||||||
err := setParameterFloat(param, float32(value))
|
err := setParameterFloat(param, float64(value))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ func (ir *iRemote) getter_int(p string) int {
|
|||||||
// setter_int sets the value v of an int parameter p
|
// setter_int sets the value v of an int parameter p
|
||||||
func (ir *iRemote) setter_int(p string, v int) {
|
func (ir *iRemote) setter_int(p string, v int) {
|
||||||
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
err := setParameterFloat(param, float32(v))
|
err := setParameterFloat(param, float64(v))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
@ -71,9 +71,9 @@ func (ir *iRemote) getter_float(p string) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setter_float sets the value v of an int parameter p
|
// setter_float sets the value v of an int parameter p
|
||||||
func (ir *iRemote) setter_float(p string, v float32) {
|
func (ir *iRemote) setter_float(p string, v float64) {
|
||||||
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
param := fmt.Sprintf("%s.%s", ir.identifier(), p)
|
||||||
err := setParameterFloat(param, float32(v))
|
err := setParameterFloat(param, float64(v))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
12
levels.go
12
levels.go
@ -25,18 +25,18 @@ var _levelCache *levelCache
|
|||||||
// levelCache defines level slices used by the pooler to track updates
|
// levelCache defines level slices used by the pooler to track updates
|
||||||
type levelCache struct {
|
type levelCache struct {
|
||||||
stripMode int
|
stripMode int
|
||||||
stripLevels []float32
|
stripLevels []float64
|
||||||
busLevels []float32
|
busLevels []float64
|
||||||
stripLevelsBuff []float32
|
stripLevelsBuff []float64
|
||||||
busLevelsBuff []float32
|
busLevelsBuff []float64
|
||||||
stripComp []bool
|
stripComp []bool
|
||||||
busComp []bool
|
busComp []bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// newLevelCache returns a levelCache struct address
|
// newLevelCache returns a levelCache struct address
|
||||||
func newLevelCache(k *kind) *levelCache {
|
func newLevelCache(k *kind) *levelCache {
|
||||||
stripLevels := make([]float32, (2*k.PhysIn)+(8*k.VirtIn))
|
stripLevels := make([]float64, (2*k.PhysIn)+(8*k.VirtIn))
|
||||||
busLevels := make([]float32, 8*k.NumBus())
|
busLevels := make([]float64, 8*k.NumBus())
|
||||||
stripComp := make([]bool, (2*k.PhysIn)+(8*k.VirtIn))
|
stripComp := make([]bool, (2*k.PhysIn)+(8*k.VirtIn))
|
||||||
busComp := make([]bool, 8*k.NumBus())
|
busComp := make([]bool, 8*k.NumBus())
|
||||||
if _levelCache == nil {
|
if _levelCache == nil {
|
||||||
|
@ -74,6 +74,12 @@ func (r *Remote) Mdirty() bool {
|
|||||||
return mdirty()
|
return mdirty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sync is a helper method that waits for dirty parameters to clear
|
||||||
|
func (r *Remote) Sync() {
|
||||||
|
for r.Pdirty() || r.Mdirty() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Gets a float parameter value
|
// Gets a float parameter value
|
||||||
func (r *Remote) GetFloat(name string) float64 {
|
func (r *Remote) GetFloat(name string) float64 {
|
||||||
val, err := getParameterFloat(name)
|
val, err := getParameterFloat(name)
|
||||||
@ -84,7 +90,7 @@ func (r *Remote) GetFloat(name string) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sets a float paramter value
|
// Sets a float paramter value
|
||||||
func (r *Remote) SetFloat(name string, value float32) {
|
func (r *Remote) SetFloat(name string, value float64) {
|
||||||
setParameterFloat(name, value)
|
setParameterFloat(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
strip.go
54
strip.go
@ -19,20 +19,20 @@ type iStrip interface {
|
|||||||
GetLabel() string
|
GetLabel() string
|
||||||
SetLabel(val string)
|
SetLabel(val string)
|
||||||
GetGain() float64
|
GetGain() float64
|
||||||
SetGain(val float32)
|
SetGain(val float64)
|
||||||
GetMc() bool
|
GetMc() bool
|
||||||
SetMc(val bool)
|
SetMc(val bool)
|
||||||
GetComp() float64
|
GetComp() float64
|
||||||
SetComp(val float32)
|
SetComp(val float64)
|
||||||
GetGate() float64
|
GetGate() float64
|
||||||
SetGate(val float32)
|
SetGate(val float64)
|
||||||
GetAudibility() float64
|
GetAudibility() float64
|
||||||
SetAudibility(val float32)
|
SetAudibility(val float64)
|
||||||
GainLayer() []gainLayer
|
GainLayer() []gainLayer
|
||||||
Levels() *levels
|
Levels() *levels
|
||||||
FadeTo(target float32, time_ int)
|
FadeTo(target float64, time_ int)
|
||||||
FadeBy(change float32, time_ int)
|
FadeBy(change float64, time_ int)
|
||||||
AppGain(name string, gain float32)
|
AppGain(name string, gain float64)
|
||||||
AppMute(name string, val bool)
|
AppMute(name string, val bool)
|
||||||
iOutputs
|
iOutputs
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ func (s *strip) GetGain() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGain sets the value of the Gain parameter
|
// SetGain sets the value of the Gain parameter
|
||||||
func (s *strip) SetGain(val float32) {
|
func (s *strip) SetGain(val float64) {
|
||||||
s.setter_float("Gain", val)
|
s.setter_float("Gain", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,18 +116,18 @@ func (s *strip) Levels() *levels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FadeTo sets the value of gain to target over at time interval of time_
|
// FadeTo sets the value of gain to target over at time interval of time_
|
||||||
func (s *strip) FadeTo(target float32, time_ int) {
|
func (s *strip) FadeTo(target float64, time_ int) {
|
||||||
s.setter_string("FadeTo", fmt.Sprintf("(\"%f\", %d)", target, time_))
|
s.setter_string("FadeTo", fmt.Sprintf("(\"%f\", %d)", target, time_))
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FadeBy adjusts the value of gain by change over a time interval of time_
|
// FadeBy adjusts the value of gain by change over a time interval of time_
|
||||||
func (s *strip) FadeBy(change float32, time_ int) {
|
func (s *strip) FadeBy(change float64, time_ int) {
|
||||||
s.setter_string("FadeBy", fmt.Sprintf("(\"%f\", %d)", change, time_))
|
s.setter_string("FadeBy", fmt.Sprintf("(\"%f\", %d)", change, time_))
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
//physicalStrip represents a single physical strip
|
// physicalStrip represents a single physical strip
|
||||||
type physicalStrip struct {
|
type physicalStrip struct {
|
||||||
strip
|
strip
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ func (p *physicalStrip) GetComp() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetComp sets the value of the Comp parameter
|
// SetComp sets the value of the Comp parameter
|
||||||
func (p *physicalStrip) SetComp(val float32) {
|
func (p *physicalStrip) SetComp(val float64) {
|
||||||
p.setter_float("Comp", val)
|
p.setter_float("Comp", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ func (p *physicalStrip) GetGate() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGate sets the value of the Gate parameter
|
// SetGate sets the value of the Gate parameter
|
||||||
func (p *physicalStrip) SetGate(val float32) {
|
func (p *physicalStrip) SetGate(val float64) {
|
||||||
p.setter_float("Gate", val)
|
p.setter_float("Gate", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ func (p *physicalStrip) GetAudibility() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetAudibility sets the value of the Audibility parameter
|
// SetAudibility sets the value of the Audibility parameter
|
||||||
func (p *physicalStrip) SetAudibility(val float32) {
|
func (p *physicalStrip) SetAudibility(val float64) {
|
||||||
p.setter_float("Audibility", val)
|
p.setter_float("Audibility", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ func (p *physicalStrip) SetMc(val bool) {
|
|||||||
panic("invalid parameter MC for physicalStrip")
|
panic("invalid parameter MC for physicalStrip")
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtualStrip represents a single virtual strip
|
// virtualStrip represents a single virtual strip
|
||||||
type virtualStrip struct {
|
type virtualStrip struct {
|
||||||
strip
|
strip
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ func (v *virtualStrip) GetComp() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetComp panics reason invalid parameter
|
// SetComp panics reason invalid parameter
|
||||||
func (v *virtualStrip) SetComp(val float32) {
|
func (v *virtualStrip) SetComp(val float64) {
|
||||||
panic("invalid parameter Comp for virtualStrip")
|
panic("invalid parameter Comp for virtualStrip")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ func (v *virtualStrip) GetGate() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGate panics reason invalid parameter
|
// SetGate panics reason invalid parameter
|
||||||
func (v *virtualStrip) SetGate(val float32) {
|
func (v *virtualStrip) SetGate(val float64) {
|
||||||
panic("invalid parameter Gate for virtualStrip")
|
panic("invalid parameter Gate for virtualStrip")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,12 +247,12 @@ func (v *virtualStrip) GetAudibility() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetAudibility panics reason invalid parameter
|
// SetAudibility panics reason invalid parameter
|
||||||
func (v *virtualStrip) SetAudibility(val float32) {
|
func (v *virtualStrip) SetAudibility(val float64) {
|
||||||
panic("invalid parameter Audibility for virtualStrip")
|
panic("invalid parameter Audibility for virtualStrip")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppGain sets the gain in db by val for the app matching name.
|
// AppGain sets the gain in db by val for the app matching name.
|
||||||
func (v *strip) AppGain(name string, val float32) {
|
func (v *strip) AppGain(name string, val float64) {
|
||||||
v.setter_string("AppGain", fmt.Sprintf("(\"%s\", %f)", name, val))
|
v.setter_string("AppGain", fmt.Sprintf("(\"%s\", %f)", name, val))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ func (v *strip) AppMute(name string, val bool) {
|
|||||||
} else {
|
} else {
|
||||||
value = 0
|
value = 0
|
||||||
}
|
}
|
||||||
v.setter_string("AppMute", fmt.Sprintf("(\"%s\", %f)", name, float32(value)))
|
v.setter_string("AppMute", fmt.Sprintf("(\"%s\", %f)", name, float64(value)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// gainLayer represents the 8 gainlayers for a single strip
|
// gainLayer represents the 8 gainlayers for a single strip
|
||||||
@ -284,7 +284,7 @@ func (gl *gainLayer) Get() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set sets the gain value for a single gainlayer
|
// Set sets the gain value for a single gainlayer
|
||||||
func (gl *gainLayer) Set(val float32) {
|
func (gl *gainLayer) Set(val float64) {
|
||||||
gl.setter_float(fmt.Sprintf("gainlayer[%d]", gl.index), val)
|
gl.setter_float(fmt.Sprintf("gainlayer[%d]", gl.index), val)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,9 +303,9 @@ func newStripLevels(i int, k *kind) levels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PreFader returns the level values for this strip, PREFADER mode
|
// PreFader returns the level values for this strip, PREFADER mode
|
||||||
func (l *levels) PreFader() []float32 {
|
func (l *levels) PreFader() []float64 {
|
||||||
_levelCache.stripMode = 0
|
_levelCache.stripMode = 0
|
||||||
var levels []float32
|
var levels []float64
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := l.init; i < l.init+l.offset; i++ {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||||
}
|
}
|
||||||
@ -313,9 +313,9 @@ func (l *levels) PreFader() []float32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostFader returns the level values for this strip, POSTFADER mode
|
// PostFader returns the level values for this strip, POSTFADER mode
|
||||||
func (l *levels) PostFader() []float32 {
|
func (l *levels) PostFader() []float64 {
|
||||||
_levelCache.stripMode = 1
|
_levelCache.stripMode = 1
|
||||||
var levels []float32
|
var levels []float64
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := l.init; i < l.init+l.offset; i++ {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||||
}
|
}
|
||||||
@ -323,9 +323,9 @@ func (l *levels) PostFader() []float32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostMute returns the level values for this strip, POSTMUTE mode
|
// PostMute returns the level values for this strip, POSTMUTE mode
|
||||||
func (l *levels) PostMute() []float32 {
|
func (l *levels) PostMute() []float64 {
|
||||||
_levelCache.stripMode = 2
|
_levelCache.stripMode = 2
|
||||||
var levels []float32
|
var levels []float64
|
||||||
for i := l.init; i < l.init+l.offset; i++ {
|
for i := l.init; i < l.init+l.offset; i++ {
|
||||||
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
levels = append(levels, convertLevel(_levelCache.stripLevels[i]))
|
||||||
}
|
}
|
||||||
|
6
util.go
6
util.go
@ -13,7 +13,7 @@ func allTrue(s []bool, sz int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update copies the contents of one float slice into another
|
// update copies the contents of one float slice into another
|
||||||
func update(s1 []float32, s2 []float32, sz int) {
|
func update(s1 []float64, s2 []float64, sz int) {
|
||||||
for i := 0; i < sz; i++ {
|
for i := 0; i < sz; i++ {
|
||||||
s1[i] = s2[i]
|
s1[i] = s2[i]
|
||||||
}
|
}
|
||||||
@ -26,10 +26,10 @@ func roundFloat(val float64, precision uint) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertLevel performs the necessary math for a channel level
|
// convertLevel performs the necessary math for a channel level
|
||||||
func convertLevel(i float32) float32 {
|
func convertLevel(i float64) float64 {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
val := 20 * math.Log10(float64(i))
|
val := 20 * math.Log10(float64(i))
|
||||||
return float32(roundFloat(float64(val), 1))
|
return float64(roundFloat(float64(val), 1))
|
||||||
}
|
}
|
||||||
return -200.0
|
return -200.0
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ func TestAllTrue(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdate(t *testing.T) {
|
func TestUpdate(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
s1 := []float32{3.6, 8.7, 1.8, 18.2}
|
s1 := []float64{3.6, 8.7, 1.8, 18.2}
|
||||||
s2 := make([]float32, len(s1))
|
s2 := make([]float64, len(s1))
|
||||||
update(s2, s1, len(s1))
|
update(s2, s1, len(s1))
|
||||||
t.Run("Should return true", func(t *testing.T) {
|
t.Run("Should return true", func(t *testing.T) {
|
||||||
assert.Equal(t, s1, s2)
|
assert.Equal(t, s1, s2)
|
||||||
@ -32,10 +32,10 @@ func TestConvertLevel(t *testing.T) {
|
|||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
res := convertLevel(0.02)
|
res := convertLevel(0.02)
|
||||||
t.Run("Should be equal", func(t *testing.T) {
|
t.Run("Should be equal", func(t *testing.T) {
|
||||||
assert.Equal(t, float32(-34), res)
|
assert.Equal(t, float64(-34), res)
|
||||||
})
|
})
|
||||||
res = convertLevel(-0.02)
|
res = convertLevel(-0.02)
|
||||||
t.Run("Should be equal", func(t *testing.T) {
|
t.Run("Should be equal", func(t *testing.T) {
|
||||||
assert.Equal(t, float32(-200), res)
|
assert.Equal(t, float64(-200), res)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user