summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-10 20:36:36 +0000
committerDavid Robillard <d@drobilla.net>2012-08-10 20:36:36 +0000
commit762435ea92bbeed0b36afc5fa4303540f3e72ba1 (patch)
treebb503e6f6d7788f45c398ffb0f35b42f73390a40 /src/server
parent16d7c76a60f8bedd23f1b3fb1f5357b0d548dab2 (diff)
downloadingen-762435ea92bbeed0b36afc5fa4303540f3e72ba1.tar.gz
ingen-762435ea92bbeed0b36afc5fa4303540f3e72ba1.tar.bz2
ingen-762435ea92bbeed0b36afc5fa4303540f3e72ba1.zip
Fix various const violations.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4647 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Buffer.hpp14
-rw-r--r--src/server/ControlBindings.cpp5
-rw-r--r--src/server/LV2Node.cpp4
-rw-r--r--src/server/LV2Node.hpp2
-rw-r--r--src/server/events/Get.cpp2
-rw-r--r--src/server/mix.cpp6
6 files changed, 22 insertions, 11 deletions
diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp
index d9c9b36f..cb07b09e 100644
--- a/src/server/Buffer.hpp
+++ b/src/server/Buffer.hpp
@@ -60,7 +60,17 @@ public:
uint32_t capacity() const { return _capacity; }
/// Audio buffers only
- inline Sample* samples() const {
+ inline const Sample* samples() const {
+ if (is_control()) {
+ return (const Sample*)LV2_ATOM_BODY_CONST(atom());
+ } else if (is_audio()) {
+ return (const Sample*)LV2_ATOM_CONTENTS_CONST(LV2_Atom_Vector, atom());
+ }
+ return NULL;
+ }
+
+ /// Audio buffers only
+ inline Sample* samples() {
if (is_control()) {
return (Sample*)LV2_ATOM_BODY(atom());
} else if (is_audio()) {
@@ -80,7 +90,7 @@ public:
}
/// Audio buffers only
- inline Sample& value_at(size_t offset) const {
+ inline const Sample& value_at(size_t offset) const {
assert(offset < nframes());
return samples()[offset];
}
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 4a4e1a04..c42002ab 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -70,7 +70,8 @@ ControlBindings::binding_key(const Raul::Atom& binding) const
Key key;
LV2_Atom* num = NULL;
if (binding.type() == uris.atom_Blank) {
- LV2_Atom_Object_Body* obj = (LV2_Atom_Object_Body*)binding.get_body();
+ const LV2_Atom_Object_Body* obj = (const LV2_Atom_Object_Body*)
+ binding.get_body();
if (obj->otype == uris.midi_Bender) {
key = Key(MIDI_BENDER);
} else if (obj->otype == uris.midi_ChannelPressure) {
@@ -347,7 +348,7 @@ ControlBindings::bind(ProcessContext& context, Key key)
context.notify(uris.ingen_controlBinding,
context.start(),
_learn_port,
- atom->size, atom->type, LV2_ATOM_BODY(atom));
+ atom->size, atom->type, LV2_ATOM_BODY_CONST(atom));
_learn_port = NULL;
return true;
diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp
index 5b2e2487..b3e65555 100644
--- a/src/server/LV2Node.cpp
+++ b/src/server/LV2Node.cpp
@@ -82,7 +82,7 @@ LV2Node::make_instance(URIs& uris,
return SharedPtr<LilvInstance>();
}
- LV2_Morph_Interface* morph_iface = (LV2_Morph_Interface*)
+ const LV2_Morph_Interface* morph_iface = (const LV2_Morph_Interface*)
lilv_instance_get_extension_data(inst, LV2_MORPH__interface);
for (uint32_t p = 0; p < num_ports(); ++p) {
@@ -385,7 +385,7 @@ LV2Node::instantiate(BufferFactory& bufs)
// FIXME: Polyphony + worker?
if (lilv_plugin_has_feature(plug, info->work_schedule)) {
- _worker_iface = (LV2_Worker_Interface*)
+ _worker_iface = (const LV2_Worker_Interface*)
lilv_instance_get_extension_data(instance(0),
LV2_WORKER__interface);
}
diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp
index f4d20658..104c64d9 100644
--- a/src/server/LV2Node.hpp
+++ b/src/server/LV2Node.hpp
@@ -106,7 +106,7 @@ protected:
LV2Plugin* _lv2_plugin;
Instances* _instances;
Instances* _prepared_instances;
- LV2_Worker_Interface* _worker_iface;
+ const LV2_Worker_Interface* _worker_iface;
Responses _responses;
SharedPtr<LV2Features::FeatureArray> _features;
};
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index f2204e67..ae4174bb 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -86,7 +86,7 @@ send_node(Interface* client, const NodeImpl* node)
{
PluginImpl* const plugin = node->plugin_impl();
if (plugin->type() == Plugin::Patch) {
- send_patch(client, (PatchImpl*)node);
+ send_patch(client, (const PatchImpl*)node);
} else {
client->put(node->path(), node->properties());
for (size_t j = 0; j < node->num_ports(); ++j) {
diff --git a/src/server/mix.cpp b/src/server/mix.cpp
index 56cb4326..c340a8a2 100644
--- a/src/server/mix.cpp
+++ b/src/server/mix.cpp
@@ -61,7 +61,7 @@ static inline bool
is_end(const Buffer* buf, LV2_Atom_Event* ev)
{
return lv2_atom_sequence_is_end(
- (LV2_Atom_Sequence_Body*)LV2_ATOM_BODY(buf->atom()),
+ (const LV2_Atom_Sequence_Body*)LV2_ATOM_BODY_CONST(buf->atom()),
buf->atom()->size,
ev);
}
@@ -90,7 +90,7 @@ mix(Context& context,
for (uint32_t i = 0; i < num_srcs; ++i) {
assert(srcs[i]->type() == uris.atom_Sequence);
iters[i] = lv2_atom_sequence_begin(
- (LV2_Atom_Sequence_Body*)LV2_ATOM_BODY(srcs[i]->atom()));
+ (const LV2_Atom_Sequence_Body*)LV2_ATOM_BODY_CONST(srcs[i]->atom()));
if (is_end(srcs[i], iters[i])) {
iters[i] = NULL;
}
@@ -110,7 +110,7 @@ mix(Context& context,
if (first) {
dst->append_event(
first->time.frames, first->body.size, first->body.type,
- (const uint8_t*)LV2_ATOM_BODY(&first->body));
+ (const uint8_t*)LV2_ATOM_BODY_CONST(&first->body));
iters[first_i] = lv2_atom_sequence_next(first);
if (is_end(srcs[first_i], iters[first_i])) {