aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-11-03 02:17:54 -0700
committerChris Robinson <[email protected]>2022-11-03 02:17:54 -0700
commitd8361bdd6fa807a4200e18e8ef7ffd13ab849b74 (patch)
tree1df40b4006ade3e715c84701916fab23af65d612 /alc
parentb73e0ecbc55cb09788d056131aaec0ed27f6046a (diff)
Add the ability to start a voice at a particular time
Diffstat (limited to 'alc')
-rw-r--r--alc/alu.cpp6
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. */