diff --git a/src/projectM-engine/CustomWave.cpp b/src/projectM-engine/CustomWave.cpp index 486f8697c..84342c15c 100755 --- a/src/projectM-engine/CustomWave.cpp +++ b/src/projectM-engine/CustomWave.cpp @@ -79,7 +79,6 @@ CustomWave::CustomWave(int _id): this->value2 = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float)); this->sample_mesh = (float*)wipemalloc(MAX_SAMPLE_SIZE*sizeof(float)); - /* Start: Load custom wave parameters */ if ((param = Param::new_param_float("r", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->r, this->r_mesh, 1.0, 0.0, .5)) == NULL) { @@ -93,11 +92,10 @@ CustomWave::CustomWave(int _id): abort(); } - if ((param = Param::new_param_float("g", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->g, this->g_mesh, 1.0, 0.0, .5)) == NULL){ + if ((param = Param::new_param_float("g", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->g, this->g_mesh, 1.0, 0.0, .5)) == NULL) { delete(this); /// @bug make exception abort(); - } if (ParamUtils::insert(param, param_tree) < 0) { @@ -117,37 +115,30 @@ CustomWave::CustomWave(int _id): delete(this); /// @bug make exception abort(); - } if ((param = Param::new_param_float("a", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->a, this->a_mesh, 1.0, 0.0, .5)) == NULL){ delete(this); /// @bug make exception abort(); - - } if (ParamUtils::insert(param, this->param_tree) < 0) { delete(this); /// @bug make exception abort(); - } if ((param = Param::new_param_float("x", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->x, this->x_mesh, 1.0, 0.0, .5)) == NULL) { delete(this); /// @bug make exception abort(); - - } if (ParamUtils::insert(param, this->param_tree) < 0) { delete(this); /// @bug make exception abort(); - } if ((param = Param::new_param_float("y", P_FLAG_DONT_FREE_MATRIX | P_FLAG_PER_POINT, &this->y, this->y_mesh, 1.0, 0.0, .5)) == NULL) { @@ -413,6 +404,8 @@ CustomWave::~CustomWave() { delete(pos->second); + delete(param_tree); + free(r_mesh); free(g_mesh); free(b_mesh); diff --git a/src/projectM-engine/PresetChooser.hpp b/src/projectM-engine/PresetChooser.hpp index 6a0e833fb..e5152dc2d 100644 --- a/src/projectM-engine/PresetChooser.hpp +++ b/src/projectM-engine/PresetChooser.hpp @@ -212,7 +212,6 @@ inline Preset * PresetChooser::doWeightedSample(WeightFunctor & weightFunctor, c // Choose a random bounded mass between 0 and 1 float cutoff = ((float)(random())) / RAND_MAX; - std::cerr << "cutoff: " << cutoff << std::endl; // Sum up mass, stopping when cutoff is reached. This is the typical // weighted sampling algorithm. float mass = 0; @@ -225,7 +224,7 @@ inline Preset * PresetChooser::doWeightedSample(WeightFunctor & weightFunctor, c // Just in case something slips through the cracks PresetIterator pos = this->end(); --pos; - std::cerr << "mass: " << mass << std::endl; + return pos.allocate(presetInputs, presetOutputs); }