diff options
author | David Robillard <d@drobilla.net> | 2016-10-02 18:36:47 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-10-02 21:01:46 -0400 |
commit | 9cc75b8ba7f9e0c32edbbfc9871fc0666e1e327f (patch) | |
tree | ad901944dcdb93c0cf668ba3ba21e41540987fc7 | |
parent | d1d96f2997e008dd842ae3f7a834c2cd5d0da614 (diff) | |
download | ingen-9cc75b8ba7f9e0c32edbbfc9871fc0666e1e327f.tar.gz ingen-9cc75b8ba7f9e0c32edbbfc9871fc0666e1e327f.tar.bz2 ingen-9cc75b8ba7f9e0c32edbbfc9871fc0666e1e327f.zip |
Fix copy/paste of internal blocks
-rw-r--r-- | src/server/InternalBlock.cpp | 22 | ||||
-rw-r--r-- | src/server/InternalBlock.hpp | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp index ef9af87e..e26bdc10 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2016 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -15,7 +15,9 @@ */ #include "Buffer.hpp" +#include "Engine.hpp" #include "InternalBlock.hpp" +#include "InternalPlugin.hpp" #include "PortImpl.hpp" namespace Ingen { @@ -29,6 +31,24 @@ InternalBlock::InternalBlock(PluginImpl* plugin, : BlockImpl(plugin, symbol, poly, parent, rate) {} +BlockImpl* +InternalBlock::duplicate(Engine& engine, + const Raul::Symbol& symbol, + GraphImpl* parent) +{ + BufferFactory& bufs = *engine.buffer_factory(); + + BlockImpl* copy = reinterpret_cast<InternalPlugin*>(_plugin)->instantiate( + bufs, symbol, _polyphonic, parent_graph(), engine); + + for (size_t i = 0; i < num_ports(); ++i) { + const Atom& value = port_impl(i)->value(); + copy->port_impl(i)->set_property(bufs.uris().ingen_value, value); + copy->port_impl(i)->set_value(value); + } + + return copy; +} void InternalBlock::pre_process(RunContext& context) diff --git a/src/server/InternalBlock.hpp b/src/server/InternalBlock.hpp index 6ba25311..a57bd89f 100644 --- a/src/server/InternalBlock.hpp +++ b/src/server/InternalBlock.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2016 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -35,6 +35,10 @@ public: GraphImpl* parent, SampleRate rate); + BlockImpl* duplicate(Engine& engine, + const Raul::Symbol& symbol, + GraphImpl* parent); + virtual void pre_process(RunContext& context); }; |