visualizer: ellipse is now closer to circular and the colors change faster
This commit is contained in:
committed by
Andrzej Rybczak
parent
e9641d34b1
commit
f90049ff07
@@ -225,13 +225,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)
|
void Visualizer::DrawSoundEllipseStereo(int16_t *buf_left, int16_t *buf_right, ssize_t samples, size_t height)
|
||||||
{
|
{
|
||||||
const long width = w.getWidth()/2;
|
const long width = w.getWidth()/2;
|
||||||
const long scaledRadius = std::max(pow(width,2), pow(height,2))/Config.visualizer_colors.size();
|
const long scaledRadius = std::max(pow(width,2), pow(height,2))/pow(Config.visualizer_colors.size(),2);
|
||||||
for (size_t i = 0; i < samples; ++i)
|
for (size_t i = 0; i < samples; ++i)
|
||||||
{
|
{
|
||||||
long x = width + ((double) buf_left[i] * 2 * ((double)width / 65536.0));
|
long x = width + ((double) buf_left[i] * 2 * ((double)width / 65536.0));
|
||||||
long y = height + ((double) buf_right[i] * 2 * ((double)height / 65536.0));
|
long y = height + ((double) buf_right[i] * 2 * ((double)height / 65536.0));
|
||||||
|
|
||||||
w << toColor(pow(x - width, 2) + pow(y - ((long)height),2), scaledRadius)
|
w << toColor(pow((x - width)*1, 2) + pow((y - ((long)height)) * 2,2), scaledRadius)
|
||||||
<< NC::XY(x, y)
|
<< NC::XY(x, y)
|
||||||
<< Config.visualizer_chars[1]
|
<< Config.visualizer_chars[1]
|
||||||
<< NC::Color::End;
|
<< NC::Color::End;
|
||||||
|
|||||||
Reference in New Issue
Block a user