diff --git a/src/linux/projectmDev10.kdevelop b/src/linux/projectmDev10.kdevelop
index 082aaca79..ae1e3a179 100644
--- a/src/linux/projectmDev10.kdevelop
+++ b/src/linux/projectmDev10.kdevelop
@@ -10,7 +10,7 @@
projectmDev10
../../
false
-
+
kdevsubversion
@@ -18,7 +18,7 @@
custom
/usr/local/bin/xmms
-
+
false
@@ -66,8 +66,8 @@
0
false
make
-
-
+
+
default
@@ -76,15 +76,15 @@
-
-
-
-
-
+
+
+
+
+
true
false
false
-
+
true
@@ -185,7 +185,7 @@
true
-
+
set
m_,_
theValue
@@ -197,9 +197,7 @@
true
Vertical
-
- automatic_%2Fhome%2Fcarm%2Fprojects%2Fdev-1.0
-
+
diff --git a/src/linux/projectmDev10.kdevses b/src/linux/projectmDev10.kdevses
index d4b3223a0..734a9572a 100644
--- a/src/linux/projectmDev10.kdevses
+++ b/src/linux/projectmDev10.kdevses
@@ -1,75 +1,111 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
@@ -78,6 +114,13 @@
+
+
+
+
+
+
+
@@ -90,9 +133,12 @@
+
+
+
-
-
+
+
diff --git a/src/projectM-engine/Algorithms.hpp b/src/projectM-engine/Algorithms.hpp
index 20355fe63..0311bf13e 100644
--- a/src/projectM-engine/Algorithms.hpp
+++ b/src/projectM-engine/Algorithms.hpp
@@ -1,7 +1,7 @@
#ifndef PROJECTM_ALGORITHMS_HPP
#define PROJECTM_ALGORITHMS_HPP
#include
-
+/// A collection of algorithms generically written over map style containers
namespace Algorithms
{
@@ -13,6 +13,7 @@ namespace Algorithms
for (typename Container::iterator pos = container.begin(); pos != container.end(); ++pos)
{
+ assert(pos->second);
functor(pos->second);
}
@@ -25,6 +26,7 @@ namespace Algorithms
for (typename Container::iterator pos = container.begin(); pos != container.end(); ++pos)
{
+ assert(pos->second);
functor(pos->second);
}
diff --git a/src/projectM-engine/BuiltinParams.cpp b/src/projectM-engine/BuiltinParams.cpp
index 519070465..0b8c7033b 100644
--- a/src/projectM-engine/BuiltinParams.cpp
+++ b/src/projectM-engine/BuiltinParams.cpp
@@ -4,6 +4,7 @@
#include "projectM.hpp"
#include
#include "Algorithms.hpp"
+#include "InitCondUtils.hpp"
#include
using namespace Algorithms;
@@ -190,7 +191,7 @@ int BuiltinParams::load_builtin_param_bool(char * name, void * engine_val, short
iv.int_val = init_val;
ub.int_val = TRUE;
- lb.int_val = FALSE;
+ lb.int_val = false;
param = new Param(name, P_TYPE_BOOL, flags, engine_val, NULL, iv, ub, lb);
@@ -272,19 +273,19 @@ int BuiltinParams::load_all_builtin_param(const PresetInputs & presetInputs, Pre
load_builtin_param_int("echo_orient", (void*)&presetOutputs.nVideoEchoOrientation, P_FLAG_NONE, 0, 3, 0, "nVideoEchoOrientation");
load_builtin_param_int("wave_mode", (void*)&presetOutputs.nWaveMode, P_FLAG_NONE, 0, 7, 0, "nWaveMode");
- load_builtin_param_bool("wave_additive", (void*)&presetOutputs.bAdditiveWaves, P_FLAG_NONE, FALSE, "bAdditiveWaves");
- load_builtin_param_bool("bModWaveAlphaByVolume", (void*)&presetOutputs.bModWaveAlphaByVolume, P_FLAG_NONE, FALSE, NULL);
- load_builtin_param_bool("wave_brighten", (void*)&presetOutputs.bMaximizeWaveColor, P_FLAG_NONE, FALSE, "bMaximizeWaveColor");
- load_builtin_param_bool("wrap", (void*)&presetOutputs.bTexWrap, P_FLAG_NONE, FALSE, "bTexWrap");
- load_builtin_param_bool("darken_center", (void*)&presetOutputs.bDarkenCenter, P_FLAG_NONE, FALSE, "bDarkenCenter");
- load_builtin_param_bool("bRedBlueStereo", (void*)&presetOutputs.bRedBlueStereo, P_FLAG_NONE, FALSE, NULL);
- load_builtin_param_bool("brighten", (void*)&presetOutputs.bBrighten, P_FLAG_NONE, FALSE, "bBrighten");
- load_builtin_param_bool("darken", (void*)&presetOutputs.bDarken, P_FLAG_NONE, FALSE, "bDarken");
- load_builtin_param_bool("solarize", (void*)&presetOutputs.bSolarize, P_FLAG_NONE, FALSE, "bSolarize");
- load_builtin_param_bool("invert", (void*)&presetOutputs.bInvert, P_FLAG_NONE, FALSE, "bInvert");
- load_builtin_param_bool("bMotionVectorsOn", (void*)&presetOutputs.bMotionVectorsOn, P_FLAG_NONE, FALSE, NULL);
- load_builtin_param_bool("wave_dots", (void*)&presetOutputs.bWaveDots, P_FLAG_NONE, FALSE, "bWaveDots");
- load_builtin_param_bool("wave_thick", (void*)&presetOutputs.bWaveThick, P_FLAG_NONE, FALSE, "bWaveThick");
+ load_builtin_param_bool("wave_additive", (void*)&presetOutputs.bAdditiveWaves, P_FLAG_NONE, false, "bAdditiveWaves");
+ load_builtin_param_bool("bModWaveAlphaByVolume", (void*)&presetOutputs.bModWaveAlphaByVolume, P_FLAG_NONE, false, NULL);
+ load_builtin_param_bool("wave_brighten", (void*)&presetOutputs.bMaximizeWaveColor, P_FLAG_NONE, false, "bMaximizeWaveColor");
+ load_builtin_param_bool("wrap", (void*)&presetOutputs.bTexWrap, P_FLAG_NONE, false, "bTexWrap");
+ load_builtin_param_bool("darken_center", (void*)&presetOutputs.bDarkenCenter, P_FLAG_NONE, false, "bDarkenCenter");
+ load_builtin_param_bool("bRedBlueStereo", (void*)&presetOutputs.bRedBlueStereo, P_FLAG_NONE, false, NULL);
+ load_builtin_param_bool("brighten", (void*)&presetOutputs.bBrighten, P_FLAG_NONE, false, "bBrighten");
+ load_builtin_param_bool("darken", (void*)&presetOutputs.bDarken, P_FLAG_NONE, false, "bDarken");
+ load_builtin_param_bool("solarize", (void*)&presetOutputs.bSolarize, P_FLAG_NONE, false, "bSolarize");
+ load_builtin_param_bool("invert", (void*)&presetOutputs.bInvert, P_FLAG_NONE, false, "bInvert");
+ load_builtin_param_bool("bMotionVectorsOn", (void*)&presetOutputs.bMotionVectorsOn, P_FLAG_NONE, false, NULL);
+ load_builtin_param_bool("wave_dots", (void*)&presetOutputs.bWaveDots, P_FLAG_NONE, false, "bWaveDots");
+ load_builtin_param_bool("wave_thick", (void*)&presetOutputs.bWaveThick, P_FLAG_NONE, false, "bWaveThick");
load_builtin_param_float("zoom", (void*)&presetOutputs.zoom, presetOutputs.zoom_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, 0, NULL);
load_builtin_param_float("rot", (void*)&presetOutputs.rot, presetOutputs.rot_mesh, P_FLAG_PER_PIXEL |P_FLAG_DONT_FREE_MATRIX, 0.0, MAX_DOUBLE_SIZE, MIN_DOUBLE_SIZE, NULL);
@@ -365,3 +366,4 @@ int BuiltinParams::load_all_builtin_param(const PresetInputs & presetInputs, Pre
return PROJECTM_SUCCESS;
}
+
diff --git a/src/projectM-engine/BuiltinParams.hpp b/src/projectM-engine/BuiltinParams.hpp
index 8d4af11fc..f92dcdc93 100644
--- a/src/projectM-engine/BuiltinParams.hpp
+++ b/src/projectM-engine/BuiltinParams.hpp
@@ -71,8 +71,6 @@ public:
}
- void traverse(void (*func_ptr)(void*));
-
private:
static const bool BUILTIN_PARAMS_DEBUG = false;
diff --git a/src/projectM-engine/CustomShape.cpp b/src/projectM-engine/CustomShape.cpp
index 5b799496a..009361c7b 100755
--- a/src/projectM-engine/CustomShape.cpp
+++ b/src/projectM-engine/CustomShape.cpp
@@ -7,7 +7,7 @@
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * This library is distributed i the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
diff --git a/src/projectM-engine/CustomWave.cpp b/src/projectM-engine/CustomWave.cpp
index 81390705f..af9886303 100755
--- a/src/projectM-engine/CustomWave.cpp
+++ b/src/projectM-engine/CustomWave.cpp
@@ -384,7 +384,7 @@ CustomWave::CustomWave(int _id):
CustomWave::~CustomWave() {
- for (std::map::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end(); ++pos)
+ for (std::map::iterator pos = per_point_eqn_tree.begin(); pos != per_point_eqn_tree.end(); ++pos)
delete(pos->second);
for (std::map::iterator pos = per_frame_eqn_tree.begin(); pos != per_frame_eqn_tree.end(); ++pos)
@@ -409,16 +409,6 @@ CustomWave::~CustomWave() {
free(value2);
free(sample_mesh);
- r_mesh = NULL;
- g_mesh = NULL;
- b_mesh = NULL;
- a_mesh = NULL;
- x_mesh = NULL;
- y_mesh = NULL;
- value1 = NULL;
- value2 = NULL;
- sample_mesh = NULL;
-
}
diff --git a/src/projectM-engine/CustomWave.hpp b/src/projectM-engine/CustomWave.hpp
index c9b4676da..d504da755 100755
--- a/src/projectM-engine/CustomWave.hpp
+++ b/src/projectM-engine/CustomWave.hpp
@@ -137,8 +137,6 @@ public:
void load_unspecified_init_conds();
void eval_custom_wave_init_conds();
- void evalPerPointEqn(PerPointEqn * per_point_eqn);
-
};
diff --git a/src/projectM-engine/InitCond.cpp b/src/projectM-engine/InitCond.cpp
index d7201b064..1cb3aa03c 100755
--- a/src/projectM-engine/InitCond.cpp
+++ b/src/projectM-engine/InitCond.cpp
@@ -34,22 +34,19 @@
#include "wipemalloc.h"
#include
+#include
char InitCond::init_cond_string_buffer[STRING_BUFFER_SIZE];
int InitCond::init_cond_string_buffer_index = 0;
/* Creates a new initial condition */
-InitCond::InitCond( Param * param, CValue init_val ) {
+InitCond::InitCond( Param * _param, CValue _init_val ):param(_param), init_val(_init_val) {
+
+ std::cerr << "InitCond::InitCond: " << this->param->name << std::endl;
+
assert(param);
-
- this->param = param;
- this->init_val = init_val;
-
- if ( INIT_COND_DEBUG ) {
- DWRITE( "InitCond::InitCond: %s -> %X -> %X\n",
- this->param->name.c_str(), this->param, this->param->engine_val );
- }
+ assert(param->engine_val);
}
/* Frees initial condition structure */
@@ -58,29 +55,35 @@ InitCond::~InitCond() {}
/* Evaluate an initial conditon */
void InitCond::evaluate() {
+
+
+ assert(this);
+
/* Parameter is of boolean type, either a 1 or 0 value integer */
/* Set matrix flag to zero. This ensures
its constant value will be used rather than a matrix value
*/
+
param->matrix_flag = 0;
if (param->type == P_TYPE_BOOL) {
- if (INIT_COND_DEBUG) {
- DWRITE( "init_cond: %s = %d (TYPE BOOL)\n", param->name.c_str(), init_val.bool_val);
- }
+
+ printf( "init_cond: %s = %d (TYPE BOOL)\n", param->name.c_str(), init_val.bool_val);
+
+
assert(param->engine_val);
*((int*)param->engine_val) = init_val.bool_val;
+
return;
}
/* Parameter is an integer type, just like C */
if ( param->type == P_TYPE_INT) {
- if ((param->name == "wave_mode") == 0 ) {
- }
if (INIT_COND_DEBUG) {
DWRITE( "init_cond: %s = %d (TYPE INT)\n", param->name.c_str(), init_val.int_val);
}
+ assert(param->engine_val);
*((int*)param->engine_val) = init_val.int_val;
return;
}
@@ -93,6 +96,7 @@ void InitCond::evaluate() {
init_val.float_val, *((float *)param->engine_val),
param, param->engine_val );
}
+ assert(param->engine_val);
*((float*)param->engine_val) = init_val.float_val;
return;
}
@@ -130,8 +134,7 @@ void InitCond::init_cond_to_string() {
if ((init_cond_string_buffer_index + string_length + 1) > (STRING_BUFFER_SIZE - 1))
return;
- /* Copy the string into the initial condition string buffer */
-
+ /* Copy the string into the initial condition string buffer */
strncpy(init_cond_string_buffer + init_cond_string_buffer_index, string, string_length);
/* Increment the string buffer, offset by one for the null terminator, which will be
diff --git a/src/projectM-engine/InitCondUtils.hpp b/src/projectM-engine/InitCondUtils.hpp
index 4ff0d90c9..2dcb6045a 100644
--- a/src/projectM-engine/InitCondUtils.hpp
+++ b/src/projectM-engine/InitCondUtils.hpp
@@ -23,6 +23,9 @@ inline void LoadUnspecInitCond::operator() (Param * param) {
InitCond * init_cond;
CValue init_val;
+ assert(param);
+ assert(param->engine_val);
+
/* Don't count these parameters as initial conditions */
if (param->flags & P_FLAG_READONLY)
return;
@@ -58,7 +61,7 @@ inline void LoadUnspecInitCond::operator() (Param * param) {
return;
/* Insert the initial condition into this presets tree */
- /// @bug check the reult status of insert
+ /// @bug check the result status of insert
m_initCondTree.insert(std::make_pair(init_cond->param->name, init_cond));
}
diff --git a/src/projectM-engine/PCM.cpp b/src/projectM-engine/PCM.cpp
index d4db5f17e..98269f77f 100755
--- a/src/projectM-engine/PCM.cpp
+++ b/src/projectM-engine/PCM.cpp
@@ -162,7 +162,6 @@ void PCM::addPCM16(short PCMdata[2][512])
PCMd[1][j % maxsamples] = (float)0;
}
}
-
// printf("Added %d samples %d %d %f\n",samples,start,(start+samples)%maxsamples,PCM[0][start+10]);
@@ -261,10 +260,7 @@ void PCM::getPCM(float *PCMdata, int samples, int channel, int freq, float smoot
rdft(samples, 1, temppcm, ip, w);
for (int j=0;j::iterator, bool> insertRetPair =
paramTree->insert(std::make_pair(param->name, param));
@@ -87,14 +87,14 @@ public:
class LoadInitCondFunctor
{
public:
- LoadInitCondFunctor(Preset * preset) :m_preset(preset) {}
+ LoadInitCondFunctor(Preset * preset) :m_preset(preset) {assert(preset);}
void operator() (Param * param)
{
InitCond * init_cond;
CValue init_val;
-
+ assert(param);
/* Don't count read only parameters as initial conditions */
if (param->flags & P_FLAG_READONLY)
return;
diff --git a/src/projectM-engine/Preset.cpp b/src/projectM-engine/Preset.cpp
index 25c250e23..50ca1ecb9 100755
--- a/src/projectM-engine/Preset.cpp
+++ b/src/projectM-engine/Preset.cpp
@@ -32,6 +32,7 @@
#include "Preset.hpp"
#include "Parser.hpp"
#include "ParamUtils.hpp"
+#include "InitCondUtils.hpp"
#include "fatal.h"
#include
@@ -40,37 +41,39 @@ Preset::Preset(const std::string & filename, const PresetInputs & presetInputs,
builtinParams(presetInputs, presetOutputs),
customWaves(&presetOutputs.customWaves),
customShapes(&presetOutputs.customShapes),
- m_presetOutputs(presetOutputs) {
+ m_presetOutputs(presetOutputs)
+{
- customWaves->clear();
- customShapes->clear();
- clearMeshChecks();
+ customWaves->clear();
+ customShapes->clear();
+ clearMeshChecks();
- initialize(filename);
+ initialize(filename);
}
Preset::~Preset()
{
- std::cout << "Preset destructor!" << std::endl;
Algorithms::traverse >(init_cond_tree);
Algorithms::traverse >(per_frame_init_eqn_tree);
Algorithms::traverse >(per_pixel_eqn_tree);
-
+
Algorithms::traverse >(per_frame_eqn_tree);
-
+
Algorithms::traverse >(user_param_tree);
-
+
/// @note We do not clear the actual container itself and instead let whoever initializes the preset inputs class to do it
- for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos) {
+ for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos)
+ {
assert(pos->second);
delete(pos->second);
-}
+ }
- for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos) {
+ for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos)
+ {
assert(pos->second);
delete(pos->second);
}
@@ -87,11 +90,8 @@ int Preset::add_per_pixel_eqn(char * name, GenExpr * gen_expr)
int index;
Param * param = NULL;
- /* Argument checks */
- if (gen_expr == NULL)
- return PROJECTM_FAILURE;
- if (name == NULL)
- return PROJECTM_FAILURE;
+ assert(gen_expr);
+ assert(name);
if (PER_PIXEL_EQN_DEBUG) printf("add_per_pixel_eqn: per pixel equation (name = \"%s\")\n", name);
@@ -123,8 +123,8 @@ int Preset::add_per_pixel_eqn(char * name, GenExpr * gen_expr)
return PROJECTM_FAILURE;
}
- index = per_pixel_eqn_tree.size();
-
+ index = per_pixel_eqn_tree.size();
+
/* Create the per pixel equation given the index, parameter, and general expression */
if ((per_pixel_eqn = new PerPixelEqn(index, param, gen_expr)) == NULL)
{
@@ -174,13 +174,15 @@ void Preset::evalCustomWavePerFrameEquations()
{
std::map & init_cond_tree = pos->second->init_cond_tree;
- for (std::map::iterator _pos = init_cond_tree.begin(); _pos != init_cond_tree.end(); ++_pos) {
+ for (std::map::iterator _pos = init_cond_tree.begin(); _pos != init_cond_tree.end(); ++_pos)
+ {
assert(_pos->second);
_pos->second->evaluate();
-}
+ }
std::map & per_frame_eqn_tree = pos->second->per_frame_eqn_tree;
- for (std::map::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos) {
- assert(_pos->second);
+ for (std::map::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos)
+ {
+ assert(_pos->second);
_pos->second->evaluate();
}
}
@@ -194,15 +196,17 @@ void Preset::evalCustomShapePerFrameEquations()
{
std::map & init_cond_tree = pos->second->init_cond_tree;
- for (std::map::iterator _pos = init_cond_tree.begin(); _pos != init_cond_tree.end(); ++_pos) {
+ for (std::map::iterator _pos = init_cond_tree.begin(); _pos != init_cond_tree.end(); ++_pos)
+ {
assert(_pos->second);
_pos->second->evaluate();
-}
+ }
std::map & per_frame_eqn_tree = pos->second->per_frame_eqn_tree;
- for (std::map::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos) {
+ for (std::map::iterator _pos = per_frame_eqn_tree.begin(); _pos != per_frame_eqn_tree.end(); ++_pos)
+ {
assert(_pos->second);
_pos->second->evaluate();
-}
+ }
}
}
@@ -210,25 +214,28 @@ void Preset::evalCustomShapePerFrameEquations()
void Preset::evalPerFrameInitEquations()
{
- for (std::map::iterator pos = per_frame_init_eqn_tree.begin(); pos != per_frame_init_eqn_tree.end(); ++pos) {
+ for (std::map::iterator pos = per_frame_init_eqn_tree.begin(); pos != per_frame_init_eqn_tree.end(); ++pos)
+ {
assert(pos->second);
pos->second->evaluate();
-}
+ }
}
void Preset::evalPerFrameEquations()
{
- for (std::map::iterator pos = init_cond_tree.begin(); pos != init_cond_tree.end(); ++pos) {
+ for (std::map::iterator pos = init_cond_tree.begin(); pos != init_cond_tree.end(); ++pos)
+ {
assert(pos->second);
pos->second->evaluate();
-}
+ }
- for (std::map::iterator pos = per_frame_eqn_tree.begin(); pos != per_frame_eqn_tree.end(); ++pos) {
-assert(pos->second);
+ for (std::map::iterator pos = per_frame_eqn_tree.begin(); pos != per_frame_eqn_tree.end(); ++pos)
+ {
+ assert(pos->second);
pos->second->evaluate();
-}
+ }
}
@@ -236,7 +243,7 @@ assert(pos->second);
void Preset::initialize(const std::string & pathname)
{
- // Clear equation trees
+ // Clear equation trees
/// @slow unnecessary if we ensure this method is private
init_cond_tree.clear();
user_param_tree.clear();
@@ -255,13 +262,13 @@ void Preset::initialize(const std::string & pathname)
memset(this->per_frame_eqn_string_buffer, 0, STRING_BUFFER_SIZE);
memset(this->per_frame_init_eqn_string_buffer, 0, STRING_BUFFER_SIZE);
int retval;
-
+
if ((retval = load_preset_file(pathname.c_str())) < 0)
{
#ifdef PRESET_DEBUG
- if (PRESET_DEBUG) std::cerr << "[Preset] failed to load file \"" <<
- pathname << "\"!" << std::endl;
+ if (PRESET_DEBUG) std::cerr << "[Preset] failed to load file \"" <<
+ pathname << "\"!" << std::endl;
#endif
//this->close_preset();
/// @bug how should we handle this problem? a well define exception?
@@ -272,27 +279,39 @@ void Preset::initialize(const std::string & pathname)
this->per_frame_eqn_count = 0;
this->per_frame_init_eqn_count = 0;
+ this->loadUnspecInitConds();
+ this->load_custom_wave_init_conditions();
+ this->load_custom_shape_init_conditions();
}
+void Preset::loadUnspecInitConds() {
+
+
+ InitCondUtils::LoadUnspecInitCond loadUnspecInitCond(this->init_cond_tree, this->per_frame_init_eqn_tree);
+
+ this->builtinParams.traverse(loadUnspecInitCond);
+
+}
void Preset::load_custom_wave_init_conditions()
{
-
- for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos) {
+
+ for (PresetOutputs::cwave_container::iterator pos = customWaves->begin(); pos != customWaves->end(); ++pos)
+ {
assert(pos->second);
pos->second->load_unspecified_init_conds();
-
-}
+ }
}
void Preset::load_custom_shape_init_conditions()
{
- for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos) {
+ for (PresetOutputs::cshape_container::iterator pos = customShapes->begin(); pos != customShapes->end(); ++pos)
+ {
assert(pos->second);
pos->second->load_custom_shape_init();
-}
+ }
}
@@ -317,7 +336,7 @@ void Preset::evaluateFrame()
void Preset::evalPerPixelEqns()
{
- /* Evaluate all per pixel equations using splay traversal */
+ /* Evaluate all per pixel equations in the tree datastructure */
for (std::map::iterator pos = per_pixel_eqn_tree.begin();
pos != per_pixel_eqn_tree.end(); ++pos)
pos->second->evaluate();
@@ -368,7 +387,7 @@ InitCond * Preset::get_init_cond( Param *param )
}
-/* load_preset_file: private function that loads a specific preset denoted
+/* preset_file: private function that loads a specific preset denoted
by the given pathname */
int Preset::load_preset_file(const char * pathname)
{
diff --git a/src/projectM-engine/Preset.hpp b/src/projectM-engine/Preset.hpp
index 3a9fde94a..975f2d7c6 100644
--- a/src/projectM-engine/Preset.hpp
+++ b/src/projectM-engine/Preset.hpp
@@ -33,7 +33,7 @@
#include
#include
-#define PRESET_DEBUG 2 /* 0 for no debugging, 1 for normal, 2 for insane */
+#define PRESET_DEBUG 0 /* 0 for no debugging, 1 for normal, 2 for insane */
#include "CustomShape.hpp"
#include "CustomWave.hpp"
@@ -61,9 +61,9 @@ protected:
public:
/// Load a preset by filename with input and output buffers specified.
- /// This is the only poper way to allocate a new preset.
+ /// This is the only proper way to allocate a new preset.
/// \param filename the absolute file path of a preset to load from the file system
- /// \param presetInputs a const reference to only read only projectM engine variables
+ /// \param presetInputs a const reference to read only projectM engine variables
/// \param presetOutputs initialized and filled with data parsed from a preset
Preset(const std::string & filename, const PresetInputs & presetInputs, PresetOutputs & presetOutputs);
@@ -113,9 +113,7 @@ public:
InitCond *get_init_cond( Param *param );
void load_custom_wave_init_conditions();
- void load_custom_wave_init( CustomWave *customWave );
void load_custom_shape_init_conditions();
- void load_custom_shape_init( CustomShape *customShape );
int load_preset_file(const char * pathname);
@@ -143,6 +141,7 @@ private:
void evalPerPixelEqns();
void evalPerFrameEquations();
void initialize(const std::string & pathname);
+ void loadUnspecInitConds();
PresetOutputs & m_presetOutputs;
};
diff --git a/src/projectM-engine/PresetChooser.hpp b/src/projectM-engine/PresetChooser.hpp
index 929fcc554..baa2bec16 100644
--- a/src/projectM-engine/PresetChooser.hpp
+++ b/src/projectM-engine/PresetChooser.hpp
@@ -68,12 +68,11 @@ public:
/// \note The preset loader is refreshed via events or otherwise outside this class's scope
PresetChooser(const PresetLoader & presetLoader);
-
/// Choose a preset via the passed in index. Must be between 0 and num valid presets in directory
/// \param index An index lying in the interval [0, this->getNumPresets()]
/// \param presetInputs the preset inputs to associate with the preset upon construction
/// \param presetOutputs the preset outputs to associate with the preset upon construction
- std::auto_ptr directoryIndex(std::size_t index, const PresetInputs & presetInputs,
+ std::auto_ptr directoryIndex(std::size_t index, const PresetInputs & presetInputs,
PresetOutputs & presetOutputs) const;
/// Gets the number of presets last believed to exist in the preset loader's filename collection
@@ -90,11 +89,10 @@ public:
/// Returns uniform (fixed) probability for any index
/// \param index the index position of the preset to load
- float operator() (std::size_t index) const;
+ float operator() (std::size_t index) const;
private:
std::size_t m_collectionSize;
-
};
@@ -110,7 +108,7 @@ public:
/// \param presetInputs the preset inputs to associate with the preset upon construction
/// \param presetOutputs the preset outputs to associate with the preset upon construction
/// \param WeightFuncstor a functor that returns a probability for each index (see UniformRandomFunctor)
- /// \returns an pointer of the newly allocated preset - you must free this object!
+ /// \returns an auto pointer of the newly allocated preset
template
std::auto_ptr weightedRandom(const PresetInputs & presetInputs, PresetOutputs & presetOutputs, WeightFunctor & weightFunctor);
@@ -119,7 +117,7 @@ public:
/// \param presetInputs the preset inputs to associate with the preset upon construction
/// \param presetOutputs the preset outputs to associate with the preset upon construction
/// \param WeightFunctor a functor that returns a probability for each index (see UniformRandomFunctor)
- /// \returns a pointer of the newly allocated preset - you must free this object!
+ /// \returns an auto pointer of the newly allocated preset
template
std::auto_ptr weightedRandom(const PresetInputs & presetInputs, PresetOutputs & preseOutputs);
diff --git a/src/projectM-engine/PresetFrameIO.hpp b/src/projectM-engine/PresetFrameIO.hpp
index d3c100cac..969845404 100644
--- a/src/projectM-engine/PresetFrameIO.hpp
+++ b/src/projectM-engine/PresetFrameIO.hpp
@@ -1,14 +1,13 @@
#ifndef PRESET_FRAME_IO_HPP
#define PRESET_FRAME_IO_HPP
#include