diff options
author | Chris Robinson <[email protected]> | 2022-11-03 02:17:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-11-03 02:17:54 -0700 |
commit | d8361bdd6fa807a4200e18e8ef7ffd13ab849b74 (patch) | |
tree | 1df40b4006ade3e715c84701916fab23af65d612 /alc | |
parent | b73e0ecbc55cb09788d056131aaec0ed27f6046a (diff) |
Add the ability to start a voice at a particular time
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index bc39b108..647b163b 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -105,6 +105,7 @@ static_assert(!(MaxResamplerPadding&1), "MaxResamplerPadding is not a multiple o namespace { using uint = unsigned int; +using namespace std::chrono; constexpr uint MaxPitch{10}; @@ -1841,6 +1842,9 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) { ASSUME(SamplesToDo > 0); + const nanoseconds curtime{device->ClockBase + + nanoseconds{seconds{device->SamplesDone}}/device->Frequency}; + for(ContextBase *ctx : *device->mContexts.load(std::memory_order_acquire)) { const EffectSlotArray &auxslots = *ctx->mActiveAuxSlots.load(std::memory_order_acquire); @@ -1861,7 +1865,7 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) { const Voice::State vstate{voice->mPlayState.load(std::memory_order_acquire)}; if(vstate != Voice::Stopped && vstate != Voice::Pending) - voice->mix(vstate, ctx, SamplesToDo); + voice->mix(vstate, ctx, curtime, SamplesToDo); } /* Process effects. */ |