diff options
author | David Robillard <d@drobilla.net> | 2007-07-27 00:26:40 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-27 00:26:40 +0000 |
commit | 972a3e8476687951e8af4e9c1d4f25014dab1b82 (patch) | |
tree | b20e1827a15a4309679fa68c7f8764e2381bde6b /src/libs/engine | |
parent | f36e709b68144191d51959d6a2224cd9c3ad7871 (diff) | |
download | ingen-972a3e8476687951e8af4e9c1d4f25014dab1b82.tar.gz ingen-972a3e8476687951e8af4e9c1d4f25014dab1b82.tar.bz2 ingen-972a3e8476687951e8af4e9c1d4f25014dab1b82.zip |
Use uint32_t for num_ports (and poly), matches LV2 and size_t is excessive on 64-bit.
Remove (linear) sorted assertion from Table, except in unit tests.
git-svn-id: http://svn.drobilla.net/lad/ingen@643 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
39 files changed, 111 insertions, 110 deletions
diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp index 9341b603..3a402948 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/Connection.cpp @@ -109,14 +109,14 @@ Connection::process(SampleCount nframes, FrameTime start, FrameTime end) // Accumulate the source's voices into local buffer starting at the second // voice (buffer is already set to first voice above) - for (size_t j=1; j < src_port()->poly(); ++j) { + for (uint32_t j=1; j < src_port()->poly(); ++j) { mix_buf->accumulate((AudioBuffer*)src_port()->buffer(j), 0, copy_size-1); } // Find the summed value and write it to the remainder of dst buffer if (copy_size < mix_buf->size()) { float src_value = src_buffer->value_at(copy_size-1); - for (size_t j=1; j < src_port()->poly(); ++j) + for (uint32_t j=1; j < src_port()->poly(); ++j) src_value += ((AudioBuffer*)src_port()->buffer(j))->value_at(copy_size-1); mix_buf->set(src_value, copy_size, mix_buf->size()-1); diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index 69aff132..a72c59db 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -29,7 +29,7 @@ using namespace std; namespace Ingen { -DSSINode::DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size) +DSSINode::DSSINode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : LADSPANode(plugin, name, 1, parent, descriptor->LADSPA_Plugin, srate, buffer_size), _dssi_descriptor(descriptor), _ui_addr(NULL), @@ -107,11 +107,12 @@ DSSINode::set_ui_url(const string& url) void -DSSINode::set_control(size_t port_num, Sample val) +DSSINode::set_control(uint32_t port_num, Sample val) { assert(port_num < _descriptor->PortCount); - cerr << "FIXME: set_control\n"; - //((TypedPort<Sample>*)_ports->at(port_num))->set_value(val, 0); + Port* port = _ports->at(port_num); + assert(port->type() == DataType::FLOAT); + ((AudioBuffer*)port->buffer(0))->set(val, 0); } @@ -195,7 +196,7 @@ DSSINode::process(SampleCount nframes, FrameTime start, FrameTime end) void -DSSINode::set_port_buffer(size_t voice, size_t port_num, Buffer* buf) +DSSINode::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) { assert(voice < _poly); diff --git a/src/libs/engine/DSSINode.hpp b/src/libs/engine/DSSINode.hpp index f54e75f8..aa309089 100644 --- a/src/libs/engine/DSSINode.hpp +++ b/src/libs/engine/DSSINode.hpp @@ -40,7 +40,7 @@ public: typedef std::map<int, string> Bank; - DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + DSSINode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); ~DSSINode(); bool instantiate(); @@ -50,13 +50,13 @@ public: void set_ui_url(const string& url); void send_update(); - void set_control(size_t port_num, Sample val); + void set_control(uint32_t port_num, Sample val); void configure(const string& key, const string& val); void program(int bank, int program); void process(SampleCount nframes, FrameTime start, FrameTime end); - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf); bool update_programs(bool send_events); void set_default_program(); diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index 6558c587..a0d370db 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -29,7 +29,7 @@ using namespace std; namespace Ingen { -DuplexPort::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output) +DuplexPort::DuplexPort(Node* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output) : Port(parent, name, index, poly, type, buffer_size) , InputPort(parent, name, index, poly, type, buffer_size) , OutputPort(parent, name, index, poly, type, buffer_size) diff --git a/src/libs/engine/DuplexPort.hpp b/src/libs/engine/DuplexPort.hpp index 3abb4549..b6d2578c 100644 --- a/src/libs/engine/DuplexPort.hpp +++ b/src/libs/engine/DuplexPort.hpp @@ -41,7 +41,7 @@ class Node; class DuplexPort : public InputPort, public OutputPort { public: - DuplexPort(Node* parent, const std::string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); + DuplexPort(Node* parent, const std::string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output); virtual ~DuplexPort() {} void pre_process(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index 743ef88c..3b853edd 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -31,7 +31,7 @@ using std::cerr; using std::cout; using std::endl; namespace Ingen { -InputPort::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size) +InputPort::InputPort(Node* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size) : Port(parent, name, index, poly, type, buffer_size) { } @@ -54,7 +54,7 @@ InputPort::add_connection(Raul::ListNode<Connection*>* const c) if (modify_buffers) { if (_connections.size() == 1) { // Use buffer directly to avoid copying - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { _buffers.at(i)->join(c->elem()->buffer(i)); //if (_is_tied) // _tied_port->buffer(i)->join(_buffers.at(i)); @@ -63,7 +63,7 @@ InputPort::add_connection(Raul::ListNode<Connection*>* const c) } else if (_connections.size() == 2) { // Used to directly use single connection buffer, now there's two // so have to use local ones again and mix down - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { _buffers.at(i)->unjoin(); //if (_is_tied) // _tied_port->buffer(i)->join(_buffers.at(i)); @@ -100,7 +100,7 @@ InputPort::remove_connection(const OutputPort* src_port) exit(EXIT_FAILURE); } else { if (_connections.size() == 0) { - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { // Use a local buffer if (modify_buffers) _buffers.at(i)->unjoin(); @@ -110,7 +110,7 @@ InputPort::remove_connection(const OutputPort* src_port) } } else if (modify_buffers && _connections.size() == 1) { // Share a buffer - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { _buffers.at(i)->join((*_connections.begin())->buffer(i)); //if (_is_tied) // _tied_port->buffer(i)->join(_buffers.at(i)); @@ -152,7 +152,7 @@ InputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end) bool do_mixdown = true; if (_connections.size() == 0) { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->prepare_read(nframes); return; } @@ -180,7 +180,7 @@ InputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end) //cerr << path() << " mixing: " << do_mixdown << endl; - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->prepare_read(nframes); if (!do_mixdown) { @@ -191,7 +191,7 @@ InputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end) /*assert(!_is_tied || _tied_port != NULL); assert(!_is_tied || _buffers.at(0)->data() == _tied_port->buffer(0)->data());*/ - for (size_t voice=0; voice < _poly; ++voice) { + for (uint32_t voice=0; voice < _poly; ++voice) { assert(_type == DataType::FLOAT); // Copy first connection ((AudioBuffer*)_buffers.at(voice))->copy( @@ -225,7 +225,7 @@ void InputPort::post_process(SampleCount nframes, FrameTime start, FrameTime end) { // Prepare for next cycle - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->prepare_write(nframes); } diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp index 1305e239..a7da6250 100644 --- a/src/libs/engine/InputPort.hpp +++ b/src/libs/engine/InputPort.hpp @@ -47,7 +47,7 @@ class Node; class InputPort : virtual public Port { public: - InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); + InputPort(Node* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size); virtual ~InputPort() {} void add_connection(Raul::ListNode<Connection*>* c); diff --git a/src/libs/engine/InternalNode.hpp b/src/libs/engine/InternalNode.hpp index b00cd8cb..6264d1a6 100644 --- a/src/libs/engine/InternalNode.hpp +++ b/src/libs/engine/InternalNode.hpp @@ -35,7 +35,7 @@ class Patch; class InternalNode : public NodeBase { public: - InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) + InternalNode(const Plugin* plugin, const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : NodeBase(plugin, path, poly, parent, srate, buffer_size) { } diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index b5451ac3..feb72b9d 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -33,7 +33,7 @@ namespace Ingen { * Object is not usable until instantiate() is called with success. * (It _will_ crash!) */ -LADSPANode::LADSPANode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size) +LADSPANode::LADSPANode(const Plugin* plugin, const string& path, uint32_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : NodeBase(plugin, path, poly, parent, srate, buffer_size), _descriptor(descriptor), _instances(NULL) @@ -61,7 +61,7 @@ LADSPANode::instantiate() size_t port_buffer_size = 0; - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { _instances[i] = _descriptor->instantiate(_descriptor, _srate); if (_instances[i] == NULL) { cerr << "Failed to instantiate plugin!" << endl; @@ -134,7 +134,7 @@ LADSPANode::instantiate() // Set default value if (port->buffer_size() == 1) { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) ((AudioBuffer*)port->buffer(i))->set(default_val, 0); } @@ -150,7 +150,7 @@ LADSPANode::instantiate() LADSPANode::~LADSPANode() { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _descriptor->cleanup(_instances[i]); delete[] _instances; @@ -162,7 +162,7 @@ LADSPANode::activate() { NodeBase::activate(); - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { for (unsigned long j=0; j < _descriptor->PortCount; ++j) { set_port_buffer(i, j, _ports->at(j)->buffer(i)); /* if (port->type() == DataType::FLOAT && port->buffer_size() == 1) @@ -181,7 +181,7 @@ LADSPANode::deactivate() { NodeBase::deactivate(); - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) if (_descriptor->deactivate != NULL) _descriptor->deactivate(_instances[i]); } @@ -192,7 +192,7 @@ LADSPANode::process(SampleCount nframes, FrameTime start, FrameTime end) { NodeBase::pre_process(nframes, start, end); - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _descriptor->run(_instances[i], nframes); NodeBase::post_process(nframes, start, end); @@ -200,7 +200,7 @@ LADSPANode::process(SampleCount nframes, FrameTime start, FrameTime end) void -LADSPANode::set_port_buffer(size_t voice, size_t port_num, Buffer* buf) +LADSPANode::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) { assert(voice < _poly); diff --git a/src/libs/engine/LADSPANode.hpp b/src/libs/engine/LADSPANode.hpp index c71e68fb..e12feb72 100644 --- a/src/libs/engine/LADSPANode.hpp +++ b/src/libs/engine/LADSPANode.hpp @@ -34,7 +34,7 @@ namespace Ingen { class LADSPANode : public NodeBase { public: - LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + LADSPANode(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); virtual ~LADSPANode(); virtual bool instantiate(); @@ -44,7 +44,7 @@ public: void process(SampleCount nframes, FrameTime start, FrameTime end); - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf); const Plugin* plugin() const { return _plugin; } void plugin(const Plugin* const pi) { _plugin = pi; } diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 8c3ea933..8694b5e9 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -38,7 +38,7 @@ namespace Ingen { */ LV2Node::LV2Node(const Plugin* plugin, const string& name, - size_t poly, + uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) @@ -61,16 +61,16 @@ LV2Node::LV2Node(const Plugin* plugin, bool LV2Node::instantiate() { - size_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin); + uint32_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin); assert(num_ports > 0); _ports = new Raul::Array<Port*>(num_ports); _instances = new SLV2Instance[_poly]; - size_t port_buffer_size = 0; + uint32_t port_buffer_size = 0; - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { _instances[i] = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL); if (_instances[i] == NULL) { cerr << "Failed to instantiate plugin!" << endl; @@ -83,7 +83,7 @@ LV2Node::instantiate() Port* port = NULL; - for (size_t j=0; j < num_ports; ++j) { + for (uint32_t j=0; j < num_ports; ++j) { SLV2Port id = slv2_plugin_get_port_by_index(_lv2_plugin, j); // LV2 shortnames are guaranteed to be unique, valid C identifiers @@ -141,7 +141,7 @@ LV2Node::instantiate() LV2Node::~LV2Node() { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) slv2_instance_free(_instances[i]); delete[] _instances; @@ -153,7 +153,7 @@ LV2Node::activate() { NodeBase::activate(); - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { for (unsigned long j=0; j < num_ports(); ++j) { Port* const port = _ports->at(j); set_port_buffer(i, j, port->buffer(i)); @@ -176,7 +176,7 @@ LV2Node::deactivate() { NodeBase::deactivate(); - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) slv2_instance_deactivate(_instances[i]); } @@ -186,7 +186,7 @@ LV2Node::process(SampleCount nframes, FrameTime start, FrameTime end) { NodeBase::pre_process(nframes, start, end); - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) slv2_instance_run(_instances[i], nframes); NodeBase::post_process(nframes, start, end); @@ -194,7 +194,7 @@ LV2Node::process(SampleCount nframes, FrameTime start, FrameTime end) void -LV2Node::set_port_buffer(size_t voice, size_t port_num, Buffer* buf) +LV2Node::set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) { assert(voice < _poly); diff --git a/src/libs/engine/LV2Node.hpp b/src/libs/engine/LV2Node.hpp index 361df02e..8a6847f1 100644 --- a/src/libs/engine/LV2Node.hpp +++ b/src/libs/engine/LV2Node.hpp @@ -36,7 +36,7 @@ class LV2Node : public NodeBase public: LV2Node(const Plugin* plugin, const string& name, - size_t poly, + uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); @@ -50,7 +50,7 @@ public: void process(SampleCount nframes, FrameTime start, FrameTime end); - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf); protected: //void get_port_vals(ulong port_index, PortInfo* info); diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 01b17743..bcec357c 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -29,7 +29,7 @@ namespace Ingen { -MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) +MidiControlNode::MidiControlNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "ingen:control_node"), path, 1, parent, srate, buffer_size), _learning(false) { diff --git a/src/libs/engine/MidiControlNode.hpp b/src/libs/engine/MidiControlNode.hpp index 2065b3c3..6d2b480c 100644 --- a/src/libs/engine/MidiControlNode.hpp +++ b/src/libs/engine/MidiControlNode.hpp @@ -40,7 +40,7 @@ class OutputPort; class MidiControlNode : public InternalNode { public: - MidiControlNode(const std::string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + MidiControlNode(const std::string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); void process(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index 37f34202..d8db7100 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -34,7 +34,7 @@ using std::cerr; using std::cout; using std::endl; namespace Ingen { -MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) +MidiNoteNode::MidiNoteNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "ingen:note_node"), path, poly, parent, srate, buffer_size), _voices(new Voice[poly]), _sustain(false) @@ -136,12 +136,12 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, SampleCoun assert(time - start < _buffer_size); assert(note_num <= 127); - Key* key = &_keys[note_num]; - Voice* voice = NULL; - size_t voice_num = 0; + Key* key = &_keys[note_num]; + Voice* voice = NULL; + uint32_t voice_num = 0; // Look for free voices - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { if (_voices[i].state == Voice::Voice::FREE) { voice = &_voices[i]; voice_num = i; @@ -154,7 +154,7 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, SampleCoun voice_num = 0; voice = &_voices[0]; jack_nframes_t oldest_time = _voices[0].time; - for (size_t i=1; i < _poly; ++i) { + for (uint32_t i=1; i < _poly; ++i) { if (_voices[i].time < oldest_time) { voice = &_voices[i]; voice_num = i; @@ -285,7 +285,7 @@ MidiNoteNode::all_notes_off(FrameTime time, SampleCount nframes, FrameTime start // FIXME: set all keys to Key::OFF? - for (size_t i=0; i < _poly; ++i) { + for (uint32_t i=0; i < _poly; ++i) { ((AudioBuffer*)_gate_port->buffer(i))->set(0.0f, time - start); _voices[i].state = Voice::FREE; } @@ -317,7 +317,7 @@ MidiNoteNode::sustain_off(FrameTime time, SampleCount nframes, FrameTime start, _sustain = false; - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) if (_voices[i].state == Voice::HOLDING) free_voice(i, time, nframes, start, end); } diff --git a/src/libs/engine/MidiNoteNode.hpp b/src/libs/engine/MidiNoteNode.hpp index 88421ecb..e67df8a7 100644 --- a/src/libs/engine/MidiNoteNode.hpp +++ b/src/libs/engine/MidiNoteNode.hpp @@ -40,7 +40,7 @@ class OutputPort; class MidiNoteNode : public InternalNode { public: - MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + MidiNoteNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); ~MidiNoteNode(); void process(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index e397033f..393cf2f4 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -27,7 +27,7 @@ namespace Ingen { -MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) +MidiTriggerNode::MidiTriggerNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "ingen:trigger_node"), path, 1, parent, srate, buffer_size) { _ports = new Raul::Array<Port*>(5); diff --git a/src/libs/engine/MidiTriggerNode.hpp b/src/libs/engine/MidiTriggerNode.hpp index 6c2dadfa..12f68789 100644 --- a/src/libs/engine/MidiTriggerNode.hpp +++ b/src/libs/engine/MidiTriggerNode.hpp @@ -43,7 +43,7 @@ class OutputPort; class MidiTriggerNode : public InternalNode { public: - MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + MidiTriggerNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); void process(SampleCount nframes, FrameTime start, FrameTime end); diff --git a/src/libs/engine/Node.hpp b/src/libs/engine/Node.hpp index 35edd201..e6c5316b 100644 --- a/src/libs/engine/Node.hpp +++ b/src/libs/engine/Node.hpp @@ -69,13 +69,13 @@ public: */ virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; - virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) = 0; + virtual void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) = 0; // FIXME: Only used by client senders. Remove? virtual const Raul::Array<Port*>& ports() const = 0; - virtual size_t num_ports() const = 0; - virtual size_t poly() const = 0; + virtual uint32_t num_ports() const = 0; + virtual uint32_t poly() const = 0; /** Used by the process order finding algorithm (ie during connections) */ virtual bool traversed() const = 0; diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index d57d4414..b7066a0c 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -33,7 +33,7 @@ using std::cout; using std::cerr; using std::endl; namespace Ingen { -NodeBase::NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) +NodeBase::NodeBase(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : Node(parent, name), _plugin(plugin), _poly(poly), @@ -58,7 +58,7 @@ NodeBase::~NodeBase() delete _providers; delete _dependants; - for (size_t i=0; i < num_ports(); ++i) + for (uint32_t i=0; i < num_ports(); ++i) delete _ports->at(i); } diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp index 7368dc9d..68a60068 100644 --- a/src/libs/engine/NodeBase.hpp +++ b/src/libs/engine/NodeBase.hpp @@ -45,7 +45,7 @@ namespace Shared { class NodeBase : public Node { public: - NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + NodeBase(const Plugin* plugin, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); virtual ~NodeBase(); @@ -57,14 +57,14 @@ public: virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end); - virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) {} + virtual void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) {} virtual void set_buffer_size(size_t size); SampleRate sample_rate() const { return _srate; } size_t buffer_size() const { return _buffer_size; } - size_t num_ports() const { return _ports ? _ports->size() : 0; } - size_t poly() const { return _poly; } + uint32_t num_ports() const { return _ports ? _ports->size() : 0; } + uint32_t poly() const { return _poly; } bool traversed() const { return _traversed; } void traversed(bool b) { _traversed = b; } @@ -84,7 +84,7 @@ public: protected: const Plugin* _plugin; - size_t _poly; + uint32_t _poly; SampleRate _srate; size_t _buffer_size; bool _activated; diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 30e13ac2..eab6336d 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -156,7 +156,7 @@ NodeFactory::load_plugins() Node* NodeFactory::load_plugin(const Plugin* a_plugin, const string& name, - size_t poly, + uint32_t poly, Patch* parent) { assert(parent != NULL); @@ -233,7 +233,7 @@ NodeFactory::load_plugin(const Plugin* a_plugin, Node* NodeFactory::load_internal_plugin(const string& uri, const string& name, - size_t poly, + uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) @@ -309,7 +309,7 @@ NodeFactory::load_lv2_plugins() Node* NodeFactory::load_lv2_plugin(const string& plug_uri, const string& node_name, - size_t poly, + uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) @@ -448,7 +448,7 @@ NodeFactory::load_dssi_plugins() */ Node* NodeFactory::load_dssi_plugin(const string& uri, - const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) + const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) { // FIXME: awful code duplication here @@ -614,7 +614,7 @@ NodeFactory::load_ladspa_plugins() Node* NodeFactory::load_ladspa_plugin(const string& uri, const string& name, - size_t poly, + uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) diff --git a/src/libs/engine/NodeFactory.hpp b/src/libs/engine/NodeFactory.hpp index 184af94c..e3f947f0 100644 --- a/src/libs/engine/NodeFactory.hpp +++ b/src/libs/engine/NodeFactory.hpp @@ -57,7 +57,7 @@ public: ~NodeFactory(); void load_plugins(); - Node* load_plugin(const Plugin* info, const string& name, size_t poly, Patch* parent); + Node* load_plugin(const Plugin* info, const string& name, uint32_t poly, Patch* parent); const list<Plugin*>& plugins() { return _plugins; } @@ -67,20 +67,20 @@ public: private: #ifdef HAVE_LADSPA void load_ladspa_plugins(); - Node* load_ladspa_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + Node* load_ladspa_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); #endif #ifdef HAVE_SLV2 void load_lv2_plugins(); - Node* load_lv2_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + Node* load_lv2_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); #endif #ifdef HAVE_DSSI void load_dssi_plugins(); - Node* load_dssi_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + Node* load_dssi_plugin(const string& plugin_uri, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); #endif - Node* load_internal_plugin(const string& plug_label, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + Node* load_internal_plugin(const string& plug_label, const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); list<Glib::Module*> _libraries; list<Plugin*> _internal_plugins; diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 216adf86..c40ba972 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -46,7 +46,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur } // Send ports - for (size_t i=0; i < patch->num_ports(); ++i) { + for (uint32_t i=0; i < patch->num_ports(); ++i) { Port* const port = patch->ports().at(i); send_port(client, port); diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index f263db74..fc501d28 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -84,7 +84,7 @@ ObjectStore::add(GraphObject* o) Node* node = dynamic_cast<Node*>(o); if (node) { - for (size_t i=0; i < node->num_ports(); ++i) { + for (uint32_t i=0; i < node->num_ports(); ++i) { add(node->ports().at(i)); } } diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp index 0e688818..ce945f09 100644 --- a/src/libs/engine/OutputPort.cpp +++ b/src/libs/engine/OutputPort.cpp @@ -24,7 +24,7 @@ namespace Ingen { void OutputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end) { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->prepare_write(nframes); } @@ -32,7 +32,7 @@ OutputPort::pre_process(SampleCount nframes, FrameTime start, FrameTime end) void OutputPort::post_process(SampleCount nframes, FrameTime start, FrameTime end) { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->prepare_read(nframes); } diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp index dbeb30a9..0c2e0443 100644 --- a/src/libs/engine/OutputPort.hpp +++ b/src/libs/engine/OutputPort.hpp @@ -42,8 +42,8 @@ class OutputPort : virtual public Port public: OutputPort(Node* parent, const string& name, - size_t index, - size_t poly, + uint32_t index, + uint32_t poly, DataType type, size_t buffer_size) : Port(parent, name, index, poly, type, buffer_size) diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index e791a074..c9c0bee6 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -31,7 +31,7 @@ using std::cerr; using std::cout; using std::endl; namespace Ingen { -Patch::Patch(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t internal_poly) +Patch::Patch(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size, uint32_t internal_poly) : NodeBase(new Plugin(Plugin::Patch, "ingen:patch"), path, poly, parent, srate, buffer_size), _internal_poly(internal_poly), _process_order(NULL), @@ -199,7 +199,7 @@ Patch::remove_connection(const Port* src_port, const Port* dst_port) } -size_t +uint32_t Patch::num_ports() const { ThreadID context = ThreadManager::current_thread_id(); diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp index 6671d204..0b911541 100644 --- a/src/libs/engine/Patch.hpp +++ b/src/libs/engine/Patch.hpp @@ -45,7 +45,7 @@ class Connection; class Patch : public NodeBase { public: - Patch(const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t local_poly); + Patch(const string& name, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size, uint32_t local_poly); virtual ~Patch(); void activate(); @@ -66,7 +66,7 @@ public: const Raul::List<Node*>& nodes() const { return _nodes; } const Raul::List<Connection*>& connections() const { return _connections; } - size_t num_ports() const; + uint32_t num_ports() const; Port* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); void add_input(Raul::ListNode<Port*>* port) { _input_ports.push_back(port); } ///< Preprocesser thread @@ -90,12 +90,12 @@ public: void enable() { _process = true; } void disable(); - size_t internal_poly() const { return _internal_poly; } + uint32_t internal_poly() const { return _internal_poly; } private: inline void build_process_order_recursive(Node* n, Raul::Array<Node*>* order) const; - size_t _internal_poly; + uint32_t _internal_poly; Raul::Array<Node*>* _process_order; ///< Accessed in audio thread only Raul::List<Connection*> _connections; ///< Accessed in audio thread only Raul::List<Port*> _input_ports; ///< Accessed in preprocessing thread only diff --git a/src/libs/engine/Plugin.cpp b/src/libs/engine/Plugin.cpp index a0f423e0..9e92f32c 100644 --- a/src/libs/engine/Plugin.cpp +++ b/src/libs/engine/Plugin.cpp @@ -24,7 +24,7 @@ namespace Ingen { Node* -Plugin::instantiate(const string& name, size_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size) +Plugin::instantiate(const string& name, uint32_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size) { assert(_type == Internal); diff --git a/src/libs/engine/Plugin.hpp b/src/libs/engine/Plugin.hpp index 10689145..21730797 100644 --- a/src/libs/engine/Plugin.hpp +++ b/src/libs/engine/Plugin.hpp @@ -131,7 +131,7 @@ public: void slv2_plugin(SLV2Plugin p) { _slv2_plugin = p; } #endif - Node* instantiate(const string& name, size_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); + Node* instantiate(const string& name, uint32_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); private: Type _type; diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp index 873e4c85..c104c32a 100644 --- a/src/libs/engine/Port.cpp +++ b/src/libs/engine/Port.cpp @@ -28,7 +28,7 @@ namespace Ingen { const char* const DataType::type_uris[4] = { "UNKNOWN", "FLOAT", "MIDI", "OSC" }; -Port::Port(Node* const node, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size) +Port::Port(Node* const node, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size) : GraphObject(node, name) , _index(index) , _poly(poly) @@ -48,7 +48,7 @@ Port::Port(Node* const node, const string& name, size_t index, size_t poly, Data Port::~Port() { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) delete _buffers.at(i); } @@ -58,7 +58,7 @@ Port::allocate_buffers() { _buffers.alloc(_poly); - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i) = BufferFactory::create(_type, _buffer_size); } @@ -68,7 +68,7 @@ Port::set_buffer_size(size_t size) { _buffer_size = size; - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->resize(size); connect_buffers(); @@ -78,7 +78,7 @@ Port::set_buffer_size(size_t size) void Port::connect_buffers() { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) Port::parent_node()->set_port_buffer(i, _index, _buffers.at(i)); } @@ -86,7 +86,7 @@ Port::connect_buffers() void Port::clear_buffers() { - for (size_t i=0; i < _poly; ++i) + for (uint32_t i=0; i < _poly; ++i) _buffers.at(i)->clear(); } diff --git a/src/libs/engine/Port.hpp b/src/libs/engine/Port.hpp index 2414e86d..2899915f 100644 --- a/src/libs/engine/Port.hpp +++ b/src/libs/engine/Port.hpp @@ -47,7 +47,7 @@ public: /** A port's parent is always a node, so static cast should be safe */ Node* parent_node() const { return (Node*)_parent; } - Buffer* buffer(size_t voice) const { return _buffers.at(voice); } + Buffer* buffer(uint32_t voice) const { return _buffers.at(voice); } /** Called once per process cycle */ virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end) = 0; @@ -60,8 +60,8 @@ public: virtual bool is_input() const = 0; virtual bool is_output() const = 0; - size_t num() const { return _index; } - size_t poly() const { return _poly; } + uint32_t num() const { return _index; } + uint32_t poly() const { return _poly; } DataType type() const { return _type; } size_t buffer_size() const { return _buffer_size; } @@ -71,13 +71,13 @@ public: bool fixed_buffers() { return _fixed_buffers; } protected: - Port(Node* const node, const std::string& name, size_t index, size_t poly, DataType type, size_t buffer_size); + Port(Node* const node, const std::string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size); virtual void allocate_buffers(); virtual void connect_buffers(); - size_t _index; - size_t _poly; + uint32_t _index; + uint32_t _poly; DataType _type; size_t _buffer_size; bool _fixed_buffers; diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index 5b4c6b05..096ef6d2 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -27,7 +27,7 @@ namespace Ingen { -TransportNode::TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) +TransportNode::TransportNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "ingen:transport_node"), path, 1, parent, srate, buffer_size) { #if 0 diff --git a/src/libs/engine/TransportNode.hpp b/src/libs/engine/TransportNode.hpp index 96810223..d6edab51 100644 --- a/src/libs/engine/TransportNode.hpp +++ b/src/libs/engine/TransportNode.hpp @@ -38,7 +38,7 @@ using std::string; class TransportNode : public InternalNode { public: - TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + TransportNode(const string& path, uint32_t poly, Patch* parent, SampleRate srate, size_t buffer_size); virtual void process(SampleCount nframes, FrameTime start, FrameTime end); }; diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index 6288a03f..c4da0cbf 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -91,7 +91,7 @@ AddPortEvent::pre_process() if (_type != "ingen:control") buffer_size = _engine.audio_driver()->buffer_size(); - const size_t old_num_ports = _patch->num_ports(); + const uint32_t old_num_ports = _patch->num_ports(); _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 24339320..93d56c86 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -65,7 +65,7 @@ CreatePatchEvent::pre_process() return; } - size_t poly = 1; + uint32_t poly = 1; if (_parent != NULL && _poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) poly = _poly; diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index 5de9dfff..d4de64b3 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -68,7 +68,7 @@ SetPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) AudioBuffer* const buf = (AudioBuffer*)_port->buffer(0); const size_t offset = (buf->size() == 1) ? 0 : _time - start; if (_voice_num == -1) - for (size_t i=0; i < _port->poly(); ++i) + for (uint32_t i=0; i < _port->poly(); ++i) ((AudioBuffer*)_port->buffer(i))->set(_val, offset); else ((AudioBuffer*)_port->buffer(_voice_num))->set(_val, offset); diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 33178e55..a1a93a08 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -79,7 +79,7 @@ SetPortValueQueuedEvent::execute(SampleCount nframes, FrameTime start, FrameTime AudioBuffer* const buf = (AudioBuffer*)_port->buffer(0); const size_t offset = (buf->size() == 1) ? 0 : _time - start; if (_voice_num == -1) - for (size_t i=0; i < _port->poly(); ++i) + for (uint32_t i=0; i < _port->poly(); ++i) ((AudioBuffer*)_port->buffer(i))->set(_val, offset); else ((AudioBuffer*)_port->buffer(_voice_num))->set(_val, offset); |