mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-27 06:35:35 +00:00
- init cond stuff refactored properly
- hit a wall in splaytree compilation, involving symbolic types git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@220 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -38,6 +38,7 @@
|
||||
#include "Preset.hpp"
|
||||
#include "SplayTree.hpp"
|
||||
#include "ParamUtils.hpp"
|
||||
#include "InitCondUtils.hpp"
|
||||
#include "wipemalloc.h"
|
||||
|
||||
#define MAX_SAMPLE_SIZE 4096
|
||||
@ -550,59 +551,11 @@ void CustomWave::evalPerPointEqns() {
|
||||
|
||||
void CustomWave::load_unspecified_init_conds() {
|
||||
|
||||
LoadUnspecInitCond fun(*this);
|
||||
InitCondUtils::LoadUnspecInitCond fun(*this->init_cond_tree, *this->per_frame_init_eqn_tree);
|
||||
param_tree->traverse(fun);
|
||||
|
||||
}
|
||||
|
||||
CustomWave::LoadUnspecInitCond::LoadUnspecInitCond(CustomWave & customWave):m_customWave(customWave) {}
|
||||
|
||||
void CustomWave::LoadUnspecInitCond::operator() (Param * param) {
|
||||
|
||||
|
||||
InitCond * init_cond;
|
||||
CValue init_val;
|
||||
|
||||
/* Don't count these parameters as initial conditions */
|
||||
if (param->flags & P_FLAG_READONLY)
|
||||
return;
|
||||
if (param->flags & P_FLAG_QVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_TVAR)
|
||||
return;
|
||||
if (param->flags & P_FLAG_USERDEF)
|
||||
return;
|
||||
|
||||
/* If initial condition was not defined by the preset file, force a default one
|
||||
with the following code */
|
||||
if ((init_cond = (InitCond*)m_customWave.init_cond_tree->splay_find(param->name)) == NULL) {
|
||||
|
||||
/* Make sure initial condition does not exist in the set of per frame initial equations */
|
||||
if ((init_cond = (InitCond*)m_customWave.per_frame_init_eqn_tree->splay_find(param->name)) != NULL)
|
||||
return;
|
||||
|
||||
if (param->type == P_TYPE_BOOL)
|
||||
init_val.bool_val = 0;
|
||||
|
||||
else if (param->type == P_TYPE_INT)
|
||||
init_val.int_val = *(int*)param->engine_val;
|
||||
|
||||
else if (param->type == P_TYPE_DOUBLE)
|
||||
init_val.float_val = *(float*)param->engine_val;
|
||||
|
||||
//printf("%s\n", param->name);
|
||||
/* Create new initial condition */
|
||||
if ((init_cond = new InitCond(param, init_val)) == NULL)
|
||||
return;
|
||||
|
||||
/* Insert the initial condition into this presets tree */
|
||||
if (m_customWave.init_cond_tree->splay_insert(init_cond, init_cond->param->name) < 0) {
|
||||
delete init_cond;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user