update OpenAL-Soft to 1.24.3.

This commit is contained in:
Sasha Szpakowski
2025-05-03 12:51:37 -03:00
parent 375c6f88cd
commit 5e4f3241ac
322 changed files with 54386 additions and 12885 deletions
+19 -21
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()};
}
}
@@ -150,17 +148,17 @@ bool NullBackendFactory::init()
bool NullBackendFactory::querySupport(BackendType type)
{ return (type == BackendType::Playback); }
std::string NullBackendFactory::probe(BackendType type)
auto NullBackendFactory::enumerate(BackendType type) -> std::vector<std::string>
{
switch(type)
{
case BackendType::Playback:
/* Include null char. */
return std::string{GetDeviceName()} + '\0';
return std::vector{std::string{GetDeviceName()}};
case BackendType::Capture:
break;
}
return std::string{};
return {};
}
BackendPtr NullBackendFactory::createBackend(DeviceBase *device, BackendType type)