summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-09-20 00:57:44 +0000
committerCarl Hetherington <carl@carlh.net>2010-09-20 00:57:44 +0000
commita212e7eec999e696dde6d4747b783fb6098bdb47 (patch)
treec68701b41e25586a6bc75a1fa11008e61740206c /libs
parente47d4633095e05ad1ed47a9ac038b043eaf75000 (diff)
Make sure that _get_vector writes a value to the output array even when veclen == 1. Fixes #3461.
git-svn-id: svn://localhost/ardour2/branches/3.0@7808 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/evoral/src/Curve.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp
index b5338f42a9..d15ff16ea5 100644
--- a/libs/evoral/src/Curve.cpp
+++ b/libs/evoral/src/Curve.cpp
@@ -264,7 +264,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
return;
}
- if (npoints == 1 ) {
+ if (npoints == 1) {
for (i = 0; i < veclen; ++i) {
vec[i] = _list.events().front()->value;
@@ -308,12 +308,13 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
rx = lx;
if (veclen > 1) {
+ dx = (hx - lx) / (veclen - 1);
+ } else {
+ dx = 0;
+ }
- dx = (hx - lx) / (veclen-1);
-
- for (i = 0; i < veclen; ++i, rx += dx) {
- vec[i] = multipoint_eval (rx);
- }
+ for (i = 0; i < veclen; ++i, rx += dx) {
+ vec[i] = multipoint_eval (rx);
}
}