+ // Build the audio envelopes for the correlation
+ AudioEnvelope *envelopeMain = new AudioEnvelope(fileMain.c_str(), &prodMain);
+ envelopeMain->loadEnvelope();
+ envelopeMain->loadStdDev();
+ envelopeMain->dumpInfo();
+
+ AudioEnvelope *envelopeSub = new AudioEnvelope(fileSub.c_str(), &prodSub);
+ envelopeSub->loadEnvelope();
+ envelopeSub->loadStdDev();
+ envelopeSub->dumpInfo();
+
+ // Calculate the correlation and hereby the audio shift
+ AudioCorrelation corr(envelopeMain);
+ int index = corr.addChild(envelopeSub, useFFT);
+
+ int shift = corr.getShift(index);
+ std::cout << " Should be shifted by " << shift << " frames: " << fileSub << std::endl
+ << "\trelative to " << fileMain << std::endl
+ << "\tin a " << prodMain.get_fps() << " fps profile (" << profile << ")." << std::endl;
+
+
+ if (saveImages) {
+ QString outImg = QString::fromLatin1("envelope-main-%1.png")
+ .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
+ envelopeMain->drawEnvelope().save(outImg);
+ std::cout << "Saved volume envelope as "
+ << QFileInfo(outImg).absoluteFilePath().toStdString()
+ << std::endl;
+ outImg = QString::fromLatin1("envelope-sub-%1.png")
+ .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
+ envelopeSub->drawEnvelope().save(outImg);
+ std::cout << "Saved volume envelope as "
+ << QFileInfo(outImg).absoluteFilePath().toStdString()
+ << std::endl;
+ outImg = QString::fromLatin1("correlation-%1.png")
+ .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
+ corr.info(index)->toImage().save(outImg);
+ std::cout << "Saved correlation image as "
+ << QFileInfo(outImg).absoluteFilePath().toStdString()
+ << std::endl;