我正在尝试用Android构建SoundTouch库。
我遵循了SoundTouch自己在自述文件中编写的指南,但是在构建它时,我仍然会得到以下错误:
ct.cpp:238:32: error:
call to 'fabs' is ambiguous
xcorr[offs] += (float) fabs(sum);这一行代码在BPMDetect.cpp中,在此函数中:
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中),所以我检查了文件中导入的库,如下所示:
#include <math.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>FYI:我决定不张贴所有的代码,因为长度,但如果你需要它,让我知道,我会立即张贴它。
发布于 2017-09-08 08:20:22
您在SOUNDTOUCH_INTEGER_SAMPLES中更改为STTypes.h (16位)了吗?
在我的例子中,这个配置也有相同的错误。
要解决这个问题,您可以尝试将fabs函数更改为labs,因为LONG_SAMPLETYPE是一个16位的长类型。
https://stackoverflow.com/questions/46058606
复制相似问题