summaryrefslogtreecommitdiffstats
path: root/src/engine/PortInfo.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-10 01:52:02 +0000
committerDavid Robillard <d@drobilla.net>2006-06-10 01:52:02 +0000
commit98fe0e7056e6697396249531785d3899f94d79be (patch)
tree233319008d4bfb6c8bdc546bdf4a81b87ecf7f3a /src/engine/PortInfo.h
parent6c8eaee73b0ea66216744f49b452e22e26fe83e1 (diff)
downloadingen-98fe0e7056e6697396249531785d3899f94d79be.tar.gz
ingen-98fe0e7056e6697396249531785d3899f94d79be.tar.bz2
ingen-98fe0e7056e6697396249531785d3899f94d79be.zip
More juggling
git-svn-id: http://svn.drobilla.net/lad/grauph@15 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/PortInfo.h')
-rw-r--r--src/engine/PortInfo.h153
1 files changed, 0 insertions, 153 deletions
diff --git a/src/engine/PortInfo.h b/src/engine/PortInfo.h
deleted file mode 100644
index 3fa4215a..00000000
--- a/src/engine/PortInfo.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* This file is part of Om. Copyright (C) 2006 Dave Robillard.
- *
- * Om 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.
- *
- * Om 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 PORTINFO_H
-#define PORTINFO_H
-
-#include <cstdlib>
-#include <string>
-#include <ladspa.h>
-
-using std::string;
-
-namespace Om {
-
-
-enum PortType { CONTROL, AUDIO, MIDI };
-enum PortDirection { INPUT = 0, OUTPUT = 1 }; // FIXME: dupe of ClientInterface::PortDirection
-enum PortHint { NONE, INTEGER, TOGGLE, LOGARITHMIC };
-
-
-/** Information about a Port.
- *
- * I'm not sure this actually has a reason for existing anymore. This is the
- * model for a Port, but no other OmObjects need a model, soo....
- *
- * \ingroup engine
- */
-class PortInfo
-{
-public:
- PortInfo(const string& port_name, PortType type, PortDirection dir, PortHint hint, float default_val, float min, float max)
- : m_name(port_name),
- m_type(type),
- m_direction(dir),
- m_hint(hint),
- m_default_val(default_val),
- m_min_val(min),
- m_max_val(max)
- {}
-
- PortInfo(const string& port_name, PortType type, PortDirection dir, float default_val, float min, float max)
- : m_name(port_name),
- m_type(type),
- m_direction(dir),
- m_hint(NONE),
- m_default_val(default_val),
- m_min_val(min),
- m_max_val(max)
- {}
-
- PortInfo(const string& port_name, PortType type, PortDirection dir, PortHint hint = NONE)
- : m_name(port_name),
- m_type(type),
- m_direction(dir),
- m_hint(hint),
- m_default_val(0.0f),
- m_min_val(0.0f),
- m_max_val(1.0f)
- {}
-
- PortInfo(const string& port_name, LADSPA_PortDescriptor d, LADSPA_PortRangeHintDescriptor hint)
- : m_name(port_name),
- m_default_val(1.0f),
- m_min_val(0.0f),
- m_max_val(1.0f)
- {
- if (LADSPA_IS_PORT_AUDIO(d)) m_type = AUDIO;
- else if (LADSPA_IS_PORT_CONTROL(d)) m_type = CONTROL;
- else exit(EXIT_FAILURE);
-
- if (LADSPA_IS_PORT_INPUT(d)) m_direction = INPUT;
- else if (LADSPA_IS_PORT_OUTPUT(d)) m_direction = OUTPUT;
- else exit(EXIT_FAILURE);
-
- if (LADSPA_IS_HINT_TOGGLED(hint)) {
- m_hint = TOGGLE; m_min_val = 0; m_max_val = 1; m_default_val = 0;
- } else if (LADSPA_IS_HINT_LOGARITHMIC(hint))
- m_hint = LOGARITHMIC;
- else if (LADSPA_IS_HINT_INTEGER(hint))
- m_hint = INTEGER;
- else
- m_hint = NONE;
- }
-
- PortType type() const { return m_type; }
- void type(PortType t) { m_type = t; }
- float min_val() const { return m_min_val; }
- void min_val(float f) { m_min_val = f; }
- float default_val() const { return m_default_val; }
- void default_val(float f) { m_default_val = f; }
- float max_val() const { return m_max_val; }
- void max_val(float f) { m_max_val = f; }
- PortDirection direction() const { return m_direction; }
-
- string type_string() {
- switch (m_type) {
- case CONTROL: return "CONTROL"; break;
- case AUDIO: return "AUDIO"; break;
- case MIDI: return "MIDI"; break;
- default: return "UNKNOWN";
- }
- }
- string direction_string() { if (m_direction == INPUT) return "INPUT"; else return "OUTPUT"; }
- string hint_string() { if (m_hint == INTEGER) return "INTEGER";
- else if (m_hint == LOGARITHMIC) return "LOGARITHMIC";
- else if (m_hint == TOGGLE) return "TOGGLE";
- else return "NONE"; }
-
- bool is_control() const { return (m_type == CONTROL); }
- bool is_audio() const { return (m_type == AUDIO); }
- bool is_midi() const { return (m_type == MIDI); }
- bool is_input() const { return (m_direction == INPUT); }
- bool is_output() const { return (m_direction == OUTPUT); }
-
- bool is_logarithmic() const { return (m_hint == LOGARITHMIC); }
- bool is_integer() const { return (m_hint == INTEGER); }
- bool is_toggle() const { return (m_hint == TOGGLE); }
-
- const string& name() const { return m_name; }
- void name(const string& n) { m_name = n; }
-
-private:
- // Prevent copies (undefined)
- PortInfo(const PortInfo&);
- PortInfo& operator=(const PortInfo&);
-
- string m_name;
- PortType m_type;
- PortDirection m_direction;
- PortHint m_hint;
- float m_default_val;
- float m_min_val;
- float m_max_val;
-};
-
-
-} // namespace Om
-
-#endif // PORTINFO_H