visualizer: scale spectrum along with window's width

This commit is contained in:
Andrzej Rybczak
2015-01-17 09:43:09 +01:00
parent 8657cdbf4d
commit 8e31f81ca9
2 changed files with 2 additions and 1 deletions

1
NEWS
View File

@@ -2,6 +2,7 @@ ncmpcpp-0.7 (????-??-??)
* Visualizer has now support for multiple colors (visualizer_color configuration variable takes the list of colors to be used).
* Visualizer has now support for two more modes: sound wave filled and sound ellipse.
* Visualizer's spectrum mode now scales better along with window's width.
* It is now possible to abort the current action using Ctrl-C or Ctrl-G in prompt mode. As a result, empty value is no longer a special value that aborts most of the actions.
* Directories and playlists in browser can now be sorted by modification time.
* ~ is now expanded to home directory in mpd_host configuration variable.

View File

@@ -418,7 +418,7 @@ void Visualizer::DrawFrequencySpectrum(int16_t *buf, ssize_t samples, size_t y_o
for (int j = 0; j < bins_per_bar; ++j)
bar_height += m_freq_magnitudes[x*bins_per_bar+j];
// buff higher frequencies
bar_height *= log2(2 + x);
bar_height *= log2(2 + x) * 100.0/win_width;
// moderately normalize the heights
bar_height = pow(bar_height, 0.5);