diff options
author | David Robillard <d@drobilla.net> | 2009-11-18 00:38:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-11-18 00:38:45 +0000 |
commit | 6ec390d53a3dbea90e7308c9e40e03266f5d5127 (patch) | |
tree | 964973527778b5b2b28f8a5ebf63057fb7651d36 | |
parent | 1a725c0811fd15900464e1eff429c6ead90805d4 (diff) | |
download | ingen-6ec390d53a3dbea90e7308c9e40e03266f5d5127.tar.gz ingen-6ec390d53a3dbea90e7308c9e40e03266f5d5127.tar.bz2 ingen-6ec390d53a3dbea90e7308c9e40e03266f5d5127.zip |
Rename DataType to PortType (since that's what it really means).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2273 a436a847-0d15-0410-975c-d299462d15a1
54 files changed, 182 insertions, 187 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 57004d7d..b0b6bdbf 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -285,7 +285,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) } bool is_patch, is_node, is_port, is_output; - DataType data_type(DataType::UNKNOWN); + PortType data_type(PortType::UNKNOWN); ResourceImpl::type(properties, is_patch, is_node, is_port, is_output, data_type); if (is_patch) { @@ -313,7 +313,7 @@ ClientStore::put(const URI& uri, const Resource::Properties& properties) cerr << "ERROR: Plugin with no type" << endl; } } else if (is_port) { - if (data_type != DataType::UNKNOWN) { + if (data_type != PortType::UNKNOWN) { PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; SharedPtr<PortModel> p(new PortModel(path, 0, data_type, pdir)); p->set_properties(properties); diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index 178a34cb..34f909d0 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -42,7 +42,7 @@ public: enum Direction { INPUT, OUTPUT }; inline uint32_t index() const { return _index; } - inline Shared::DataType type() const { return _type; } + inline Shared::PortType type() const { return _type; } inline const Raul::Atom& value() const { return _current_val; } inline bool connected() const { return (_connections > 0); } inline bool is_input() const { return (_direction == INPUT); } @@ -78,7 +78,7 @@ public: private: friend class ClientStore; - PortModel(const Raul::Path& path, uint32_t index, Shared::DataType type, Direction dir) + PortModel(const Raul::Path& path, uint32_t index, Shared::PortType type, Direction dir) : ObjectModel(path) , _index(index) , _type(type) @@ -86,7 +86,7 @@ private: , _current_val(0.0f) , _connections(0) { - if (_type == Shared::DataType::UNKNOWN) + if (_type == Shared::PortType::UNKNOWN) std::cerr << "[PortModel] Warning: Unknown port type" << std::endl; } @@ -99,7 +99,7 @@ private: void set(SharedPtr<ObjectModel> model); uint32_t _index; - Shared::DataType _type; + Shared::PortType _type; Direction _direction; Raul::Atom _current_val; size_t _connections; diff --git a/src/common/interface/Port.hpp b/src/common/interface/Port.hpp index 884b10e3..c7029095 100644 --- a/src/common/interface/Port.hpp +++ b/src/common/interface/Port.hpp @@ -20,7 +20,7 @@ #include <stdint.h> #include "GraphObject.hpp" -#include "DataType.hpp" +#include "PortType.hpp" namespace Raul { class Atom; } @@ -39,7 +39,7 @@ class Port : public virtual GraphObject public: virtual uint32_t index() const = 0; virtual bool is_input() const = 0; - virtual Shared::DataType type() const = 0; + virtual Shared::PortType type() const = 0; virtual const Raul::Atom& value() const = 0; }; diff --git a/src/common/interface/DataType.hpp b/src/common/interface/PortType.hpp index dc2726df..77211b71 100644 --- a/src/common/interface/DataType.hpp +++ b/src/common/interface/PortType.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef DATATYPE_H -#define DATATYPE_H +#ifndef PORTTYPE_H +#define PORTTYPE_H #include <raul/URI.hpp> @@ -24,15 +24,13 @@ namespace Ingen { namespace Shared { -/** A data type that can be stored in a Port. +/** The type of a port. * - * This type refers to the type of the entire buffer, mirroring LV2, - * e.g. :AudioPort and :ControlPort both are really 32-bit floating point, - * but they are different port types. - * - * FIXME: Event/MIDI/OSC kludges. + * This type refers to the type of the port itself (not necessarily the type + * of its contents). Ports with different types can contain the same type of + * data, but may e.g. have different access semantics. */ -class DataType { +class PortType { public: enum Symbol { @@ -40,13 +38,10 @@ public: AUDIO = 1, CONTROL = 2, EVENTS = 3, - //MIDI = 4, - //OSC = 5, - //STRING = 6, - VALUE = 7 + VALUE = 7, }; - DataType(const Raul::URI& uri) + PortType(const Raul::URI& uri) : _symbol(UNKNOWN) { if (uri.str() == type_uri(AUDIO)) { @@ -60,7 +55,7 @@ public: } } - DataType(Symbol symbol) + PortType(Symbol symbol) : _symbol(symbol) {} @@ -69,8 +64,8 @@ public: inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); } inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); } - inline bool operator==(const DataType& type) const { return (_symbol == type._symbol); } - inline bool operator!=(const DataType& type) const { return (_symbol != type._symbol); } + inline bool operator==(const PortType& type) const { return (_symbol == type._symbol); } + inline bool operator!=(const PortType& type) const { return (_symbol != type._symbol); } inline bool is_audio() { return _symbol == AUDIO; } inline bool is_control() { return _symbol == CONTROL; } @@ -99,4 +94,4 @@ private: } // namespace Shared } // namespace Ingen -#endif // DATATYPE_H +#endif // PORTTYPE_H diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp index 1b5a582e..fbca1e7b 100644 --- a/src/engine/AudioBuffer.cpp +++ b/src/engine/AudioBuffer.cpp @@ -36,9 +36,9 @@ namespace Ingen { using namespace Shared; -AudioBuffer::AudioBuffer(Shared::DataType type, size_t size) +AudioBuffer::AudioBuffer(Shared::PortType type, size_t size) : ObjectBuffer(size + sizeof(LV2_Object) - + (type == DataType::AUDIO ? sizeof(LV2_Vector_Body) : 0)) + + (type == PortType::AUDIO ? sizeof(LV2_Vector_Body) : 0)) , _port_type(type) , _state(OK) , _set_value(0) @@ -50,12 +50,12 @@ AudioBuffer::AudioBuffer(Shared::DataType type, size_t size) _type = type; // Control port / Single float object - if (type == DataType::CONTROL) { + if (type == PortType::CONTROL) { object()->type = 0;//map->float_type; // Audio port / Vector of float } else { - assert(type == DataType::AUDIO); + assert(type == PortType::AUDIO); object()->type = 0;//map->vector_type; LV2_Vector_Body* body = (LV2_Vector_Body*)object()->body; body->elem_count = size / sizeof(Sample); @@ -75,7 +75,7 @@ AudioBuffer::AudioBuffer(Shared::DataType type, size_t size) void AudioBuffer::resize(size_t size) { - if (_port_type == DataType::AUDIO) { + if (_port_type == PortType::AUDIO) { ObjectBuffer::resize(size + sizeof(LV2_Vector_Body)); vector()->elem_count = size / sizeof(Sample); } @@ -103,7 +103,7 @@ AudioBuffer::clear() void AudioBuffer::set_value(Sample val, FrameTime cycle_start, FrameTime time) { - if (_port_type == DataType::CONTROL) + if (_port_type == PortType::CONTROL) time = cycle_start; const FrameTime offset = time - cycle_start; @@ -165,7 +165,7 @@ AudioBuffer::copy(Context& context, const Buffer* src) { if (_type == src->type()) { ObjectBuffer::copy(context, src); - } else if (_type == DataType::AUDIO && src->type() == DataType::CONTROL) { + } else if (_type == PortType::AUDIO && src->type() == PortType::CONTROL) { set_block(((AudioBuffer*)src)->data()[0], 0, nframes()); } } @@ -179,7 +179,7 @@ AudioBuffer::copy(Context& context, const Buffer* src) void AudioBuffer::mix(Context& context, const Buffer* const src) { - if (src->type() != DataType::CONTROL && src->type() != DataType::AUDIO) + if (src->type() != PortType::CONTROL && src->type() != PortType::AUDIO) return; AudioBuffer* src_abuf = (AudioBuffer*)src; diff --git a/src/engine/AudioBuffer.hpp b/src/engine/AudioBuffer.hpp index 7a8d119d..25cfd15c 100644 --- a/src/engine/AudioBuffer.hpp +++ b/src/engine/AudioBuffer.hpp @@ -33,7 +33,7 @@ namespace Ingen { class AudioBuffer : public ObjectBuffer { public: - AudioBuffer(Shared::DataType type, size_t capacity); + AudioBuffer(Shared::PortType type, size_t capacity); void clear(); @@ -45,9 +45,9 @@ public: inline Sample* data() const { switch (_port_type.symbol()) { - case Shared::DataType::CONTROL: + case Shared::PortType::CONTROL: return (Sample*)object()->body; - case Shared::DataType::AUDIO: + case Shared::PortType::AUDIO: return (Sample*)(object()->body + sizeof(LV2_Vector_Body)); default: return NULL; @@ -57,10 +57,10 @@ public: inline SampleCount nframes() const { SampleCount ret = 0; switch (_port_type.symbol()) { - case Shared::DataType::CONTROL: + case Shared::PortType::CONTROL: ret = 1; break; - case Shared::DataType::AUDIO: + case Shared::PortType::AUDIO: ret = (_size - sizeof(LV2_Object) - sizeof(LV2_Vector_Body)) / sizeof(Sample); break; default: @@ -82,7 +82,7 @@ private: LV2_Vector_Body* vector() { return(LV2_Vector_Body*)object()->body; } - Shared::DataType _port_type; ///< Type of port this buffer is for + Shared::PortType _port_type; ///< Type of port this buffer is for State _state; ///< State of buffer for setting values next cycle Sample _set_value; ///< Value set by set_value (for completing the set next cycle) FrameTime _set_time; ///< Time _set_value was set (to reset next cycle) diff --git a/src/engine/AudioDriver.hpp b/src/engine/AudioDriver.hpp index e40558ea..33c9d5ef 100644 --- a/src/engine/AudioDriver.hpp +++ b/src/engine/AudioDriver.hpp @@ -21,7 +21,7 @@ #include "raul/Path.hpp" #include "Driver.hpp" #include "types.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" namespace Raul { class Path; } @@ -40,7 +40,7 @@ class ProcessContext; class AudioDriver : public Driver { public: - AudioDriver() : Driver(Shared::DataType::AUDIO) {} + AudioDriver() : Driver(Shared::PortType::AUDIO) {} virtual void set_root_patch(PatchImpl* patch) = 0; virtual PatchImpl* root_patch() = 0; diff --git a/src/engine/Buffer.cpp b/src/engine/Buffer.cpp index b473c194..4b66b63f 100644 --- a/src/engine/Buffer.cpp +++ b/src/engine/Buffer.cpp @@ -27,7 +27,7 @@ using namespace Shared; class Engine; Buffer* -Buffer::create(Engine& engine, Shared::DataType type, size_t size) +Buffer::create(Engine& engine, Shared::PortType type, size_t size) { if (type.is_control()) return new AudioBuffer(type, size); diff --git a/src/engine/Buffer.hpp b/src/engine/Buffer.hpp index f566f9b6..94589dac 100644 --- a/src/engine/Buffer.hpp +++ b/src/engine/Buffer.hpp @@ -24,7 +24,7 @@ #include "raul/Deletable.hpp" #include "raul/SharedPtr.hpp" #include "types.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" namespace Ingen { @@ -34,7 +34,7 @@ class Engine; class Buffer : public boost::noncopyable, public Raul::Deletable { public: - Buffer(Shared::DataType type, size_t size) + Buffer(Shared::PortType type, size_t size) : _type(type) , _size(size) {} @@ -44,8 +44,8 @@ public: virtual void resize(size_t size) { _size = size; } - virtual void* port_data(Shared::DataType port_type) = 0; - virtual const void* port_data(Shared::DataType port_type) const = 0; + virtual void* port_data(Shared::PortType port_type) = 0; + virtual const void* port_data(Shared::PortType port_type) const = 0; /** Rewind (ie reset read pointer), but leave contents unchanged */ virtual void rewind() const {} @@ -56,11 +56,11 @@ public: virtual void prepare_read(Context& context) {} virtual void prepare_write(Context& context) {} - Shared::DataType type() const { return _type; } + Shared::PortType type() const { return _type; } size_t size() const { return _size; } protected: - Shared::DataType _type; + Shared::PortType _type; size_t _size; bool _local; diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp index 63fd31ae..cfbe72e6 100644 --- a/src/engine/BufferFactory.cpp +++ b/src/engine/BufferFactory.cpp @@ -46,7 +46,7 @@ struct BufferDeleter { SharedPtr<Buffer> -BufferFactory::get(Shared::DataType type, size_t size) +BufferFactory::get(Shared::PortType type, size_t size) { Raul::AtomicPtr<Buffer>& head_ptr = free_list(type); Buffer* try_head; @@ -73,7 +73,7 @@ BufferFactory::get(Shared::DataType type, size_t size) SharedPtr<Buffer> -BufferFactory::create(Shared::DataType type, size_t size) +BufferFactory::create(Shared::PortType type, size_t size) { assert(ThreadManager::current_thread_id() != THREAD_PROCESS); diff --git a/src/engine/BufferFactory.hpp b/src/engine/BufferFactory.hpp index dcc1e03f..8ec29697 100644 --- a/src/engine/BufferFactory.hpp +++ b/src/engine/BufferFactory.hpp @@ -19,7 +19,7 @@ #define BUFFER_FACTORY_H #include <map> -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "glibmm/thread.h" #include "raul/RingBuffer.hpp" #include "raul/AtomicPtr.hpp" @@ -36,20 +36,20 @@ class BufferFactory { public: BufferFactory(Engine& engine, SharedPtr<Shared::LV2URIMap> map); - SharedPtr<Buffer> get(Shared::DataType type, size_t size=0); + SharedPtr<Buffer> get(Shared::PortType type, size_t size=0); private: friend class BufferDeleter; void recycle(Buffer* buf); - SharedPtr<Buffer> create(Shared::DataType type, size_t size=0); + SharedPtr<Buffer> create(Shared::PortType type, size_t size=0); - inline Raul::AtomicPtr<Buffer>& free_list(Shared::DataType type) { + inline Raul::AtomicPtr<Buffer>& free_list(Shared::PortType type) { switch (type.symbol()) { - case DataType::AUDIO: return _free_audio; - case DataType::CONTROL: return _free_control; - case DataType::EVENTS: return _free_event; - case DataType::VALUE: return _free_object; + case PortType::AUDIO: return _free_audio; + case PortType::CONTROL: return _free_control; + case PortType::EVENTS: return _free_event; + case PortType::VALUE: return _free_object; default: throw; } } diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp index 715b1984..24f42545 100644 --- a/src/engine/ConnectionImpl.cpp +++ b/src/engine/ConnectionImpl.cpp @@ -45,8 +45,8 @@ ConnectionImpl::ConnectionImpl(BufferFactory& bufs, PortImpl* src_port, PortImpl assert(src_port != dst_port); assert(src_port->path() != dst_port->path()); assert(src_port->type() == dst_port->type() - || ( (src_port->type() == DataType::CONTROL || src_port->type() == DataType::AUDIO) - && (dst_port->type() == DataType::CONTROL || dst_port->type() == DataType::AUDIO) )); + || ( (src_port->type() == PortType::CONTROL || src_port->type() == PortType::AUDIO) + && (dst_port->type() == PortType::CONTROL || dst_port->type() == PortType::AUDIO) )); /*assert((src_port->parent_node()->poly() == dst_port->parent_node()->poly()) || (src_port->parent_node()->poly() == 1 || dst_port->parent_node()->poly() == 1));*/ diff --git a/src/engine/ConnectionImpl.hpp b/src/engine/ConnectionImpl.hpp index c9101304..76224269 100644 --- a/src/engine/ConnectionImpl.hpp +++ b/src/engine/ConnectionImpl.hpp @@ -22,7 +22,7 @@ #include <cstdlib> #include <boost/utility.hpp> #include "raul/Deletable.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "interface/Connection.hpp" #include "PortImpl.hpp" #include "PortImpl.hpp" diff --git a/src/engine/Driver.hpp b/src/engine/Driver.hpp index ad8fd8c3..9445d9dd 100644 --- a/src/engine/Driver.hpp +++ b/src/engine/Driver.hpp @@ -21,7 +21,7 @@ #include <string> #include <boost/utility.hpp> #include "raul/Deletable.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "DuplexPort.hpp" namespace Raul { class Path; } @@ -71,7 +71,7 @@ protected: class Driver : boost::noncopyable { public: - Driver(Shared::DataType type) + Driver(Shared::PortType type) : _type(type) {} @@ -95,7 +95,7 @@ public: virtual Raul::List<DriverPort*>::Node* remove_port(const Raul::Path& path) = 0; protected: - Shared::DataType _type; + Shared::PortType _type; }; diff --git a/src/engine/DuplexPort.cpp b/src/engine/DuplexPort.cpp index 6cf1d908..997c4e29 100644 --- a/src/engine/DuplexPort.cpp +++ b/src/engine/DuplexPort.cpp @@ -39,7 +39,7 @@ DuplexPort::DuplexPort( const string& name, uint32_t index, uint32_t poly, - DataType type, + PortType type, const Raul::Atom& value, size_t buffer_size, bool is_output) diff --git a/src/engine/DuplexPort.hpp b/src/engine/DuplexPort.hpp index 621d0c62..31c679b5 100644 --- a/src/engine/DuplexPort.hpp +++ b/src/engine/DuplexPort.hpp @@ -44,7 +44,7 @@ public: const std::string& name, uint32_t index, uint32_t poly, - Shared::DataType type, + Shared::PortType type, const Raul::Atom& value, size_t buffer_size, bool is_output); diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index 1c17bf74..a12f6e2e 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -107,11 +107,11 @@ Engine::engine_store() const Driver* -Engine::driver(DataType type, EventType event_type) +Engine::driver(PortType type, EventType event_type) { - if (type == DataType::AUDIO) { + if (type == PortType::AUDIO) { return _audio_driver.get(); - } else if (type == DataType::EVENTS) { + } else if (type == PortType::EVENTS) { if (event_type == EventType::MIDI) { return _midi_driver; } else if (event_type == EventType::OSC) { @@ -124,9 +124,9 @@ Engine::driver(DataType type, EventType event_type) void -Engine::set_driver(DataType type, SharedPtr<Driver> driver) +Engine::set_driver(PortType type, SharedPtr<Driver> driver) { - if (type == DataType::AUDIO) { + if (type == PortType::AUDIO) { _audio_driver = PtrCast<AudioDriver>(driver); } else { cerr << "WARNING: Unable to set driver for type " << type.uri() << endl; diff --git a/src/engine/Engine.hpp b/src/engine/Engine.hpp index 93162ff4..5851e9a1 100644 --- a/src/engine/Engine.hpp +++ b/src/engine/Engine.hpp @@ -24,7 +24,7 @@ #include <boost/utility.hpp> #include "raul/SharedPtr.hpp" #include "module/World.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "interface/EventType.hpp" template<typename T> class Queue; @@ -94,10 +94,10 @@ public: SharedPtr<EngineStore> engine_store() const; /** Return the active driver for the given type */ - Driver* driver(Shared::DataType type, Shared::EventType event_type); + Driver* driver(Shared::PortType type, Shared::EventType event_type); /** Set the driver for the given data type (replacing the old) */ - virtual void set_driver(Shared::DataType type, SharedPtr<Driver> driver); + virtual void set_driver(Shared::PortType type, SharedPtr<Driver> driver); virtual void set_midi_driver(MidiDriver* driver); virtual void add_event_source(SharedPtr<EventSource> source); diff --git a/src/engine/EventBuffer.cpp b/src/engine/EventBuffer.cpp index 380fe3b6..8d3769a6 100644 --- a/src/engine/EventBuffer.cpp +++ b/src/engine/EventBuffer.cpp @@ -34,7 +34,7 @@ using namespace Shared; * \a capacity is in bytes (not number of events). */ EventBuffer::EventBuffer(size_t capacity) - : Buffer(DataType(DataType::EVENTS), capacity) + : Buffer(PortType(PortType::EVENTS), capacity) , _buf(new LV2EventBuffer(capacity)) { clear(); diff --git a/src/engine/EventBuffer.hpp b/src/engine/EventBuffer.hpp index b5287f63..b779a837 100644 --- a/src/engine/EventBuffer.hpp +++ b/src/engine/EventBuffer.hpp @@ -20,7 +20,7 @@ #include "event.lv2/event.h" #include "event.lv2/event-helpers.h" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "Buffer.hpp" #include "LV2EventBuffer.hpp" @@ -33,8 +33,8 @@ public: void clear() { _buf->reset(); } - void* port_data(Shared::DataType port_type) { return _buf; } - const void* port_data(Shared::DataType port_type) const { return _buf; } + void* port_data(Shared::PortType port_type) { return _buf; } + const void* port_data(Shared::PortType port_type) const { return _buf; } void rewind() const { _buf->rewind(); } diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp index 4182e862..484e8b53 100644 --- a/src/engine/InputPort.cpp +++ b/src/engine/InputPort.cpp @@ -42,7 +42,7 @@ InputPort::InputPort(BufferFactory& bufs, const string& name, uint32_t index, uint32_t poly, - DataType type, + PortType type, const Raul::Atom& value, size_t buffer_size) : PortImpl(bufs, parent, name, index, poly, type, value, buffer_size) @@ -58,8 +58,8 @@ InputPort::can_direct() const return _connections.size() == 1 && _connections.front()->src_port()->poly() == poly() && (_connections.front()->src_port()->type() == type() - || (_connections.front()->src_port()->type() == DataType::AUDIO - && type() == DataType::CONTROL)); + || (_connections.front()->src_port()->type() == PortType::AUDIO + && type() == PortType::CONTROL)); } @@ -145,7 +145,7 @@ InputPort::add_connection(Connections::Node* const c) connect_buffers(); // Automatically broadcast connected control inputs - if (_type == DataType::CONTROL) + if (_type == PortType::CONTROL) _broadcast = true; } @@ -173,7 +173,7 @@ InputPort::remove_connection(const OutputPort* src_port) buffer(v)->clear(); // Turn off broadcasting if we're no longer connected - if (_type == DataType::CONTROL && _connections.size() == 0) + if (_type == PortType::CONTROL && _connections.size() == 0) _broadcast = false; return connection; diff --git a/src/engine/InputPort.hpp b/src/engine/InputPort.hpp index 971a8747..b44c594e 100644 --- a/src/engine/InputPort.hpp +++ b/src/engine/InputPort.hpp @@ -51,7 +51,7 @@ public: const std::string& name, uint32_t index, uint32_t poly, - Shared::DataType type, + Shared::PortType type, const Raul::Atom& value, size_t buffer_size); diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp index 04ffa3f9..b89d2bca 100644 --- a/src/engine/LADSPANode.cpp +++ b/src/engine/LADSPANode.cpp @@ -85,9 +85,9 @@ LADSPANode::prepare_poly(BufferFactory& bufs, uint32_t poly) Buffer* buffer = port->prepared_buffer(i).get(); // FIXME: Preserve individual voice values - if (port->type() == DataType::CONTROL) { + if (port->type() == PortType::CONTROL) { ((AudioBuffer*)buffer)->set_value(port->value().get_float(), 0, 0); - } else if (port->type() == DataType::AUDIO) { + } else if (port->type() == PortType::AUDIO) { ((AudioBuffer*)buffer)->set_value(0.0f, 0, 0); } } @@ -192,11 +192,11 @@ LADSPANode::instantiate(BufferFactory& bufs) Path port_path(path().child(port_name)); - DataType type = DataType::AUDIO; + PortType type = PortType::AUDIO; port_buffer_size = _buffer_size * sizeof(Sample); if (LADSPA_IS_PORT_CONTROL(_descriptor->PortDescriptors[j])) { - type = DataType::CONTROL; + type = PortType::CONTROL; port_buffer_size = sizeof(Sample); } else { assert(LADSPA_IS_PORT_AUDIO(_descriptor->PortDescriptors[j])); @@ -264,9 +264,9 @@ LADSPANode::activate() set_port_buffer(i, j, port->buffer(i)); - if (port->type() == DataType::CONTROL) { + if (port->type() == PortType::CONTROL) { ((AudioBuffer*)port->buffer(i).get())->set_value(port->value().get_float(), 0, 0); - } else if (port->type() == DataType::AUDIO) { + } else if (port->type() == PortType::AUDIO) { ((AudioBuffer*)port->buffer(i).get())->set_value(0.0f, 0, 0); } } diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp index 9ac478a8..dff994b9 100644 --- a/src/engine/LV2Node.cpp +++ b/src/engine/LV2Node.cpp @@ -96,9 +96,9 @@ LV2Node::prepare_poly(BufferFactory& bufs, uint32_t poly) Buffer* buffer = port->prepared_buffer(i).get(); // FIXME: Preserve individual voice values - if (port->type() == DataType::CONTROL) { + if (port->type() == PortType::CONTROL) { ((AudioBuffer*)buffer)->set_value(port->value().get_float(), 0, 0); - } else if (port->type() == DataType::AUDIO) { + } else if (port->type() == PortType::AUDIO) { ((AudioBuffer*)buffer)->set_value(0.0f, 0, 0); } } @@ -207,18 +207,18 @@ LV2Node::instantiate(BufferFactory& bufs) port_path = path().child(port_name); Raul::Atom val; - DataType data_type = DataType::UNKNOWN; + PortType data_type = PortType::UNKNOWN; if (slv2_port_is_a(plug, id, info->control_class)) { - data_type = DataType::CONTROL; + data_type = PortType::CONTROL; port_buffer_size = sizeof(Sample); } else if (slv2_port_is_a(plug, id, info->audio_class)) { - data_type = DataType::AUDIO; + data_type = PortType::AUDIO; port_buffer_size = _buffer_size; } else if (slv2_port_is_a(plug, id, info->event_class)) { - data_type = DataType::EVENTS; + data_type = PortType::EVENTS; port_buffer_size = _buffer_size; } else if (slv2_port_is_a(plug, id, info->value_port_class)) { - data_type = DataType::VALUE; + data_type = PortType::VALUE; port_buffer_size = 0; // Get default value, and its length @@ -254,7 +254,7 @@ LV2Node::instantiate(BufferFactory& bufs) direction = OUTPUT; } - if (data_type == DataType::UNKNOWN || direction == UNKNOWN) { + if (data_type == PortType::UNKNOWN || direction == UNKNOWN) { delete _ports; _ports = NULL; delete _instances; @@ -270,7 +270,7 @@ LV2Node::instantiate(BufferFactory& bufs) else port = new OutputPort(bufs, this, port_name, j, _polyphony, data_type, val, port_buffer_size); - if (direction == INPUT && data_type == DataType::CONTROL) + if (direction == INPUT && data_type == PortType::CONTROL) ((AudioBuffer*)port->buffer(0).get())->set_value(val.get_float(), 0, 0); SLV2Values contexts = slv2_port_get_value(plug, id, context_pred); @@ -311,9 +311,9 @@ LV2Node::activate() set_port_buffer(i, j, port->buffer(i)); - if (port->type() == DataType::CONTROL) { + if (port->type() == PortType::CONTROL) { ((AudioBuffer*)port->buffer(i).get())->set_value(port->value().get_float(), 0, 0); - } else if (port->type() == DataType::AUDIO) { + } else if (port->type() == PortType::AUDIO) { ((AudioBuffer*)port->buffer(i).get())->set_value(0.0f, 0, 0); } } diff --git a/src/engine/MidiDriver.hpp b/src/engine/MidiDriver.hpp index 86b54986..6bafb0fc 100644 --- a/src/engine/MidiDriver.hpp +++ b/src/engine/MidiDriver.hpp @@ -36,7 +36,7 @@ class AudioDriver; class MidiDriver : public Driver { public: - MidiDriver() : Driver(Shared::DataType::EVENTS) {} + MidiDriver() : Driver(Shared::PortType::EVENTS) {} virtual void attach(AudioDriver& master) {} diff --git a/src/engine/OSCDriver.hpp b/src/engine/OSCDriver.hpp index 1c838210..e207d483 100644 --- a/src/engine/OSCDriver.hpp +++ b/src/engine/OSCDriver.hpp @@ -32,7 +32,7 @@ namespace Ingen { class OSCDriver : public Driver { public: - OSCDriver() : Driver(Shared::DataType::EVENTS) {} + OSCDriver() : Driver(Shared::PortType::EVENTS) {} /** Prepare events (however neccessary) for the specified block (realtime safe) */ virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; diff --git a/src/engine/ObjectBuffer.cpp b/src/engine/ObjectBuffer.cpp index f96c910f..6104e19b 100644 --- a/src/engine/ObjectBuffer.cpp +++ b/src/engine/ObjectBuffer.cpp @@ -38,7 +38,7 @@ using namespace Shared; * \a capacity is in bytes, including LV2_Object header */ ObjectBuffer::ObjectBuffer(size_t capacity) - : Buffer(DataType(DataType::VALUE), capacity) + : Buffer(PortType(PortType::VALUE), capacity) { //cerr << "Creating Object Buffer capacity = " << capacity << endl; assert(capacity >= sizeof(LV2_Object)); @@ -97,12 +97,12 @@ ObjectBuffer::resize(size_t size) void* -ObjectBuffer::port_data(DataType port_type) +ObjectBuffer::port_data(PortType port_type) { switch (port_type.symbol()) { - case DataType::CONTROL: + case PortType::CONTROL: return object()->body; - case DataType::AUDIO: + case PortType::AUDIO: return ((LV2_Vector_Body*)object()->body)->elems; default: return _buf; @@ -111,12 +111,12 @@ ObjectBuffer::port_data(DataType port_type) const void* -ObjectBuffer::port_data(DataType port_type) const +ObjectBuffer::port_data(PortType port_type) const { switch (port_type.symbol()) { - case DataType::CONTROL: + case PortType::CONTROL: return _buf + sizeof(LV2_Object); - case DataType::AUDIO: + case PortType::AUDIO: return _buf + sizeof(LV2_Object) + sizeof(LV2_Vector_Body); default: return _buf; diff --git a/src/engine/ObjectBuffer.hpp b/src/engine/ObjectBuffer.hpp index ec28453b..709864b9 100644 --- a/src/engine/ObjectBuffer.hpp +++ b/src/engine/ObjectBuffer.hpp @@ -20,7 +20,7 @@ #include "raul/Atom.hpp" #include "object.lv2/object.h" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "Buffer.hpp" namespace Ingen { @@ -33,8 +33,8 @@ public: void clear(); - void* port_data(Shared::DataType port_type); - const void* port_data(Shared::DataType port_type) const; + void* port_data(Shared::PortType port_type); + const void* port_data(Shared::PortType port_type) const; void copy(Context& context, const Buffer* src); void mix(Context& context, const Buffer* src) {} diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp index 02886be5..75c25567 100644 --- a/src/engine/ObjectSender.cpp +++ b/src/engine/ObjectSender.cpp @@ -23,7 +23,7 @@ #include "PortImpl.hpp" #include "ConnectionImpl.hpp" #include "NodeFactory.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "AudioBuffer.hpp" using namespace std; @@ -141,7 +141,7 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund client->set_property(port->meta_uri(), "ingen:polyphonic", bool(port->polyphonic())); // Send control value - if (port->type() == DataType::CONTROL) { + if (port->type() == PortType::CONTROL) { const Sample& value = PtrCast<const AudioBuffer>(port->buffer(0))->value_at(0); client->set_port_value(port->path(), value); } diff --git a/src/engine/OutputPort.cpp b/src/engine/OutputPort.cpp index 30d29fa0..4524805f 100644 --- a/src/engine/OutputPort.cpp +++ b/src/engine/OutputPort.cpp @@ -34,7 +34,7 @@ OutputPort::OutputPort(BufferFactory& bufs, const string& name, uint32_t index, uint32_t poly, - DataType type, + PortType type, const Raul::Atom& value, size_t buffer_size) : PortImpl(bufs, parent, name, index, poly, type, value, buffer_size) @@ -42,7 +42,7 @@ OutputPort::OutputPort(BufferFactory& bufs, if (!dynamic_cast<Patch*>(parent)) add_property("rdf:type", Raul::Atom(Raul::Atom::URI, "lv2:OutputPort")); - if (type == DataType::CONTROL) + if (type == PortType::CONTROL) _broadcast = true; } diff --git a/src/engine/OutputPort.hpp b/src/engine/OutputPort.hpp index baaa6680..a5c92200 100644 --- a/src/engine/OutputPort.hpp +++ b/src/engine/OutputPort.hpp @@ -44,7 +44,7 @@ public: const std::string& name, uint32_t index, uint32_t poly, - Shared::DataType type, + Shared::PortType type, const Raul::Atom& value, size_t buffer_size); diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp index 2e02355f..6388f648 100644 --- a/src/engine/PatchImpl.cpp +++ b/src/engine/PatchImpl.cpp @@ -146,7 +146,7 @@ PatchImpl::process(ProcessContext& context) /*if (_ports) for (size_t i=0; i < _ports->size(); ++i) - if (_ports->at(i)->is_input() && _ports->at(i)->type() == DataType::MIDI) + if (_ports->at(i)->is_input() && _ports->at(i)->type() == PortType::MIDI) cerr << _ports->at(i)->path() << " " << _ports->at(i)->buffer(0) << " # events: " << ((MidiBuffer*)_ports->at(i)->buffer(0))->event_count() << endl;*/ @@ -342,14 +342,14 @@ PatchImpl::num_ports() const /** Create a port. Not realtime safe. */ PortImpl* -PatchImpl::create_port(BufferFactory& bufs, const string& name, DataType type, size_t buffer_size, bool is_output) +PatchImpl::create_port(BufferFactory& bufs, const string& name, PortType type, size_t buffer_size, bool is_output) { - if (type == DataType::UNKNOWN) { + if (type == PortType::UNKNOWN) { cerr << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl; return NULL; } - assert( !(type == DataType::UNKNOWN) ); + assert( !(type == PortType::UNKNOWN) ); return new DuplexPort(bufs, this, name, num_ports(), _polyphony, type, Raul::Atom(), buffer_size, is_output); } diff --git a/src/engine/PatchImpl.hpp b/src/engine/PatchImpl.hpp index 67f35869..4e927c0e 100644 --- a/src/engine/PatchImpl.hpp +++ b/src/engine/PatchImpl.hpp @@ -21,7 +21,7 @@ #include <cstdlib> #include <string> #include "raul/List.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "interface/Patch.hpp" #include "NodeBase.hpp" #include "PluginImpl.hpp" @@ -96,7 +96,7 @@ public: uint32_t num_ports() const; - PortImpl* create_port(BufferFactory& bufs, const std::string& name, Shared::DataType type, size_t buffer_size, bool is_output); + PortImpl* create_port(BufferFactory& bufs, const std::string& name, Shared::PortType type, size_t buffer_size, bool is_output); void add_input(Raul::List<PortImpl*>::Node* port) { _input_ports.push_back(port); } ///< Preprocesser thread void add_output(Raul::List<PortImpl*>::Node* port) { _output_ports.push_back(port); } ///< Preprocessor thread Raul::List<PortImpl*>::Node* remove_port(const std::string& name); diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp index 169c7289..23f7b5f8 100644 --- a/src/engine/PortImpl.cpp +++ b/src/engine/PortImpl.cpp @@ -18,7 +18,7 @@ #include <iostream> #include "raul/Array.hpp" #include "raul/Maid.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "events/SendPortValue.hpp" #include "events/SendPortActivity.hpp" #include "AudioBuffer.hpp" @@ -44,10 +44,10 @@ PortImpl::PortImpl(BufferFactory& bufs, const string& name, uint32_t index, uint32_t poly, - DataType type, + PortType type, const Atom& value, size_t buffer_size) - : GraphObjectImpl(node, name, (type == DataType::AUDIO || type == DataType::CONTROL)) + : GraphObjectImpl(node, name, (type == PortType::AUDIO || type == PortType::CONTROL)) , _bufs(bufs) , _index(index) , _poly(poly) @@ -77,7 +77,7 @@ PortImpl::PortImpl(BufferFactory& bufs, add_property("rdf:type", Atom(Atom::URI, type.uri())); - if (type == DataType::EVENTS) + if (type == PortType::EVENTS) _broadcast = true; // send activity blips assert(_buffers->size() > 0); @@ -96,7 +96,7 @@ PortImpl::~PortImpl() bool PortImpl::set_polyphonic(Maid& maid, bool p) { - if (_type == DataType::CONTROL || _type == DataType::AUDIO) + if (_type == PortType::CONTROL || _type == PortType::AUDIO) return GraphObjectImpl::set_polyphonic(maid, p); else return (!p); @@ -175,19 +175,19 @@ PortImpl::broadcast_value(Context& context, bool force) { Raul::Atom val; switch (_type.symbol()) { - case DataType::UNKNOWN: + case PortType::UNKNOWN: break; - case DataType::AUDIO: - case DataType::CONTROL: + case PortType::AUDIO: + case PortType::CONTROL: val = ((AudioBuffer*)buffer(0).get())->value_at(0); break; - case DataType::EVENTS: + case PortType::EVENTS: if (((EventBuffer*)buffer(0).get())->event_count() > 0) { const Events::SendPortActivity ev(context.engine(), context.start(), this); context.event_sink().write(sizeof(ev), &ev); } break; - case DataType::VALUE: + case PortType::VALUE: LV2Object::to_atom(context.engine().world(), ((ObjectBuffer*)buffer(0).get())->object(), val); break; } diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp index 6b8c1b56..e3de9f7f 100644 --- a/src/engine/PortImpl.hpp +++ b/src/engine/PortImpl.hpp @@ -25,7 +25,7 @@ #include "interface/Port.hpp" #include "types.hpp" #include "GraphObjectImpl.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "Buffer.hpp" #include "Context.hpp" @@ -93,9 +93,9 @@ public: uint32_t index() const { return _index; } uint32_t poly() const { return _poly; } - Shared::DataType type() const { return _type; } + Shared::PortType type() const { return _type; } size_t buffer_size() const { - return (_type == Shared::DataType::CONTROL) ? 1 : _buffer_size; + return (_type == Shared::PortType::CONTROL) ? 1 : _buffer_size; } void set_buffer_size(BufferFactory& factory, size_t size); @@ -116,7 +116,7 @@ protected: const std::string& name, uint32_t index, uint32_t poly, - Shared::DataType type, + Shared::PortType type, const Raul::Atom& value, size_t buffer_size); @@ -124,7 +124,7 @@ protected: uint32_t _index; uint32_t _poly; uint32_t _buffer_size; - Shared::DataType _type; + Shared::PortType _type; Raul::Atom _value; bool _broadcast; bool _set_by_user; diff --git a/src/engine/events/ClearPatch.cpp b/src/engine/events/ClearPatch.cpp index 92c0156c..0b5c2127 100644 --- a/src/engine/events/ClearPatch.cpp +++ b/src/engine/events/ClearPatch.cpp @@ -114,10 +114,10 @@ ClearPatch::execute(ProcessContext& context) for (EngineStore::Objects::iterator i = _removed_table->begin(); i != _removed_table->end(); ++i) { SharedPtr<PortImpl> port = PtrCast<PortImpl>(i->second); - if (port && port->type() == DataType::AUDIO) { + if (port && port->type() == PortType::AUDIO) { _driver_ports->push_back( _engine.audio_driver()->remove_port(port->path())); - } else if (port && port->type() == DataType::EVENTS) { + } else if (port && port->type() == PortType::EVENTS) { _driver_ports->push_back( _engine.midi_driver()->remove_port(port->path())); } diff --git a/src/engine/events/Connect.cpp b/src/engine/events/Connect.cpp index 62e32916..18c31e03 100644 --- a/src/engine/events/Connect.cpp +++ b/src/engine/events/Connect.cpp @@ -76,8 +76,8 @@ Connect::pre_process() } if ( ! (_src_port->type() == _dst_port->type() - || ( (_src_port->type() == DataType::CONTROL || _src_port->type() == DataType::AUDIO) - && (_dst_port->type() == DataType::CONTROL || _dst_port->type() == DataType::AUDIO) ))) { + || ( (_src_port->type() == PortType::CONTROL || _src_port->type() == PortType::AUDIO) + && (_dst_port->type() == PortType::CONTROL || _dst_port->type() == PortType::AUDIO) ))) { _error = TYPE_MISMATCH; QueuedEvent::pre_process(); return; diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index 848092b1..60fd7cf9 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -72,7 +72,7 @@ CreatePort::CreatePort( * TODO: fix this using RCU? */ - if (_data_type == DataType::UNKNOWN) { + if (_data_type == PortType::UNKNOWN) { cerr << "[CreatePortEvent] Unknown port type " << type << endl; _error = UNKNOWN_TYPE; } diff --git a/src/engine/events/CreatePort.hpp b/src/engine/events/CreatePort.hpp index a0b3d2a5..af58fcfe 100644 --- a/src/engine/events/CreatePort.hpp +++ b/src/engine/events/CreatePort.hpp @@ -21,7 +21,7 @@ #include "QueuedEvent.hpp" #include "raul/Path.hpp" #include "raul/Array.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "interface/Resource.hpp" namespace Ingen { @@ -66,7 +66,7 @@ private: Raul::Path _path; Raul::URI _type; bool _is_output; - Shared::DataType _data_type; + Shared::PortType _data_type; PatchImpl* _patch; PortImpl* _patch_port; Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports array for Patch diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp index aa773176..3c27ea94 100644 --- a/src/engine/events/Delete.cpp +++ b/src/engine/events/Delete.cpp @@ -153,9 +153,9 @@ Delete::execute(ProcessContext& context) _port->parent_patch()->external_ports(_ports_array); if ( ! _port->parent_patch()->parent()) { - if (_port->type() == DataType::AUDIO) + if (_port->type() == PortType::AUDIO) _driver_port = _engine.audio_driver()->remove_port(_port->path()); - else if (_port->type() == DataType::EVENTS) + else if (_port->type() == PortType::EVENTS) _driver_port = _engine.midi_driver()->remove_port(_port->path()); // Apparently this needs to be called in post_process?? diff --git a/src/engine/events/Move.cpp b/src/engine/events/Move.cpp index 9782e0d6..eb250dab 100644 --- a/src/engine/events/Move.cpp +++ b/src/engine/events/Move.cpp @@ -106,9 +106,9 @@ Move::execute(ProcessContext& context) if (port && port->parent()->parent() == NULL) { DriverPort* driver_port = NULL; - if (port->type() == DataType::AUDIO) + if (port->type() == PortType::AUDIO) driver_port = _engine.audio_driver()->driver_port(_new_path); - else if (port->type() == DataType::EVENTS) + else if (port->type() == PortType::EVENTS) driver_port = _engine.midi_driver()->driver_port(_new_path); if (driver_port) diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp index 2ef3edda..82165460 100644 --- a/src/engine/events/RequestMetadata.cpp +++ b/src/engine/events/RequestMetadata.cpp @@ -94,9 +94,9 @@ RequestMetadata::execute(ProcessContext& context) if (_special_type == PORT_VALUE) { PortImpl* port = dynamic_cast<PortImpl*>(_resource); if (port) { - if (port->type() == DataType::CONTROL || port->type() == DataType::AUDIO) + if (port->type() == PortType::CONTROL || port->type() == PortType::AUDIO) _value = ((AudioBuffer*)port->buffer(0).get())->value_at(0); // TODO: offset - else if (port->type() == DataType::VALUE) + else if (port->type() == PortType::VALUE) LV2Object::to_atom(context.engine().world(), ((ObjectBuffer*)port->buffer(0).get())->object(), _value); } else { diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index caed4909..7d9b5fa5 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -17,7 +17,7 @@ #include <string> #include <boost/format.hpp> -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" #include "ClientBroadcaster.hpp" #include "CreateNode.hpp" #include "CreatePatch.hpp" @@ -94,7 +94,7 @@ SetMetadata::pre_process() if (is_graph_object && !_object) { Path path(_subject.str()); bool is_patch = false, is_node = false, is_port = false, is_output = false; - DataType data_type(DataType::UNKNOWN); + PortType data_type(PortType::UNKNOWN); ResourceImpl::type(_properties, is_patch, is_node, is_port, is_output, data_type); if (is_patch) { uint32_t poly = 1; diff --git a/src/engine/ingen.lv2/ingen_lv2.cpp b/src/engine/ingen.lv2/ingen_lv2.cpp index 04a682d3..2dd8cedc 100644 --- a/src/engine/ingen.lv2/ingen_lv2.cpp +++ b/src/engine/ingen.lv2/ingen_lv2.cpp @@ -125,7 +125,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, plugin->world->local_engine = plugin->engine; // FIXME: fixed buffer size - plugin->engine->set_driver(DataType::AUDIO, + plugin->engine->set_driver(PortType::AUDIO, SharedPtr<Driver>(new IngenLV2Driver(*plugin->engine, rate, 4096))); return (LV2_Handle)plugin; diff --git a/src/engine/internals/Controller.cpp b/src/engine/internals/Controller.cpp index 3d003a43..bc2f2349 100644 --- a/src/engine/internals/Controller.cpp +++ b/src/engine/internals/Controller.cpp @@ -49,26 +49,26 @@ ControllerNode::ControllerNode(BufferFactory& bufs, { _ports = new Raul::Array<PortImpl*>(6); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, DataType::EVENTS, Raul::Atom(), _buffer_size); + _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom(), _buffer_size); _ports->at(0) = _midi_in_port; - _param_port = new InputPort(bufs, this, "controller", 1, 1, DataType::CONTROL, 0.0f, sizeof(Sample)); + _param_port = new InputPort(bufs, this, "controller", 1, 1, PortType::CONTROL, 0.0f, sizeof(Sample)); _param_port->set_property("lv2:minimum", 0.0f); _param_port->set_property("lv2:maximum", 127.0f); _param_port->set_property("lv2:integer", true); _ports->at(1) = _param_port; - _log_port = new InputPort(bufs, this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, sizeof(Sample)); + _log_port = new InputPort(bufs, this, "logarithmic", 2, 1, PortType::CONTROL, 0.0f, sizeof(Sample)); _log_port->set_property("lv2:toggled", true); _ports->at(2) = _log_port; - _min_port = new InputPort(bufs, this, "minimum", 3, 1, DataType::CONTROL, 0.0f, sizeof(Sample)); + _min_port = new InputPort(bufs, this, "minimum", 3, 1, PortType::CONTROL, 0.0f, sizeof(Sample)); _ports->at(3) = _min_port; - _max_port = new InputPort(bufs, this, "maximum", 4, 1, DataType::CONTROL, 1.0f, sizeof(Sample)); + _max_port = new InputPort(bufs, this, "maximum", 4, 1, PortType::CONTROL, 1.0f, sizeof(Sample)); _ports->at(4) = _max_port; - _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1, DataType::AUDIO, 0.0f, _buffer_size); + _audio_port = new OutputPort(bufs, this, "ar_output", 5, 1, PortType::AUDIO, 0.0f, _buffer_size); _ports->at(5) = _audio_port; } diff --git a/src/engine/internals/Note.cpp b/src/engine/internals/Note.cpp index ffe9ceca..3e4eaa4e 100644 --- a/src/engine/internals/Note.cpp +++ b/src/engine/internals/Note.cpp @@ -48,22 +48,22 @@ NoteNode::NoteNode(BufferFactory& bufs, const string& path, bool polyphonic, Pat { _ports = new Raul::Array<PortImpl*>(5); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, DataType::EVENTS, Raul::Atom(), _buffer_size); + _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom(), _buffer_size); _ports->at(0) = _midi_in_port; - _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, DataType::AUDIO, 440.0f, _buffer_size); + _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, PortType::AUDIO, 440.0f, _buffer_size); _ports->at(1) = _freq_port; - _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); + _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, PortType::AUDIO, 0.0f, _buffer_size); _vel_port->set_property("lv2:minimum", 0.0f); _vel_port->set_property("lv2:maximum", 1.0f); _ports->at(2) = _vel_port; - _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); + _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, PortType::AUDIO, 0.0f, _buffer_size); _gate_port->set_property("lv2:toggled", true); _ports->at(3) = _gate_port; - _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); + _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, PortType::AUDIO, 0.0f, _buffer_size); _trig_port->set_property("lv2:toggled", true); _ports->at(4) = _trig_port; } diff --git a/src/engine/internals/Trigger.cpp b/src/engine/internals/Trigger.cpp index 15251f88..fcd657c7 100644 --- a/src/engine/internals/Trigger.cpp +++ b/src/engine/internals/Trigger.cpp @@ -41,24 +41,24 @@ TriggerNode::TriggerNode(BufferFactory& bufs, const string& path, bool polyphoni { _ports = new Raul::Array<PortImpl*>(5); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, DataType::EVENTS, Raul::Atom(), _buffer_size); + _midi_in_port = new InputPort(bufs, this, "input", 0, 1, PortType::EVENTS, Raul::Atom(), _buffer_size); _ports->at(0) = _midi_in_port; - _note_port = new InputPort(bufs, this, "note", 1, 1, DataType::CONTROL, 60.0f, sizeof(Sample)); + _note_port = new InputPort(bufs, this, "note", 1, 1, PortType::CONTROL, 60.0f, sizeof(Sample)); _note_port->set_property("lv2:minimum", 0.0f); _note_port->set_property("lv2:maximum", 127.0f); _note_port->set_property("lv2:integer", true); _ports->at(1) = _note_port; - _gate_port = new OutputPort(bufs, this, "gate", 2, 1, DataType::AUDIO, 0.0f, _buffer_size); + _gate_port = new OutputPort(bufs, this, "gate", 2, 1, PortType::AUDIO, 0.0f, _buffer_size); _gate_port->set_property("lv2:toggled", true); _ports->at(2) = _gate_port; - _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, DataType::AUDIO, 0.0f, _buffer_size); + _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, PortType::AUDIO, 0.0f, _buffer_size); _trig_port->set_property("lv2:toggled", true); _ports->at(3) = _trig_port; - _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, DataType::AUDIO, 0.0f, _buffer_size); + _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, PortType::AUDIO, 0.0f, _buffer_size); _vel_port->set_property("lv2:minimum", 0.0f); _vel_port->set_property("lv2:maximum", 1.0f); _ports->at(4) = _vel_port; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 69687b32..c939f5ea 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -271,7 +271,7 @@ ConnectWindow::connect(bool existing) bool found = _engine_jack_module->get_symbol( "new_jack_audio_driver", (void*&)(new_driver)); if (found) { - world->local_engine->set_driver(DataType::AUDIO, + world->local_engine->set_driver(PortType::AUDIO, SharedPtr<Driver>(new_driver(*world->local_engine, "default", "", 0))); } } diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index c4f5de5e..012e8fcd 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -125,9 +125,9 @@ void Port::set_control(float value, bool signal) { if (signal) { - if (model()->type() == DataType::CONTROL) { + if (model()->type() == PortType::CONTROL) { App::instance().engine()->set_port_value(model()->path(), Atom(value)); - } else if (model()->type() == DataType::EVENTS) { + } else if (model()->type() == PortType::EVENTS) { App::instance().engine()->set_port_value(model()->path(), Atom("<http://example.org/ev#BangEvent>", 0, NULL)); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 647dac8b..bbf5cbbd 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -48,7 +48,7 @@ PortMenu::init(SharedPtr<PortModel> port, bool patch_port) _destroy_menuitem->hide(); } - if (port->type() == DataType::EVENTS || port->type() == DataType::VALUE) + if (port->type() == PortType::EVENTS || port->type() == PortType::VALUE) _polyphonic_menuitem->hide(); _enable_signal = true; diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 3fa1c7ce..4cdeb552 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -210,7 +210,7 @@ main(int argc, char** argv) const std::string client_name, void* jack_client) = NULL; if (engine_jack_module->get_symbol("new_jack_audio_driver", (void*&)new_driver)) { - engine->set_driver(DataType::AUDIO, SharedPtr<Driver>(new_driver( + engine->set_driver(PortType::AUDIO, SharedPtr<Driver>(new_driver( *engine, "default", args.engine_name_arg, NULL))); } else { cerr << Glib::Module::get_last_error() << endl; diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index d3583124..24aca9cb 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -418,7 +418,7 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) _model->add_statement(port_id, "rdf:instanceOf", class_rdf_node(port->path())); - if (port->is_input() && port->type() == DataType::CONTROL) + if (port->is_input() && port->type() == PortType::CONTROL) _model->add_statement(port_id, "ingen:value", AtomRDF::atom_to_node(_model->world(), Atom(port->value()))); @@ -448,7 +448,7 @@ Serialiser::serialise_port_meta(const Port* port, const Redland::Node& port_id) if (port->value().is_valid()) { _model->add_statement(port_id, "lv2:default", AtomRDF::atom_to_node(_model->world(), Atom(port->value()))); - } else if (port->type() == DataType::CONTROL) { + } else if (port->type() == PortType::CONTROL) { cerr << "WARNING: Port " << port->path() << " has no lv2:default" << endl; } } diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 0d773be4..5f23caf3 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -76,13 +76,13 @@ ResourceImpl::type( const Properties& properties, bool& patch, bool& node, - bool& port, bool& is_output, DataType& data_type) + bool& port, bool& is_output, PortType& data_type) { typedef Resource::Properties::const_iterator iterator; const std::pair<iterator,iterator> types_range = properties.equal_range("rdf:type"); patch = node = port = is_output = false; - data_type = DataType::UNKNOWN; + data_type = PortType::UNKNOWN; for (iterator i = types_range.first; i != types_range.second; ++i) { const Atom& atom = i->second; if (atom.type() == Atom::URI) { @@ -103,17 +103,17 @@ ResourceImpl::type( is_output = true; port = true; } else if (!strcmp(suffix, "AudioPort")) { - data_type = DataType::AUDIO; + data_type = PortType::AUDIO; port = true; } else if (!strcmp(suffix, "ControlPort")) { - data_type = DataType::CONTROL; + data_type = PortType::CONTROL; port = true; } } else if (!strcmp(atom.get_uri(), "lv2ev:EventPort")) { - data_type = DataType::EVENTS; + data_type = PortType::EVENTS; port = true; } else if (!strcmp(atom.get_uri(), "obj:ValuePort")) { - data_type = DataType::VALUE; + data_type = PortType::VALUE; port = true; } } diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index 36d4305e..9b10ec15 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -22,7 +22,7 @@ #include <sigc++/sigc++.h> #include "raul/URI.hpp" #include "interface/Resource.hpp" -#include "interface/DataType.hpp" +#include "interface/PortType.hpp" namespace Ingen { namespace Shared { @@ -53,7 +53,7 @@ public: const Properties& properties, bool& patch, bool& node, - bool& port, bool& is_output, DataType& data_type); + bool& port, bool& is_output, PortType& data_type); static const Raul::URI meta_uri(const Raul::URI& base, const Raul::URI& uri); |