QtConcurrent::mappedReduced

728 views Asked by At

to improve my program, i want to use Qtconcurrent to parallelize my audio process. Unfortunately, i have many errors and i don't know why ...

In my *.pro : QT += concurrent

I use minGW with Qt 5.3.1 and when i try to build, the compiler said "forming reference to void" (qvector.h).

Here my main code :

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();
}

and my class :

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
};

if someone can explain me my mistakes.thx :)

Edit : now i don't have build error with this modification

QFuture<QString> res = QtConcurrent::mappedReduced(wavSoundsList, std::tr1::bind(&BenchFFT::process, BenchFFT(), std::tr1::placeholders::_1), &Reduce, QtConcurrent::OrderedReduce);

but my program crashed .....

0

There are 0 answers