From aa8864d3f1050b278c4a44e27906d0af2dadf53a Mon Sep 17 00:00:00 2001 From: psperl Date: Sun, 12 Aug 2007 18:55:14 +0000 Subject: [PATCH] PJS: minor tweaks to smooth preset switching git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@322 6778bc44-b910-0410-a7a0-be141de4315d --- src/projectM-engine/PresetMerge.cpp | 28 +++++++++++------------ src/projectM-engine/console_interface.cpp | 5 +++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/projectM-engine/PresetMerge.cpp b/src/projectM-engine/PresetMerge.cpp index d7ccdd5c0..69d37d017 100644 --- a/src/projectM-engine/PresetMerge.cpp +++ b/src/projectM-engine/PresetMerge.cpp @@ -7,40 +7,40 @@ void PresetMerger::MergePresets(PresetOutputs & A, PresetOutputs & B, double rat for (PresetOutputs::cshape_container::iterator pos = A.customShapes.begin(); pos != A.customShapes.end(); ++pos) - { - pos->second->a *= ratio; - pos->second->a2 *= ratio; - pos->second->border_a *= ratio; - } - - for (PresetOutputs::cshape_container::iterator pos = B.customShapes.begin(); - pos != B.customShapes.end(); ++pos) { pos->second->a *= invratio; pos->second->a2 *= invratio; pos->second->border_a *= invratio; - A.customShapes[pos->first>>8]=pos->second; + } + + for (PresetOutputs::cshape_container::iterator pos = B.customShapes.begin(); + pos != B.customShapes.end(); ++pos) + { + pos->second->a *= ratio; + pos->second->a2 *= ratio; + pos->second->border_a *= ratio; + A.customShapes[pos->first>>8]=pos->second; } for (PresetOutputs::cwave_container::iterator pos = A.customWaves.begin(); pos != A.customWaves.end(); ++pos) { - pos->second->a *= ratio; + pos->second->a *= invratio; for (int x; x < pos->second->samples; x++) { - pos->second->a_mesh[x]=pos->second->a_mesh[x]*ratio; + pos->second->a_mesh[x]=pos->second->a_mesh[x]*invratio; } } for (PresetOutputs::cwave_container::iterator pos = B.customWaves.begin(); pos != B.customWaves.end(); ++pos) { - pos->second->a *= invratio; + pos->second->a *= ratio; for (int x; x < pos->second->samples; x++) { - pos->second->a_mesh[x]=pos->second->a_mesh[x]*invratio; + pos->second->a_mesh[x]=pos->second->a_mesh[x]*ratio; } - A.customWaves[pos->first>>8]=pos->second; + A.customWaves[pos->first>>8]=pos->second; } diff --git a/src/projectM-engine/console_interface.cpp b/src/projectM-engine/console_interface.cpp index ef11b206f..907c58bd7 100755 --- a/src/projectM-engine/console_interface.cpp +++ b/src/projectM-engine/console_interface.cpp @@ -177,6 +177,8 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode case PROJECTM_K_r: m_activePreset = m_presetChooser->weightedRandom (this->presetInputs, this->presetOutputs); + presetInputs.frame = 0; + smoothFrame = 0; break; case PROJECTM_K_p: @@ -188,7 +190,8 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode } m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs); - + presetInputs.frame = 0; + smoothFrame = 0; break; case PROJECTM_K_l: if (renderer->noSwitch==0)renderer->noSwitch=1; else renderer->noSwitch=0;