mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-01 22:45:18 +00:00
fix oscilloscope amplitude and direction (#629)
This commit is contained in:
parent
d4a66f4a16
commit
24a618bf0b
1 changed files with 2 additions and 2 deletions
|
|
@ -226,8 +226,8 @@ class Visualizer extends React.Component {
|
|||
// Iterate over the width of the canvas in "real" pixels.
|
||||
for (let j = 0; j <= this._renderWidth(); j++) {
|
||||
const amplitude = sliceAverage(this.dataArray, sliceWidth, j);
|
||||
const percentAmplitude = (amplitude - 128) / 128; // dataArray gives us bytes
|
||||
const y = percentAmplitude * h + h / 2; // center wave at half height
|
||||
const percentAmplitude = amplitude / 255; // dataArray gives us bytes
|
||||
const y = (1 - percentAmplitude) * h; // flip y
|
||||
const x = j * PIXEL_DENSITY;
|
||||
|
||||
// Canvas coordinates are in the middle of the pixel by default.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue