Add preset load callback to playlist library#953
Merged
Conversation
Adds projectm_playlist_set_preset_load_event_callback() to allow applications to handle preset loading themselves. This enables loading presets from: - Archives (ZIP files) - Network sources (HTTP) - Custom storage solutions - Asynchronous loading patterns When the callback is set and returns true, the playlist library skips its default filesystem-based loading. If the callback returns false or isn't set, the default behavior is used. Fixes #946
There was a problem hiding this comment.
Pull request overview
This PR adds a callback mechanism to the playlist library that allows applications to handle preset loading themselves instead of relying on the default filesystem loading. This enables loading presets from archives, network sources, or custom storage solutions as requested in issue #946.
Changes:
- Added
projectm_playlist_preset_load_eventcallback type that receives preset index, filename, hard_cut flag, and user data - Added
projectm_playlist_set_preset_load_event_callback()API function to register the callback - Modified
PlayPresetIndex()to invoke the callback before attempting filesystem loading - Callback return value controls whether default filesystem loading proceeds
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/playlist/api/projectM-4/playlist_callbacks.h | Defines the new preset load callback type and registration function with comprehensive documentation |
| src/playlist/PlaylistCWrapper.hpp | Adds callback storage members and setter method declaration |
| src/playlist/PlaylistCWrapper.cpp | Implements callback setter and invocation logic in the preset loading flow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kblaschke
approved these changes
Feb 1, 2026
Member
kblaschke
left a comment
There was a problem hiding this comment.
That'll help many devs - including myself 😁
I'd say it's ready for merging!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a callback that's invoked before loading each preset from the playlist.
The callback receives the preset index, filename, and whether it's a hard cut.
Returning
falsefrom the callback prevents the preset from loading, allowingapplications to implement custom filtering or logging.
Fixes #946