为了改进我的程序,我想使用 Qtconcurrent 来并行化我的音频处理。不幸的是,我有很多错误,我不知道为什么......
在我的 *.pro 中:QT += 并发
我将 minGW 与 Qt 5.3.1 一起使用,当我尝试构建时,编译器说“形成对 void 的引用”(qvector.h)。
这是我的主要代码:
void Reduce(QString& result, const QString& txt){ result += txt;}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QFuture<QString> res = QtConcurrent::mappedReduced(wavSoundsList, &BenchFFT::process, Reduce, QtConcurrent::OrderedReduce);
res.waitForFinished();
qDebug("%s",qPrintable(res.result()));
return a.exec();
}
和我的班级:
class BenchFFT
{
public:
BenchFFT();
QString process(const QString &wavFile);
private:
QString soundsPath;
QStringList wavSoundsList;
//Audio file
bool OpenWav(const QString WavPath, SndfileHandle &file);
//FFT
bool ComputeFFT(SndfileHandle file);
double Blackman(int x, int iWindowSize);
//Intel IPP7
IppsFFTSpec_R_64f * pFFTSpec;
Ipp64f* data; // source FFT
Ipp64fc* fftResult; // dest FFT
};
如果有人可以解释我的错误.thx :)
编辑:现在我没有这个修改的构建错误
QFuture<QString> res = QtConcurrent::mappedReduced(wavSoundsList, std::tr1::bind(&BenchFFT::process, BenchFFT(), std::tr1::placeholders::_1), &Reduce, QtConcurrent::OrderedReduce);
但是我的程序崩溃了.....