traverso-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-devel] Idea: Audio Import Option(Copy Audio File to Session Di


From: 石任之
Subject: [Traverso-devel] Idea: Audio Import Option(Copy Audio File to Session Dir)
Date: Wed, 29 May 2019 15:42:37 +0800

1. WHY WE NEED IT
In most audio production scenario, we import many audio files that stored in
different directory among machine(environment) into the Traverso.

But when we bring the session to another  environment , all clips should be reseted one by one.

So copy the audio file into project will make the porject more self-included.

2. INTERACTION
 -1 When import Audio, show a dialog to ask user if copy audio files into Session dir.
 -2 Traverso show a ProgressDialog until finish copy operation.
 -3 This option can be set in Preference window.

3. HOW TO ARCHIEVE THAT
Just copy the file, and reset AudioSource path.
And find some place to store the settings.

I write some simple code like following...
===============================================================================
bool copyFile(QFile& srcFile, QFile& desFile, QProgressDialog& dialog)
{
    char* byteTemp = new char[4096];
    double totalCopySize = 0;

    QDataStream in(&srcFile);
    QDataStream out(&desFile);

    while (!in.atEnd())
    {
        int readSize = 0;
        readSize = in.readRawData(byteTemp, 4096);
        out.writeRawData(byteTemp, readSize);
        totalCopySize += readSize;

        dialog.setValue(int((totalprogress + totalCopySize) / totalSize * 100));

        QCoreApplication::processEvents();
        if(dialog.wasCanceled())
        {

            QMessageBox::critical(this, "Notice",
                                  "User Canceled Copy Operation",
                                  QMessageBox::Ok);

            break;
        }
    }
    if (totalCopySize == srcfileSize)
    {
        qDebug("success");
        totalprogress += srcfileSize;
        return true;
    }else {
        return false;
    }
}
===============================================================================
Any suggestion? Thanks.
Best regards.
Renzhi Shi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]