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
This commit is contained in:
psperl
2007-08-12 18:55:14 +00:00
parent 31fd2c5cd9
commit aa8864d3f1
2 changed files with 18 additions and 15 deletions

View File

@ -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;
}

View File

@ -177,6 +177,8 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode
case PROJECTM_K_r:
m_activePreset = m_presetChooser->weightedRandom<PresetChooser::UniformRandomFunctor>
(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;