summaryrefslogtreecommitdiffstats
path: root/src/engine/events/RequestMetadata.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-25 20:40:13 +0000
committerDavid Robillard <d@drobilla.net>2010-02-25 20:40:13 +0000
commit77a9beca75debd2d87d735fc4fe847694eee6f13 (patch)
treeae03699b999e84bc4c283abfd215c8037ecddaf6 /src/engine/events/RequestMetadata.cpp
parente22984efe9b82ab006494aea93814a592cd44ece (diff)
downloadingen-77a9beca75debd2d87d735fc4fe847694eee6f13.tar.gz
ingen-77a9beca75debd2d87d735fc4fe847694eee6f13.tar.bz2
ingen-77a9beca75debd2d87d735fc4fe847694eee6f13.zip
Work on contexts and polymorphic ports.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2492 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events/RequestMetadata.cpp')
-rw-r--r--src/engine/events/RequestMetadata.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp
index 707398bd..4d879298 100644
--- a/src/engine/events/RequestMetadata.cpp
+++ b/src/engine/events/RequestMetadata.cpp
@@ -15,6 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "raul/IntrusivePtr.hpp"
#include "interface/ClientInterface.hpp"
#include "events/RequestMetadata.hpp"
#include "shared/LV2Object.hpp"
@@ -94,11 +95,15 @@ RequestMetadata::execute(ProcessContext& context)
if (_special_type == PORT_VALUE) {
PortImpl* port = dynamic_cast<PortImpl*>(_resource);
if (port) {
- if (port->type() == PortType::CONTROL || port->type() == PortType::AUDIO)
- _value = ((AudioBuffer*)port->buffer(0).get())->value_at(0); // TODO: offset
- else if (port->type() == PortType::VALUE || port->type() == PortType::MESSAGE)
- LV2Object::to_atom(context.engine().world(),
- ((ObjectBuffer*)port->buffer(0).get())->object(), _value);
+ IntrusivePtr<AudioBuffer> abuf = PtrCast<AudioBuffer>(port->buffer(0));
+ if (abuf) {
+ _value = abuf->value_at(0);
+ } else {
+ IntrusivePtr<ObjectBuffer> obuf = PtrCast<ObjectBuffer>(port->buffer(0));
+ if (obuf) {
+ LV2Object::to_atom(obuf->object(), _value);
+ }
+ }
} else {
_resource = 0;
}