summaryrefslogtreecommitdiffstats
path: root/src/server/events/CreatePort.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-03 02:18:42 +0000
committerDavid Robillard <d@drobilla.net>2011-10-03 02:18:42 +0000
commit8768c927968c2541bcac763d9a4f237081eaca4b (patch)
tree214b29607be379f4cab4d254562a9949677c5848 /src/server/events/CreatePort.cpp
parentaf70d4f1e0927ea3e89b78fdf0de4247a32a39b4 (diff)
downloadingen-8768c927968c2541bcac763d9a4f237081eaca4b.tar.gz
ingen-8768c927968c2541bcac763d9a4f237081eaca4b.tar.bz2
ingen-8768c927968c2541bcac763d9a4f237081eaca4b.zip
Remove static PortType enumeration from public/client side interface.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3523 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/CreatePort.cpp')
-rw-r--r--src/server/events/CreatePort.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 5c3ecbd2..c6d7c296 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -46,21 +46,46 @@ CreatePort::CreatePort(
SharedPtr<Request> request,
SampleCount timestamp,
const Raul::Path& path,
- const Raul::URI& type,
bool is_output,
const Resource::Properties& properties)
: QueuedEvent(engine, request, timestamp)
, _path(path)
- , _type(type)
- , _is_output(is_output)
- , _data_type(type)
+ , _data_type(PortType::UNKNOWN)
, _patch(NULL)
, _patch_port(NULL)
+ , _ports_array(NULL)
, _driver_port(NULL)
, _properties(properties)
+ , _is_output(is_output)
{
- if (_data_type == PortType::UNKNOWN)
+ const Ingen::Shared::LV2URIMap& uris = *_engine.world()->uris().get();
+
+ typedef Resource::Properties::const_iterator Iterator;
+ typedef std::pair<Iterator, Iterator> Range;
+ const Range types = properties.equal_range(uris.rdf_type);
+ for (Iterator i = types.first; i != types.second; ++i) {
+ const Raul::Atom& type = i->second;
+ if (type.type() != Atom::URI) {
+ warn << "Non-URI port type " << type << endl;
+ continue;
+ }
+
+ if (type == uris.lv2_AudioPort) {
+ _data_type = PortType::AUDIO;
+ } else if (type == uris.lv2_ControlPort) {
+ _data_type = PortType::CONTROL;
+ } else if (type == uris.ev_EventPort) {
+ _data_type = PortType::EVENTS;
+ } else if (type == uris.atom_ValuePort) {
+ _data_type = PortType::VALUE;
+ } else if (type == uris.atom_MessagePort) {
+ _data_type = PortType::MESSAGE;
+ }
+ }
+
+ if (_data_type == PortType::UNKNOWN) {
_error = UNKNOWN_TYPE;
+ }
}
void