refactor(sointu): move engineeringTime helper function to the file where it is actually used

This commit is contained in:
vsariola 2021-08-30 22:27:38 +03:00
parent a8f8911f03
commit eda48491e2
2 changed files with 9 additions and 10 deletions

View File

@ -195,3 +195,12 @@ func (p Patch) ParamHintString(instrIndex, unitIndex int, param string) string {
}
return ""
}
func engineeringTime(sec float64) string {
if sec < 1e-3 {
return fmt.Sprintf("%.2f us", sec*1e6)
} else if sec < 1 {
return fmt.Sprintf("%.2f ms", sec*1e3)
}
return fmt.Sprintf("%.2f s", sec)
}

View File

@ -1,7 +1,6 @@
package sointu
import (
"fmt"
"math"
)
@ -14,15 +13,6 @@ type UnitParameter struct {
CanModulate bool // if this parameter can be modulated i.e. has a port number in "send" unit
}
func engineeringTime(sec float64) string {
if sec < 1e-3 {
return fmt.Sprintf("%.2f us", sec*1e6)
} else if sec < 1 {
return fmt.Sprintf("%.2f ms", sec*1e3)
}
return fmt.Sprintf("%.2f s", sec)
}
// UnitTypes documents all the available unit types and if they support stereo variant
// and what parameters they take.
var UnitTypes = map[string]([]UnitParameter){