diff options
Diffstat (limited to 'src/engine/ingen_engine.cpp')
-rw-r--r-- | src/engine/ingen_engine.cpp | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/src/engine/ingen_engine.cpp b/src/engine/ingen_engine.cpp index 07d2c921..b5fe92a9 100644 --- a/src/engine/ingen_engine.cpp +++ b/src/engine/ingen_engine.cpp @@ -15,39 +15,35 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <cstdio> -#include <string> -#include "raul/Process.hpp" -#include "ingen_engine.hpp" +#include "module/Module.hpp" #include "Engine.hpp" -#include "tuning.hpp" +#include "QueuedEngineInterface.hpp" #include "util.hpp" +#include "tuning.hpp" -namespace Ingen { - -Engine* -new_engine(Ingen::Shared::World* world) -{ - set_denormal_flags(); - return new Engine(world); -} +using namespace Ingen; +struct IngenEngineModule : public Ingen::Shared::Module { + void load(Ingen::Shared::World* world) { + set_denormal_flags(); + world->local_engine = SharedPtr<Engine>(new Engine(world)); + SharedPtr<QueuedEngineInterface> interface( + new Ingen::QueuedEngineInterface(*world->local_engine, event_queue_size)); + world->engine = interface; + world->local_engine->add_event_source(interface); + } +}; -bool -launch_osc_engine(int port) -{ - char port_str[6]; - snprintf(port_str, 6, "%u", port); - const std::string cmd = std::string("ingen -e --engine-port=").append(port_str); +static IngenEngineModule* module = NULL; - if (Raul::Process::launch(cmd)) { - return true; - } else { - std::cerr << "Failed to launch engine process." << std::endl; - return false; - } -} +extern "C" { +Ingen::Shared::Module* +ingen_module_load() { + if (!module) + module = new IngenEngineModule(); -} // namespace Ingen + return module; +} +} // extern "C" |