1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Do orphan block checking differently... (#655)

... Don't have special knowledge of "blockid" in ProjectSerializer, which should
be very low-level.

Instead, we can deserialize the project first, and use the block ids collected
by the sample block factory since f137a1e.
This commit is contained in:
Paul Licameli
2020-09-01 11:54:36 -04:00
committed by GitHub
parent 1e3885730f
commit 92d7ee38e5
5 changed files with 39 additions and 30 deletions

View File

@@ -129,6 +129,8 @@ public:
~SqliteSampleBlockFactory() override;
SampleBlockIDs GetActiveBlockIDs() override;
SampleBlockPtr DoGet(SampleBlockID sbid) override;
SampleBlockPtr DoCreate(samplePtr src,
@@ -171,6 +173,21 @@ SampleBlockPtr SqliteSampleBlockFactory::DoCreate(
return sb;
}
auto SqliteSampleBlockFactory::GetActiveBlockIDs() -> SampleBlockIDs
{
SampleBlockIDs result;
for (auto end = mAllBlocks.end(), it = mAllBlocks.begin(); it != end;) {
if (it->second.expired())
// Tighten up the map
it = mAllBlocks.erase(it);
else {
result.insert( it->first );
++it;
}
}
return result;
}
SampleBlockPtr SqliteSampleBlockFactory::DoCreateSilent(
size_t numsamples, sampleFormat srcformat )
{