Commit Graph

2439 Commits

Author SHA1 Message Date
9ea98bf01e Add glob pattern filtering to playlist library.
Syntax is very similar to .gitignore glob syntax, with a few exceptions to simplify use.
2022-12-04 20:54:15 +01:00
a1ffd93e31 Add next/previous/last functions and playback history recording. 2022-11-26 23:47:04 +01:00
03f81ff36f Added more missing functions and tests to the playlist implementation. 2022-11-26 22:17:29 +01:00
7dcbe75db3 Added playback control methods and preset switching support. 2022-11-21 19:56:30 +01:00
94ee2a360b Added remaining API functions and preset change callback. 2022-11-21 19:56:30 +01:00
5fe7e8c3aa Removed rating type enum, reformatted comments for settings struct. 2022-11-21 19:56:30 +01:00
5b47b465f9 Removed more now unused callbacks from the core API. 2022-11-21 19:56:30 +01:00
2b1099a653 Implement external preset switching control and add stream loading support.
Lots of interconnected changes in this commit:
- Removed unnecessary name/author/filename members all over the place.
- Started using exceptions to deliver preset loading and rendering errors to the topmost ProjectM class.
- Added stream loading methods to factories and the base Preset class.
- Added new events for requesting preset switch and telling the user about loading errors.
- Consolidated preset switching logic in ProjectM class a bit.
2022-11-21 19:56:30 +01:00
b23b5ce25c Deleted all playlist-related code from libprojectM.
Note: SDL test UI won't compile after this commit. Will be fixed in a later commit, when the playlist library is done.
2022-11-21 19:56:28 +01:00
7363afecc2 Add path scanning and sorting to the playlist implementation.
Path scanning is using C++17's std::filesystem if available, but uses boost::filesystem as fallback. Using boost can be forced using the ENABLE_BOOST_FILESYSTEM CMake option.
2022-11-21 19:54:57 +01:00
4dfae6bf22 Add test project for playlist library, implemented tests for existing code and fixed a few issues found by testing. 2022-11-21 19:54:57 +01:00
ebce27fbfb Move libprojectM tests into subdirectory. 2022-11-21 19:54:57 +01:00
d26ae0a935 Implementation of the first batch of playlist management functions. 2022-11-21 19:54:57 +01:00
d9ea368a0c Add playlist library and first set of API functions. 2022-11-21 19:54:57 +01:00
c6c0dac97d Add README for API interface library. 2022-11-21 19:54:57 +01:00
b6dfb6e195 Moved public API headers into an INTERFACE library 2022-11-21 19:54:56 +01:00
18b032a8ef API: Add missing setter for FPS value.
Also make sure to propagate the changed value to the preset code via the PipelineContext class. Keeping it in the settings struct for now. Storing a dynamic value in settings makes no sense, so it will be removed later.
2022-11-20 16:53:25 +01:00
003e45e9d9 API: Add missing getter for preset duration value. 2022-11-20 16:53:25 +01:00
89f2e5353b Generated new, non-expiring Discord invite link. 2022-11-20 16:44:56 +01:00
e9c1a3eaed Removed parameter and fixed return value 2022-10-29 23:00:45 +02:00
6991953a4e Add get and set for beat sensitivy value to API 2022-10-29 23:00:45 +02:00
dbbbc3e591 Added API function for dumping the next frame. 2022-10-23 18:08:53 +02:00
75f802e261 Remove the "d" hotkey for debug image output. 2022-10-23 18:00:00 +02:00
44e664d81a Added missing member initializer.
Was uninitialized and thus saved a debug image on every startup as the boolean value was mostly non-zero.
2022-10-23 17:59:05 +02:00
ad2203f7bb Discord links 2022-10-14 09:12:17 -07:00
cb0bbfa860 Removed all text-related code from the core lib.
This removes:
- "Toast" messages
- The help text
- Statistics
- Preset name and (unimplemented) song title display
- Preset selection list and search menu

Some of the above functionality might later be added as an optional library, in a separate repository and with proper UTF-8 support.
2022-09-20 22:46:03 +02:00
62cecb36d6 Fix internal texture format again (GLES doesn't support GL_BGRA) 2022-09-20 22:37:19 +02:00
44f51f9fb6 Remove "#pragma comment" which was required for linking psapi.lib on Windows.
Also removed includes of windows.h/unistd.h, as these shouldn't be required anymore in the ProjectM class.
2022-09-18 13:32:58 +02:00
d97feb22f6 Entirely removed native presets.
The native presets did not build anymore due to refactorings, cause other build issues on Windows (e.g. require linking to psapi.lib) and would need a complete makeover anyway.
2022-09-18 13:32:58 +02:00
98b10f5ec6 Fixed a crash when all presets in the playlist have a rating of 0.
In this case, the weighted random chooser would divide by zero, which will cause a crash. In the case this happens, we'll simply use a uniform random distribution as all ratings are equally zero.
2022-09-18 13:32:33 +02:00
5a165f5de8 Parser: use size_t variable where possible
This fixes some -Wsign-compare warnings.
2022-09-16 10:51:00 +02:00
4d2345cd13 MilkdropWaveform: use size_t for loop counter
This fixes a Wsign-compare warning.
2022-09-16 10:51:00 +02:00
db1b02e718 MilkdropWaveform: remove unused private variable 2022-09-16 10:51:00 +02:00
2805459021 MenuText: use correct forward declaration
The external gltext.h is C, thus forward declare GLTtext as a struct
instead of a class.

In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:108:9: warning: struct 'GLTtext' was previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
typedef struct GLTtext GLTtext;
        ^
/projectm/src/libprojectM/Renderer/MenuText.h:9:7: note: previous use is here
class GLTtext;
      ^

In file included from /projectm/src/libprojectM/Renderer/MenuText.cpp:7:
/projectm/src/libprojectM/Renderer/../gltext.h:211:1: warning: 'GLTtext' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
struct GLTtext {
^
/projectm/src/libprojectM/Renderer/MenuText.h:9:1: note: did you mean struct here?
class GLTtext;
^~~~~
struct
2022-09-16 10:51:00 +02:00
4805790900 Shape: add missing override 2022-09-16 10:51:00 +02:00
9c8e412cdb Replace broken WIN32 checks with _WIN32
CMake defines WIN32 by default on Windows, but we shouldn't rely on it.
_WIN32 is defined by all compilers targeting Windows.

Also cleaned up some header includes.
2022-09-16 10:47:56 +02:00
4cf04e6f66 Remove unused WIN32 ifdefs 2022-09-16 10:47:56 +02:00
2e9d0aaafe Expr.cpp: use _MSC_VER instead of WIN32
CMake defines WIN32 by default on Windows, but we shouldn't rely on it,
as it is also defined when using MinGW. Since the comments suggest MSVC-
specific code, scope to MSVC only.
2022-09-16 10:47:56 +02:00
6edb9d01dd Avoid relying on max() from windows.h
Unfortunately, windows.h breaks the standard library because it
defines max() as a macro by default.

To fix this, add NOMINMAX (and WIN32_LEAN_AND_MEAN for good measure) to
the compile options. Ideally, this would be set on a per-target basis,
but with so many OBJECT targets, that is really tedious. Luckily,
add_compile_definitions() is scoped to the current directory and sub-
directories only.
2022-09-16 10:47:56 +02:00
91a0b0be23 CMake: disable --no-undefined on Windows
link.exe emits warning LNK4044 about an unrecognized option '/-no-undefined'.

c.f. https://github.com/mesonbuild/meson/pull/4230
2022-09-16 10:47:56 +02:00
1813613e8b CMake: use target_compile_definitions instead of target_compile_options
It captures the intent better.
2022-09-16 10:47:56 +02:00
9e5f86b75f features.cmake: enable exceptions and RTTI on MSVC
On MSVC, this warning is emitted when including <vector>, among others:

  warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

clang-cl won't even build without /EHsc and fails on the first try-statement.

Since projectM uses the C++ standard library and because it uses exceptions
itself, enable the flag.

Also, since projectM uses dynamic_cast, enable RTTI.

While both /EHsc and /GR are added by CMake by default, user-provided
CMAKE_CXX_FLAGS will override the CMake default. So instead of relying on
the CMake default, enable them explicitly.
2022-09-16 10:47:56 +02:00
f40fd3f467 features.cmake: avoid duplicate header check 2022-09-16 10:47:56 +02:00
37f2cb2b00 Renderer: Fix build with GCC 12
In file included from /projectm/src/libprojectM/Renderer/Renderer.cpp:1:
/projectm/src/libprojectM/Renderer/Renderer.hpp:191:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
  191 |     std::unique_ptr<TextureManager> m_textureManager;
      |          ^~~~~~~~~~
2022-09-15 17:03:48 +02:00
e4701793ee CMake: set ENABLE_SHARED_LINKING to ON when ENABLE_SHARED_LIB is enabled
This fixes the following CMake error when configuring with just
-DENABLE_STATIC_LIB=OFF:

CMake Error at src/libprojectM/CMakeLists.txt:130 (add_library):
  add_library cannot create ALIAS target "projectM::libprojectM" because
  target "projectM_static" does not already exist.

In this case, static linking is disabled, thus the "projectM_static"
CMake target doesn't exist. Previously, ENABLE_SHARED_LINKING was always
false, and because of that, "projectM::libprojectM" was added as as an
alias to "projectM_static", which didn't exist.

Now, ENABLE_SHARED_LINKING is set to true only when ENABLE_SHARED_LIB is
enabled, otherwise it will be false.
2022-09-15 17:02:05 +02:00
371365a03f ProjectM.cpp: Unname unused parameters
Amends the previous commit.

In order to avoid unused parameter warnings when building the library
itself, also unname these parameters here.

The names of these parameters are still named in ProjectM.hpp, so they
serve as documentation. In ProjectM.cpp, they are mere stubs.

As a drive-by, removed some unneeded newlines.
2022-09-15 16:57:40 +02:00
c547489feb ProjectM.{hpp,cpp}: Move event function stubs
This will avoid -Wunused-parameter warnings in client applications.
2022-09-15 16:57:40 +02:00
972b911e75 BeatDetect/Render: Fix -Wshadow warnings
Rename the variables to avoid shadowing local variables and class
members.

Also changed some spaces to tabs for local consistency.
2022-09-15 16:57:40 +02:00
0d047407dc ProjectM.hpp: Use #pragma warning on MSVC only
Fixes multiple "warning: unknown pragma ignored [-Wunknown-pragmas]"
diagnostics on GCC/Clang when used with MinGW, both when building the
library aswell as in client applications.
2022-09-15 16:57:40 +02:00
02c6e2df68 Fixed CMake compiler/linker flag detection on Windows.
Replacing the / with _ in the variable name, as CMake doesn't support this character in variable names.
2022-09-15 16:22:05 +02:00