diff options
author | David Robillard <d@drobilla.net> | 2012-08-10 20:36:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-10 20:36:36 +0000 |
commit | 762435ea92bbeed0b36afc5fa4303540f3e72ba1 (patch) | |
tree | bb503e6f6d7788f45c398ffb0f35b42f73390a40 /src/server/Buffer.hpp | |
parent | 16d7c76a60f8bedd23f1b3fb1f5357b0d548dab2 (diff) | |
download | ingen-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/Buffer.hpp')
-rw-r--r-- | src/server/Buffer.hpp | 14 |
1 files changed, 12 insertions, 2 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]; } |