mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-11 22:51:06 +02:00
Sequence.cpp: Convert all blockfiles types including aliases in ConvertToSampleFormat
This commit is contained in:
parent
d3513320d6
commit
57694a2449
@ -178,17 +178,6 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||||||
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
||||||
BlockFile* pOldBlockFile = pOldSeqBlock->f;
|
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();
|
sampleCount len = pOldSeqBlock->f->GetLength();
|
||||||
samplePtr bufferOld = NewSamples(len, oldFormat);
|
samplePtr bufferOld = NewSamples(len, oldFormat);
|
||||||
samplePtr bufferNew = NewSamples(len, mSampleFormat);
|
samplePtr bufferNew = NewSamples(len, mSampleFormat);
|
||||||
@ -225,7 +214,6 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||||||
DeleteSamples(bufferNew);
|
DeleteSamples(bufferNew);
|
||||||
DeleteSamples(bufferOld);
|
DeleteSamples(bufferOld);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
{
|
{
|
||||||
@ -234,12 +222,9 @@ bool Sequence::ConvertToSampleFormat(sampleFormat format, bool* pbChanged)
|
|||||||
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
for (size_t i = 0; (i < mBlock->GetCount() && bSuccess); i++)
|
||||||
{
|
{
|
||||||
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
SeqBlock* pOldSeqBlock = mBlock->Item(i);
|
||||||
if (!pOldSeqBlock->f->IsAlias())
|
|
||||||
{
|
|
||||||
mDirManager->Deref(pOldSeqBlock->f);
|
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?
|
pOldSeqBlock->f = NULL; //vvvvv ...so we don't delete the file when we delete mBlock, next. ANSWER-ME: Right, or delete?
|
||||||
}
|
}
|
||||||
}
|
|
||||||
delete mBlock;
|
delete mBlock;
|
||||||
|
|
||||||
// Replace with new blocks.
|
// Replace with new blocks.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user