Skip to content

Commit e90dc28

Browse files
committedDec 9, 2024··
Improve playlist documentation regarding callbacks.
Doxygen documentation now mentions that the playlist library will set the preset switch callbacks in projectM and needs them to function properly. Added hints on how to restore functionality if needed.
1 parent 3eaa733 commit e90dc28

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed
 

Diff for: ‎src/playlist/api/projectM-4/playlist_core.h

+25-9
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,18 @@ extern "C" {
3636
/**
3737
* @brief Creates a playlist manager for the given projectM instance
3838
*
39-
* Only one active playlist manager is supported per projectM instance. If multiple playlists use
39+
* <p>Only one active playlist manager is supported per projectM instance. If multiple playlists use
4040
* the same projectM instance, only the last created playlist manager will receive preset change
41-
* callbacks from the projectM instance.
41+
* callbacks from the projectM instance.</p>
4242
*
43-
* To switch to another playlist, use the projectm_playlist_connect() method.
43+
* <p>To switch to another playlist, use the <tt>projectm_playlist_connect()</tt> method.</p>
44+
*
45+
* @important <p>If the projectM handle is not NULL, this method will register the playlist manager with the
46+
* <tt>projectm_preset_switch_requested_event</tt> and <tt>projectm_preset_switch_failed_event</tt> callbacks
47+
* of the referenced projectM instance. Setting any one of those callbacks to another function pointer
48+
* afterwards will cause the playlist manager to no longer being able to switch presets.</p>
49+
* <p>If the callback needs to be changed temporarily, the playlist functionality can be restored by calling
50+
* <tt>projectm_playlist_connect()</tt>, which will re-register the callbacks.</p>
4451
*
4552
* @param projectm_instance The projectM instance to connect to. Can be a null pointer to leave the newly
4653
* created playlist instance unconnected.
@@ -52,7 +59,9 @@ PROJECTM_PLAYLIST_EXPORT projectm_playlist_handle projectm_playlist_create(proje
5259
/**
5360
* @brief Destroys a previously created playlist manager.
5461
*
55-
* If the playlist manager is currently connected to a projectM instance, it will be disconnected.
62+
* If the playlist manager is currently connected to a projectM instance, it will be disconnected
63+
* by resetting the <tt>projectm_preset_switch_requested_event</tt> and
64+
* <tt>projectm_preset_switch_failed_event</tt> callbacks to NULL.
5665
*
5766
* @param instance The playlist manager instance to destroy.
5867
* @since 4.0.0
@@ -62,14 +71,21 @@ PROJECTM_PLAYLIST_EXPORT void projectm_playlist_destroy(projectm_playlist_handle
6271
/**
6372
* @brief Connects the playlist manager to a projectM instance.
6473
*
65-
* Sets or removes the preset switch callbacks and stores the projectM instance handle for use with
66-
* manual preset switches via the playlist API.
74+
* <p>Sets or removes the preset switch callbacks and stores the projectM instance handle for use with
75+
* manual preset switches via the playlist API.</p>
6776
*
68-
* When switching between multiple playlist managers, first call this method on the last used
77+
* <p>When switching between multiple playlist managers, first call this method on the last used
6978
* playlist manager with a null pointer for the projectM instance, then call this method with the
7079
* actual projectM instance on the playlist manager that should be activated. It is also safe to
71-
* call projectm_playlist_connect() with a null projectM handle on all playlist manager instances
72-
* before activating a single one with a valid, non-null projectM handle.
80+
* call <tt>projectm_playlist_connect()</tt> with a null projectM handle on all playlist manager instances
81+
* before activating a single one with a valid, non-null projectM handle.</p>
82+
*
83+
* @important <p>If the projectM handle is not NULL, this method will register the playlist manager with the
84+
* <tt>projectm_preset_switch_requested_event</tt> and <tt>projectm_preset_switch_failed_event</tt> callbacks
85+
* of the referenced projectM instance. Setting any one of those callbacks to another function pointer
86+
* afterwards will cause the playlist manager to no longer being able to switch presets.</p>
87+
* <p>If the callback needs to be changed temporarily, the playlist functionality can be restored by calling
88+
* <tt>projectm_playlist_connect()</tt>, which will re-register the callbacks.</p>
7389
*
7490
* @param instance The playlist manager instance.
7591
* @param projectm_instance The projectM instance to connect to. Can be a null pointer to remove

0 commit comments

Comments
 (0)
Please sign in to comment.