From 6a13ef00b3415e039a3e3b9783362fb7e32363ad Mon Sep 17 00:00:00 2001 From: Darby Payne Date: Tue, 21 Oct 2014 23:57:36 -0700 Subject: [PATCH] visualizer: make ellipse mode have concentric ellipses --- src/visualizer.cpp | 7 +++---- src/visualizer.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/visualizer.cpp b/src/visualizer.cpp index 1aa3dea6..15c847ce 100644 --- a/src/visualizer.cpp +++ b/src/visualizer.cpp @@ -203,7 +203,7 @@ void Visualizer::spacePressed() Statusbar::printf("Visualization type: %1%", visualizerName.c_str()); } -NC::Color Visualizer::toColor( int number, int max ) +NC::Color Visualizer::toColor( size_t number, size_t max ) { const int colorMapSize = Config.visualizer_colors.size(); const int normalizedNumber = ( ( number * colorMapSize ) / max ) % colorMapSize; @@ -224,14 +224,13 @@ void Visualizer::DrawSoundWaveFillStereo(int16_t *buf_left, int16_t *buf_right, void Visualizer::DrawSoundEllipseStereo(int16_t *buf_left, int16_t *buf_right, ssize_t samples, size_t height) { - const int width = w.getWidth()/2; + const size_t width = w.getWidth()/2; for (size_t i = 0; i < samples; ++i) { int x = width + ((double) buf_left[i] * 2 * ((double)width / 65536.0)); int y = height + ((double) buf_right[i] * 2 * ((double)height / 65536.0)); - int c = abs(buf_right[i] - buf_left[i]) % Config.visualizer_colors.size(); - w << Config.visualizer_colors[c] + w << toColor(buf_right[i] * buf_right[i] + buf_left[i] * buf_left[i], pow(width, 2) * pow(height,2)) << NC::XY(x, y) << Config.visualizer_chars[1] << NC::Color::End; diff --git a/src/visualizer.h b/src/visualizer.h index dc4bb33f..3c840db2 100644 --- a/src/visualizer.h +++ b/src/visualizer.h @@ -64,7 +64,7 @@ protected: virtual bool isLockable() OVERRIDE { return true; } private: - NC::Color toColor(int, int); + NC::Color toColor( size_t, size_t); void DrawSoundWave(int16_t *, ssize_t, size_t, size_t); void DrawSoundWaveFill(int16_t *, ssize_t, size_t, size_t); void DrawSoundWaveStereo(int16_t *, int16_t *, ssize_t, size_t);