diff options
author | David Robillard <d@drobilla.net> | 2007-02-05 06:23:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-05 06:23:05 +0000 |
commit | 4c8aad127d9504c7d355975180f877f5baa9f744 (patch) | |
tree | bdb70b9a849a290f32c9bbb45947da4b796dcd97 /src/main.cpp | |
parent | 60647fedf17cdebfcf45c76d8fa9cee120006921 (diff) | |
download | machina-4c8aad127d9504c7d355975180f877f5baa9f744.tar.gz machina-4c8aad127d9504c7d355975180f877f5baa9f744.tar.bz2 machina-4c8aad127d9504c7d355975180f877f5baa9f744.zip |
It's aliiiiivee!
git-svn-id: http://svn.drobilla.net/lad/machina@278 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 79809e0..325757b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,27 +15,66 @@ */ #include <iostream> +#include <signal.h> #include "Machine.hpp" #include "Node.hpp" #include "Action.hpp" #include "Edge.hpp" #include "Loader.hpp" +#include "JackDriver.hpp" +#include "JackNodeFactory.hpp" using namespace std; using namespace Machina; +bool quit = false; + + +void +catch_int(int) +{ + signal(SIGINT, catch_int); + signal(SIGTERM, catch_int); + + std::cout << "Interrupted" << std::endl; + + quit = true; +} + + int main(int argc, char** argv) { - if (argc != 2) + if (argc != 2) { + cout << "Usage: " << argv[0] << " FILE" << endl; return -1; + } + + SharedPtr<JackDriver> driver(new JackDriver()); + SharedPtr<NodeFactory> factory(new JackNodeFactory(driver)); + + Loader l(factory); - Loader l; SharedPtr<Machine> m = l.load(argv[1]); m->activate(); + driver->set_machine(m); + driver->attach("machina"); + + signal(SIGINT, catch_int); + signal(SIGTERM, catch_int); + + while (!quit) + sleep(1); + + driver->detach(); + + return 0; +} + + /* Machine m(1); @@ -47,14 +86,12 @@ main(int argc, char** argv) n2->add_outgoing_edge(new Edge(m.initial_node())); */ + /* Timestamp t = 0; while (t < 4000) { - m->process(1000); + m->run(1000); t += 1000; } - - return 0; -} - + */ |