Esempio n. 1
0
void Splitter::sendCueData()
{
    bool cdQuality = disk()->audioFile()->isCdQuality();
    OutFormat *format = OutFormat::currentFormat();

    bool fakeIndex = (format->createCue() and
                      format->preGapType() == OutFormat::PreGapAddToFirstTrack);

    QString s = QString("FILE \"%1\" WAVE").arg(disk()->audioFileName());
    mProcess->write(s.toLocal8Bit() + "\n");

    for (int t=0; t<disk()->count(); ++t)
    {
        Track *track = disk()->track(t);

        QString s = QString("TRACK %1 AUDIO").arg(t + 1);
        DEBUG_CUE << s;
        mProcess->write(s.toLocal8Bit() + "\n");

        if (fakeIndex && t == 0)
        {
            QString s = cdQuality ? "  INDEX 01 00:00:00" : "  INDEX 01 00:00.000";
            DEBUG_CUE << s;
            mProcess->write(s.toLocal8Bit() + "\n");
        }
        else
        {

            for (int i=0; i<100; ++i)
            {
                if (!track->cueIndex(i).isNull())
                {
                    QString s = QString("  INDEX %1 %2")
                            .arg(i, 2, 10, QChar('0'))
                            .arg(track->cueIndex(i).toString(cdQuality));
                DEBUG_CUE << s;
                mProcess->write(s.toLocal8Bit() + "\n");
                }
            }
        }
    }
}
Esempio n. 2
0
void Splitter::sendCueData()
{
    bool cdQuality = disk()->audioFile()->isCdQuality();
    OutFormat *format = OutFormat::currentFormat();

    bool fakeIndex = (format->createCue() and
                      format->preGapType() == OutFormat::PreGapAddToFirstTrack);

    QFile cue(disk()->cueFile());
    cue.open(QFile::ReadOnly);

    int trackNum = 0;
    QByteArray line;
    while (!cue.atEnd())
    {
        line = cue.readLine();
        QString str = QString(line).trimmed();
        QString key = str.section(' ', 0, 0).toUpper();

        if (key == "TRACK")
        {
            trackNum++;
            mProcess->write(line);
            continue;
        }

        if (key == "INDEX")
        {
            int indexNum = str.section(' ', 1, 1).toInt();

            if (fakeIndex && trackNum == 1)
            {
                if (indexNum == 1)
                {
                    if (cdQuality)
                        mProcess->write("  INDEX 01 00:00:00\n");
                    else
                        mProcess->write("  INDEX 01 00:00.000\n");
                }
            }
            else
            {
                CueIndex index(str.section(' ', 2));
                mProcess->write(QString("  INDEX %1 %2\n")
                                .arg(indexNum, 2, 10, QChar('0'))
                                .arg(index.toString(cdQuality))
                                .toLocal8Bit());
            }
            continue;
        }

        if (key == "FILE")
        {
            mProcess->write(line);
            continue;
        }

    }

    cue.close();
}