summaryrefslogtreecommitdiffstats
path: root/src/common/interface/MessageType.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
committerDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
commit87597f85c5a69a9accd3ce2ed88f2a006173e885 (patch)
treea3ffa393e9aecbc55dae64bad3bd45ee317e6d26 /src/common/interface/MessageType.hpp
parenta645d2b8be4d7d31f6eef1649156b166a01e0c31 (diff)
downloadingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.gz
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.bz2
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.zip
Comprehensive use of cached URIs and more advanced Value (Atom) system.
Atoms (e.g. property values or port values) can now be an Atom::DICT, which maps directly to/from an RDF resource. This is now used to store control bindings as a port property, eliminating the special API. Full interned URIs used everywhere, instead of CURIEs pretending to be URIs. Avoid converting string literals to URIs all over the place. Support for binding MIDI pitch bender and MIDI channel pressure. Saving/restoring of MIDI bindings as a free side-effect of the above. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2409 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common/interface/MessageType.hpp')
-rw-r--r--src/common/interface/MessageType.hpp120
1 files changed, 0 insertions, 120 deletions
diff --git a/src/common/interface/MessageType.hpp b/src/common/interface/MessageType.hpp
deleted file mode 100644
index 3f18aaac..00000000
--- a/src/common/interface/MessageType.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen 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.
- *
- * Ingen 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 INGEN_INTERFACE_MESSAGETYPE_HPP
-#define INGEN_INTERFACE_MESSAGETYPE_HPP
-
-#include <cassert>
-#include <iostream>
-#include <string>
-
-namespace Ingen {
-namespace Shared {
-
-
-/** A type of control message that could be bound to a control port.
- *
- * \ingroup interface
- */
-class MessageType
-{
-public:
- enum Type {
- MIDI_PITCH,
- MIDI_CC,
- MIDI_RPN,
- MIDI_NRPN
- };
-
- MessageType(Type type, int16_t num)
- : _type(type)
- {
- switch (type) {
- case MIDI_PITCH:
- break;
- case MIDI_CC:
- assert(num >= 0 && num < 128);
- _id.midi_cc = num;
- break;
- case MIDI_RPN:
- assert(num >= 0 && num < 16384);
- _id.midi_pn = num;
- break;
- case MIDI_NRPN:
- assert(num >= 0 && num < 16384);
- _id.midi_pn = num;
- break;
- }
- }
-
- inline Type type() const { return _type; }
- inline int8_t midi_cc_num() const { assert(_type == MIDI_CC); return _id.midi_cc; }
- inline int8_t midi_rpn_num() const { assert(_type == MIDI_RPN); return _id.midi_pn; }
- inline int8_t midi_nrpn_num() const { assert(_type == MIDI_NRPN); return _id.midi_pn; }
-
- inline int num() const {
- switch (_type) {
- case MIDI_CC:
- return _id.midi_cc;
- case MIDI_RPN:
- case MIDI_NRPN:
- return _id.midi_pn;
- default:
- return -1;
- }
- }
-
- inline const char* type_uri() const {
- switch (_type) {
- case MIDI_PITCH:
- return "midi:PitchBend";
- case MIDI_CC:
- return "midi:Control";
- case MIDI_RPN:
- return "midi:RPN";
- case MIDI_NRPN:
- return "midi:NRPN";
- }
- }
-
-private:
- union {
- int8_t midi_cc; ///< Controller number [0..2^7)
- int16_t midi_pn; ///< RPN or NRPN number [0..2^14)
- } _id;
-
- Type _type;
-};
-
-
-} // namespace Shared
-} // namespace Ingen
-
-
-static inline std::ostream& operator<<(std::ostream& os, const Ingen::Shared::MessageType& type)
-{
- using namespace Ingen::Shared;
- switch (type.type()) {
- case MessageType::MIDI_PITCH: return os << "MIDI Pitch Bender";
- case MessageType::MIDI_CC: return os << "MIDI CC " << type.num();
- case MessageType::MIDI_RPN: return os << "MIDI RPN " << type.num();
- case MessageType::MIDI_NRPN: return os << "MIDI NRPN " << type.num();
- }
- return os;
-}
-
-#endif // INGEN_INTERFACE_MESSAGETYPE_HPP