-
-
Notifications
You must be signed in to change notification settings - Fork 375
/
parameters.h
310 lines (279 loc) · 12.4 KB
/
parameters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/**
* @file parameters.h
* @copyright 2003-2023 projectM Team
* @brief Functions to set and retrieve all sorts of projectM parameters and setting.
*
* 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 Sets the texture search paths.
*
* Calling this method will clear and reload all textures, including the main rendering texture.
* Can cause a small delay/lag in rendering. Only use if texture paths were changed.
*
* @param instance The projectM instance handle.
* @param texture_search_paths A list of texture search paths.
* @param count The number of paths in the list.
*/
PROJECTM_EXPORT void projectm_set_texture_search_paths(projectm_handle instance,
const char** texture_search_paths,
size_t count);
/**
* @brief Sets a user-specified frame time in fractional seconds.
*
* Setting this to any value equal to or larger than zero will make projectM use this time value for
* animations instead of the system clock. Any value less than zero will use the system time instead,
* which is the default behavior.
*
* This method can be used to render visualizations at non-realtime frame rates, e.g. encoding a video
* as fast as projectM can render frames.
*
* While switching back and forth between system and user time values is possible, it will cause
* visual artifacts in the rendering as the time value will make large jumps between frames. Thus,
* it is recommended to stay with one type of timing value.
*
* If using this feature, it is further recommended to set the time to 0.0 on the first frame.
*
* @param instance The projectM instance handle.
* @param seconds_since_first_frame Any value >= 0 to use user-specified timestamps, values < 0 will use the system clock.
*/
PROJECTM_EXPORT void projectm_set_frame_time(projectm_handle instance, double seconds_since_first_frame);
/**
* @brief Returns the fractional seconds time value used rendering the last frame.
* @note This will not return the value set with projectm_set_frame_time, but the actual time
* used to render the last frame. If a user-specified frame time was set, this value is
* returned. Otherwise, the frame time measured via the system clock will be returned.
* @param instance The projectM instance handle.
* @return Time elapsed since projectM was started, or the value of the user-specified time value used
* to render the last frame.
*/
PROJECTM_EXPORT double projectm_get_last_frame_time(projectm_handle instance);
/**
* @brief Sets the beat sensitivity.
*
* The beat sensitivity to be used.
*
* @param instance The projectM instance handle.
* @param sensitivity The sensitivity setting.
*/
PROJECTM_EXPORT void projectm_set_beat_sensitivity(projectm_handle instance, float sensitivity);
/**
* @brief Returns the beat sensitivity.
* @param instance The projectM instance handle.
* @return The current sensitivity setting.
*/
PROJECTM_EXPORT float projectm_get_beat_sensitivity(projectm_handle instance);
/**
* @brief Sets the minimum display time before a hard cut can happen.
*
* <p>Hard cuts are beat-sensitive preset transitions, immediately changing from
* one preset to the next without a smooth blending period.</p>
*
* <p>Set this to a higher value than preset duration to disable hard cuts.</p>
*
* @param instance The projectM instance handle.
* @param seconds Minimum number of seconds the preset will be displayed before a hard cut.
*/
PROJECTM_EXPORT void projectm_set_hard_cut_duration(projectm_handle instance, double seconds);
/**
* @brief Returns the minimum display time before a hard cut can happen.
* @param instance The projectM instance handle.
* @return The minimum number of seconds the preset will be displayed before a hard cut.
*/
PROJECTM_EXPORT double projectm_get_hard_cut_duration(projectm_handle instance);
/**
* @brief Enables or disables hard cuts.
*
* Even if enabled, the hard cut duration must be set to a value lower than the preset duration
* to work properly.
*
* @param instance The projectM instance handle.
* @param enabled True to enable hard cuts, false to disable.
*/
PROJECTM_EXPORT void projectm_set_hard_cut_enabled(projectm_handle instance, bool enabled);
/**
* @brief Returns whether hard cuts are enabled or not.
* @param instance The projectM instance handle.
* @return True if hard cuts are enabled, false otherwise.
*/
PROJECTM_EXPORT bool projectm_get_hard_cut_enabled(projectm_handle instance);
/**
* @brief Sets the hard cut volume sensitivity.
*
* The beat detection volume difference that must be surpassed to trigger a hard cut.
*
* @param instance The projectM instance handle.
* @param sensitivity The volume threshold that triggers a hard cut if surpassed.
*/
PROJECTM_EXPORT void projectm_set_hard_cut_sensitivity(projectm_handle instance, float sensitivity);
/**
* @brief Returns the current hard cut sensitivity.
* @param instance The projectM instance handle.
* @return The current hard cut sensitivity.
*/
PROJECTM_EXPORT float projectm_get_hard_cut_sensitivity(projectm_handle instance);
/**
* @brief Sets the time in seconds for a soft transition between two presets.
*
* During a soft cut, both presets are rendered and slowly transitioned from one
* to the other.
*
* @param instance The projectM instance handle.
* @param seconds Time in seconds it takes to smoothly transition from one preset to another.
*/
PROJECTM_EXPORT void projectm_set_soft_cut_duration(projectm_handle instance, double seconds);
/**
* @brief Returns the time in seconds for a soft transition between two presets.
* @param instance The projectM instance handle.
* @return Time in seconds it takes to smoothly transition from one preset to another.
*/
PROJECTM_EXPORT double projectm_get_soft_cut_duration(projectm_handle instance);
/**
* @brief Sets the preset display duration before switching to the next using a soft cut.
*
* This can be considered as the maximum time a preset is displayed. If this time is reached,
* a smooth cut will be initiated. A hard cut, if any, will always happen before this time.
*
* @param instance The projectM instance handle.
* @param seconds The number of seconds a preset will be displayed before the next is shown.
*/
PROJECTM_EXPORT void projectm_set_preset_duration(projectm_handle instance, double seconds);
/**
* @brief Returns the preset display duration before switching to the next using a soft cut.
*
* This can be considered as the maximum time a preset is displayed. If this time is reached,
* a smooth cut will be initiated. A hard cut, if any, will always happen before this time.
*
* @param instance The projectM instance handle.
* @return The currently set preset display duration in seconds.
*/
PROJECTM_EXPORT double projectm_get_preset_duration(projectm_handle instance);
/**
* @brief Sets the per-pixel equation mesh size in units.
* Will internally be clamped to [8,300] in each axis. If any dimension is set to an odd value, it will be incremented by 1
* so only multiples of two are used.
* @param instance The projectM instance handle.
* @param width The new width of the mesh.
* @param height The new height of the mesh.
*/
PROJECTM_EXPORT void projectm_set_mesh_size(projectm_handle instance, size_t width, size_t height);
/**
* @brief Returns the per-pixel equation mesh size in units.
* @param instance The projectM instance handle.
* @param width The width of the mesh.
* @param height The height of the mesh.
*/
PROJECTM_EXPORT void projectm_get_mesh_size(projectm_handle instance, size_t* width, size_t* height);
/**
* @brief Sets the current/average frames per second.
*
* Applications running projectM should UpdateMeshSize this value regularly and set it to the calculated
* (and possibly averaged) FPS value the output rendered with. The value is passed on to presets,
* which may choose to use it for calculations. It is not used in any other way by the library.
*
* @param instance The projectM instance handle.
* @param fps The current FPS value projectM is running with.
*/
PROJECTM_EXPORT void projectm_set_fps(projectm_handle instance, int32_t fps);
/**
* @brief Returns the current/average frames per second.
*
* This value needs to be set by the application. If it wasn't set, a default value of 60 is used.
*
* @param instance The projectM instance handle.
* @return The current/average frames per second.
*/
PROJECTM_EXPORT int32_t projectm_get_fps(projectm_handle instance);
/**
* @brief Enabled or disables aspect ratio correction in presets that support it.
*
* This sets a flag presets can use to aspect-correct rendered shapes, which otherwise would
* be distorted if the viewport isn't exactly square.
*
* @param instance The projectM instance handle.
* @param enabled True to enable aspect correction, false to disable it.
*/
PROJECTM_EXPORT void projectm_set_aspect_correction(projectm_handle instance, bool enabled);
/**
* @brief Returns whether aspect ratio correction is enabled or not.
* @param instance The projectM instance handle.
* @return True if aspect ratio correction is enabled, false otherwise.
*/
PROJECTM_EXPORT bool projectm_get_aspect_correction(projectm_handle instance);
/**
* @brief Sets the "easter egg" value.
*
* <p>This doesn't enable any fancy feature, it only influences the randomized display time of presets. It's
* passed as the "sigma" value of the gaussian random number generator used to determine the maximum display time,
* effectively multiplying the generated number of seconds by this amount.</p>
*
* <p>See function sampledPresetDuration() of the TimeKeeper class on how it is used.</p>
*
* @param instance The projectM instance handle.
* @param value The new "easter egg" value. Must be greater than zero, otherwise a default sigma value of 1.0 will be used.
*/
PROJECTM_EXPORT void projectm_set_easter_egg(projectm_handle instance, float value);
/**
* @brief Returns the current "easter egg" value.
* @param instance The projectM instance handle.
* @return The current "easter egg" value.
*/
PROJECTM_EXPORT float projectm_get_easter_egg(projectm_handle instance);
/**
* @brief Locks or unlocks the current preset.
*
* Locking effectively disables automatic preset transitions, both hard and soft cuts. Programmatic
* preset switches will still be executed.
*
* @param instance The projectM instance handle.
* @param lock True to lock the current preset, false to enable automatic transitions.
*/
PROJECTM_EXPORT void projectm_set_preset_locked(projectm_handle instance, bool lock);
/**
* @brief Returns whether the current preset is locked or not.
* @param instance The projectM instance handle.
* @return True if the preset lock is enabled, false otherwise.
*/
PROJECTM_EXPORT bool projectm_get_preset_locked(projectm_handle instance);
/**
* @brief Sets the current viewport size in pixels.
*
* Calling this function will reset the OpenGL renderer.
*
* @param instance The projectM instance handle.
* @param width New viewport width in pixels.
* @param height New viewport height in pixels.
*/
PROJECTM_EXPORT void projectm_set_window_size(projectm_handle instance, size_t width, size_t height);
/**
* @brief Returns the current viewport size in pixels.
* @param instance The projectM instance handle.
* @param width Valid pointer to a size_t variable that will receive the window width value.
* @param height Valid pointer to a size_t variable that will receive the window height value.
*/
PROJECTM_EXPORT void projectm_get_window_size(projectm_handle instance, size_t* width, size_t* height);
#ifdef __cplusplus
} // extern "C"
#endif