Mercurial > hg > opencollidoscope
comparison 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 |
comparison
equal
deleted
inserted
replaced
6:4c0e82b725d9 | 7:a4a336624f5a |
---|---|
55 else if ( audioVal < -1.0f ){ | 55 else if ( audioVal < -1.0f ){ |
56 audioVal = -1.0f; | 56 audioVal = -1.0f; |
57 } | 57 } |
58 | 58 |
59 audioVal *= 0.8f; | 59 audioVal *= 0.8f; |
60 // this yRatio is for the bottom scope, the top will be drawn with a translation/4 | 60 // map audio val from [-1.0, 1.0] to [0.0, 1.0] |
61 // because it's half of the half of the tier where the wave is drawn | 61 // then map the value obtained to the height of the wave tier ( window height / NUM_WAVES ) |
62 float yRatio = ((1 + audioVal) / 2.0f) * (di.getWindowHeight() / NUM_WAVES ); | 62 float yRatio = ((1 + audioVal) / 2.0f) * (di.getWindowHeight() / NUM_WAVES ); |
63 float xRatio = index * (di.getWindowWidth() / (float)mLine.size()); | 63 float xRatio = index * (di.getWindowWidth() / (float)mLine.size()); |
64 | 64 |
65 // this flips the coordinates for the second wave | |
65 mLine.getPoints()[index].x = float( di.flipX( int(xRatio) ) ); | 66 mLine.getPoints()[index].x = float( di.flipX( int(xRatio) ) ); |
66 mLine.getPoints()[index].y = float( di.flipY( int(yRatio) ) ); | 67 mLine.getPoints()[index].y = float( di.flipY( int(yRatio) ) ); |
67 | 68 |
68 // add the missing line to reach the right of the window | 69 // add the missing line to reach the right of the window |
69 // indeed the scope starts from 0 to size -1 and adds xRatio | 70 // indeed the scope starts from 0 to size -1 and adds xRatio |