Commit Graph

104 Commits

Author SHA1 Message Date
Andrew Reading f59c9f4b2b Rewrite the Block Analyzer to improve performance.
The block analyzer was doing lots of repeated, out-of-order blits to the
widget's canvas. To improve performance and reduce CPU usage, this has
been rewritten to generate the canvas contents using only a single buffer.
Cache thrashing has been greatly reduced by writing to memory only
sequentially and in one single write pass. Further, the raw format is
now guaranteed to be in a format efficient for Qt.

The results are visually identical to what they were previously, but
result in a CPU usage reduction between 2 and 6 percent depending on refresh
rate and Psychadelic Mode value. In particular, there used to be a ~3 percent
overhead for Psychadelic Mode, and this has been eliminated.

The specific details of the block analyzer and explanations for how it works
(and used to work) have been documented via fairly extensive comments
in blockanalyzer.cpp.
2022-09-01 19:36:03 +01:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jim Broadus 987fe047c6 Fix access past end of vector in getPsychedelicColor 2020-07-13 15:07:02 +01:00
Jonas Kvinge 28bbb74c26 Replace use of QColor::dark with QColor::darker 2020-01-04 23:00:40 +01:00
Jonas Kvinge 3f9b6b1192 Fix formatting 2019-11-10 15:21:08 +01:00
Jonas Kvinge 344023e6dd Fix formatting 2019-11-10 15:16:39 +01:00
Jonas Kvinge ba31c755ef Replace all uses of QSignalMapper with C++11 lambda expressions 2019-11-10 15:07:12 +01:00
John Maguire cb6cd7c485 Merge remote-tracking branch 'origin/master' into qt5 2019-10-04 16:51:43 +01:00
luz.paz fb93ae4b02 Fix misc. source comment typos
Typos found via `codespell`
2019-08-21 23:43:16 -04:00
Jonas Kvinge 16bdd39c03 Merge remote-tracking branch 'upstream/master' into qt5-update 2018-11-29 23:21:54 +01:00
Jonas Kvinge 9f946a2898 Improvements to makefiles and make components optional (#6221) 2018-11-29 21:32:12 +00:00
Jonas Kvinge 8c198a99a5 Qt 5 fixes 2018-11-21 10:31:17 +00:00
Jonas Kvinge 9709ce0896 Fix crash in analyzer (#6193) 2018-11-11 16:15:30 +00:00
Amish Naidu 107e945872 Convert uses of QtAlgorithms to std:: algorithms 2018-10-09 19:17:54 +01:00
Mark Furneaux fba9e8dd69 Fix psychedelic mode on analysers (#5688)
* Fix psychedelic mode

* Remove unnecessary checks

When the code isn't broken, these are just a waste
2017-03-31 11:48:28 +01:00
Santiago Gil 0b34586e52 Fix some warnings shown on start-up (#5679)
* Fix 'RGB parameters out of range' with psychedelic colors

* Fix 'edit-find' icon name

* BlockAnalyzer::drawBackground(): do not attempt to paint on a null background

* Use qBound()
2017-03-27 12:57:24 +01:00
santigl 6c9bc43bbb Refactor analyzers for new FHT modifications. Use QVectors where possible. Make readability changes in the code. 2017-03-13 18:56:37 +00:00
santigl 6a19afde15 Refactor FHT class: use QVector and const values, remove unnecesary memory handling. 2017-03-13 18:56:37 +00:00
narunlifescience e586829452 use emplace_back 2015-11-24 03:44:33 -06:00
narunlifescience 154da7b5c0 Fix boom analyzer, terbine & bar analyzer behaviour when paused
remove hidden file added
2015-11-23 12:54:08 -06:00
narunlifescience b77cb613e2 combine nyancatanalyzer & rainbowdashanalyzer(eliminate duplicated code)
update

minor modifications

format

add seperate classes for nyancat & dash

format

minor correction

restore previous name Nyanalyzer cat
2015-11-23 11:39:42 -06:00
Ivan Leontiev 651289ea26 Add condition against nullptr dereferencing to AnalyzerContainer::TogglePsychedelicColors() 2015-08-18 23:21:34 +00:00
Mark Furneaux f68d983ddc Sonogram should stop scrolling when paused
Fixes #755
2015-07-11 23:12:44 -04:00
Mark Furneaux 8e2795c6a2 More readable toggle 2015-07-02 08:10:08 -04:00
Mark Furneaux c102bf7fe6 Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)

I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 11:48:03 -04:00
Mark Furneaux 36d885b73d Bound the Block Analyzer's column count
As it stands, the block analyzer just chops off columns to the right if the window is too small and always internally runs off 256 columns. Since the analyzer is bounded to 256 colums, this qMax bound is totally pointless.
It also makes the demo asymmetrical which trips up my OCD whenever Clementine is idling...
2015-06-20 00:09:38 -04:00
Krzysztof Sobiecki 1cbe135a8d Fix some errors in src/analyzers introduced while fixing cpplint.py errors 2014-11-29 21:05:59 +01:00
Krzysztof Sobiecki dc669eb603 Fix cpplint.py errors, fix copyright notices in src/analyzers, move src/core/fht* to src/analyzers 2014-11-29 20:07:01 +01:00
Alibek Omarov a8c2537056 RainbowDash analyzer now more pretty 2014-06-18 23:37:43 +06:00
Alibek Omarov 60ae9e9408 Now Bar Analyzer respects color scheme 2014-06-18 21:55:29 +06:00
David Sansome c217450d0c Fix some bad sizeof -> arraysize changes from revision 41e9c15248. 2014-05-23 21:31:50 +10:00
Mark Furneaux c404552682 Fix random artifacting on nyanalyzer on startup
memset works on bytes, not the source datatype width
2014-05-23 07:20:13 -04:00
Mark Furneaux f2a1defa2a Make sizeof more generic 2014-05-22 10:58:08 -04:00
Mark Furneaux 663b7430d8 Add new analyzer "Rainbow Dash"
As requested in SuperUltraCriticalShowstopper request #2685
I have built an analyzer based on Rainbow Dash
...oh god, what have I done...

This will either make some people happy, or is absolute garbage.
2014-05-22 10:33:21 -04:00
John Maguire 42a2739daf Merge pull request #4343 from TheUbuntuGuy/master
Fix block analyzer framerate
2014-05-14 14:14:33 +02:00
Mark Furneaux 542dbe8d12 Make framerate notification less nasty
Now uses a virtual function in Analyser::Base to notify any
analyser which whishes to listen
2014-05-13 16:43:46 -04:00
John Maguire c2890de65f Remove "using" statement in header 2014-05-13 14:46:50 +02:00
Mark Furneaux 6a882370a6 Fix block analyzer framerate
Block analyzer uses an internal variable m_step to determine how
long to hold a bar up. This is dependant on framerate, however it is
only set on creation or resize of the analyzer. This patch changes
this value whenever the framerate is changed, preventing the analyzer
from appearing wildly fast or extremely slow until a restart.
2014-05-12 18:15:00 -04:00
Mark Furneaux 00a1fe1e32 Refactoring 2014-05-03 09:14:15 -04:00
Mark Furneaux 53f21584e4 Fix inconsistent buffer sizes sent to analyzer
The analyzers are sent new buffers of audio data to process each time
they pass through the gst pipeline. Different file formats and bit depths/
sample rates can change the size of these buffers, in some cases making them
large and therefore infrequent. This causes choppiness in the analyzer
as it is not getting new data with every frame. This patch chunks the buffers
coming off the pipeline to correspond with the framerate of the analyzer.
2014-04-29 21:38:21 -04:00
John Maguire 41e9c15248 Add arraysize macro from Chromium 2014-04-29 14:11:52 +02:00
Mark Furneaux 16f12a3da8 Formatting 2014-04-27 02:49:26 -04:00
Mark Furneaux 7d3d0f04cf Fix analyzer framerate when mouseover play scrubber
This patch prevents the framerate of all analyzers from
increasing beyond the framerate set in the interface at all times.
It however will allow the analyser to redraw as often as required
to prevent artifacting when the play scrubber is drawn in front.
2014-04-27 01:54:42 -04:00
Krzysztof A. Sobiecki 0ecf1e76a6 Reformat done with clang-3.5 svn200967 2014-02-07 17:08:31 +01:00
John Maguire bebd781fdf Reformat all non-3rd-party C/C++/Objective-C++.
Command line:
find src ext -regex '.*\.\(h\|cpp\|mm\)' -exec clang-format -i
 -style='{BasedOnStyle: Google, DerivePointerBinding: false}' {} \;
2014-02-07 16:34:20 +01:00
John Maguire 71893e4847 Use nullptr instead of NULL everywhere. 2014-02-06 17:29:59 +01:00
Vasily Fomin b1c488ffea Make wheel events on the analyzer change the volume. Fixes issue 3761 2013-07-27 16:13:07 +10:00
John Maguire 79318cc4e1 Build fixes for mingw-w64 2012-11-13 14:43:13 +01:00
David Sansome 41d8c61e0d Let nyanalyzer cat nap inbetween songs 2012-10-16 21:20:56 +11:00
John Maguire 5280038f9a Remove unused debug #define. 2012-06-18 13:56:56 +02:00