From 26c8c50c2605e377f74d7a73bae3bbbf4f7bad61 Mon Sep 17 00:00:00 2001 From: Chris Robinson <chris.kcat@gmail.com> Date: Mon, 26 Apr 2021 20:25:24 -0700 Subject: Partially implement an extension to hold sources on disconnect Rather than stopping voices/sources when the device becomes disconnected, the context can be set to leave them alone. As a consequence, their state will remain as playing and they'll keep their last known sample offset indefinately. For applications mindful of this behavior, it will allow resetting or reopening the device to reconnect and automatically resume where it left off. --- alc/alu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'alc/alu.cpp') diff --git a/alc/alu.cpp b/alc/alu.cpp index 168f0112..d7f4410f 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -2030,6 +2030,12 @@ void DeviceBase::handleDisconnect(const char *msg, ...) } } + if(!ctx->mStopVoicesOnDisconnect) + { + ProcessVoiceChanges(ctx); + continue; + } + auto voicelist = ctx->getVoicesSpanAcquired(); auto stop_voice = [](Voice *voice) -> void { -- cgit v1.2.3