@@ -37,17 +37,24 @@ void ProjectMWrapper::initialize(Poco::Util::Application& app)
37
37
38
38
_projectM = projectm_create ();
39
39
40
+ int fps = _projectMConfigView->getInt (" fps" , 60 );
41
+ if (fps <= 0 )
42
+ {
43
+ // We don't know the target framerate, pass in a default of 60.
44
+ fps = 60 ;
45
+ }
46
+
40
47
projectm_set_window_size (_projectM, canvasWidth, canvasHeight);
41
- projectm_set_fps (_projectM, _projectMConfigView-> getInt ( " fps" , 60 ) );
42
- projectm_set_mesh_size (_projectM, _projectMConfigView->getInt (" meshX" , 220 ), _projectMConfigView->getInt (" meshY" , 125 ));
48
+ projectm_set_fps (_projectM, fps);
49
+ projectm_set_mesh_size (_projectM, _projectMConfigView->getInt (" meshX" , 48 ), _projectMConfigView->getInt (" meshY" , 32 ));
43
50
projectm_set_aspect_correction (_projectM, _projectMConfigView->getBool (" aspectCorrectionEnabled" , true ));
44
51
projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" , false ));
45
52
46
53
// Preset display settings
47
- projectm_set_preset_duration (_projectM, _projectMConfigView->getInt (" displayDuration" , 30 ));
48
- projectm_set_soft_cut_duration (_projectM, _projectMConfigView->getInt (" transitionDuration" , 3 ));
54
+ projectm_set_preset_duration (_projectM, _projectMConfigView->getDouble (" displayDuration" , 30.0 ));
55
+ projectm_set_soft_cut_duration (_projectM, _projectMConfigView->getDouble (" transitionDuration" , 3.0 ));
49
56
projectm_set_hard_cut_enabled (_projectM, _projectMConfigView->getBool (" hardCutsEnabled" , false ));
50
- projectm_set_hard_cut_duration (_projectM, _projectMConfigView->getInt (" hardCutDuration" , 20 ));
57
+ projectm_set_hard_cut_duration (_projectM, _projectMConfigView->getDouble (" hardCutDuration" , 20.0 ));
51
58
projectm_set_hard_cut_sensitivity (_projectM, static_cast <float >(_projectMConfigView->getDouble (" hardCutSensitivity" , 1.0 )));
52
59
projectm_set_beat_sensitivity (_projectM, static_cast <float >(_projectMConfigView->getDouble (" beatSensitivity" , 1.0 )));
53
60
@@ -81,7 +88,6 @@ void ProjectMWrapper::initialize(Poco::Util::Application& app)
81
88
// be sure what the link exactly points to, especially if a trailing slash is missing.
82
89
projectm_playlist_add_path (_playlist, presetPath.c_str (), true , false );
83
90
}
84
-
85
91
}
86
92
projectm_playlist_sort (_playlist, 0 , projectm_playlist_size (_playlist), SORT_PREDICATE_FILENAME_ONLY, SORT_ORDER_ASCENDING);
87
93
@@ -129,6 +135,11 @@ int ProjectMWrapper::TargetFPS()
129
135
return _projectMConfigView->getInt (" fps" , 60 );
130
136
}
131
137
138
+ void ProjectMWrapper::UpdateRealFPS (float fps)
139
+ {
140
+ projectm_set_fps (_projectM, static_cast <uint32_t >(std::round (fps)));
141
+ }
142
+
132
143
void ProjectMWrapper::RenderFrame () const
133
144
{
134
145
glClearColor (0.0 , 0.0 , 0.0 , 0.0 );
@@ -250,12 +261,47 @@ void ProjectMWrapper::OnConfigurationPropertyRemoved(const std::string& key)
250
261
251
262
if (key == " projectM.presetLocked" )
252
263
{
253
- projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" ));
264
+ projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" , false ));
254
265
Poco::NotificationCenter::defaultCenter ().postNotification (new UpdateWindowTitleNotification);
255
266
}
256
267
257
268
if (key == " projectM.shuffleEnabled" )
258
269
{
259
- projectm_playlist_set_shuffle (_playlist, _projectMConfigView->getBool (" shuffleEnabled" ));
270
+ projectm_playlist_set_shuffle (_playlist, _projectMConfigView->getBool (" shuffleEnabled" , true ));
271
+ }
272
+
273
+ if (key == " projectM.aspectCorrectionEnabled" )
274
+ {
275
+ projectm_set_aspect_correction (_projectM, _projectMConfigView->getBool (" aspectCorrectionEnabled" , true ));
276
+ }
277
+
278
+ if (key == " projectM.displayDuration" )
279
+ {
280
+ projectm_set_preset_duration (_projectM, _projectMConfigView->getDouble (" displayDuration" , 30.0 ));
281
+ }
282
+
283
+ if (key == " projectM.transitionDuration" )
284
+ {
285
+ projectm_set_soft_cut_duration (_projectM, _projectMConfigView->getDouble (" transitionDuration" , 3.0 ));
286
+ }
287
+
288
+ if (key == " projectM.hardCutsEnabled" )
289
+ {
290
+ projectm_set_aspect_correction (_projectM, _projectMConfigView->getBool (" hardCutsEnabled" , false ));
291
+ }
292
+
293
+ if (key == " projectM.hardCutDuration" )
294
+ {
295
+ projectm_set_hard_cut_duration (_projectM, _projectMConfigView->getDouble (" hardCutDuration" , 20.0 ));
296
+ }
297
+
298
+ if (key == " projectM.hardCutSensitivity" )
299
+ {
300
+ projectm_set_hard_cut_sensitivity (_projectM, static_cast <float >(_projectMConfigView->getDouble (" hardCutSensitivity" , 1.0 )));
301
+ }
302
+
303
+ if (key == " projectM.meshX" || key == " projectM.meshY" )
304
+ {
305
+ projectm_set_mesh_size (_projectM, _projectMConfigView->getUInt64 (" meshX" , 48 ), _projectMConfigView->getUInt64 (" meshY" , 32 ));
260
306
}
261
307
}
0 commit comments