import { Slider } from "./types" ; import * as Utils from "./utils" ; export const getBalanceText = ( balance ) : string => { if ( balance === 0 ) { return "Balance: Center" ; } const direction = balance > 0 ? "Right" : "Left" ; return `Balance: ${ Math . abs ( balance ) }% ${ direction }` ; } ; export const getVolumeText = ( volume ) : string => `Volume: ${ volume }%` ; export const getPositionText = ( duration , seekToPercent ) : string => { const newElapsedStr = Utils . getTimeStr ( ( duration * seekToPercent ) / 100 , false ) ; const durationStr = Utils . getTimeStr ( duration , false ) ; return `Seek to: ${ newElapsedStr }/${ durationStr } (${ seekToPercent }%)` ; } ; export const getDoubleSizeModeText = ( enabled ) : string => `${ enabled ? "Disable" : "Enable" } doublesize mode` ; const formatHz = ( hz ) : string => hz < 1000 ? `${ hz }HZ` : `${ hz / 1000 }KHZ` ; const ensureSign = ( num ) : string => num > 0 ? `+${ num }` : num . toString ( ) ; const roundToTenths = ( num ) : string => ( Math . round ( num * 10 ) / 10 ) . toFixed ( 1 ) ; export const getEqText = ( band , level ) : string => { const db = roundToTenths ( ( ( level - 50 ) / 50 ) * 12 ) ; const label = band === "preamp" ? "Preamp" : formatHz ( band ) ; return `EQ: ${ label } ${ ensureSign ( db ) } DB` ; } ;