MCPcopy Create free account
hub / github.com/audacity/audacity / DoCreateFromId

Method DoCreateFromId

libraries/lib-project-file-io/SqliteSampleBlock.cpp:278–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278SampleBlockPtr SqliteSampleBlockFactory::DoCreateFromId(
279 sampleFormat srcformat, SampleBlockID id)
280{
281 if (id <= 0)
282 return DoCreateSilent(-id, floatSample);
283
284 // First see if this block id was previously loaded
285 auto& wb = mAllBlocks[id];
286
287 if (auto block = wb.lock())
288 return block;
289
290 // First sight of this id
291 auto ssb = std::make_shared<SqliteSampleBlock>(shared_from_this());
292 wb = ssb;
293 ssb->mSampleFormat = srcformat;
294 // This may throw database errors
295 // It initializes the rest of the fields
296 ssb->Load(static_cast<SampleBlockID>(id));
297
298 return ssb;
299}
300
301BlockSampleView SqliteSampleBlock::GetFloatSampleView(bool mayThrow)
302{

Callers

nothing calls this directly

Calls 2

lockMethod · 0.45
LoadMethod · 0.45

Tested by

no test coverage detected