From 3819ef4a768e87e00c3586591505638e6820976e Mon Sep 17 00:00:00 2001 From: David Runge Date: Mon, 1 May 2017 14:54:51 +0200 Subject: classes/ZZZ.sc: Removing unneeded postlns. Adding wrapper functions hzToAmp and ampToHz for direct conversion. --- classes/ZZZ.sc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/classes/ZZZ.sc b/classes/ZZZ.sc index 3f39357..65b18c1 100644 --- a/classes/ZZZ.sc +++ b/classes/ZZZ.sc @@ -51,7 +51,6 @@ ZZZ{ },{ voltage = amplitude.lincurve(1.0, 2.5, ampToVACConst, 7.7, -4, nil); }); - voltage.postln; ^voltage; } @@ -69,7 +68,6 @@ ZZZ{ },{ amplitude = voltage.curvelin(ampToVACConst, 7.7, 1.0, 2.5, -4, \max); }); - amplitude.postln; ^amplitude; } @@ -86,7 +84,6 @@ ZZZ{ },{ voltage = frequency.explin(55, 880, 1.0, 5.0, nil); }); - voltage.postln; ^voltage; } @@ -103,8 +100,26 @@ ZZZ{ },{ frequency = voltage.linexp(1.0, 5.0, 55, 880, nil); }); - frequency.postln; ^frequency; } + /** + * Calculates amplitude for supplied frequency. + * Wraps call to hzToVAC -> vacToAmp + * @return amplitude for corresponding frequency + */ + *hzToAmp{ + arg frequency; + ^this.vacToAmp(this.hzToVAC(frequency)); + } + + /** + * Calculates frequency for supplied amplitude. + * Wraps call to ampToVAC -> vacToHz + * @return frequency for corresponding amplitude + */ + *ampToHz{ + arg amplitude; + ^this.vacToHz(this.ampToVAC(amplitude)); + } } -- cgit v1.2.3-70-g09d2