aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-20 02:35:34 +0000
committerDavid Robillard <d@drobilla.net>2007-01-20 02:35:34 +0000
commit223672dd2445a6fd5f1a984823c1e926da316f41 (patch)
tree741dce09ff31c706cb23d19fb6ddd832acc94e7c
downloadmachina-223672dd2445a6fd5f1a984823c1e926da316f41.tar.gz
machina-223672dd2445a6fd5f1a984823c1e926da316f41.tar.bz2
machina-223672dd2445a6fd5f1a984823c1e926da316f41.zip
Added Machina.
Moved some Jack and RDF functionality down to RAUL from Ingen, for use by Machina. git-svn-id: http://svn.drobilla.net/lad/machina@263 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--AUTHORS4
-rw-r--r--ChangeLog1
-rw-r--r--Makefile.am7
-rw-r--r--NEWS4
-rw-r--r--README4
-rw-r--r--THANKS2
-rwxr-xr-xautogen.sh6
-rw-r--r--configure.ac69
-rw-r--r--machina.desktop.in10
-rw-r--r--src/Action.hpp47
-rw-r--r--src/Edge.cpp99
-rw-r--r--src/Edge.hpp47
-rw-r--r--src/Machina.hpp24
-rw-r--r--src/MetaState.cpp127
-rw-r--r--src/MetaState.hpp48
-rw-r--r--src/Node.cpp101
-rw-r--r--src/Node.hpp74
-rw-r--r--src/main.cpp64
-rw-r--r--src/pixmaps/machina-icon.svg49
-rw-r--r--src/types.hpp30
20 files changed, 817 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..694edde
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,4 @@
+Author:
+
+Dave Robillard <dave@codeson.net>
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..06053c4
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+Nope.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..08e5c1e
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS = src
+
+desktopfilesdir = $(datadir)/applications
+dist_desktopfiles_DATA = machina.desktop
+
+doc: Doxyfile src/*.h src/*.cpp
+ doxygen
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..c931a57
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,4 @@
+Machina NEWS file
+
+0.0.0:
+ * Um.. nothing
diff --git a/README b/README
new file mode 100644
index 0000000..0b3d621
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+A sequencer based on finite automata.
+
+This is in this repository right now for my convenience.
+It is not intended to be used.
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..4fdc229
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,2 @@
+Professor Albert Chan
+Professor Frank Dehne
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..37cf2dc
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+aclocal-1.9
+#autoheader -Wall
+automake-1.9 --gnu --add-missing -Wall
+autoconf -Wall
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..1665508
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,69 @@
+# configure.in for machina
+
+AC_INIT(machina, 0.0.1, dave@codeson.net)
+AC_CONFIG_SRCDIR([src/main.cpp])
+#AC_CONFIG_HEADER([config.h])
+AM_INIT_AUTOMAKE
+
+AC_LANG([C++])
+
+AC_PROG_CXX
+AC_TYPE_SIZE_T
+
+PKG_CHECK_MODULES(JACK, jack >= 0.102.20)
+PKG_CHECK_MODULES(RAUL, raul >= 0.0.0)
+
+# Check for debugging flag
+debug="no"
+AC_ARG_ENABLE(debug,
+ [AS_HELP_STRING(--enable-debug, [Enable debugging (no)])],
+ [debug="$enableval"])
+if test "$debug" = "yes"; then
+ # Useless POS gnomecanvasmm doesn't build w/ -pedantic
+ CFLAGS="-O0 -g -DDEBUG"
+ CXXFLAGS="$CFLAGS"
+else
+ CFLAGS="$CFLAGS -DNDEBUG"
+ CXXFLAGS="$CFLAGS -DNDEBUG"
+fi
+
+# Check for strict flag
+strict="no"
+AC_ARG_ENABLE(strict,
+ [AS_HELP_STRING(--enable-strict, [Enable strict compiler warnings or errors (no)])],
+ [strict="$enableval"])
+if test "$strict" = "yes"; then
+ # Useless POS gnomecanvasmm doesn't build w/ -pedantic
+ CFLAGS="$CFLAGS -ansi -Wall -Wextra -Wno-unused-parameter -Wconversion -Winit-self"
+ CXXFLAGS="$CXXFLAGS -ansi -Wall -Wextra -Wno-unused-parameter -Wconversion -Winit-self -Woverloaded-virtual -Wsign-promo"
+fi
+
+# Boost shared_ptr debugging
+pointer_debug="no"
+AC_ARG_ENABLE(pointer_debug,
+ [AS_HELP_STRING(--enable-pointer-debug, [Enable smart pointer debugging (no)])],
+ [pointer_debug="$enableval"])
+if test "$pointer_debug" = "yes"; then
+ CFLAGS+=" -DBOOST_SP_ENABLE_DEBUG_HOOKS"
+ CXXFLAGS+=" -DBOOST_SP_ENABLE_DEBUG_HOOKS"
+fi
+
+# Bolt on a few specific flags to CXXFLAGS that should always be used
+CXXFLAGS="$CXXFLAGS -pipe -Wall -fmessage-length=139 -fdiagnostics-show-location=every-line"
+CFLAGS="$CFLAGS -pipe -Wall -fmessage-length=139 -fdiagnostics-show-location=every-line"
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([src/Makefile])
+AC_CONFIG_FILES([machina.desktop])
+
+AC_OUTPUT
+
+#AC_MSG_RESULT([])
+#AC_MSG_RESULT([**********************************************************************])
+#AC_MSG_RESULT([Patchage build configuration:])
+#AC_MSG_RESULT([])
+#AC_MSG_RESULT([Alsa support: $build_alsa])
+#AC_MSG_RESULT([Lash support: $have_lash])
+#AC_MSG_RESULT([**********************************************************************])
+#AC_MSG_RESULT([])
+
diff --git a/machina.desktop.in b/machina.desktop.in
new file mode 100644
index 0000000..9245e90
--- /dev/null
+++ b/machina.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Machina
+Version=@PACKAGE_VERSION@
+Comment=Sequencer influenced by finite automata
+Exec=machina
+Terminal=false
+Icon=machina-icon.svg
+Type=Application
+Categories=Application;AudioVideo;Sound;Audio
diff --git a/src/Action.hpp b/src/Action.hpp
new file mode 100644
index 0000000..0b2ac40
--- /dev/null
+++ b/src/Action.hpp
@@ -0,0 +1,47 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MACHINA_ACTION_HPP
+#define MACHINA_ACTION_HPP
+
+#include <string>
+#include <iostream>
+#include "types.hpp"
+
+namespace Machina {
+
+
+struct Action {
+ virtual ~Action() {}
+
+ virtual void execute(Timestamp /*time*/) {}
+};
+
+
+class PrintAction : public Action {
+public:
+ PrintAction(const std::string& msg) : _msg(msg) {}
+
+ void execute(Timestamp time) { std::cout << "t=" << time << ": " << _msg << std::endl; }
+
+private:
+ std::string _msg;
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_ACTION_HPP
diff --git a/src/Edge.cpp b/src/Edge.cpp
new file mode 100644
index 0000000..347dfc6
--- /dev/null
+++ b/src/Edge.cpp
@@ -0,0 +1,99 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <cassert>
+#include "Node.hpp"
+
+namespace Machina {
+
+
+Node::Node(FrameCount duration)
+ : _is_active(false)
+ , _start_time(0)
+ , _duration(duration)
+ , _enter_action(NULL)
+ , _exit_action(NULL)
+{
+}
+
+
+void
+Node::add_enter_action(Action* action)
+{
+ assert(!_enter_action);
+ _enter_action = action;
+}
+
+
+void
+Node::remove_enter_action(Action* /*action*/)
+{
+ _enter_action = NULL;
+}
+
+
+
+void
+Node::add_exit_action(Action* action)
+{
+ assert(!_exit_action);
+ _exit_action = action;
+}
+
+
+void
+Node::remove_exit_action(Action* /*action*/)
+{
+ _exit_action = NULL;
+}
+
+
+void
+Node::enter(Timestamp time)
+{
+ _is_active = true;
+ _start_time = time;
+ if (_enter_action)
+ _enter_action->execute(time);
+}
+
+
+void
+Node::exit(Timestamp time)
+{
+ if (_exit_action)
+ _exit_action->execute(time);
+ _is_active = false;
+ _start_time = 0;
+}
+
+
+void
+Node::add_successor(Node* successor)
+{
+ _successors.push_back(successor);
+}
+
+
+void
+Node::remove_successor(Node* successor)
+{
+ _successors.remove(successor);
+}
+
+
+} // namespace Machina
+
diff --git a/src/Edge.hpp b/src/Edge.hpp
new file mode 100644
index 0000000..eb2715d
--- /dev/null
+++ b/src/Edge.hpp
@@ -0,0 +1,47 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MACHINA_EDGE_HPP
+#define MACHINA_EDGE_HPP
+
+#include <list>
+#include <boost/utility.hpp>
+#include "types.hpp"
+#include "Action.hpp"
+
+namespace Machina {
+
+class Node;
+
+class Edge : boost::noncopyable {
+public:
+
+ Edge(Node* dst) : _src(NULL) , _dst(dst) {}
+
+ Node* src() { return _src; }
+ Node* dst() { return _dst; }
+
+ void set_src(Node* src) { _src = src; }
+
+private:
+ Node* _src;
+ Node* _dst;
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_EDGE_HPP
diff --git a/src/Machina.hpp b/src/Machina.hpp
new file mode 100644
index 0000000..ba02239
--- /dev/null
+++ b/src/Machina.hpp
@@ -0,0 +1,24 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <list>
+
+
+class Machina {
+private:
+ std::list<Node> _nodes;
+};
+
diff --git a/src/MetaState.cpp b/src/MetaState.cpp
new file mode 100644
index 0000000..43ff4b1
--- /dev/null
+++ b/src/MetaState.cpp
@@ -0,0 +1,127 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <algorithm>
+#include "MetaState.hpp"
+#include "Node.hpp"
+#include "Edge.hpp"
+
+namespace Machina {
+
+
+MetaState::MetaState(size_t poly)
+ : _initial_node(new Node())
+ , _voices(poly, NULL)//_initial_node)
+ , _time(0)
+{
+ /* reserve poly spaces in _voices, so accessing it
+ * with operator[] should be realtime safe.
+ */
+}
+
+
+MetaState::~MetaState()
+{
+ delete _initial_node;
+}
+
+
+void
+MetaState::reset()
+{
+ for (std::vector<Node*>::iterator i = _voices.begin();
+ i != _voices.end(); ++i) {
+ *i = NULL;
+ }
+}
+
+
+void
+MetaState::process(FrameCount nframes)
+{
+ const FrameCount cycle_end = _time + nframes;
+ bool done = false;
+
+ FrameCount latest_event = _time;
+
+ std::cerr << "--------- " << _time << " - " << _time + nframes << std::endl;
+
+ // FIXME: way too much iteration
+
+ while (!done) {
+
+ done = true;
+
+ for (std::vector<Node*>::iterator i = _voices.begin();
+ i != _voices.end(); ++i) {
+
+ Node* const n = *i;
+
+ // Active voice which ends within this cycle, transition
+ if (n && n->is_active() && n->end_time() < cycle_end) {
+ // Guaranteed to be within this cycle
+ const FrameCount end_time = std::max(_time, n->end_time());
+ n->exit(std::max(_time, n->end_time()));
+ done = false;
+
+ // Greedily grab one of the successors with the voice already
+ // on this node so voices follow paths nicely
+ for (Node::EdgeList::const_iterator s = n->outgoing_edges().begin();
+ s != n->outgoing_edges().end(); ++s) {
+ Node* dst = (*s)->dst();
+ if (!dst->is_active()) {
+ dst->enter(end_time);
+ *i = dst;
+ break;
+ }
+ }
+
+ latest_event = end_time;
+ }
+
+ }
+
+ // FIXME: use free voices to claim any 'free successors'
+ // (when nodes have multiple successors and one gets chosen in the
+ // greedy bit above)
+
+ // If every voice is on the initial node...
+ bool is_reset = true;
+ for (std::vector<Node*>::iterator i = _voices.begin();
+ i != _voices.end(); ++i)
+ if ((*i) != NULL && (*i)->is_active())
+ is_reset = false;
+
+ // ... then start
+ if (is_reset) {
+
+ std::vector<Node*>::iterator n = _voices.begin();
+ for (Node::EdgeList::const_iterator s = _initial_node->outgoing_edges().begin();
+ s != _initial_node->outgoing_edges().end() && n != _voices.end();
+ ++s, ++n) {
+ (*s)->dst()->enter(latest_event);
+ done = false;
+ *n = (*s)->dst();
+ }
+ }
+ }
+
+ _time += nframes;
+}
+
+
+} // namespace Machina
+
diff --git a/src/MetaState.hpp b/src/MetaState.hpp
new file mode 100644
index 0000000..08e15a7
--- /dev/null
+++ b/src/MetaState.hpp
@@ -0,0 +1,48 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MACHINA_METASTATE_HPP
+#define MACHINA_METASTATE_HPP
+
+#include <vector>
+#include "types.hpp"
+
+namespace Machina {
+
+class Node;
+
+
+class MetaState {
+public:
+ MetaState(size_t poly);
+ ~MetaState();
+
+ Node* initial_node() { return _initial_node; }
+
+ void reset();
+ void process(FrameCount nframes);
+
+private:
+ Node* _initial_node;
+ std::vector<Node*> _voices;
+
+ FrameCount _time;
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_METASTATE_HPP
diff --git a/src/Node.cpp b/src/Node.cpp
new file mode 100644
index 0000000..841b728
--- /dev/null
+++ b/src/Node.cpp
@@ -0,0 +1,101 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <cassert>
+#include "Node.hpp"
+#include "Edge.hpp"
+
+namespace Machina {
+
+
+Node::Node(FrameCount duration)
+ : _is_active(false)
+ , _start_time(0)
+ , _duration(duration)
+ , _enter_action(NULL)
+ , _exit_action(NULL)
+{
+}
+
+
+void
+Node::add_enter_action(Action* action)
+{
+ assert(!_enter_action);
+ _enter_action = action;
+}
+
+
+void
+Node::remove_enter_action(Action* /*action*/)
+{
+ _enter_action = NULL;
+}
+
+
+
+void
+Node::add_exit_action(Action* action)
+{
+ assert(!_exit_action);
+ _exit_action = action;
+}
+
+
+void
+Node::remove_exit_action(Action* /*action*/)
+{
+ _exit_action = NULL;
+}
+
+
+void
+Node::enter(Timestamp time)
+{
+ _is_active = true;
+ _start_time = time;
+ if (_enter_action)
+ _enter_action->execute(time);
+}
+
+
+void
+Node::exit(Timestamp time)
+{
+ if (_exit_action)
+ _exit_action->execute(time);
+ _is_active = false;
+ _start_time = 0;
+}
+
+
+void
+Node::add_outgoing_edge(Edge* edge)
+{
+ edge->set_src(this);
+ _outgoing_edges.push_back(edge);
+}
+
+
+void
+Node::remove_outgoing_edge(Edge* edge)
+{
+ _outgoing_edges.remove(edge);
+}
+
+
+} // namespace Machina
+
diff --git a/src/Node.hpp b/src/Node.hpp
new file mode 100644
index 0000000..353cbc2
--- /dev/null
+++ b/src/Node.hpp
@@ -0,0 +1,74 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MACHINA_NODE_HPP
+#define MACHINA_NODE_HPP
+
+#include <list>
+#include <boost/utility.hpp>
+#include "types.hpp"
+#include "Action.hpp"
+
+namespace Machina {
+
+class Edge;
+
+
+/** A node is a state (as in a FSM diagram), or "note".
+ *
+ * It contains a action, as well as a duration and pointers to it's
+ * successors (states/nodes that (may) follow it).
+ */
+class Node : public boost::noncopyable {
+public:
+ Node(FrameCount duration=0);
+
+ void add_enter_action(Action* action);
+ void remove_enter_action(Action* action);
+
+ void add_exit_action(Action* action);
+ void remove_exit_action(Action* action);
+
+ void enter(Timestamp time);
+ void exit(Timestamp time);
+
+ void add_outgoing_edge(Edge* edge);
+ void remove_outgoing_edge(Edge* edge);
+
+ Timestamp process(Timestamp time, FrameCount nframes);
+
+ bool is_active() const { return _is_active; }
+ Timestamp start_time() const { return _start_time; }
+ Timestamp end_time() const { return _start_time + _duration; }
+ FrameCount duration() { return _duration; }
+ void set_duration(FrameCount d) { _duration = d; }
+
+ typedef std::list<Edge*> EdgeList;
+ const EdgeList& outgoing_edges() const { return _outgoing_edges; }
+
+private:
+ bool _is_active;
+ Timestamp _start_time; ///< valid iff _is_active
+ FrameCount _duration;
+ Action* _enter_action;
+ Action* _exit_action;
+ EdgeList _outgoing_edges;
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_NODE_HPP
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..bf3148e
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,64 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <iostream>
+#include "MetaState.hpp"
+#include "Node.hpp"
+#include "Action.hpp"
+#include "Edge.hpp"
+
+using namespace std;
+using namespace Machina;
+
+
+Node* create_debug_node(const string& name, FrameCount duration)
+{
+ // leaks like a sieve, obviously
+
+ Node* n = new Node(duration);
+ PrintAction* a_enter = new PrintAction(string("> ") + name);
+ PrintAction* a_exit = new PrintAction(string("< ")/* + name*/);
+
+ n->add_enter_action(a_enter);
+ n->add_exit_action(a_exit);
+
+ return n;
+}
+
+
+int
+main()//int argc, char** argv)
+{
+ MetaState ms(1);
+
+ Node* n1 = create_debug_node("1", 1);
+ Node* n2 = create_debug_node("2", 10);
+
+ ms.initial_node()->add_outgoing_edge(new Edge(n1));
+ n1->add_outgoing_edge(new Edge(n2));
+ n2->add_outgoing_edge(new Edge(ms.initial_node()));
+
+ Timestamp t = 0;
+
+ while (t < 80) {
+ ms.process(10);
+ t += 10;
+ }
+
+ return 0;
+}
+
+
diff --git a/src/pixmaps/machina-icon.svg b/src/pixmaps/machina-icon.svg
new file mode 100644
index 0000000..e8b359f
--- /dev/null
+++ b/src/pixmaps/machina-icon.svg
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="48"
+ height="48"
+ id="svg1887">
+ <defs
+ id="defs1889" />
+ <g
+ id="layer1">
+ <path
+ d="M 11.643939,6.8265207 C 11.516609,6.6129803 11.268811,6.5206237 11.062329,6.3939764 C 10.525746,6.1519833 10.00503,5.8809041 9.4873511,5.6012477 C 8.8868171,5.2605624 8.2397108,5.0305983 7.5830106,4.828183 C 7.0635557,4.670182 6.5229936,4.6418764 5.9850852,4.6128037 C 5.4410135,4.5776465 4.9052094,4.6023289 4.3669897,4.6708791 C 3.8991218,4.7187427 3.5061366,4.9544196 3.1001194,5.162585 C 6.0207094,3.2937758 4.6245828,4.2135363 4.0394461,4.8567385 C 3.7964617,5.143765 3.6481323,5.4783614 3.4871,5.8131051 C 3.2640573,6.266955 3.1196392,6.7390382 3.0082093,7.2292266 C 2.9166435,7.785025 2.9185852,8.3495781 2.90795,8.9110064 C 2.8870458,9.610928 3.0350965,10.283562 3.2040292,10.956375 C 3.3797861,11.638495 3.7149155,12.260739 4.0337914,12.883653 C 4.3155079,13.45138 4.6565606,13.983021 5.0301712,14.4921 C 5.4568246,14.931669 5.9760271,15.257145 6.4906827,15.581107 C 7.0387804,15.873711 7.6095968,16.113739 8.1873294,16.338361 C 8.6291368,16.543667 9.0986497,16.605812 9.5762154,16.65622 C 10.12525,16.690671 10.675671,16.684585 11.225476,16.684901 C 11.779322,16.676547 12.265348,16.449699 12.753089,16.215167 C 15.410517,14.730522 7.9642686,19.166528 13.927431,15.584796 C 14.435332,15.279729 12.897875,16.171424 12.383097,16.464738 C 12.821435,16.181152 13.107343,15.762473 13.391191,15.337906 C 13.658283,14.883464 13.883238,14.409548 14.083995,13.923268 C 14.301222,13.420954 14.414396,12.88578 14.530099,12.353915 C 14.646515,11.868685 14.61565,11.380852 14.594336,10.893307 C 14.527085,10.54933 14.412659,10.223554 14.295259,9.8950564 C 14.140307,9.5386489 13.946399,9.2041208 13.75562,8.8674393 C 13.537382,8.5471061 13.259935,8.2756557 12.994801,7.9954021 C 12.734503,7.7342234 12.463408,7.4861156 12.199848,7.2281448 C 12.012475,7.0294798 11.784937,6.8893193 11.563968,6.7344146 C 11.557418,6.7055446 11.360025,6.6686205 11.35259,6.6662218 L 13.089833,5.4824036 C 13.17256,5.5206302 13.266521,5.5349664 13.338014,5.5970833 C 13.560411,5.769492 13.793538,5.9257537 13.983628,6.1371032 C 14.245502,6.3957531 14.512684,6.6483871 14.771365,6.9102119 C 15.045387,7.2010712 15.331943,7.4830131 15.555846,7.8164095 C 15.752386,8.1660654 15.945068,8.5160088 16.119607,8.8782502 C 16.244625,9.2192841 16.369014,9.5554341 16.431402,9.9159204 C 16.48896,10.430477 16.468854,10.939629 16.379124,11.454159 C 16.272003,11.994751 16.167666,12.540326 15.957837,13.052873 C 15.767268,13.553642 15.533899,14.02937 15.276999,14.500166 C 15.008835,14.95065 14.72676,15.38872 14.304837,15.714325 C 8.0154024,19.418852 18.652128,13.254172 11.142217,17.499696 C 10.632459,17.71565 10.127544,17.914342 9.5607963,17.894339 C 9.0047171,17.892655 8.4476954,17.896111 7.8927936,17.854932 C 7.4047798,17.789376 6.9288343,17.704953 6.4793611,17.489172 C 5.9016663,17.249141 5.3326598,16.990231 4.785893,16.684014 C 4.2467765,16.348507 3.691354,16.02245 3.2587294,15.54889 C 2.8925095,15.019584 2.5630579,14.46655 2.2729081,13.890008 C 1.9458137,13.254698 1.5878286,12.624933 1.4098293,11.927592 C 1.239367,11.239988 1.0879073,10.551673 1.0850363,9.8383272 C 1.0861707,9.2699007 1.072559,8.698251 1.1500816,8.1336828 C 1.2498083,7.6310455 1.3750022,7.1456036 1.6025158,6.68255 C 1.7440919,6.3330604 1.8637014,5.9778864 2.1299792,5.6987755 C 2.8077354,4.7686983 3.5061281,4.4310071 4.7199934,3.8521622 C 5.1378741,3.6691331 5.5468785,3.4715614 6.0127405,3.4381334 C 6.5614632,3.3927374 7.1098692,3.3714916 7.6611915,3.4079788 C 8.2078758,3.4498067 8.7557804,3.4975977 9.2798467,3.6730042 C 9.934373,3.8964829 10.575201,4.1530962 11.181381,4.4905412 C 11.718603,4.760547 12.263726,5.0091188 12.810711,5.2582757 C 13.041513,5.3922836 13.291753,5.4983997 13.464742,5.7107315 L 11.643939,6.8265207 z "
+ style="fill:black"
+ id="path1897" />
+ <path
+ d="M 14.024641,15.800333 C 14.323595,15.8264 14.622219,15.808939 14.920803,15.801521 C 15.558331,15.703674 16.180736,15.529 16.808124,15.381523 C 17.486323,15.211308 18.177923,15.164804 18.872735,15.134316 C 19.835735,15.082442 20.788421,15.17976 21.73832,15.325152 C 22.652157,15.451378 23.506375,15.768827 24.340291,16.150788 C 25.58852,16.724206 26.804743,17.355911 27.997721,18.035605 C 29.410681,18.830585 30.726467,19.771942 31.947328,20.836039 C 33.112051,21.794329 34.045406,22.956333 34.886404,24.197346 C 35.470928,25.120899 35.922523,26.113833 36.295481,27.138572 C 36.628219,28.039553 36.966892,28.937621 37.292661,29.841182 C 37.421888,30.188947 37.552029,30.536353 37.680297,30.88442 L 35.886749,31.874176 C 35.774854,31.518649 35.672996,31.159643 35.536234,30.812339 C 35.22394,29.90299 34.886078,29.004165 34.557661,28.100634 C 34.200797,27.085914 33.749033,26.110967 33.205502,25.181819 C 32.399208,23.940413 31.498943,22.779698 30.346623,21.833415 C 29.116997,20.787168 27.811225,19.846033 26.382366,19.086307 C 25.188243,18.410964 23.970035,17.779784 22.708404,17.23852 C 21.861833,16.901722 20.997811,16.623507 20.095374,16.479814 C 19.148549,16.324517 18.197692,16.251734 17.238149,16.333264 C 16.549415,16.385002 15.860118,16.439648 15.18923,16.617503 C 14.552215,16.772324 13.916306,16.949767 13.263257,17.021445 C 12.940617,17.034679 12.618047,17.047077 12.295249,17.05681 L 14.024641,15.800333 z "
+ style="fill:black"
+ id="path1899" />
+ <path
+ d="M 40.39795,24.465623 C 40.246055,24.63612 40.148194,24.895689 40.039721,25.107247 C 39.723882,25.648506 39.535885,26.231298 39.368949,26.829452 C 39.233717,27.505187 39.216895,28.195603 39.183392,28.881566 C 39.127744,29.443674 39.097521,30.007052 39.079213,30.571363 C 39.06804,30.943585 38.950801,31.299297 38.855222,31.655964 C 38.524156,32.588126 37.284994,32.816008 36.588135,33.181795 C 36.242539,32.904896 35.966665,32.551158 35.662323,32.230294 C 35.269036,31.801928 34.747925,31.531193 34.250921,31.243324 C 33.699271,30.885712 33.063006,30.747738 32.436505,30.585599 C 31.700557,30.433057 30.956421,30.324205 30.216804,30.19049 C 29.645459,30.080865 29.064783,30.059078 28.485271,30.038135 C 28.142535,30.031839 27.799753,30.033321 27.456989,30.033446 L 29.130355,28.818119 C 29.471492,28.820746 29.812742,28.820845 30.153677,28.834471 C 30.735593,28.863293 31.318193,28.895711 31.889215,29.022248 C 32.629654,29.163306 33.374802,29.277841 34.112862,29.430965 C 34.758761,29.594599 35.399067,29.760727 35.968815,30.123693 C 36.482709,30.42482 37.01414,30.716435 37.426442,31.1548 C 37.690578,31.436726 37.944395,31.794237 38.301746,31.940439 C 37.879204,32.193506 36.636219,32.921181 36.953115,32.544138 C 37.060373,32.203575 37.19404,31.862123 37.233222,31.50346 C 37.262308,30.933998 37.29028,30.364313 37.352325,29.797208 C 37.395624,29.100459 37.421397,28.399982 37.543441,27.710937 C 37.684017,27.103488 37.840508,26.513632 38.146834,25.963525 C 38.251556,25.742948 38.389622,25.526129 38.425017,25.282839 L 40.39795,24.465623 z "
+ style="fill:black"
+ id="path1901" />
+ <path
+ d="M 42.333386,38.753862 C 42.359667,38.465721 42.161675,38.28171 42.026348,38.054147 C 41.630713,37.603164 41.189848,37.201876 40.737498,36.809715 C 40.309762,36.450589 39.850158,36.140227 39.378771,35.842507 C 38.894718,35.557129 38.391798,35.308039 37.879105,35.081148 C 37.411941,34.87426 36.928056,34.710271 36.447466,34.538672 C 35.911868,34.340552 35.358573,34.214602 34.798685,34.112097 C 34.269945,34.038094 33.735343,34.038053 33.202696,34.030736 C 32.735879,34.010398 32.275222,34.10485 31.818025,34.176764 C 31.482563,34.29698 31.172208,34.472406 30.856536,34.635451 C 33.939044,32.741691 32.344518,33.767288 31.669657,34.263364 C 31.30737,34.480679 31.040557,34.780639 30.763042,35.089188 C 30.514414,35.408126 30.3566,35.7771 30.183491,36.137264 C 29.978216,36.626976 29.840881,37.140346 29.697145,37.650242 C 29.54687,38.181912 29.522013,38.719457 29.551952,39.264386 C 29.620619,39.785722 29.814502,40.272709 30.011447,40.755387 C 30.234074,41.288988 30.545175,41.773681 30.855298,42.258492 C 31.133616,42.671874 31.476921,43.033299 31.815039,43.396903 C 32.216493,43.847327 32.739922,44.151268 33.241105,44.475405 C 33.743895,44.762328 34.275429,44.987435 34.804234,45.220002 C 35.390755,45.426839 35.982934,45.617127 36.577976,45.796966 C 37.177949,45.949542 37.798243,45.953537 38.412734,45.97537 C 39.162471,45.992279 39.912371,45.981116 40.662091,45.970293 C 41.080237,46.014829 41.462096,45.931461 41.848908,45.828111 C 40.97651,46.274618 39.868589,47.151699 41.340613,46.002689 C 41.875319,45.572985 42.33753,45.065861 42.812404,44.573546 C 43.155895,44.248939 43.266196,43.84901 43.380177,43.409514 C 43.461258,42.998716 43.531163,42.586486 43.598655,42.173556 C 43.651201,41.669704 43.649887,41.162477 43.655589,40.656546 C 43.705882,40.113114 43.627602,39.618296 43.446516,39.114489 C 43.254571,38.714491 42.924652,38.543007 42.565661,38.334744 C 42.251519,38.204331 41.916366,38.203334 41.583643,38.181909 L 43.276728,36.962685 C 43.62994,37.00067 43.981914,37.016769 44.305318,37.187925 C 44.684917,37.440691 45.04285,37.656619 45.24662,38.095995 C 45.438617,38.627175 45.544833,39.147595 45.490163,39.722791 C 45.489061,40.231841 45.493748,40.741526 45.461656,41.24983 C 45.401117,41.671952 45.334314,42.090536 45.24329,42.507951 C 45.141868,42.980501 45.067084,43.42716 44.705952,43.783293 C 44.222704,44.274823 43.761327,44.789524 43.236133,45.237942 C 42.319113,45.998277 41.323378,46.691004 40.201487,47.117455 C 39.802516,47.167022 39.406419,47.21613 39.000294,47.178323 C 38.257422,47.170638 37.514542,47.16584 36.771642,47.162142 C 36.136595,47.144531 35.496749,47.145535 34.883011,46.955719 C 34.284316,46.757616 33.680906,46.57263 33.087294,46.360158 C 32.555323,46.121798 32.022929,45.884312 31.523955,45.580238 C 31.008538,45.245458 30.46515,44.938883 30.05743,44.468751 C 29.704739,44.100222 29.347254,43.734541 29.075504,43.299129 C 28.764356,42.802178 28.460514,42.301201 28.223012,41.763375 C 28.009112,41.267044 27.799486,40.765138 27.721692,40.225592 C 27.683655,39.656829 27.696442,39.095018 27.842561,38.536568 C 27.98085,38.024567 28.108612,37.507939 28.298995,37.011976 C 28.460008,36.630384 28.614541,36.254541 28.849039,35.907715 C 29.113082,35.579324 29.353679,35.247687 29.734419,35.042807 C 30.60273,34.377867 31.421809,33.777444 32.482599,33.329924 C 32.806224,33.169683 33.123785,32.989087 33.482243,32.918461 C 33.94284,32.865714 34.404092,32.800304 34.869517,32.822593 C 35.409658,32.833003 35.952494,32.835707 36.486225,32.930855 C 37.049419,33.050933 37.608068,33.187924 38.151145,33.383054 C 38.637297,33.555211 39.126943,33.719524 39.596206,33.935288 C 40.108658,34.185295 40.619372,34.441581 41.114118,34.72632 C 41.589177,35.033142 42.047112,35.358503 42.474146,35.730965 C 42.936206,36.132517 43.389003,36.542646 43.805484,36.99238 C 43.988665,37.238945 44.183403,37.471186 44.238043,37.783391 L 42.333386,38.753862 z "
+ style="fill:black"
+ id="path1903" />
+ <text
+ x="4.8571429"
+ y="13.571428"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ id="text1905"
+ xml:space="preserve"><tspan
+ x="4.8571429"
+ y="13.571428"
+ id="tspan1907">a</tspan></text>
+ <text
+ x="33.039062"
+ y="44.142857"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ id="text1909"
+ xml:space="preserve"><tspan
+ x="33.039062"
+ y="44.142857"
+ id="tspan1911">b</tspan></text>
+ </g>
+</svg>
diff --git a/src/types.hpp b/src/types.hpp
new file mode 100644
index 0000000..be1fd1a
--- /dev/null
+++ b/src/types.hpp
@@ -0,0 +1,30 @@
+/* This file is part of Machina. Copyright (C) 2007 Dave Robillard.
+ *
+ * Machina 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 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Machina 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 details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MACHINA_TYPES_HPP
+#define MACHINA_TYPES_HPP
+
+#include <jack/types.h>
+
+namespace Machina {
+
+
+typedef jack_nframes_t FrameCount;
+typedef jack_nframes_t Timestamp;
+
+} // namespace Machina
+
+#endif // MACHINA_TYPES_HPP