| 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} */ |
no test coverage detected