Address Copilot review feedback

This commit is contained in:
Mischa
2026-01-24 22:17:26 -08:00
committed by Mischa Spiegelmock
parent aa24265fd1
commit e718f99e6f
2 changed files with 10 additions and 9 deletions

View File

@ -131,12 +131,9 @@ void PlaylistCWrapper::PlayPresetIndex(uint32_t index, bool hardCut, bool resetF
{
if (m_presetLoadEventCallback(index, filename.c_str(), hardCut, m_presetLoadEventUserData))
{
// Application handled the load, don't try to load from filesystem.
// Only fire switched event if the app's load succeeded.
if (!m_lastPresetSwitchFailed && m_presetSwitchedEventCallback != nullptr)
{
m_presetSwitchedEventCallback(hardCut, index, m_presetSwitchedEventUserData);
}
// Application handled the load - return without further action.
// The app is responsible for calling projectm_load_preset_file/data,
// handling errors, and firing the switched event when ready.
return;
}
}

View File

@ -80,20 +80,24 @@ typedef void (*projectm_playlist_preset_switch_failed_event)(const char* preset_
* - Custom preset storage solutions
*
* When this callback is set and returns true, the playlist library will NOT attempt
* to load the preset file itself. The application is responsible for calling
* projectm_load_preset_file() or projectm_load_preset_data() with the preset content.
* to load the preset file itself and will return immediately without firing any events.
* The application takes full responsibility for:
* - Calling projectm_load_preset_file() or projectm_load_preset_data() with the preset content
* - Handling any loading errors
* - Firing the preset_switched_event callback when the preset is ready (if desired)
*
* If the callback returns false or is not set, the playlist library will use the
* default behavior of loading the preset from the filesystem.
*
* @note The filename pointer is only valid inside the callback. Make a copy if it needs
* to be retained for later use.
* @note Do not call any playlist preset-switching functions from within this callback.
* @param index The playlist index of the preset to be loaded.
* @param filename The preset filename/URL at this index. Can be used as a key or path.
* @param hard_cut True if this should be a hard cut, false for a smooth transition.
* @param user_data A user-defined data pointer that was provided when registering the callback,
* e.g. context information.
* @return True if the application handled the preset loading, false to use default behavior.
* @return True if the application handles preset loading, false to use default behavior.
* @since 4.2.0
*/
typedef bool (*projectm_playlist_preset_load_event)(unsigned int index, const char* filename,