Update openal-soft to solve UWP crash issue

This commit is contained in:
halx99 2023-06-28 16:40:40 +08:00
parent 408608a579
commit 902166ed16
9 changed files with 164 additions and 189 deletions

View File

@ -179,7 +179,7 @@
## OpenAL Soft
- [![Upstream](https://img.shields.io/github/v/tag/kcat/openal-soft?label=Upstream)](https://github.com/kcat/openal-soft)
- Version: git 1.23.1-a49b612 (8655)
- Version: git 1.23.1-e714c8f (8659)
- License: LGPL-2.1
## OpenSSL

View File

@ -179,7 +179,7 @@
## OpenAL Soft
- [![Upstream](https://img.shields.io/github/v/tag/kcat/openal-soft?label=Upstream)](https://github.com/kcat/openal-soft)
- Version: git 1.23.1-a49b612 (8655)
- Version: git 1.23.1-e714c8f (8659)
- License: LGPL-2.1
## OpenSSL

View File

@ -376,28 +376,28 @@ void UpsampleBFormatTransform(
}
inline auto& GetAmbiScales(AmbiScaling scaletype) noexcept
constexpr auto GetAmbiScales(AmbiScaling scaletype) noexcept
{
switch(scaletype)
{
case AmbiScaling::FuMa: return AmbiScale::FromFuMa();
case AmbiScaling::SN3D: return AmbiScale::FromSN3D();
case AmbiScaling::UHJ: return AmbiScale::FromUHJ();
case AmbiScaling::FuMa: return al::span{AmbiScale::FromFuMa};
case AmbiScaling::SN3D: return al::span{AmbiScale::FromSN3D};
case AmbiScaling::UHJ: return al::span{AmbiScale::FromUHJ};
case AmbiScaling::N3D: break;
}
return AmbiScale::FromN3D();
return al::span{AmbiScale::FromN3D};
}
inline auto& GetAmbiLayout(AmbiLayout layouttype) noexcept
constexpr auto GetAmbiLayout(AmbiLayout layouttype) noexcept
{
if(layouttype == AmbiLayout::FuMa) return AmbiIndex::FromFuMa();
return AmbiIndex::FromACN();
if(layouttype == AmbiLayout::FuMa) return al::span{AmbiIndex::FromFuMa};
return al::span{AmbiIndex::FromACN};
}
inline auto& GetAmbi2DLayout(AmbiLayout layouttype) noexcept
constexpr auto GetAmbi2DLayout(AmbiLayout layouttype) noexcept
{
if(layouttype == AmbiLayout::FuMa) return AmbiIndex::FromFuMa2D();
return AmbiIndex::FromACN2D();
if(layouttype == AmbiLayout::FuMa) return al::span{AmbiIndex::FromFuMa2D};
return al::span{AmbiIndex::FromACN2D};
}
@ -859,7 +859,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
*/
return CalcAngleCoeffs(ScaleAzimuthFront(az, 1.5f), ev, 0.0f);
};
auto&& scales = GetAmbiScales(voice->mAmbiScaling);
const auto scales = GetAmbiScales(voice->mAmbiScaling);
auto coeffs = calc_coeffs(Device->mRenderMode);
if(!(coverage > 0.0f))

View File

@ -577,7 +577,8 @@ struct DeviceHelper final : private IMMNotificationClient
Platform::String^ devIfPath =
devid.empty() ? (flow == eRender ? MediaDevice::GetDefaultAudioRenderId(deviceRole) : MediaDevice::GetDefaultAudioCaptureId(deviceRole))
: ref new Platform::String(devid.data());
if (!devIfPath)
return E_POINTER;
Concurrency::task<DeviceInformation^> createDeviceOp(
DeviceInformation::CreateFromIdAsync(devIfPath, nullptr, DeviceInformationKind::DeviceInterface));
auto status = createDeviceOp.then([&](DeviceInformation^ deviceInfo)
@ -674,6 +675,8 @@ struct DeviceHelper final : private IMMNotificationClient
const auto deviceRole = Windows::Media::Devices::AudioDeviceRole::Default;
auto DefaultAudioId = flowdir == eRender ? MediaDevice::GetDefaultAudioRenderId(deviceRole)
: MediaDevice::GetDefaultAudioCaptureId(deviceRole);
if (!DefaultAudioId)
return defaultId;
Concurrency::task<DeviceInformation ^> createDefaultOp(DeviceInformation::CreateFromIdAsync(DefaultAudioId, nullptr, DeviceInformationKind::DeviceInterface));
auto task_status = createDefaultOp.then([&defaultId](DeviceInformation ^ deviceInfo)
{
@ -1272,7 +1275,7 @@ HRESULT WasapiPlayback::resetProxy()
const uint32_t chancount{OutputType.Format.nChannels};
const DWORD chanmask{OutputType.dwChannelMask};
if(chancount >= 12 && (chanmask&X714Mask) == X7DOT1DOT4)
mDevice->FmtChans = DevFmtX71;
mDevice->FmtChans = DevFmtX714;
else if(chancount >= 8 && (chanmask&X71Mask) == X7DOT1)
mDevice->FmtChans = DevFmtX71;
else if(chancount >= 7 && (chanmask&X61Mask) == X6DOT1)

View File

@ -93,28 +93,28 @@ void LoadSamples(float *RESTRICT dst, const std::byte *src, const size_t srcstep
}
inline auto& GetAmbiScales(AmbiScaling scaletype) noexcept
constexpr auto GetAmbiScales(AmbiScaling scaletype) noexcept
{
switch(scaletype)
{
case AmbiScaling::FuMa: return AmbiScale::FromFuMa();
case AmbiScaling::SN3D: return AmbiScale::FromSN3D();
case AmbiScaling::UHJ: return AmbiScale::FromUHJ();
case AmbiScaling::FuMa: return al::span{AmbiScale::FromFuMa};
case AmbiScaling::SN3D: return al::span{AmbiScale::FromSN3D};
case AmbiScaling::UHJ: return al::span{AmbiScale::FromUHJ};
case AmbiScaling::N3D: break;
}
return AmbiScale::FromN3D();
return al::span{AmbiScale::FromN3D};
}
inline auto& GetAmbiLayout(AmbiLayout layouttype) noexcept
constexpr auto GetAmbiLayout(AmbiLayout layouttype) noexcept
{
if(layouttype == AmbiLayout::FuMa) return AmbiIndex::FromFuMa();
return AmbiIndex::FromACN();
if(layouttype == AmbiLayout::FuMa) return al::span{AmbiIndex::FromFuMa};
return al::span{AmbiIndex::FromACN};
}
inline auto& GetAmbi2DLayout(AmbiLayout layouttype) noexcept
constexpr auto GetAmbi2DLayout(AmbiLayout layouttype) noexcept
{
if(layouttype == AmbiLayout::FuMa) return AmbiIndex::FromFuMa2D();
return AmbiIndex::FromACN2D();
if(layouttype == AmbiLayout::FuMa) return al::span{AmbiIndex::FromFuMa2D};
return al::span{AmbiIndex::FromACN2D};
}
@ -453,7 +453,7 @@ void ConvolutionState::update(const ContextBase *context, const EffectSlot *slot
}
mOutTarget = target.Main->Buffer;
auto&& scales = GetAmbiScales(mAmbiScaling);
const auto scales = GetAmbiScales(mAmbiScaling);
const uint8_t *index_map{Is2DAmbisonic(mChannels) ?
GetAmbi2DLayout(mAmbiLayout).data() :
GetAmbiLayout(mAmbiLayout).data()};

View File

@ -314,17 +314,17 @@ void InitDistanceComp(ALCdevice *device, const al::span<const Channel> channels,
}
inline auto& GetAmbiScales(DevAmbiScaling scaletype) noexcept
constexpr auto GetAmbiScales(DevAmbiScaling scaletype) noexcept
{
if(scaletype == DevAmbiScaling::FuMa) return AmbiScale::FromFuMa();
if(scaletype == DevAmbiScaling::SN3D) return AmbiScale::FromSN3D();
return AmbiScale::FromN3D();
if(scaletype == DevAmbiScaling::FuMa) return al::span{AmbiScale::FromFuMa};
if(scaletype == DevAmbiScaling::SN3D) return al::span{AmbiScale::FromSN3D};
return al::span{AmbiScale::FromN3D};
}
inline auto& GetAmbiLayout(DevAmbiLayout layouttype) noexcept
constexpr auto GetAmbiLayout(DevAmbiLayout layouttype) noexcept
{
if(layouttype == DevAmbiLayout::FuMa) return AmbiIndex::FromFuMa();
return AmbiIndex::FromACN();
if(layouttype == DevAmbiLayout::FuMa) return al::span{AmbiIndex::FromFuMa};
return al::span{AmbiIndex::FromACN};
}
@ -355,8 +355,8 @@ DecoderView MakeDecoderView(ALCdevice *device, const AmbDecConf *conf,
const auto num_coeffs = decoder.mIs3D ? AmbiChannelsFromOrder(decoder.mOrder)
: Ambi2DChannelsFromOrder(decoder.mOrder);
const auto idx_map = decoder.mIs3D ? AmbiIndex::FromACN().data()
: AmbiIndex::FromACN2D().data();
const auto idx_map = decoder.mIs3D ? AmbiIndex::FromACN.data()
: AmbiIndex::FromACN2D.data();
const auto hfmatrix = conf->HFMatrix;
const auto lfmatrix = conf->LFMatrix;
@ -601,13 +601,13 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=
case DevFmtX714: decoder = X714Config; break;
case DevFmtX3D71: decoder = X3D71Config; break;
case DevFmtAmbi3D:
auto&& acnmap = GetAmbiLayout(device->mAmbiLayout);
auto&& n3dscale = GetAmbiScales(device->mAmbiScale);
const auto acnmap = GetAmbiLayout(device->mAmbiLayout);
const auto n3dscale = GetAmbiScales(device->mAmbiScale);
/* For DevFmtAmbi3D, the ambisonic order is already set. */
const size_t count{AmbiChannelsFromOrder(device->mAmbiOrder)};
std::transform(acnmap.begin(), acnmap.begin()+count, std::begin(device->Dry.AmbiMap),
[&n3dscale](const uint8_t &acn) noexcept -> BFChannelConfig
[n3dscale](const uint8_t &acn) noexcept -> BFChannelConfig
{ return BFChannelConfig{1.0f/n3dscale[acn], acn}; });
AllocChannels(device, count, 0);
device->m2DMixing = false;
@ -640,8 +640,8 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=
continue;
}
auto ordermap = decoder.mIs3D ? AmbiIndex::OrderFromChannel().data()
: AmbiIndex::OrderFrom2DChannel().data();
auto ordermap = decoder.mIs3D ? AmbiIndex::OrderFromChannel.data()
: AmbiIndex::OrderFrom2DChannel.data();
chancoeffs.resize(maxz(chancoeffs.size(), idx+1u), ChannelDec{});
al::span<const float,MaxAmbiChannels> src{decoder.mCoeffs[i]};
@ -663,11 +663,11 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=
device->mAmbiOrder = decoder.mOrder;
device->m2DMixing = !decoder.mIs3D;
const al::span<const uint8_t> acnmap{decoder.mIs3D ? AmbiIndex::FromACN().data() :
AmbiIndex::FromACN2D().data(), ambicount};
auto&& coeffscale = GetAmbiScales(decoder.mScaling);
const al::span<const uint8_t> acnmap{decoder.mIs3D ? AmbiIndex::FromACN.data() :
AmbiIndex::FromACN2D.data(), ambicount};
const auto coeffscale = GetAmbiScales(decoder.mScaling);
std::transform(acnmap.begin(), acnmap.end(), std::begin(device->Dry.AmbiMap),
[&coeffscale](const uint8_t &acn) noexcept
[coeffscale](const uint8_t &acn) noexcept
{ return BFChannelConfig{1.0f/coeffscale[acn], acn}; });
AllocChannels(device, ambicount, device->channelsFromFmt());
@ -902,7 +902,7 @@ void InitHrtfPanning(ALCdevice *device)
device->m2DMixing = false;
const size_t count{AmbiChannelsFromOrder(ambi_order)};
std::transform(AmbiIndex::FromACN().begin(), AmbiIndex::FromACN().begin()+count,
std::transform(AmbiIndex::FromACN.begin(), AmbiIndex::FromACN.begin()+count,
std::begin(device->Dry.AmbiMap),
[](const uint8_t &index) noexcept { return BFChannelConfig{1.0f, index}; }
);
@ -925,10 +925,10 @@ void InitUhjPanning(ALCdevice *device)
device->mAmbiOrder = 1;
device->m2DMixing = true;
auto acnmap_begin = AmbiIndex::FromFuMa2D().begin();
auto acnmap_begin = AmbiIndex::FromFuMa2D.begin();
std::transform(acnmap_begin, acnmap_begin + count, std::begin(device->Dry.AmbiMap),
[](const uint8_t &acn) noexcept -> BFChannelConfig
{ return BFChannelConfig{1.0f/AmbiScale::FromUHJ()[acn], acn}; });
{ return BFChannelConfig{1.0f/AmbiScale::FromUHJ[acn], acn}; });
AllocChannels(device, count, device->channelsFromFmt());
}
@ -979,28 +979,39 @@ void aluInitRenderer(ALCdevice *device, int hrtf_id, std::optional<StereoEncodin
{
ERR("Failed to load layout file %s\n", config);
ERR(" %s\n", err->c_str());
return false;
}
else if(conf.NumSpeakers > MAX_OUTPUT_CHANNELS)
{
ERR("Unsupported decoder speaker count %zu (max %d)\n", conf.NumSpeakers,
MAX_OUTPUT_CHANNELS);
return false;
}
else if(conf.ChanMask > Ambi3OrderMask)
{
ERR("Unsupported decoder channel mask 0x%04x (max 0x%x)\n", conf.ChanMask,
Ambi3OrderMask);
else
{
device->mXOverFreq = clampf(conf.XOverFreq, 100.0f, 1000.0f);
decoder_store = std::make_unique<DecoderConfig<DualBand,MAX_OUTPUT_CHANNELS>>();
decoder = MakeDecoderView(device, &conf, *decoder_store);
for(size_t i{0};i < decoder.mChannels.size();++i)
speakerdists[i] = conf.Speakers[i].Distance;
return false;
}
TRACE("Using %s decoder: \"%s\"\n", DevFmtChannelsString(device->FmtChans),
conf.Description.c_str());
device->mXOverFreq = clampf(conf.XOverFreq, 100.0f, 1000.0f);
decoder_store = std::make_unique<DecoderConfig<DualBand,MAX_OUTPUT_CHANNELS>>();
decoder = MakeDecoderView(device, &conf, *decoder_store);
for(size_t i{0};i < decoder.mChannels.size();++i)
speakerdists[i] = conf.Speakers[i].Distance;
return true;
};
bool usingCustom{false};
if(layout)
{
if(auto decopt = device->configValue<std::string>("decoder", layout))
load_config(decopt->c_str());
usingCustom = load_config(decopt->c_str());
}
if(!usingCustom && device->FmtChans != DevFmtAmbi3D)
TRACE("Using built-in %s decoder\n", DevFmtChannelsString(device->FmtChans));
/* Enable the stablizer only for formats that have front-left, front-
* right, and front-center outputs.
@ -1144,7 +1155,7 @@ void aluInitEffectPanning(EffectSlot *slot, ALCcontext *context)
slot->mWetBuffer.resize(count);
auto acnmap_begin = AmbiIndex::FromACN().begin();
auto acnmap_begin = AmbiIndex::FromACN.begin();
auto iter = std::transform(acnmap_begin, acnmap_begin + count, slot->Wet.AmbiMap.begin(),
[](const uint8_t &acn) noexcept -> BFChannelConfig
{ return BFChannelConfig{1.0f, acn}; });

View File

@ -48,70 +48,54 @@ inline constexpr size_t MaxAmbi2DChannels{Ambi2DChannelsFromOrder(MaxAmbiOrder)}
* coefficients should be divided by these values to get proper scalings.
*/
struct AmbiScale {
static auto& FromN3D() noexcept
{
static constexpr const std::array<float,MaxAmbiChannels> ret{{
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
}};
return ret;
}
static auto& FromSN3D() noexcept
{
static constexpr const std::array<float,MaxAmbiChannels> ret{{
1.000000000f, /* ACN 0, sqrt(1) */
1.732050808f, /* ACN 1, sqrt(3) */
1.732050808f, /* ACN 2, sqrt(3) */
1.732050808f, /* ACN 3, sqrt(3) */
2.236067978f, /* ACN 4, sqrt(5) */
2.236067978f, /* ACN 5, sqrt(5) */
2.236067978f, /* ACN 6, sqrt(5) */
2.236067978f, /* ACN 7, sqrt(5) */
2.236067978f, /* ACN 8, sqrt(5) */
2.645751311f, /* ACN 9, sqrt(7) */
2.645751311f, /* ACN 10, sqrt(7) */
2.645751311f, /* ACN 11, sqrt(7) */
2.645751311f, /* ACN 12, sqrt(7) */
2.645751311f, /* ACN 13, sqrt(7) */
2.645751311f, /* ACN 14, sqrt(7) */
2.645751311f, /* ACN 15, sqrt(7) */
}};
return ret;
}
static auto& FromFuMa() noexcept
{
static constexpr const std::array<float,MaxAmbiChannels> ret{{
1.414213562f, /* ACN 0 (W), sqrt(2) */
1.732050808f, /* ACN 1 (Y), sqrt(3) */
1.732050808f, /* ACN 2 (Z), sqrt(3) */
1.732050808f, /* ACN 3 (X), sqrt(3) */
1.936491673f, /* ACN 4 (V), sqrt(15)/2 */
1.936491673f, /* ACN 5 (T), sqrt(15)/2 */
2.236067978f, /* ACN 6 (R), sqrt(5) */
1.936491673f, /* ACN 7 (S), sqrt(15)/2 */
1.936491673f, /* ACN 8 (U), sqrt(15)/2 */
2.091650066f, /* ACN 9 (Q), sqrt(35/8) */
1.972026594f, /* ACN 10 (O), sqrt(35)/3 */
2.231093404f, /* ACN 11 (M), sqrt(224/45) */
2.645751311f, /* ACN 12 (K), sqrt(7) */
2.231093404f, /* ACN 13 (L), sqrt(224/45) */
1.972026594f, /* ACN 14 (N), sqrt(35)/3 */
2.091650066f, /* ACN 15 (P), sqrt(35/8) */
}};
return ret;
}
static auto& FromUHJ() noexcept
{
static constexpr const std::array<float,MaxAmbiChannels> ret{{
1.000000000f, /* ACN 0 (W), sqrt(1) */
1.224744871f, /* ACN 1 (Y), sqrt(3/2) */
1.224744871f, /* ACN 2 (Z), sqrt(3/2) */
1.224744871f, /* ACN 3 (X), sqrt(3/2) */
/* Higher orders not relevant for UHJ. */
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
}};
return ret;
}
static inline constexpr std::array<float,MaxAmbiChannels> FromN3D{{
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
}};
static inline constexpr std::array<float,MaxAmbiChannels> FromSN3D{{
1.000000000f, /* ACN 0, sqrt(1) */
1.732050808f, /* ACN 1, sqrt(3) */
1.732050808f, /* ACN 2, sqrt(3) */
1.732050808f, /* ACN 3, sqrt(3) */
2.236067978f, /* ACN 4, sqrt(5) */
2.236067978f, /* ACN 5, sqrt(5) */
2.236067978f, /* ACN 6, sqrt(5) */
2.236067978f, /* ACN 7, sqrt(5) */
2.236067978f, /* ACN 8, sqrt(5) */
2.645751311f, /* ACN 9, sqrt(7) */
2.645751311f, /* ACN 10, sqrt(7) */
2.645751311f, /* ACN 11, sqrt(7) */
2.645751311f, /* ACN 12, sqrt(7) */
2.645751311f, /* ACN 13, sqrt(7) */
2.645751311f, /* ACN 14, sqrt(7) */
2.645751311f, /* ACN 15, sqrt(7) */
}};
static inline constexpr std::array<float,MaxAmbiChannels> FromFuMa{{
1.414213562f, /* ACN 0 (W), sqrt(2) */
1.732050808f, /* ACN 1 (Y), sqrt(3) */
1.732050808f, /* ACN 2 (Z), sqrt(3) */
1.732050808f, /* ACN 3 (X), sqrt(3) */
1.936491673f, /* ACN 4 (V), sqrt(15)/2 */
1.936491673f, /* ACN 5 (T), sqrt(15)/2 */
2.236067978f, /* ACN 6 (R), sqrt(5) */
1.936491673f, /* ACN 7 (S), sqrt(15)/2 */
1.936491673f, /* ACN 8 (U), sqrt(15)/2 */
2.091650066f, /* ACN 9 (Q), sqrt(35/8) */
1.972026594f, /* ACN 10 (O), sqrt(35)/3 */
2.231093404f, /* ACN 11 (M), sqrt(224/45) */
2.645751311f, /* ACN 12 (K), sqrt(7) */
2.231093404f, /* ACN 13 (L), sqrt(224/45) */
1.972026594f, /* ACN 14 (N), sqrt(35)/3 */
2.091650066f, /* ACN 15 (P), sqrt(35/8) */
}};
static inline constexpr std::array<float,MaxAmbiChannels> FromUHJ{{
1.000000000f, /* ACN 0 (W), sqrt(1) */
1.224744871f, /* ACN 1 (Y), sqrt(3/2) */
1.224744871f, /* ACN 2 (Z), sqrt(3/2) */
1.224744871f, /* ACN 3 (X), sqrt(3/2) */
/* Higher orders not relevant for UHJ. */
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
}};
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
static std::array<float,MaxAmbiOrder+1> GetHFOrderScales(const uint src_order,
@ -127,72 +111,49 @@ struct AmbiScale {
};
struct AmbiIndex {
static auto& FromFuMa() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbiChannels> ret{{
0, /* W */
3, /* X */
1, /* Y */
2, /* Z */
6, /* R */
7, /* S */
5, /* T */
8, /* U */
4, /* V */
12, /* K */
13, /* L */
11, /* M */
14, /* N */
10, /* O */
15, /* P */
9, /* Q */
}};
return ret;
}
static auto& FromFuMa2D() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbi2DChannels> ret{{
0, /* W */
3, /* X */
1, /* Y */
8, /* U */
4, /* V */
15, /* P */
9, /* Q */
}};
return ret;
}
static inline constexpr std::array<uint8_t,MaxAmbiChannels> FromFuMa{{
0, /* W */
3, /* X */
1, /* Y */
2, /* Z */
6, /* R */
7, /* S */
5, /* T */
8, /* U */
4, /* V */
12, /* K */
13, /* L */
11, /* M */
14, /* N */
10, /* O */
15, /* P */
9, /* Q */
}};
static inline constexpr std::array<uint8_t,MaxAmbi2DChannels> FromFuMa2D{{
0, /* W */
3, /* X */
1, /* Y */
8, /* U */
4, /* V */
15, /* P */
9, /* Q */
}};
static auto& FromACN() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbiChannels> ret{{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15
}};
return ret;
}
static auto& FromACN2D() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbi2DChannels> ret{{
0, 1,3, 4,8, 9,15
}};
return ret;
}
static inline constexpr std::array<uint8_t,MaxAmbiChannels> FromACN{{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15
}};
static inline constexpr std::array<uint8_t,MaxAmbi2DChannels> FromACN2D{{
0, 1,3, 4,8, 9,15
}};
static auto& OrderFromChannel() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbiChannels> ret{{
0, 1,1,1, 2,2,2,2,2, 3,3,3,3,3,3,3,
}};
return ret;
}
static auto& OrderFrom2DChannel() noexcept
{
static constexpr const std::array<uint8_t,MaxAmbi2DChannels> ret{{
0, 1,1, 2,2, 3,3,
}};
return ret;
}
static inline constexpr std::array<uint8_t,MaxAmbiChannels> OrderFromChannel{{
0, 1,1,1, 2,2,2,2,2, 3,3,3,3,3,3,3,
}};
static inline constexpr std::array<uint8_t,MaxAmbi2DChannels> OrderFrom2DChannel{{
0, 1,1, 2,2, 3,3,
}};
};

View File

@ -289,7 +289,7 @@ void DirectHrtfState::build(const HrtfStore *Hrtf, const uint irSize, const bool
mChannels[0].mSplitter.init(static_cast<float>(xover_norm));
for(size_t i{0};i < mChannels.size();++i)
{
const size_t order{AmbiIndex::OrderFromChannel()[i]};
const size_t order{AmbiIndex::OrderFromChannel[i]};
mChannels[i].mSplitter = mChannels[0].mSplitter;
mChannels[i].mHfScale = AmbiOrderHFGain[order];
}

View File

@ -1273,7 +1273,7 @@ void Voice::prepare(DeviceBase *device)
else if(mAmbiOrder && device->mAmbiOrder > mAmbiOrder)
{
const uint8_t *OrderFromChan{Is2DAmbisonic(mFmtChannels) ?
AmbiIndex::OrderFrom2DChannel().data() : AmbiIndex::OrderFromChannel().data()};
AmbiIndex::OrderFrom2DChannel.data() : AmbiIndex::OrderFromChannel.data()};
const auto scales = AmbiScale::GetHFOrderScales(mAmbiOrder, device->mAmbiOrder,
device->m2DMixing);