Closed tari3x closed 1 year ago
Fixed some further errors and a crash (for some reason loading config from file was failing). Here's the diff
git diff | cat
diff --git a/src/common/qprojectm.hpp b/src/common/qprojectm.hpp
index 9e284c3..ab68b23 100644
--- a/src/common/qprojectm.hpp
+++ b/src/common/qprojectm.hpp
@@ -30,53 +30,83 @@
class QProjectM : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
- explicit QProjectM(const QString& config_file)
- : _projectM(projectm_create(config_file.toLocal8Bit().data(), projectm_flags::PROJECTM_FLAG_DISABLE_PLAYLIST_LOAD))
+ explicit QProjectM(const QString& config_file)
+ : _projectM(projectm_create(NULL, PROJECTM_FLAG_DISABLE_PLAYLIST_LOAD))
+ {
+ if (!_projectM)
{
- projectm_set_preset_switched_event_callback(_projectM, &QProjectM::presetSwitchedEvent, this);
- projectm_set_preset_switch_failed_event_callback(_projectM, &QProjectM::presetSwitchFailedEvent, this);
- projectm_set_preset_rating_changed_event_callback(_projectM, &QProjectM::presetRatingChanged, this);
+ projectm_settings settings{};
+
+ // Window/rendering settings
+ settings.window_width = 1023;
+ settings.window_height = 1024;
+ settings.fps = 60;
+ settings.mesh_x = 220;
+ settings.mesh_y = 125;
+ settings.aspect_correction = true;
+
+ // Preset display settings
+ settings.preset_duration = 30;
+ settings.soft_cut_duration = 3;
+ settings.hard_cut_enabled = false;
+ settings.hard_cut_duration = 20;
+ settings.hard_cut_sensitivity = 1.0;
+ settings.beat_sensitivity = 1.0;
+ settings.shuffle_enabled = false;
+ // settings.preset_url = &presetPath[0];
+
+ // Unsupported settings
+ // settings.soft_cut_ratings_enabled = false;
+ // settings.menu_font_url = nullptr;
+ // settings.title_font_url = nullptr;
+
+ _projectM = projectm_create_settings(&settings, PROJECTM_FLAG_NONE);
}
- projectm* instance() const
- {
- return _projectM;
- }
+ projectm_set_preset_switched_event_callback(_projectM, &QProjectM::presetSwitchedEvent, this);
+ projectm_set_preset_switch_failed_event_callback(_projectM, &QProjectM::presetSwitchFailedEvent, this);
+ projectm_set_preset_rating_changed_event_callback(_projectM, &QProjectM::presetRatingChanged, this);
+ }
+
+ projectm* instance() const
+ {
+ return _projectM;
+ }
signals:
- void presetSwitchedSignal(bool hardCut, unsigned int index) const;
+ void presetSwitchedSignal(bool hardCut, unsigned int index) const;
- void presetSwitchFailedSignal(bool hardCut, unsigned int index, const QString& message) const;
+ void presetSwitchFailedSignal(bool hardCut, unsigned int index, const QString& message) const;
- void presetRatingChangedSignal(unsigned int index, int rating,
- projectm_preset_rating_type ratingType) const;
+ void presetRatingChangedSignal(unsigned int index, int rating,
+ projectm_preset_rating_type ratingType) const;
protected:
- static void presetSwitchedEvent(bool hardCut, unsigned int index, void* context)
- {
- auto qProjectM = reinterpret_cast<QProjectM*>(context);
- qProjectM->presetSwitchedSignal(hardCut, index);
- }
-
- static void presetSwitchFailedEvent(bool hardCut, unsigned int index, const char* message, void* context)
- {
- auto qProjectM = reinterpret_cast<QProjectM*>(context);
- qProjectM->presetSwitchFailedSignal(hardCut, index, QString(message));
- }
-
- static void presetRatingChanged(unsigned int index, int rating,
- projectm_preset_rating_type ratingType, void* context)
- {
- auto qProjectM = reinterpret_cast<QProjectM*>(context);
- qProjectM->presetRatingChangedSignal(index, rating, ratingType);
- }
-
- projectm* _projectM{ nullptr };
+ static void presetSwitchedEvent(bool hardCut, unsigned int index, void* context)
+ {
+ auto qProjectM = reinterpret_cast<QProjectM*>(context);
+ qProjectM->presetSwitchedSignal(hardCut, index);
+ }
+
+ static void presetSwitchFailedEvent(bool hardCut, unsigned int index, const char* message, void* context)
+ {
+ auto qProjectM = reinterpret_cast<QProjectM*>(context);
+ qProjectM->presetSwitchFailedSignal(hardCut, index, QString(message));
+ }
+
+ static void presetRatingChanged(unsigned int index, int rating,
+ projectm_preset_rating_type ratingType, void* context)
+ {
+ auto qProjectM = reinterpret_cast<QProjectM*>(context);
+ qProjectM->presetRatingChangedSignal(index, rating, ratingType);
+ }
+
+ projectm* _projectM{ nullptr };
};
#endif
diff --git a/src/common/qprojectm_mainwindow.cpp b/src/common/qprojectm_mainwindow.cpp
index 44cd591..9bf58d6 100644
--- a/src/common/qprojectm_mainwindow.cpp
+++ b/src/common/qprojectm_mainwindow.cpp
@@ -232,7 +232,7 @@ projectm* QProjectM_MainWindow::GetProjectM()
void QProjectM_MainWindow::addPCM(float * buffer, unsigned int bufferSize)
{
- projectm_pcm_add_float_2ch_data(qprojectM()->instance(), buffer, bufferSize);
+ projectm_pcm_add_float(qprojectM()->instance(), buffer, bufferSize, PROJECTM_STEREO);
}
void QProjectM_MainWindow::updatePlaylistSelection ( bool hardCut, unsigned int index )
I can confirm these bugs exist, and the patch applied remedies the crash as well, although this patch seems to disable using the config file altogether. @tari3x thanks for your work! Do you have any insight to what's causing the segfault when loading the config file? It'd be nice to be able to properly load the config. I don't quite have time to debug this further this weekend, although I might get to it later this week if you don't beat me to it.
Didn't dig deeper I'm afraid. Seems like the config format changed and the config reading function doesn't fail gracefully when reading it.
Just to note: this bug still exists when attempting to build from 'main' branch. Any help to build a working version greatly appreciated!
Fwiw, I ended up using the SDK front-end, works well for me.
Thanks! Unfortunately, although I was able to build the SDK front end on Ubuntu, it segfaults every time I launch it with no further debugging info. The 'new' SDK frontend does not compile at all on R-Pi, although I have been able to complete and install the current build of libprojectM. It looks like the decision to take the two frontends into separate repos has meant that changes to libprojectm that break them do not get noticed in the same way they would if they were part of the main build...
This may sound like a dumb question, but im having exactly the same issue. how do I implement the patch above?
I've merged a few changes, these should fix everything to make the PulseAudio app compile against libprojectM's current master state.
While you can still play around with the application, in its current state it's mostly broken as audio capturing doesn't work properly anymore and then there's still the OpenGL rendering issues after the transition to QOpenGLWindow. So expect presets to look totally broken and unresponsive. For the time being, I recommend using the SDL2 application. It doesn't (yet) have the playlist editing features, but it works flawlessly.
That said, while the Qt app is currently not our development focus, don't expect the core team to fix this application anytime soon. If someone else wants to take this task and help fixing the mentioned issues, please go ahead!
I'm closing the issue for now, but expect more breakages as the libprojectM API will change again in the near future.
If this front-end basically doesn't work, would it make sense to remove the repo until this is fixed, or at least make it very loud (in the README?) that people should be using the SDL front-end instead? This would save a lot of users a couple of hours of stumbling around.
You can't "remove" the repo from GitHub without losing all issues and other associated history, and there's also no way of hiding it, so this is not an option.
Adding it to the README would be an option, but such a note is often not removed when the app is working again, also setting a false flag.
I've added a (hopefully) visible note to the repository description.
it can be archived as well