diff --git a/src/controller/ctlrscript.cxx b/src/controller/ctlrscript.cxx new file mode 100644 index 0000000..5d35b55 --- /dev/null +++ b/src/controller/ctlrscript.cxx @@ -0,0 +1,42 @@ +/* + * Author: Harry van Haaren 2016 + * harryhaaren@gmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "ctlrscript.hxx" + +#include + +#include "../jack.hxx" +#include "../event.hxx" +#include "../gridlogic.hxx" + +#include "../eventhandler.hxx" + +extern Jack* jack; + +CtlrScript::CtlrScript(std::string filename) : + Controller() +{ + printf("%s, attempting to compile %s\n", __func__, filename.c_str()); + +#warning WIP HERE, add TCC libs, and attempt to load/compile filename +} + +void CtlrScript::bpm(int bpm) +{ + printf("%s : %d\n", __func__, bpm); +} diff --git a/src/controller/ctlrscript.hxx b/src/controller/ctlrscript.hxx new file mode 100644 index 0000000..99656d7 --- /dev/null +++ b/src/controller/ctlrscript.hxx @@ -0,0 +1,53 @@ +/* + * Author: Harry van Haaren 2013 + * harryhaaren@gmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef LUPPP_CONTROLLER_SCRIPT_H +#define LUPPP_CONTROLLER_SCRIPT_H + +#include "controller.hxx" + +#include "../observer/midi.hxx" + +/** This is a controller using TCC as a backend, which reads .c files + * as "scripts", but compiles them on the fly and then hooks in the + * poll / handle event loop into the controller itself. + * + * It is designed to be a flexible way of prototyping support for any + * MIDI/HID devices. Once a controller file is concidered "finished", + * it may be sent as a pull request for inclusion in vanilla Luppp. + * + * As TCC is only a C compiler (as opposed to C++) this layer translates + * Luppps internal events (which are C++ classes) to native C structs, + * which can then be passed to the TCC compiled C backend. Ideally the + * Luppp internal event handling system would be ported to plain C, + * however this would also require significant effort, which does not + * seem worth the time at the moment. + */ +class CtlrScript : public Controller +{ + public: + CtlrScript(std::string filename); + + std::string getName(){return "CtlrScript";} + + void bpm(int bpm); +}; + +#endif // LUPPP_CONTROLLER_SCRIPT_H +