Commit Graph

2307 Commits

Author SHA1 Message Date
e87f6ec1d3 Apply formatting 2022-05-29 15:29:54 +02:00
f626b73a5b CMake: Check if SDL2::SDL2 target is aliased and set property on the original target instead 2022-05-20 17:51:59 +02:00
c0b5b1f189 Increased minimum CMake version to 3.15 2022-05-20 17:51:59 +02:00
5583a5e1a8 Changed some declarations and added includes to make the API header compile with C99. 2022-04-15 22:13:45 +02:00
0fe87a2c04 Moved Pcm class tests to the unit test project.
Added a helper function to reset autoleveler, made it public as might come in handy if there's a gap (pause/resume, new track etc.) in the audio data.
2022-04-14 15:59:06 +02:00
1769039b08 Deleted old "unit tests" which did nothing useful.
Note: This change alone will not configure properly as the test target has no code files.
2022-04-14 15:59:06 +02:00
a027e27af2 Some small fixes to compile against LLVM 12 headers. 2022-04-14 15:58:53 +02:00
e97bf85bf4 Fix "idle" preset by re-enabling custom textures on shapes.
Renamed the parameter to "image" and fixed texture wrapping/sizing.
2022-04-14 15:58:40 +02:00
162fd411cd Removed GLM dependency from shared & static library targets.
These targets do not compile any source and thus don't need the include dir, but CMake exports a link-only dependency for the static library, which is also not required as GLM is header-only.
2022-04-11 23:21:04 +03:00
c92f32b4b3 fix comment 2022-04-11 13:47:42 +02:00
4c597da56a Change API for adding to Pcm 2022-04-06 14:33:19 +02:00
63fe41bbb9 Fix code in macro branch 2022-04-06 14:33:19 +02:00
b65b6a8ecd Fix easy stuff clang-tidy complains about 2022-04-06 14:33:19 +02:00
1f4f664f58 Remove unused smoothing variable 2022-04-06 14:33:19 +02:00
187f696289 Improve const correctness
We should consider making m_freqL and m_freqR mutable,
as there is no outwardly visible effect at the place these are changed
(UpdateFftChannel).
This would also allow us to make GetSpectrum const,
which is more intuitive.
2022-04-06 14:33:19 +02:00
f7e29b2778 Make offset and stride compile time parameters 2022-04-06 14:33:19 +02:00
e293899b99 Remove unnecessary stride parameter 2022-04-06 14:33:19 +02:00
1b709c513e Fix missing trailing return type 2022-04-06 14:33:19 +02:00
05f9e9124a Factor out common AddPcm structure 2022-04-06 14:33:19 +02:00
9207d99d79 Use trailing return types
Should we do this for void too?
Clang-tidy doesn't flag it, but could be more consistent.
2022-04-06 14:33:19 +02:00
a92686c754 Update headers 2022-04-06 14:33:19 +02:00
7740116f26 Fix casings (PCM.cpp) 2022-04-06 14:33:19 +02:00
df052d5e38 Fix easy .clang-tidy complaints (PCM.hpp) 2022-04-06 14:33:19 +02:00
5d80bf9f57 Fix casing (PCM.hpp) 2022-04-06 14:33:19 +02:00
fa8da74c54 Use recursive mutex to guard preset switching. 2022-04-06 14:32:55 +02:00
8863a093ef Replaced pthread API with STL's concurrency library.
Multithreading will now also work on Windows while the STL variant is even less verbose, making the code easier to read. Thus enabled threading for all platforms, including emscripten.
2022-04-06 14:32:55 +02:00
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