1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-07 23:32:53 +02:00

Sequence.cpp: Convert all blockfiles types including aliases in ConvertToSampleFormat

This commit is contained in:
mchinen 2012-03-01 04:18:32 +00:00
parent d3513320d6
commit 57694a2449

View File

@ -178,17 +178,6 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
SeqBlock* pOldSeqBlock = mBlock->Item(i);
BlockFile* pOldBlockFile = pOldSeqBlock->f;
if (pOldBlockFile->IsAlias())
{
// No conversion of aliased data.
//v Should the user be alerted, as we're not actually converting the aliased file?
// James (2011-12-01, offlist) believes this is okay because we are assuring
// the user we'll do the format conversion if we turn this into a non-aliased block.
// TODO: Confirm that.
pNewBlockArray->Add(pOldSeqBlock);
}
else
{
sampleCount len = pOldSeqBlock->f->GetLength();
samplePtr bufferOld = NewSamples(len, oldFormat);
samplePtr bufferNew = NewSamples(len, mSampleFormat);
@ -225,7 +214,6 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
DeleteSamples(bufferNew);
DeleteSamples(bufferOld);
}
}
if (bSuccess)
{
@ -234,12 +222,9 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
{
SeqBlock* pOldSeqBlock = mBlock->Item(i);
if (!pOldSeqBlock->f->IsAlias())
{
mDirManager->Deref(pOldSeqBlock->f);
pOldSeqBlock->f = NULL; //vvvvv ...so we don't delete the file when we delete mBlock, next. ANSWER-ME: Right, or delete?
}
}
delete mBlock;
// Replace with new blocks.