Cog/ThirdParty/libprojectM/include/projectM-4/callbacks.h
Christopher Snowhill 341e27b3b6 Visualization Experiment: Test out projectM
This was just an experiment, and was hashed in to test it out. It does
not look like it would be a very efficient thing to ship this in the
main app at all, especially since the collection of presets is so dang
huge. It was also never meant to replace the existing visualizations,
but instead as another option. One of the things from this branch will
make it into the final: Optional nullability of the Visualization
Manager parameters, since technically they're both checked on call.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2025-03-14 17:36:06 -07:00

89 lines
3.6 KiB
C

/**
* @file callbacks.h
* @copyright 2003-2023 projectM Team
* @brief Functions and prototypes for projectM callbacks.
*
* projectM -- Milkdrop-esque visualisation SDK
* Copyright (C)2003-2023 projectM Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* See 'LICENSE.txt' included within this release
*
*/
#pragma once
#include "projectM-4/types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Callback function that is executed whenever projectM wants to switch to a new preset.
*
* @param is_hard_cut If true, the transition was triggered by a beat-driven event.
* @param user_data A user-defined data pointer that was provided when registering the callback,
* e.g. context information.
*/
typedef void (*projectm_preset_switch_requested_event)(bool is_hard_cut, void* user_data);
/**
* @brief Callback function that is executed if a preset change failed.
*
* The message and filename pointers are only valid inside the callback. Make a copy if these values
* need to be retained for later use.
*
* @param preset_filename The filename of the failed preset.
* @param message The error message.
* @param user_data A user-defined data pointer that was provided when registering the callback,
* e.g. context information.
*/
typedef void (*projectm_preset_switch_failed_event)(const char* preset_filename,
const char* message, void* user_data);
/**
* @brief Sets a callback function that will be called when a preset change is requested.
*
* Only one callback can be registered per projectM instance. To remove the callback, use NULL.
*
* @param instance The projectM instance handle.
* @param callback A pointer to the callback function.
* @param user_data A pointer to any data that will be sent back in the callback, e.g. context
* information.
*/
PROJECTM_EXPORT void projectm_set_preset_switch_requested_event_callback(projectm_handle instance,
projectm_preset_switch_requested_event callback,
void* user_data);
/**
* @brief Sets a callback function that will be called when a preset change failed.
*
* Only one callback can be registered per projectM instance. To remove the callback, use NULL.
*
* @param instance The projectM instance handle.
* @param callback A pointer to the callback function.
* @param user_data A pointer to any data that will be sent back in the callback, e.g. context
* information.
*/
PROJECTM_EXPORT void projectm_set_preset_switch_failed_event_callback(projectm_handle instance,
projectm_preset_switch_failed_event callback,
void* user_data);
#ifdef __cplusplus
} // extern "C"
#endif