summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorGuido Aulisi <guido.aulisi@gmail.com>2014-08-16 12:26:33 +0200
committerRobin Gareus <robin@gareus.org>2015-01-19 23:55:52 +0100
commitc6e71a683e6a685ed55c35670c6b4bfd20e38b5f (patch)
tree6011c7f180fe6c54664da259b2ac21f8b1a4852a /libs/evoral
parent5190cbc9b2180ab3b98f3e1eb443653c50beecce (diff)
Curve::_get_vector: fix return value when veclen == 1
When the crossfade length is only 1 frame, I got strange gain coefficients from get_vector (63 in my case). The function wrongly returned the x axis value.
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/src/Curve.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp
index 20cc5d9ec3..f99a8075d5 100644
--- a/libs/evoral/src/Curve.cpp
+++ b/libs/evoral/src/Curve.cpp
@@ -302,14 +302,11 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
if (veclen > 1) {
dx_num = hx - lx;
dx_den = veclen - 1;
- }
-
- if (veclen > 1) {
for (int i = 0; i < veclen; ++i) {
vec[i] = (lx * (m_num / m_den) + m_num * i * dx_num / (m_den * dx_den)) + c;
}
} else {
- vec[0] = lx;
+ vec[0] = lx * (m_num / m_den) + c;
}
return;