Commit Graph

2431 Commits

Author SHA1 Message Date
17cfcda0d3 Reformatted the main projectM class. 2022-04-04 22:03:37 +02:00
560b2caf37 A few additional code cleanups in waveform and shape implementations.
Made all variables const which are never changed and only contain temporary values, removed default switch cases where we know the exact number of choices.
2022-03-29 12:11:21 +02:00
c6078b7887 More shape and wave rendering fixes. 2022-03-29 12:11:21 +02:00
d272d4a354 Fix default wrap modes for built-in textures.
Should use REPEAT instead of CLAMP_TO_EDGE, as Milkdrop has the same defaults.
2022-03-29 12:11:21 +02:00
0efcf2392f Simplified/reformatted param creation functions.
Checking "param" to be nullptr, then return a nullptr instead of param makes no sense.

Param::create() uses "new" on every branch, so if this failed, std::bad_alloc exception will be thrown in the case not enough memory is available.
2022-03-29 12:11:21 +02:00
1ee932a23c Refactored default waveform math and drawing.
Also added Milkdrop's wave smoothing algorithm to make the waveforms look less pointy.

Now very closely matches Milkdrop's math and rendering style except some very minor scaling issues.

Will now render wave mode 8 (spectrum) even if not finished/enabled in the original Milkdrop. Also, Milkdrop does for some reason not use the "mystery" parameter to rotate linear waveforms (modes 6-8) even if the source suggests it. projectM will do it, but there are probably no presets that use it purposely.

Also worth noting: The wave_a parameter has no effect in both Milkdrop and projectM. The wave is always drawn fully opaque.
2022-03-29 12:11:21 +02:00
b761540eb2 Fixed shapecode outline rendering to match Milkdrop logic.
Now uses anti-aliased, 1px lines and draws them four times in a rectangular offset pattern to "fake" a thicker outline.

Needed to pass the actual viewport size into the render context, as the internal texture size value is useless (the target framebuffer is always as large as the viewport).
2022-03-29 12:11:21 +02:00
76a83db1a8 Split Renderable.hpp/.cpp into separate files.
Moved all declarations and implementations into class-specific files. Makes it easier to find them and creates smaller compilation units.

Added Doxygen comments to all moved classes and reformatted their code.

Fixed a few typos and type/function declarations.

Added default initializers in the headers where needed.
2022-03-29 12:11:21 +02:00
a02d6781a4 Fix FileScanner::scanGeneric for filesystems that dont set d_type
Signed-off-by: falkTX <falktx@falktx.com>
2022-03-28 12:32:35 +02:00
12423a4425 Some additional clang-tidy casing clarifications. 2022-03-28 12:23:52 +02:00
fc3ad4802d Use correct rdft function 2022-03-28 12:22:54 +02:00
de73776651 Use class keyword, as done in forward declaration 2022-03-28 12:22:54 +02:00
33126f5df6 Remove smoothing logic 2022-03-28 12:22:54 +02:00
8313146a01 Remove unnecessary loop 2022-03-28 12:22:54 +02:00
c8b2a82351 Use types specifying bitcount for addPCMX argument 2022-03-28 12:22:54 +02:00
fd0f355ebb Use .size() in argument to _copyPCM where possible 2022-03-28 12:22:54 +02:00
ff8e32d00b Give function overload more descriptive name 2022-03-28 12:22:54 +02:00
e562aa524d Use guard instead of logic inside conditional 2022-03-28 12:22:54 +02:00
6557b528e8 Change name of constrain to clamp 2022-03-28 12:22:54 +02:00
3ada642871 Remove unnecessary forward declaration 2022-03-28 12:22:54 +02:00
3f107a3594 Remove iostream include 2022-03-28 12:22:54 +02:00
c6de2ead7e Move Test::verify definition to .cpp
Part of removing the iostream included in PCM.cpp.
I noticed that TestRunner.cpp had a missing #include <iostream>.
By moving the definition to the .cpp, the definition may see <iostream>
without it leaking out to everything that includes TestRunner.hpp.
2022-03-28 12:22:54 +02:00
ec666b8032 Remove empty ctor and dtor 2022-03-28 12:22:54 +02:00
610117ff57 Remove heap allocation for AutoLevel 2022-03-28 12:22:54 +02:00
4053457dbd Correct rdft asserts 2022-03-28 12:22:54 +02:00
1178ddfed5 Apply formatting 2022-03-28 12:22:54 +02:00
27798317ee Give uncased variables a casing
Picked camelCase.
These variables will now be picked up on if we standardize our casing.
2022-03-28 12:22:54 +02:00
e63fc1f88c Ensure array size correctness of rdft calls 2022-03-28 12:22:54 +02:00
02be000d97 Make w and ip arrays 2022-03-28 12:22:54 +02:00
a533f2876d Use static_assert instead of #error directive 2022-03-28 12:22:54 +02:00
db209a5808 Use std::max instead of fmax 2022-03-28 12:22:54 +02:00
969dcec7a2 Use std::abs instead of fabs 2022-03-28 12:22:54 +02:00
3c133f34aa Use std::array in PCM tests 2022-03-28 12:22:54 +02:00
198a031f28 Remove unused member function freePCM 2022-03-28 12:22:54 +02:00
6458c0e8df Move member initialization from initializer list 2022-03-28 12:22:54 +02:00
631e764691 Move AutoLevel's initialization from constructor 2022-03-28 12:22:54 +02:00
fd25439653 Use size_t for loop indices 2022-03-28 12:22:54 +02:00
91347f95d3 Change raw arrays to std::array 2022-03-28 12:22:54 +02:00
12afc044a0 Make values constexpr where possible 2022-03-28 12:22:54 +02:00
6563bd8174 Parser fixes to support multiple equations/assignments per line.
Just a few preliminary changes to fix the issue with multiple equations in a single line in shape and wave equations, e.g. "x=1; y=2;".
2022-03-28 11:54:43 +02:00
bf8a4b4f29 Improve timer precision by using std::chrono::high_resolution_clock.
Also removes the need to use the OS-specific time APIs.
2022-03-28 11:47:25 +02:00
99b55db617 Move around public members 2022-03-19 21:26:48 +01:00
c07ebb3bd9 Smash together two methods
detectFromSamples and getBeatVals into calculateBeatStatistics.
They didn't make sense individually, I think this makes more sense.
2022-03-19 21:26:48 +01:00
4ff1c459c9 Don't reset members unnecessarily 2022-03-19 21:26:48 +01:00
a7b05c9f96 Construct BeatDetect with a reference, not pointer 2022-03-19 21:26:48 +01:00
8d926120fe Use list initialization for floats 2022-03-19 21:26:48 +01:00
964a3a3d59 Move array initialization to declaration 2022-03-19 21:26:48 +01:00
1ec9fddb20 Remove remaining isnan definition 2022-03-19 21:26:48 +01:00
323eef32ec Remove projectM_isnan macro 2022-03-19 21:26:48 +01:00
902fe0fd14 Use std::min instead of conditional branches 2022-03-19 21:26:48 +01:00