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

Function ShareOrCopySampleBlock

libraries/lib-wave-track/Sequence.cpp:472–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470 }
471
472 SampleBlockPtr ShareOrCopySampleBlock(
473 SampleBlockFactory *pFactory, sampleFormat format, SampleBlockPtr sb )
474 {
475 if ( pFactory ) {
476 // must copy contents to a fresh SampleBlock object in another database
477 auto sampleCount = sb->GetSampleCount();
478 SampleBuffer buffer{ sampleCount, format };
479 sb->GetSamples( buffer.ptr(), format, 0, sampleCount );
480 sb = pFactory->Create( buffer.ptr(), sampleCount, format );
481 }
482 else
483 // Can just share
484 ;
485 return sb;
486 }
487}
488
489/*! @excsafety{Strong} */

Callers 2

PasteMethod · 0.85
AppendBlockMethod · 0.85

Calls 4

ptrMethod · 0.80
GetSampleCountMethod · 0.45
GetSamplesMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected