visualizer: make ellipse mode have concentric ellipses

This commit is contained in:
Darby Payne
2014-10-21 23:57:36 -07:00
committed by Andrzej Rybczak
parent 8805bff045
commit 6a13ef00b3
2 changed files with 4 additions and 5 deletions

View File

@@ -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;

View File

@@ -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);