首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android - SoundTouch中的模糊函数fabs()

Android - SoundTouch中的模糊函数fabs()
EN

Stack Overflow用户
提问于 2017-09-05 15:28:43
回答 1查看 240关注 0票数 2

我正在尝试用Android构建SoundTouch库。

我遵循了SoundTouch自己在自述文件中编写的指南,但是在构建它时,我仍然会得到以下错误:

代码语言:javascript
复制
ct.cpp:238:32: error: 
    call to 'fabs' is ambiguous
      xcorr[offs] += (float) fabs(sum);

这一行代码在BPMDetect.cpp中,在此函数中:

代码语言:javascript
复制
void BPMDetect::updateXCorr(int process_samples)
{
    int offs;
    SAMPLETYPE *pBuffer;

    assert(buffer->numSamples() >= (uint)(process_samples + windowLen));

    pBuffer = buffer->ptrBegin();

    // calculate decay factor for xcorr filtering
    float xcorr_decay = (float)pow(0.5, 1.0 / (xcorr_decay_time_constant * target_srate / process_samples));

    #pragma omp parallel for
    for (offs = windowStart; offs < windowLen; offs ++) 
    {
        LONG_SAMPLETYPE sum;
        int i;

        sum = 0;
        for (i = 0; i < process_samples; i ++) 
        {
            sum += pBuffer[i] * pBuffer[i + offs];    // scaling the sub-result shouldn't be necessary
        }
        xcorr[offs] *= xcorr_decay;   // decay 'xcorr' here with suitable time constant.

        xcorr[offs] += (float) fabs(sum);
    }
}

由于我知道fabs()函数包含在math.h库中(至少在c中),所以我检查了文件中导入的库,如下所示:

代码语言:javascript
复制
#include <math.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>

FYI:我决定不张贴所有的代码,因为长度,但如果你需要它,让我知道,我会立即张贴它。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-08 08:20:22

您在SOUNDTOUCH_INTEGER_SAMPLES中更改为STTypes.h (16位)了吗?

在我的例子中,这个配置也有相同的错误。

要解决这个问题,您可以尝试将fabs函数更改为labs,因为LONG_SAMPLETYPE是一个16位的长类型。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46058606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档