From eda48491e2c4c0415763e11af492a640f77613bf Mon Sep 17 00:00:00 2001 From: vsariola <5684185+vsariola@users.noreply.github.com> Date: Mon, 30 Aug 2021 22:27:38 +0300 Subject: [PATCH] refactor(sointu): move engineeringTime helper function to the file where it is actually used --- patch.go | 9 +++++++++ unittype.go | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/patch.go b/patch.go index 04c9b53..36c814d 100644 --- a/patch.go +++ b/patch.go @@ -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) +} diff --git a/unittype.go b/unittype.go index 08a8361..338b444 100644 --- a/unittype.go +++ b/unittype.go @@ -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){