summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/AudioBuffer.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-13 22:19:24 +0000
committerDavid Robillard <d@drobilla.net>2008-08-13 22:19:24 +0000
commit96c22c9cdff5abb50d3653d352acfbbf345b96d2 (patch)
tree85de776f580df0ae52ae3436e29edeaba8427c28 /src/libs/engine/AudioBuffer.cpp
parentcc67a8d797a1b9ba05440f8abb60815aabe838dd (diff)
downloadingen-96c22c9cdff5abb50d3653d352acfbbf345b96d2.tar.gz
ingen-96c22c9cdff5abb50d3653d352acfbbf345b96d2.tar.bz2
ingen-96c22c9cdff5abb50d3653d352acfbbf345b96d2.zip
Fix crash on triggers on the last sample of the cycle.
git-svn-id: http://svn.drobilla.net/lad/ingen@1356 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/AudioBuffer.cpp')
-rw-r--r--src/libs/engine/AudioBuffer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libs/engine/AudioBuffer.cpp b/src/libs/engine/AudioBuffer.cpp
index 5eea7103..098103c0 100644
--- a/src/libs/engine/AudioBuffer.cpp
+++ b/src/libs/engine/AudioBuffer.cpp
@@ -135,10 +135,12 @@ AudioBuffer::set_value(Sample val, FrameTime cycle_start, FrameTime time)
FrameTime offset = time - cycle_start;
assert(offset <= _size);
- set_block(val, offset, _size - 1);
-
- if (offset > 0)
- _state = HALF_SET_CYCLE_1;
+ if (offset < _size) {
+ set_block(val, offset, _size - 1);
+
+ if (offset > 0)
+ _state = HALF_SET_CYCLE_1;
+ } // else trigger at very end of block
_set_time = time;
_set_value = val;