update openal-soft to 1.24.3

keeping the alt 87514151c4 (diff-73a8dc1ce58605f6c5ea53548454c3bae516ec5132a29c9d7ff7edf9730c75be)
This commit is contained in:
AzaezelX 2025-09-03 11:09:27 -05:00
parent 12db0500e8
commit ba32094b7b
276 changed files with 49304 additions and 8712 deletions

View file

@ -27,11 +27,8 @@
#include <chrono>
#include <cstdint>
#include <cstring>
#include <functional>
#include <thread>
#include "almalloc.h"
#include "alstring.h"
#include "althrd_setname.h"
#include "core/device.h"
#include "core/helpers.h"
@ -48,7 +45,7 @@ using namespace std::string_view_literals;
struct NullBackend final : public BackendBase {
NullBackend(DeviceBase *device) noexcept : BackendBase{device} { }
explicit NullBackend(DeviceBase *device) noexcept : BackendBase{device} { }
int mixerProc();
@ -63,7 +60,7 @@ struct NullBackend final : public BackendBase {
int NullBackend::mixerProc()
{
const milliseconds restTime{mDevice->UpdateSize*1000/mDevice->Frequency / 2};
const milliseconds restTime{mDevice->mUpdateSize*1000/mDevice->mSampleRate / 2};
SetRTPriority();
althrd_setname(GetMixerThreadName());
@ -76,16 +73,17 @@ int NullBackend::mixerProc()
auto now = std::chrono::steady_clock::now();
/* This converts from nanoseconds to nanosamples, then to samples. */
int64_t avail{std::chrono::duration_cast<seconds>((now-start) * mDevice->Frequency).count()};
if(avail-done < mDevice->UpdateSize)
const auto avail = int64_t{std::chrono::duration_cast<seconds>((now-start)
* mDevice->mSampleRate).count()};
if(avail-done < mDevice->mUpdateSize)
{
std::this_thread::sleep_for(restTime);
continue;
}
while(avail-done >= mDevice->UpdateSize)
while(avail-done >= mDevice->mUpdateSize)
{
mDevice->renderSamples(nullptr, mDevice->UpdateSize, 0u);
done += mDevice->UpdateSize;
mDevice->renderSamples(nullptr, mDevice->mUpdateSize, 0u);
done += mDevice->mUpdateSize;
}
/* For every completed second, increment the start time and reduce the
@ -93,11 +91,11 @@ int NullBackend::mixerProc()
* and current time from growing too large, while maintaining the
* correct number of samples to render.
*/
if(done >= mDevice->Frequency)
if(done >= mDevice->mSampleRate)
{
seconds s{done/mDevice->Frequency};
seconds s{done/mDevice->mSampleRate};
start += s;
done -= mDevice->Frequency*s.count();
done -= mDevice->mSampleRate*s.count();
}
}
@ -110,10 +108,10 @@ void NullBackend::open(std::string_view name)
if(name.empty())
name = GetDeviceName();
else if(name != GetDeviceName())
throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%.*s\" not found",
al::sizei(name), name.data()};
throw al::backend_exception{al::backend_error::NoDevice, "Device name \"{}\" not found",
name};
mDevice->DeviceName = name;
mDeviceName = name;
}
bool NullBackend::reset()
@ -126,11 +124,11 @@ void NullBackend::start()
{
try {
mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&NullBackend::mixerProc), this};
mThread = std::thread{&NullBackend::mixerProc, this};
}
catch(std::exception& e) {
throw al::backend_exception{al::backend_error::DeviceError,
"Failed to start mixing thread: %s", e.what()};
"Failed to start mixing thread: {}", e.what()};
}
}