mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-12-04 18:20:48 +00:00
fix type error in getLevel
This commit is contained in:
parent
5bb7eb9668
commit
7022c5dacf
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]
|
// getLevel returns a single level value of type type_ for channel[i]
|
||||||
func getLevel(type_, i int) (float64, error) {
|
func getLevel(type_, i int) (float64, error) {
|
||||||
var val float64
|
var val float32
|
||||||
res, _, _ := vmGetLevelFloat.Call(
|
res, _, _ := vmGetLevelFloat.Call(
|
||||||
uintptr(type_),
|
uintptr(type_),
|
||||||
uintptr(i),
|
uintptr(i),
|
||||||
@ -325,7 +325,7 @@ func getLevel(type_, i int) (float64, error) {
|
|||||||
err := fmt.Errorf("VBVMR_GetLevel returned %d", res)
|
err := fmt.Errorf("VBVMR_GetLevel returned %d", res)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return val, nil
|
return float64(val), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getMidiMessage gets midi channel, pitch and velocity for a single midi input
|
// getMidiMessage gets midi channel, pitch and velocity for a single midi input
|
||||||
|
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
|
// convertLevel performs the necessary math for a channel level
|
||||||
func convertLevel(i float64) float64 {
|
func convertLevel(i float64) float64 {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
val := 20 * math.Log10(float64(i))
|
val := 20 * math.Log10(i)
|
||||||
return float64(roundFloat(float64(val), 1))
|
return roundFloat(val, 1)
|
||||||
}
|
}
|
||||||
return -200.0
|
return -200.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user