From 46fd95deb47fc64c20a71b9f2166fdb0a9738ebf Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 30 Nov 2022 14:44:24 +0000 Subject: [PATCH] Fix OpenAL backend on driver data not returned. Creating the context beforehand before device query. --- Sources/Audio/ALDevice.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Sources/Audio/ALDevice.cpp b/Sources/Audio/ALDevice.cpp index 547870682..3535e747a 100644 --- a/Sources/Audio/ALDevice.cpp +++ b/Sources/Audio/ALDevice.cpp @@ -449,6 +449,15 @@ namespace spades { SPRaise("Failed to open OpenAL device."); } + + alContext = al::qalcCreateContext(alDevice, NULL); + if (!alContext) { + al::qalcCloseDevice(alDevice); + SPRaise("Failed to create OpenAL context."); + } + + al::qalcMakeContextCurrent(alContext); + SPLog("OpenAL Info:"); SPLog(" Vendor: %s", al::qalGetString(AL_VENDOR)); SPLog(" Version: %s", al::qalGetString(AL_VERSION)); @@ -462,14 +471,6 @@ namespace spades { } } - alContext = al::qalcCreateContext(alDevice, NULL); - if (UNLIKELY(!alContext)) { - al::qalcCloseDevice(alDevice); - SPRaise("Failed to create OpenAL context."); - } - - al::qalcMakeContextCurrent(alContext); - map = NULL; roomHistoryPos = 0;