aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/machina
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/machina')
-rw-r--r--src/engine/machina/LearnRequest.hpp81
-rw-r--r--src/engine/machina/Machine.hpp13
2 files changed, 8 insertions, 86 deletions
diff --git a/src/engine/machina/LearnRequest.hpp b/src/engine/machina/LearnRequest.hpp
deleted file mode 100644
index 04f0626..0000000
--- a/src/engine/machina/LearnRequest.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* This file is part of Machina.
- * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
- *
- * 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.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef MACHINA_LEARNREQUEST_HPP
-#define MACHINA_LEARNREQUEST_HPP
-
-#include "raul/Maid.hpp"
-#include "raul/SharedPtr.hpp"
-#include "types.hpp"
-#include "Node.hpp"
-#include "MidiAction.hpp"
-
-namespace Machina {
-
-class Node;
-class MidiAction;
-
-
-/** A request to MIDI learn a certain node.
- */
-class LearnRequest : public Raul::Deletable {
-public:
-
- static SharedPtr<LearnRequest>
- create(SharedPtr<Raul::Maid> maid, SharedPtr<Node> node)
- {
- SharedPtr<LearnRequest> ret(new LearnRequest(maid, node));
- maid->manage(ret);
- return ret;
- }
-
- void start(double q, Raul::TimeStamp time)
- { _started = true; _start_time = time; _quantization = q; }
-
- void finish(TimeStamp time);
-
- bool started() { return _started; }
-
- const SharedPtr<Node>& node() { return _node; }
- const SharedPtr<MidiAction>& enter_action() { return _enter_action; }
- const SharedPtr<MidiAction>& exit_action() { return _exit_action; }
-
-private:
- LearnRequest(SharedPtr<Raul::Maid> maid, SharedPtr<Node> node)
- : _started(false)
- , _start_time(TimeUnit(TimeUnit::BEATS, 19200), 0, 0) // irrelevant
- , _quantization(0) // irrelevant
- , _node(node)
- , _enter_action(new MidiAction(4, NULL))
- , _exit_action(new MidiAction(4, NULL))
- {
- maid->manage(_enter_action);
- maid->manage(_exit_action);
- }
-
- bool _started;
- TimeStamp _start_time;
- double _quantization;
- SharedPtr<Node> _node;
- SharedPtr<MidiAction> _enter_action;
- SharedPtr<MidiAction> _exit_action;
-};
-
-
-} // namespace Machina
-
-#endif // MACHINA_LEARNREQUEST_HPP
diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp
index 1d07a2c..8c1caf3 100644
--- a/src/engine/machina/Machine.hpp
+++ b/src/engine/machina/Machine.hpp
@@ -1,5 +1,5 @@
/* This file is part of Machina.
- * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
+ * Copyright (C) 2007-2010 David Robillard <http://drobilla.net>
*
* 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
@@ -20,17 +20,20 @@
#include <vector>
#include <boost/utility.hpp>
-#include "raul/SharedPtr.hpp"
-#include "raul/WeakPtr.hpp"
+
#include "raul/List.hpp"
+#include "raul/Maid.hpp"
+#include "raul/SharedPtr.hpp"
#include "raul/TimeSlice.hpp"
+#include "raul/WeakPtr.hpp"
#include "redlandmm/Model.hpp"
+
#include "types.hpp"
-#include "LearnRequest.hpp"
#include "Node.hpp"
namespace Machina {
+class LearnRequest;
/** A (Finite State) Machine.
*/
@@ -54,7 +57,7 @@ public:
void add_node(SharedPtr<Node> node);
void remove_node(SharedPtr<Node> node);
- void learn(SharedPtr<LearnRequest> learn);
+ void learn(SharedPtr<Raul::Maid> maid, SharedPtr<Node> node);
void write_state(Redland::Model& model);