Mercurial > hg > opencollidoscope
diff CollidoscopeApp/include/Oscilloscope.h @ 7:a4a336624f5a
added some comments
DrawInfo dependency from NUM_WAVES
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Fri, 15 Jul 2016 16:05:34 +0200 |
parents | 75b744078d66 |
children | 4dad0b810f18 |
line wrap: on
line diff
--- a/CollidoscopeApp/include/Oscilloscope.h Thu Jul 14 15:08:31 2016 +0200 +++ b/CollidoscopeApp/include/Oscilloscope.h Fri Jul 15 16:05:34 2016 +0200 @@ -57,11 +57,12 @@ } audioVal *= 0.8f; - // this yRatio is for the bottom scope, the top will be drawn with a translation/4 - // because it's half of the half of the tier where the wave is drawn + // map audio val from [-1.0, 1.0] to [0.0, 1.0] + // then map the value obtained to the height of the wave tier ( window height / NUM_WAVES ) float yRatio = ((1 + audioVal) / 2.0f) * (di.getWindowHeight() / NUM_WAVES ); float xRatio = index * (di.getWindowWidth() / (float)mLine.size()); + // this flips the coordinates for the second wave mLine.getPoints()[index].x = float( di.flipX( int(xRatio) ) ); mLine.getPoints()[index].y = float( di.flipY( int(yRatio) ) );