| 517 | } |
| 518 | |
| 519 | FloatSliderLFOControl* LFOPool::GetLFO(FloatSlider* owner) |
| 520 | { |
| 521 | int index = sNextLFOIndex; |
| 522 | for (int i = 0; i < LFO_POOL_SIZE; ++i) //search for the next one that isn't enabled, but only one loop around |
| 523 | { |
| 524 | if (!sLFOPool[index]->IsEnabled() && !sLFOPool[index]->IsPinned()) |
| 525 | break; //found a disabled one |
| 526 | index = (index + 1) % LFO_POOL_SIZE; |
| 527 | } |
| 528 | sNextLFOIndex = (index + 1) % LFO_POOL_SIZE; |
| 529 | if (sLFOPool[index]->GetOwner()) |
| 530 | sLFOPool[index]->GetOwner()->SetLFO(nullptr); //revoke LFO |
| 531 | sLFOPool[index]->RandomizeSettings(); |
| 532 | sLFOPool[index]->SetOwner(owner); |
| 533 | return sLFOPool[index]; |
| 534 | } |
| 535 | |
| 536 | namespace |
| 537 | { |