@@ -37,17 +37,24 @@ void ProjectMWrapper::initialize(Poco::Util::Application& app)
3737
3838 _projectM = projectm_create ();
3939
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+
4047 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 ));
4350 projectm_set_aspect_correction (_projectM, _projectMConfigView->getBool (" aspectCorrectionEnabled" , true ));
4451 projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" , false ));
4552
4653 // 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 ));
4956 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 ));
5158 projectm_set_hard_cut_sensitivity (_projectM, static_cast <float >(_projectMConfigView->getDouble (" hardCutSensitivity" , 1.0 )));
5259 projectm_set_beat_sensitivity (_projectM, static_cast <float >(_projectMConfigView->getDouble (" beatSensitivity" , 1.0 )));
5360
@@ -81,7 +88,6 @@ void ProjectMWrapper::initialize(Poco::Util::Application& app)
8188 // be sure what the link exactly points to, especially if a trailing slash is missing.
8289 projectm_playlist_add_path (_playlist, presetPath.c_str (), true , false );
8390 }
84-
8591 }
8692 projectm_playlist_sort (_playlist, 0 , projectm_playlist_size (_playlist), SORT_PREDICATE_FILENAME_ONLY, SORT_ORDER_ASCENDING);
8793
@@ -129,6 +135,11 @@ int ProjectMWrapper::TargetFPS()
129135 return _projectMConfigView->getInt (" fps" , 60 );
130136}
131137
138+ void ProjectMWrapper::UpdateRealFPS (float fps)
139+ {
140+ projectm_set_fps (_projectM, static_cast <uint32_t >(std::round (fps)));
141+ }
142+
132143void ProjectMWrapper::RenderFrame () const
133144{
134145 glClearColor (0.0 , 0.0 , 0.0 , 0.0 );
@@ -250,12 +261,47 @@ void ProjectMWrapper::OnConfigurationPropertyRemoved(const std::string& key)
250261
251262 if (key == " projectM.presetLocked" )
252263 {
253- projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" ));
264+ projectm_set_preset_locked (_projectM, _projectMConfigView->getBool (" presetLocked" , false ));
254265 Poco::NotificationCenter::defaultCenter ().postNotification (new UpdateWindowTitleNotification);
255266 }
256267
257268 if (key == " projectM.shuffleEnabled" )
258269 {
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 ));
260306 }
261307}
0 commit comments