diff --git a/src/libprojectM/KeyHandler.cpp b/src/libprojectM/KeyHandler.cpp index d1a54dc8a..69cd8249a 100755 --- a/src/libprojectM/KeyHandler.cpp +++ b/src/libprojectM/KeyHandler.cpp @@ -170,7 +170,7 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode presetSwitchedEvent(true, **m_presetPos); m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs); renderer->SetPipeline(presetOutputs); - renderer->setPresetName(m_activePreset->presetName()); + renderer->setPresetName(m_activePreset->name()); timeKeeper->StartPreset(); break; @@ -185,7 +185,7 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode renderer->SetPipeline(presetOutputs); assert(m_activePreset.get()); - renderer->setPresetName(m_activePreset->presetName()); + renderer->setPresetName(m_activePreset->name()); timeKeeper->StartPreset(); break; @@ -210,7 +210,7 @@ void projectM::default_key_handler( projectMEvent event, projectMKeycode keycode m_activePreset = m_presetPos->allocate(this->presetInputs, this->presetOutputs); renderer->SetPipeline(presetOutputs); - renderer->setPresetName(m_activePreset->presetName()); + renderer->setPresetName(m_activePreset->name()); timeKeeper->StartPreset(); break; diff --git a/src/libprojectM/MilkdropPreset.hpp b/src/libprojectM/MilkdropPreset.hpp index efbb15445..f6e9ff5b8 100644 --- a/src/libprojectM/MilkdropPreset.hpp +++ b/src/libprojectM/MilkdropPreset.hpp @@ -45,6 +45,7 @@ #include "BuiltinParams.hpp" #include "PresetFrameIO.hpp" #include "InitCond.hpp" +#include "Preset.hpp" class CustomWave; class CustomShape; @@ -53,7 +54,6 @@ class InitCond; class MilkdropPreset : public Preset { -protected: public: @@ -63,14 +63,15 @@ public: /// \param MilkdropPresetName a descriptive name for the MilkdropPreset. Usually just the file name /// \param MilkdropPresetInputs a reference to read only projectM engine variables /// \param MilkdropPresetOutputs initialized and filled with data parsed from a MilkdropPreset - MilkdropPreset(const std::string & absoluteFilePath, const std::string & MilkdropPresetName, MilkdropPresetInputs & MilkdropPresetInputs, MilkdropPresetOutputs & MilkdropPresetOutputs); + MilkdropPreset(const std::string & absoluteFilePath, const std::string & milkdropPresetName, + PresetInputs & presetInputs, PresetOutputs & presetOutputs); /// Load a MilkdropPreset from an input stream with input and output buffers specified. /// \param in an already initialized input stream to read the MilkdropPreset file from /// \param MilkdropPresetName a descriptive name for the MilkdropPreset. Usually just the file name /// \param MilkdropPresetInputs a reference to read only projectM engine variables /// \param MilkdropPresetOutputs initialized and filled with data parsed from a MilkdropPreset - MilkdropPreset(std::istream & in, const std::string & MilkdropPresetName, MilkdropPresetInputs & MilkdropPresetInputs, MilkdropPresetOutputs & MilkdropPresetOutputs); + MilkdropPreset(std::istream & in, const std::string & milkdropPresetName, PresetInputs & presetInputs, PresetOutputs & presetOutputs); ~MilkdropPreset(); @@ -105,36 +106,23 @@ public: /// \returns a file path string std::string absoluteFilePath() const { - return m_absoluteFilePath; + return _absoluteFilePath; } /// Accessor method for the MilkdropPreset outputs instance associated with this MilkdropPreset /// \returns A MilkdropPreset output instance with values computed from most recent evaluateFrame() - MilkdropPresetOutputs & MilkdropPresetOutputs() const + PresetOutputs & presetOutputs() const { - return m_MilkdropPresetOutputs; + return _presetOutputs; } - MilkdropPresetInputs & MilkdropPresetInputs() const + PresetInputs & presetInputs() const { - return m_PresetInputs; + return _presetInputs; } - /// Sets the descriptive name for this MilkdropPreset (typically the file name) - /// \param theValue the new MilkdropPreset name to assign to the MilkdropPreset - void setPresetName ( const std::string& theValue ) - { - m_PresetName = theValue; - } - - /// Gets the descriptive name for this MilkdropPreset (typically the file name) - /// \returns the name of the MilkdropPreset - std::string MilkPresetName() const - { - return m_PresetName; - } /// @bug encapsulate @@ -152,13 +140,10 @@ public: private: // The absolute file path of the MilkdropPreset - std::string m_absoluteFilePath; + std::string _absoluteFilePath; // The absolute path of the MilkdropPreset - std::string m_absolutePath; - - // The name for the MilkdropPreset. Usually the file name, but in theory anything goes - std::string m_MilkdropPresetName; + std::string _absolutePath; void initialize(const std::string & pathname); void initialize(std::istream & in); @@ -182,8 +167,8 @@ private: void preloadInitialize(); void postloadInitialize(); - PresetOutputs & m_PresetOutputs; - PresetInputs & m_PresetInputs; // added for gx, gy reference. + PresetOutputs & _presetOutputs; + PresetInputs & _presetInputs; // added for gx, gy reference. template void transfer_q_variables(std::vector & customObjects); @@ -198,14 +183,14 @@ void MilkdropPreset::transfer_q_variables(std::vector & customObj for (typename std::vector::iterator pos = customObjects.begin(); pos != customObjects.end();++pos) { custom_object = *pos; - custom_object->q1 = m_MilkdropPresetOutputs.q[0]; - custom_object->q2 = m_MilkdropPresetOutputs.q[1]; - custom_object->q3 = m_MilkdropPresetOutputs.q[2]; - custom_object->q4 = m_MilkdropPresetOutputs.q[3]; - custom_object->q5 = m_MilkdropPresetOutputs.q[4]; - custom_object->q6 = m_MilkdropPresetOutputs.q[5]; - custom_object->q7 = m_MilkdropPresetOutputs.q[6]; - custom_object->q8 = m_MilkdropPresetOutputs.q[7]; + custom_object->q1 = _presetOutputs.q[0]; + custom_object->q2 = _presetOutputs.q[1]; + custom_object->q3 = _presetOutputs.q[2]; + custom_object->q4 = _presetOutputs.q[3]; + custom_object->q5 = _presetOutputs.q[4]; + custom_object->q6 = _presetOutputs.q[5]; + custom_object->q7 = _presetOutputs.q[6]; + custom_object->q8 = _presetOutputs.q[7]; } diff --git a/src/libprojectM/Param.cpp b/src/libprojectM/Param.cpp index de3d11714..ca21e8ffc 100755 --- a/src/libprojectM/Param.cpp +++ b/src/libprojectM/Param.cpp @@ -37,6 +37,7 @@ #include "Preset.hpp" #include #include +#include /** Constructor */ Param::Param( std::string _name, short int _type, short int _flags, void * _engine_val, void * _matrix, diff --git a/src/libprojectM/ParamUtils.hpp b/src/libprojectM/ParamUtils.hpp index d02a47c36..dd94ff73a 100644 --- a/src/libprojectM/ParamUtils.hpp +++ b/src/libprojectM/ParamUtils.hpp @@ -8,9 +8,7 @@ #include "Param.hpp" #include #include - - -class BuiltinParams; +#include "BuiltinParams.hpp" class ParamUtils { diff --git a/src/libprojectM/Parser.cpp b/src/libprojectM/Parser.cpp index f6bba78d4..b655dc215 100755 --- a/src/libprojectM/Parser.cpp +++ b/src/libprojectM/Parser.cpp @@ -36,7 +36,6 @@ #include "Func.hpp" #include "InitCond.hpp" #include "Param.hpp" -#include "Preset.hpp" #include "Parser.hpp" #include "PerFrameEqn.hpp" #include "PerPixelEqn.hpp" @@ -247,7 +246,7 @@ token_t Parser::parseToken(std::istream & fs, char * string) /* Parse input in the form of "exp, exp, exp, ...)" Returns a general expression list */ -GenExpr **Parser::parse_prefix_args(std::istream & fs, int num_args, Preset * preset) +GenExpr **Parser::parse_prefix_args(std::istream & fs, int num_args, MilkdropPreset * preset) { int i, j; @@ -322,7 +321,7 @@ int Parser::parse_preset_name(std::istream & fs, char * name) /* Parses per pixel equations */ -int Parser::parse_per_pixel_eqn(std::istream & fs, Preset * preset, char * init_string) +int Parser::parse_per_pixel_eqn(std::istream & fs, MilkdropPreset * preset, char * init_string) { @@ -364,7 +363,7 @@ int Parser::parse_per_pixel_eqn(std::istream & fs, Preset * preset, char * init } /* Parses an equation line, this function is way too big, should add some helper functions */ -int Parser::parse_line(std::istream & fs, Preset * preset) +int Parser::parse_line(std::istream & fs, MilkdropPreset * preset) { char eqn_string[MAX_TOKEN_SIZE]; @@ -641,7 +640,7 @@ int Parser::parse_line(std::istream & fs, Preset * preset) CustomWave * custom_wave; /* Retrieve custom shape associated with this id */ - if ((custom_wave = Preset::find_custom_object(last_custom_wave_id, preset->customWaves)) == NULL) + if ((custom_wave = MilkdropPreset::find_custom_object(last_custom_wave_id, preset->customWaves)) == NULL) return PROJECTM_FAILURE; return parse_wave_per_frame_eqn(fs, custom_wave, preset); @@ -663,7 +662,7 @@ int Parser::parse_line(std::istream & fs, Preset * preset) CustomShape * custom_shape; /* Retrieve custom shape associated with this id */ - if ((custom_shape = Preset::find_custom_object(last_custom_shape_id, preset->customShapes)) == NULL) + if ((custom_shape = MilkdropPreset::find_custom_object(last_custom_shape_id, preset->customShapes)) == NULL) return PROJECTM_FAILURE; return parse_shape_per_frame_eqn(fs, custom_shape, preset); @@ -713,7 +712,7 @@ int Parser::parse_line(std::istream & fs, Preset * preset) /* Parses a general expression, this function is the meat of the parser */ -GenExpr * Parser::parse_gen_expr ( std::istream & fs, TreeExpr * tree_expr, Preset * preset) +GenExpr * Parser::parse_gen_expr ( std::istream & fs, TreeExpr * tree_expr, MilkdropPreset * preset) { int i; @@ -1164,7 +1163,7 @@ int Parser::insert_infix_rec(InfixOp * infix_op, TreeExpr * root) } /* Parses an infix operator */ -GenExpr * Parser::parse_infix_op(std::istream & fs, token_t token, TreeExpr * tree_expr, Preset * preset) +GenExpr * Parser::parse_infix_op(std::istream & fs, token_t token, TreeExpr * tree_expr, MilkdropPreset * preset) { GenExpr * gen_expr; @@ -1348,7 +1347,7 @@ int Parser::parse_float(std::istream & fs, float * float_ptr) } /* Parses a per frame equation. That is, interprets a stream of data as a per frame equation */ -PerFrameEqn * Parser::parse_per_frame_eqn(std::istream & fs, int index, Preset * preset) +PerFrameEqn * Parser::parse_per_frame_eqn(std::istream & fs, int index, MilkdropPreset * preset) { char string[MAX_TOKEN_SIZE]; @@ -1399,7 +1398,7 @@ PerFrameEqn * Parser::parse_per_frame_eqn(std::istream & fs, int index, Preset } /* Parses an 'implicit' per frame equation. That is, interprets a stream of data as a per frame equation without a prefix */ -PerFrameEqn * Parser::parse_implicit_per_frame_eqn(std::istream & fs, char * param_string, int index, Preset * preset) +PerFrameEqn * Parser::parse_implicit_per_frame_eqn(std::istream & fs, char * param_string, int index, MilkdropPreset * preset) { Param * param; @@ -1452,7 +1451,7 @@ PerFrameEqn * Parser::parse_implicit_per_frame_eqn(std::istream & fs, char * pa } /* Parses an initial condition */ -InitCond * Parser::parse_init_cond(std::istream & fs, char * name, Preset * preset) +InitCond * Parser::parse_init_cond(std::istream & fs, char * name, MilkdropPreset * preset) { Param * param; @@ -1547,7 +1546,7 @@ void Parser::parse_string_block(std::istream & fs, std::string * out_string) { } -InitCond * Parser::parse_per_frame_init_eqn(std::istream & fs, Preset * preset, std::map * database) +InitCond * Parser::parse_per_frame_init_eqn(std::istream & fs, MilkdropPreset * preset, std::map * database) { char name[MAX_TOKEN_SIZE]; @@ -1761,7 +1760,7 @@ void Parser::readStringUntil(std::istream & fs, std::string * out_buffer, bool w } -int Parser::parse_wavecode(char * token, std::istream & fs, Preset * preset) +int Parser::parse_wavecode(char * token, std::istream & fs, MilkdropPreset * preset) { char * var_string; @@ -1786,7 +1785,7 @@ int Parser::parse_wavecode(char * token, std::istream & fs, Preset * preset) if (PARSE_DEBUG) printf("parse_wavecode: wavecode id = %d, parameter = \"%s\"\n", id, var_string); /* Retrieve custom wave information from preset, allocating new one if necessary */ - if ((custom_wave = Preset::find_custom_object(id, preset->customWaves)) == NULL) + if ((custom_wave = MilkdropPreset::find_custom_object(id, preset->customWaves)) == NULL) { std::cerr << "parse_wavecode: failed to load (or create) custom wave (id = " << id << ")!\n" << std::endl; @@ -1860,7 +1859,7 @@ int Parser::parse_wavecode(char * token, std::istream & fs, Preset * preset) return PROJECTM_SUCCESS; } -int Parser::parse_shapecode(char * token, std::istream & fs, Preset * preset) +int Parser::parse_shapecode(char * token, std::istream & fs, MilkdropPreset * preset) { char * var_string; @@ -1892,7 +1891,7 @@ int Parser::parse_shapecode(char * token, std::istream & fs, Preset * preset) /* Retrieve custom shape information from preset. The 3rd argument if true creates a custom shape if one does not exist */ - if ((custom_shape = Preset::find_custom_object(id, preset->customShapes)) == NULL) + if ((custom_shape = MilkdropPreset::find_custom_object(id, preset->customShapes)) == NULL) { if (PARSE_DEBUG) printf("parse_shapecode: failed to load (or create) custom shape (id = %d)!\n", id); return PROJECTM_FAILURE; @@ -2154,7 +2153,7 @@ int Parser::parse_shape_prefix(char * token, int * id, char ** eqn_string) } /* Parses custom wave equations */ -int Parser::parse_wave(char * token, std::istream & fs, Preset * preset) +int Parser::parse_wave(char * token, std::istream & fs, MilkdropPreset * preset) { int id; @@ -2182,7 +2181,7 @@ int Parser::parse_wave(char * token, std::istream & fs, Preset * preset) } -int Parser::parse_wave_helper(std::istream & fs, Preset * preset, int id, char * eqn_type, char * init_string) +int Parser::parse_wave_helper(std::istream & fs, MilkdropPreset * preset, int id, char * eqn_type, char * init_string) { Param * param; @@ -2193,7 +2192,7 @@ int Parser::parse_wave_helper(std::istream & fs, Preset * preset, int id, char InitCond * init_cond; /* Retrieve custom wave associated with this id */ - if ((custom_wave = Preset::find_custom_object(id, preset->customWaves)) == NULL) + if ((custom_wave = MilkdropPreset::find_custom_object(id, preset->customWaves)) == NULL) { if (PARSE_DEBUG) printf("parse_wave_helper: custom wave id %d not found!\n", id); return PROJECTM_FAILURE; @@ -2335,7 +2334,7 @@ int Parser::parse_wave_helper(std::istream & fs, Preset * preset, int id, char } /* Parses custom shape equations */ -int Parser::parse_shape(char * token, std::istream & fs, Preset * preset) +int Parser::parse_shape(char * token, std::istream & fs, MilkdropPreset * preset) { int id; @@ -2359,7 +2358,7 @@ int Parser::parse_shape(char * token, std::istream & fs, Preset * preset) } /* Retrieve custom shape associated with this id */ - if ((custom_shape = Preset::find_custom_object(id,preset->customShapes)) == NULL) + if ((custom_shape = MilkdropPreset::find_custom_object(id,preset->customShapes)) == NULL) return PROJECTM_FAILURE; @@ -2428,7 +2427,7 @@ int Parser::get_string_prefix_len(char * string) return i; } -int Parser::parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset) +int Parser::parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * custom_shape, MilkdropPreset * preset) { InitCond * init_cond; @@ -2448,7 +2447,7 @@ int Parser::parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * cus return PROJECTM_SUCCESS; } -int Parser::parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset) +int Parser::parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, MilkdropPreset * preset) { Param * param; @@ -2510,7 +2509,7 @@ int Parser::parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_sh return PROJECTM_SUCCESS; } -int Parser::parse_wave_per_frame_eqn(std::istream & fs, CustomWave * custom_wave, Preset * preset) +int Parser::parse_wave_per_frame_eqn(std::istream & fs, CustomWave * custom_wave, MilkdropPreset * preset) { Param * param; diff --git a/src/libprojectM/Parser.hpp b/src/libprojectM/Parser.hpp index 9e6928091..4dde7efb2 100755 --- a/src/libprojectM/Parser.hpp +++ b/src/libprojectM/Parser.hpp @@ -21,7 +21,7 @@ /** * $Id$ * - * Preset parser + * MilkdropPreset parser * * $Log$ */ @@ -36,7 +36,7 @@ #include "Expr.hpp" #include "PerFrameEqn.hpp" #include "InitCond.hpp" -#include "Preset.hpp" +#include "MilkdropPreset.hpp" /* Strings that prefix (and denote the type of) equations */ #define PER_FRAME_STRING "per_frame_" @@ -125,7 +125,7 @@ class CustomWave; class GenExpr; class InfixOp; class PerFrameEqn; -class Preset; +class MilkdropPreset; class TreeExpr; class Parser { @@ -146,46 +146,46 @@ public: static bool tokenWrapAroundEnabled; static PerFrameEqn *parse_per_frame_eqn( std::istream & fs, int index, - Preset * preset); - static int parse_per_pixel_eqn( std::istream & fs, Preset * preset, + MilkdropPreset * preset); + static int parse_per_pixel_eqn( std::istream & fs, MilkdropPreset * preset, char * init_string); - static InitCond *parse_init_cond( std::istream & fs, char * name, Preset * preset ); + static InitCond *parse_init_cond( std::istream & fs, char * name, MilkdropPreset * preset ); static int parse_preset_name( std::istream & fs, char * name ); static int parse_top_comment( std::istream & fs ); - static int parse_line( std::istream & fs, Preset * preset ); + static int parse_line( std::istream & fs, MilkdropPreset * preset ); static int get_string_prefix_len(char * string); static TreeExpr * insert_gen_expr(GenExpr * gen_expr, TreeExpr ** root); static TreeExpr * insert_infix_op(InfixOp * infix_op, TreeExpr ** root); static token_t parseToken(std::istream & fs, char * string); - static GenExpr ** parse_prefix_args(std::istream & fs, int num_args, Preset * preset); - static GenExpr * parse_infix_op(std::istream & fs, token_t token, TreeExpr * tree_expr, Preset * preset); + static GenExpr ** parse_prefix_args(std::istream & fs, int num_args, MilkdropPreset * preset); + static GenExpr * parse_infix_op(std::istream & fs, token_t token, TreeExpr * tree_expr, MilkdropPreset * preset); static GenExpr * parse_sign_arg(std::istream & fs); static int parse_float(std::istream & fs, float * float_ptr); static int parse_int(std::istream & fs, int * int_ptr); static int insert_gen_rec(GenExpr * gen_expr, TreeExpr * root); static int insert_infix_rec(InfixOp * infix_op, TreeExpr * root); - static GenExpr * parse_gen_expr(std::istream & fs, TreeExpr * tree_expr, Preset * preset); - static PerFrameEqn * parse_implicit_per_frame_eqn(std::istream & fs, char * param_string, int index, Preset * preset); - static InitCond * parse_per_frame_init_eqn(std::istream & fs, Preset * preset, std::map * database); + static GenExpr * parse_gen_expr(std::istream & fs, TreeExpr * tree_expr, MilkdropPreset * preset); + static PerFrameEqn * parse_implicit_per_frame_eqn(std::istream & fs, char * param_string, int index, MilkdropPreset * preset); + static InitCond * parse_per_frame_init_eqn(std::istream & fs, MilkdropPreset * preset, std::map * database); static int parse_wavecode_prefix(char * token, int * id, char ** var_string); - static int parse_wavecode(char * token, std::istream & fs, Preset * preset); + static int parse_wavecode(char * token, std::istream & fs, MilkdropPreset * preset); static int parse_wave_prefix(char * token, int * id, char ** eqn_string); - static int parse_wave_helper(std::istream & fs, Preset * preset, int id, char * eqn_type, char * init_string); - static int parse_shapecode(char * eqn_string, std::istream & fs, Preset * preset); + static int parse_wave_helper(std::istream & fs, MilkdropPreset * preset, int id, char * eqn_type, char * init_string); + static int parse_shapecode(char * eqn_string, std::istream & fs, MilkdropPreset * preset); static int parse_shapecode_prefix(char * token, int * id, char ** var_string); static void parse_string_block(std::istream & fs, std::string * out_string); static bool scanForComment(std::istream & fs); - static int parse_wave(char * eqn_string, std::istream & fs, Preset * preset); - static int parse_shape(char * eqn_string, std::istream & fs, Preset * preset); + static int parse_wave(char * eqn_string, std::istream & fs, MilkdropPreset * preset); + static int parse_shape(char * eqn_string, std::istream & fs, MilkdropPreset * preset); static int parse_shape_prefix(char * token, int * id, char ** eqn_string); static void readStringUntil(std::istream & fs, std::string * out_buffer, bool wrapAround = true, const std::set & skipList = std::set()) ; static int string_to_float(char * string, float * float_ptr); - static int parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset); - static int parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, Preset * preset); - static int parse_wave_per_frame_eqn(std::istream & fs, CustomWave * custom_wave, Preset * preset); + static int parse_shape_per_frame_init_eqn(std::istream & fs, CustomShape * custom_shape, MilkdropPreset * preset); + static int parse_shape_per_frame_eqn(std::istream & fs, CustomShape * custom_shape, MilkdropPreset * preset); + static int parse_wave_per_frame_eqn(std::istream & fs, CustomWave * custom_wave, MilkdropPreset * preset); static bool wrapsToNextLine(const std::string & str); }; diff --git a/src/libprojectM/Pipeline.hpp b/src/libprojectM/Pipeline.hpp index 1e0ebcfac..d38920c5b 100644 --- a/src/libprojectM/Pipeline.hpp +++ b/src/libprojectM/Pipeline.hpp @@ -51,7 +51,6 @@ public: Pipeline(); void setStaticPerPixel(int gx, int gy); virtual ~Pipeline(); - virtual void Render(const BeatDetect &music, const PipelineContext &context); virtual Point PerPixel(Point p, const PerPixelContext context); }; diff --git a/src/libprojectM/Preset.cpp b/src/libprojectM/Preset.cpp index d942f72a7..69bebaf03 100755 --- a/src/libprojectM/Preset.cpp +++ b/src/libprojectM/Preset.cpp @@ -2,7 +2,7 @@ * Preset.cpp * * Created on: Aug 5, 2008 - * Author: carm + * Author: struktured */ #include "Preset.hpp" @@ -18,8 +18,8 @@ void Preset::setName(const std::string & value) { _name = value; } const std::string & Preset::name() const { return _name; } -void setAuthor(const std::string & value) { _author = value; } +void Preset::setAuthor(const std::string & value) { _author = value; } -const std::string & author() const { return _author; } +const std::string & Preset::author() const { return _author; } diff --git a/src/libprojectM/PresetLoader.cpp b/src/libprojectM/PresetLoader.cpp index 8848e04b2..ff57e486a 100644 --- a/src/libprojectM/PresetLoader.cpp +++ b/src/libprojectM/PresetLoader.cpp @@ -32,6 +32,8 @@ extern "C" #include #include "fatal.h" +#include "Common.hpp" + const std::string PresetLoader::PROJECTM_FILE_EXTENSION(".prjm"); const std::string PresetLoader::MILKDROP_FILE_EXTENSION(".milk"); diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp index 50aeafa4a..fe2da9622 100755 --- a/src/libprojectM/projectM.cpp +++ b/src/libprojectM/projectM.cpp @@ -106,7 +106,6 @@ projectM::~projectM() _pcm = 0; } - } DLLEXPORT unsigned projectM::initRenderToTexture() @@ -256,13 +255,17 @@ void *projectM::thread_func(void *vptr_args) void projectM::evaluateSecondPreset() { - setupPresetInputs(&m_activePreset2->presetInputs()); + +/* setupPresetInputs(&m_activePreset2->presetInputs()); + m_activePreset2->presetInputs().frame = timeKeeper->PresetFrameB(); m_activePreset2->presetInputs().progress= timeKeeper->PresetProgressB(); assert ( m_activePreset2.get() ); m_activePreset2->evaluateFrame(); m_activePreset2->presetOutputs().Render(*beatDetect,presetInputs2); +*/ + } void projectM::setupPresetInputs(PresetInputs *inputs) @@ -292,10 +295,11 @@ DLLEXPORT void projectM::renderFrame() //printf("A:%f, B:%f, S:%f\n", timeKeeper->PresetProgressA(), timeKeeper->PresetProgressB(), timeKeeper->SmoothRatio()); mspf= ( int ) ( 1000.0/ ( float ) presetInputs.fps ); //milliseconds per frame - - setupPresetInputs(&m_activePreset->presetInputs()); - m_activePreset->presetInputs().frame = timeKeeper->PresetFrameA(); - m_activePreset->presetInputs().progress= timeKeeper->PresetProgressA(); + + //m_activePreset->Render(beatDetect, pipelineContext); + //setupPresetInputs(&m_activePreset->presetInputs()); + //m_activePreset->presetInputs().frame = timeKeeper->PresetFrameA(); + //m_activePreset->presetInputs().progress= timeKeeper->PresetProgressA(); beatDetect->detectFromSamples(); @@ -309,10 +313,11 @@ DLLEXPORT void projectM::renderFrame() timeKeeper->StartSmoothing(); // printf("Start Smooth\n"); // if(timeKeeper->IsSmoothing())printf("Confirmed\n"); - switchPreset(m_activePreset2, +assert(false); +/* switchPreset(m_activePreset2, &m_activePreset->presetInputs() == &presetInputs ? presetInputs2 : presetInputs, &m_activePreset->presetOutputs() == &presetOutputs ? presetOutputs2 : presetOutputs); - +*/ presetSwitchedEvent(false, **m_presetPos); } @@ -339,8 +344,10 @@ DLLEXPORT void projectM::renderFrame() pthread_cond_signal(&condition); pthread_mutex_unlock( &mutex ); #endif - m_activePreset->evaluateFrame(); - m_activePreset->presetOutputs().Render(*beatDetect,presetInputs); + //m_activePreset->evaluateFrame(); + m_activePreset->Render(*beatDetect, pipelineContext); + + //m_activePreset->presetOutputs().Render(*beatDetect,presetInputs); #ifdef USE_THREADS pthread_mutex_lock( &mutex ); @@ -352,7 +359,7 @@ DLLEXPORT void projectM::renderFrame() //PresetMerger::MergePresets ( m_activePreset->presetOutputs(),m_activePreset2->presetOutputs(),timeKeeper->SmoothRatio(),presetInputs.gx, presetInputs.gy ); Pipeline pipeline; pipeline.setStaticPerPixel(presetInputs.gx,presetInputs.gy); -PipelineMerger::MergePipelines( m_activePreset->presetOutputs(),m_activePreset2->presetOutputs(), pipeline,timeKeeper->SmoothRatio()); +PipelineMerger::MergePipelines( m_activePreset->pipeline(),m_activePreset2->pipeline(), pipeline,timeKeeper->SmoothRatio()); renderer->RenderFrame ( pipeline, presetInputs ); } else @@ -365,11 +372,13 @@ renderer->RenderFrame ( pipeline, presetInputs ); } //printf("Normal\n"); - m_activePreset->evaluateFrame(); - m_activePreset->presetOutputs().Render(*beatDetect,presetInputs); + m_activePreset->Render(*beatDetect, pipelineContext); - renderer->RenderFrame ( m_activePreset->presetOutputs(), presetInputs ); +// m_activePreset->evaluateFrame(); +// m_activePreset->presetOutputs().Render(*beatDetect,presetInputs); + + renderer->RenderFrame (m_activePreset->pipeline(), pipelineContext); } // std::cout<< m_activePreset->absoluteFilePath()<setPresetName ( m_activePreset->presetName() ); + renderer->setPresetName ( m_activePreset->name() ); timeKeeper->StartPreset(); assert(pcm()); // printf ( "exiting projectM_init()\n" ); @@ -830,7 +839,7 @@ void projectM::selectPreset ( unsigned int index ) m_activePreset = m_presetPos->allocate ( presetInputs, presetOutputs ); - renderer->setPresetName ( m_activePreset->presetName() ); + renderer->setPresetName ( m_activePreset->name() ); timeKeeper->StartPreset(); } @@ -845,7 +854,7 @@ void projectM::switchPreset(std::auto_ptr & targetPreset, PresetInputs & targetPreset = m_presetPos->allocate( inputs, outputs ); // Set preset name here- event is not done because at the moment this function is oblivious to smooth/hard switches - renderer->setPresetName ( targetPreset->presetName() ); + renderer->setPresetName ( targetPreset->name() ); renderer->SetPipeline(outputs); }