aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Enderby <sean.enderby@gmail.com>2014-06-12 09:22:34 +0100
committerSean Enderby <sean.enderby@gmail.com>2014-06-12 09:22:34 +0100
commitdb4716c2ece48ab9cbe38b2432969f9a03b1c173 (patch)
tree5dd86fbe151c1ad09399ce6c92530805176660c1 /src
parente028f0d8204722f01495ec28edadbb4bdf1b6f1b (diff)
downloadLibXtract-db4716c2ece48ab9cbe38b2432969f9a03b1c173.tar.gz
LibXtract-db4716c2ece48ab9cbe38b2432969f9a03b1c173.tar.bz2
LibXtract-db4716c2ece48ab9cbe38b2432969f9a03b1c173.zip
some fixes to scalar.c so they work in MSVC
Diffstat (limited to 'src')
-rw-r--r--src/scalar.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/scalar.c b/src/scalar.c
index 7b0db80..1182618 100644
--- a/src/scalar.c
+++ b/src/scalar.c
@@ -313,7 +313,7 @@ int xtract_tristimulus_1(const double *data, const int N, const void *argv, doub
if((temp = data[i]))
{
den += temp;
- h = round(freqs[i] / fund);
+ h = floor(freqs[i] / fund + 0.5);
if(h == 1)
p1 += temp;
}
@@ -347,7 +347,7 @@ int xtract_tristimulus_2(const double *data, const int N, const void *argv, doub
if((temp = data[i]))
{
den += temp;
- h = round(freqs[i] / fund);
+ h = floor(freqs[i] / fund + 0.5);
switch (h)
{
case 2:
@@ -396,7 +396,7 @@ int xtract_tristimulus_3(const double *data, const int N, const void *argv, doub
if((temp = data[i]))
{
den += temp;
- h = round(freqs[i] / fund);
+ h = floor(freqs[i] / fund + 0.5);
if(h >= 5)
num += temp;
}
@@ -649,7 +649,7 @@ int xtract_spectral_inharmonicity(const double *data, const int N, const void *a
{
if(amps[n])
{
- h = round(freqs[n] / fund);
+ h = floor(freqs[n] / fund + 0.5);
num += fabs(freqs[n] - h * fund) * XTRACT_SQ(amps[n]);
den += XTRACT_SQ(amps[n]);
}
@@ -681,7 +681,7 @@ int xtract_odd_even_ratio(const double *data, const int N, const void *argv, dou
{
if((temp = data[n]))
{
- h = round(freqs[n] / fund);
+ h = floor(freqs[n] / fund + 0.5);
if(XTRACT_IS_ODD(h))
{
odd += temp;
@@ -842,6 +842,8 @@ int xtract_hps(const double *data, const int N, const void *argv, double *result
return XTRACT_NO_RESULT;
}
+ peak_index = 0;
+
tempProduct = peak = 0;
for (i = 0; i < M; ++i)
{