aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-12 03:08:42 +0000
committerDavid Robillard <d@drobilla.net>2007-02-12 03:08:42 +0000
commit547d2e751fe03b6c2e81beef8fad27a31b5905e8 (patch)
treeb0f9725a1a4e49cf5c0b6c901a1a5b57291f480e /src
parent9be91674f5de3da9d27b6afcdf9d76d27f5b40cb (diff)
downloadmachina-547d2e751fe03b6c2e81beef8fad27a31b5905e8.tar.gz
machina-547d2e751fe03b6c2e81beef8fad27a31b5905e8.tar.bz2
machina-547d2e751fe03b6c2e81beef8fad27a31b5905e8.zip
Added missing files.
git-svn-id: http://svn.drobilla.net/lad/machina@304 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/machina/LearnRequest.hpp81
-rw-r--r--src/engine/machina/MidiDriver.hpp54
2 files changed, 135 insertions, 0 deletions
diff --git a/src/engine/machina/LearnRequest.hpp b/src/engine/machina/LearnRequest.hpp
new file mode 100644
index 0000000..60f1b27
--- /dev/null
+++ b/src/engine/machina/LearnRequest.hpp
@@ -0,0 +1,81 @@
+/* This file is part of Machina.
+ * Copyright (C) 2007 Dave 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 Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef MACHINA_LEARNREQUEST_HPP
+#define MACHINA_LEARNREQUEST_HPP
+
+#include <raul/Maid.h>
+#include <raul/SharedPtr.h>
+#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;
+ }
+
+ // Add the learned actions to the node
+ void finish(Timestamp time)
+ {
+ _node->add_enter_action(_enter_action);
+ _node->add_exit_action(_exit_action);
+ _node->set_duration(time - _start_time);
+ std::cerr << "LEARN DURATION: " << _node->duration() << std::endl;
+ }
+
+ void start(Timestamp time) { _started = true; _start_time = 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)
+ , _node(node)
+ , _enter_action(MidiAction::create(maid, 4, NULL))
+ , _exit_action(MidiAction::create(maid, 4, NULL))
+ {
+ }
+
+ bool _started;
+ Timestamp _start_time;
+ SharedPtr<Node> _node;
+ SharedPtr<MidiAction> _enter_action;
+ SharedPtr<MidiAction> _exit_action;
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_LEARNREQUEST_HPP
diff --git a/src/engine/machina/MidiDriver.hpp b/src/engine/machina/MidiDriver.hpp
new file mode 100644
index 0000000..7f6dca1
--- /dev/null
+++ b/src/engine/machina/MidiDriver.hpp
@@ -0,0 +1,54 @@
+/* This file is part of Machina.
+ * Copyright (C) 2007 Dave 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_MIDIDRIVER_HPP
+#define MACHINA_MIDIDRIVER_HPP
+
+#include "machina/types.hpp"
+
+namespace Machina {
+
+class Node;
+
+
+class MidiDriver {
+public:
+ virtual ~MidiDriver() {}
+
+ /** Emit a MIDI event at the given time */
+ virtual void write_event(Timestamp time,
+ size_t size,
+ const unsigned char* event) = 0;
+
+ /** Beginning of current cycle in absolute time.
+ */
+ virtual Timestamp cycle_start() = 0;
+
+ /** Length of current cycle in ticks.
+ *
+ * A "tick" is the smallest recognizable unit of (discrete) time.
+ * Ticks could be single audio frames, MIDI clock at a certain ppqn, etc.
+ */
+ virtual FrameCount cycle_length() = 0;
+
+};
+
+
+} // namespace Machina
+
+#endif // MACHINA_MIDIDRIVER_HPP
+