| 276 | } |
| 277 | |
| 278 | SampleBlockPtr 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 | |
| 301 | BlockSampleView SqliteSampleBlock::GetFloatSampleView(bool mayThrow) |
| 302 | { |