Skip to content

Commit 742c619

Browse files
committed
Rename ALeffectslot
1 parent 4835bf7 commit 742c619

File tree

9 files changed

+117
-114
lines changed

9 files changed

+117
-114
lines changed

al/auxeffectslot.cpp

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

al/auxeffectslot.h

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#include "eax/utils.h"
3131
#endif // ALSOFT_EAX
3232

33-
namespace al {
34-
struct Context;
35-
struct Buffer;
36-
} // namespace al
3733

3834
#if ALSOFT_EAX
3935
/* NOLINTNEXTLINE(clazy-copyable-polymorphic) Exceptions must be copyable. */
@@ -49,11 +45,16 @@ enum class SlotState : bool {
4945
Initial, Playing,
5046
};
5147

52-
struct ALeffectslot {
48+
namespace al {
49+
50+
struct Context;
51+
struct Buffer;
52+
53+
struct EffectSlot {
5354
u32 mEffectId{};
5455
f32 mGain{1.0f};
5556
bool mAuxSendAuto{true};
56-
al::intrusive_ptr<ALeffectslot> mTarget;
57+
al::intrusive_ptr<EffectSlot> mTarget;
5758
al::intrusive_ptr<al::Buffer> mBuffer;
5859

5960
struct EffectData {
@@ -75,10 +76,10 @@ struct ALeffectslot {
7576
/* Self ID */
7677
u32 mId{};
7778

78-
explicit ALeffectslot(gsl::not_null<al::Context*> context);
79-
ALeffectslot(const ALeffectslot&) = delete;
80-
ALeffectslot& operator=(const ALeffectslot&) = delete;
81-
~ALeffectslot();
79+
explicit EffectSlot(gsl::not_null<al::Context*> context);
80+
EffectSlot(const EffectSlot&) = delete;
81+
auto operator=(const EffectSlot&) -> EffectSlot& = delete;
82+
~EffectSlot();
8283

8384
auto inc_ref() noexcept { return mRef.fetch_add(1, std::memory_order_acq_rel)+1; }
8485
auto dec_ref() noexcept { return mRef.fetch_sub(1, std::memory_order_acq_rel)-1; }
@@ -89,14 +90,12 @@ struct ALeffectslot {
8990
}
9091

9192
auto initEffect(u32 effectId, ALenum effectType, const EffectProps &effectProps,
92-
gsl::not_null<al::Context*> context) -> void;
93-
void updateProps(gsl::not_null<al::Context*> context) const;
94-
95-
static void SetName(gsl::not_null<al::Context*> context, u32 id, std::string_view name);
93+
gsl::not_null<Context*> context) -> void;
94+
void updateProps(gsl::not_null<Context*> context) const;
9695

96+
static void SetName(gsl::not_null<Context*> context, u32 id, std::string_view name);
9797

9898
#if ALSOFT_EAX
99-
public:
10099
void eax_initialize(EaxFxSlotIndexValue index);
101100

102101
[[nodiscard]]
@@ -250,7 +249,7 @@ struct ALeffectslot {
250249
}
251250
};
252251

253-
gsl::not_null<al::Context*> const mEaxALContext;
252+
gsl::not_null<Context*> const mEaxALContext;
254253
EaxFxSlotIndexValue mEaxFXSlotIndex{};
255254
int mEaxVersion{}; // Current EAX version.
256255
std::bitset<eax_dirty_bit_count> mEaxDf; // Dirty flags for the current EAX version.
@@ -345,33 +344,35 @@ struct ALeffectslot {
345344
void eax5_fx_slot_commit(Eax5State& state, std::bitset<eax_dirty_bit_count>& dst_df);
346345

347346
// `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_EFFECT, effect)`
348-
void eax_set_efx_slot_effect(EaxEffect &effect);
347+
void eax_set_efx_slot_effect(EaxEffect const &effect);
349348

350349
// `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, value)`
351350
void eax_set_efx_slot_send_auto(bool is_send_auto);
352351

353352
// `alAuxiliaryEffectSlotf(effect_slot, AL_EFFECTSLOT_GAIN, gain)`
354-
void eax_set_efx_slot_gain(ALfloat gain);
353+
void eax_set_efx_slot_gain(f32 gain);
355354

356355
public:
357356
class EaxDeleter {
358357
public:
359-
void operator()(gsl::not_null<ALeffectslot*> effect_slot) const;
358+
void operator()(gsl::not_null<EffectSlot*> effect_slot) const;
360359
};
361360
#endif // ALSOFT_EAX
362361
};
363362

363+
} /* namespace al */
364+
364365
void UpdateAllEffectSlotProps(gsl::not_null<al::Context*> context);
365366

366367
#if ALSOFT_EAX
367-
using EaxAlEffectSlotUPtr = std::unique_ptr<ALeffectslot, ALeffectslot::EaxDeleter>;
368+
using EaxAlEffectSlotUPtr = std::unique_ptr<al::EffectSlot, al::EffectSlot::EaxDeleter>;
368369

369370
auto eax_create_al_effect_slot(gsl::not_null<al::Context*> context) -> EaxAlEffectSlotUPtr;
370371
#endif // ALSOFT_EAX
371372

372373
struct EffectSlotSubList {
373374
uint64_t mFreeMask{~0_u64};
374-
gsl::owner<std::array<ALeffectslot,64>*> mEffectSlots{nullptr};
375+
gsl::owner<std::array<al::EffectSlot,64>*> mEffectSlots{nullptr};
375376

376377
EffectSlotSubList() noexcept = default;
377378
EffectSlotSubList(const EffectSlotSubList&) = delete;

al/debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ try {
513513
case AL_BUFFER: al::Buffer::SetName(context, name, objname); return;
514514
case AL_FILTER_EXT: ALfilter::SetName(context, name, objname); return;
515515
case AL_EFFECT_EXT: ALeffect::SetName(context, name, objname); return;
516-
case AL_AUXILIARY_EFFECT_SLOT_EXT: ALeffectslot::SetName(context, name, objname); return;
516+
case AL_AUXILIARY_EFFECT_SLOT_EXT: al::EffectSlot::SetName(context, name, objname); return;
517517
}
518518

519519
context->throw_error(AL_INVALID_ENUM, "Invalid name identifier {:#04x}",

al/eax/fx_slots.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class EaxFxSlotsException final : public EaxException {
1919

2020
} // namespace
2121

22-
2322
void EaxFxSlots::initialize(gsl::not_null<al::Context*> al_context)
2423
{
2524
auto fx_slot_index = EaxFxSlotIndexValue{};
@@ -38,20 +37,20 @@ void EaxFxSlots::uninitialize() noexcept
3837
fx_slot = nullptr;
3938
}
4039

41-
const ALeffectslot &EaxFxSlots::get(EaxFxSlotIndex index) const
40+
auto EaxFxSlots::get(EaxFxSlotIndex const index) const -> al::EffectSlot const&
4241
{
4342
if(!index.has_value())
4443
fail("Empty index.");
4544
return *fx_slots_[index.value()];
4645
}
4746

48-
ALeffectslot &EaxFxSlots::get(EaxFxSlotIndex index)
47+
auto EaxFxSlots::get(EaxFxSlotIndex const index) -> al::EffectSlot&
4948
{
5049
if(!index.has_value())
5150
fail("Empty index.");
5251
return *fx_slots_[index.value()];
5352
}
5453

5554
[[noreturn]]
56-
void EaxFxSlots::fail(const std::string_view message)
55+
void EaxFxSlots::fail(std::string_view const message)
5756
{ throw EaxFxSlotsException{message}; }

al/eax/fx_slots.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class EaxFxSlots {
2424
fx_slot->eax_commit();
2525
}
2626

27-
[[nodiscard]] auto get(EaxFxSlotIndex index) const -> const ALeffectslot&;
28-
[[nodiscard]] auto get(EaxFxSlotIndex index) -> ALeffectslot&;
27+
[[nodiscard]] auto get(EaxFxSlotIndex index) const -> const al::EffectSlot&;
28+
[[nodiscard]] auto get(EaxFxSlotIndex index) -> al::EffectSlot&;
2929

3030
private:
3131
using Items = std::array<EaxAlEffectSlotUPtr, EAX_MAX_FXSLOTS>;

al/source.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -870,26 +870,26 @@ auto LookupFilter(gsl::not_null<al::Context*> context, std::unsigned_integral au
870870
context->throw_error(AL_INVALID_NAME, "Invalid filter ID {}", id);
871871
}
872872

873-
inline auto LookupEffectSlot(std::nothrow_t, gsl::not_null<al::Context*> context,
874-
std::unsigned_integral auto id) noexcept -> ALeffectslot*
873+
auto LookupEffectSlot(std::nothrow_t, gsl::not_null<al::Context*> const context,
874+
std::unsigned_integral auto const id) noexcept -> al::EffectSlot*
875875
{
876876
const auto lidx = (id-1) >> 6;
877877
const auto slidx = (id-1) & 0x3f;
878878

879879
if(lidx >= context->mEffectSlotList.size()) [[unlikely]]
880880
return nullptr;
881-
auto &sublist{context->mEffectSlotList[gsl::narrow_cast<size_t>(lidx)]};
881+
auto &sublist = context->mEffectSlotList[gsl::narrow_cast<usize>(lidx)];
882882
if(sublist.mFreeMask & (1_u64 << slidx)) [[unlikely]]
883883
return nullptr;
884-
return std::to_address(sublist.mEffectSlots->begin() + gsl::narrow_cast<size_t>(slidx));
884+
return std::to_address(sublist.mEffectSlots->begin() + gsl::narrow_cast<isize>(slidx));
885885
}
886886

887887
[[nodiscard]]
888-
auto LookupEffectSlot(gsl::not_null<al::Context*> context, std::unsigned_integral auto id)
889-
-> gsl::not_null<ALeffectslot*>
888+
auto LookupEffectSlot(gsl::not_null<al::Context*> const context,
889+
std::unsigned_integral auto const id) -> gsl::not_null<al::EffectSlot*>
890890
{
891-
if(auto *slot = LookupEffectSlot(std::nothrow, context, id))
892-
[[likely]] return gsl::make_not_null(slot);
891+
if(auto *const slot = LookupEffectSlot(std::nothrow, context, id)) [[likely]]
892+
return gsl::make_not_null(slot);
893893
context->throw_error(AL_INVALID_NAME, "Invalid effect slot ID {}", id);
894894
}
895895

@@ -1974,7 +1974,7 @@ NOINLINE void SetProperty(const gsl::not_null<ALsource*> Source,
19741974
const auto filterid = as_unsigned(values[2]);
19751975

19761976
const auto slotlock = std::unique_lock{Context->mEffectSlotLock};
1977-
auto slot = al::intrusive_ptr<ALeffectslot>{};
1977+
auto slot = al::intrusive_ptr<al::EffectSlot>{};
19781978
if(slotid)
19791979
slot = LookupEffectSlot(Context, slotid)->newReference();
19801980

@@ -4043,7 +4043,7 @@ auto ALsource::eax_create_direct_filter_param() const noexcept -> EaxAlLowPassPa
40434043
return EaxAlLowPassParam{level_mb_to_gain(gain_mb), level_mb_to_gain(gainhf_mb)};
40444044
}
40454045

4046-
auto ALsource::eax_create_room_filter_param(const ALeffectslot &fx_slot,
4046+
auto ALsource::eax_create_room_filter_param(const al::EffectSlot &fx_slot,
40474047
const EAXSOURCEALLSENDPROPERTIES& send) const noexcept -> EaxAlLowPassParam
40484048
{
40494049
auto gain_mb = 0.0f;
@@ -4751,7 +4751,7 @@ void ALsource::eax_get(const EaxCall &call) const
47514751
}
47524752
}
47534753

4754-
void ALsource::eax_set_al_source_send(al::intrusive_ptr<ALeffectslot> slot, size_t sendidx,
4754+
void ALsource::eax_set_al_source_send(al::intrusive_ptr<al::EffectSlot> slot, usize const sendidx,
47554755
const EaxAlLowPassParam &filter)
47564756
{
47574757
if(sendidx >= EAX_MAX_FXSLOTS)

al/source.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
namespace al {
3838
struct Context;
3939
struct Buffer;
40+
struct EffectSlot;
4041
} // namespace al
41-
struct ALeffectslot;
4242
enum class Resampler : u8;
4343

4444
enum class SourceStereo : bool {
@@ -128,7 +128,7 @@ struct ALsource {
128128
DirectData Direct;
129129

130130
struct SendData {
131-
al::intrusive_ptr<ALeffectslot> mSlot;
131+
al::intrusive_ptr<al::EffectSlot> mSlot;
132132
float mGain{};
133133
float mGainHF{};
134134
float mHFReference{};
@@ -857,7 +857,7 @@ struct ALsource {
857857

858858
[[nodiscard]] auto eax_create_direct_filter_param() const noexcept -> EaxAlLowPassParam;
859859

860-
[[nodiscard]] auto eax_create_room_filter_param(const ALeffectslot& fx_slot,
860+
[[nodiscard]] auto eax_create_room_filter_param(al::EffectSlot const& fx_slot,
861861
const EAXSOURCEALLSENDPROPERTIES& send) const noexcept -> EaxAlLowPassParam;
862862

863863
void eax_update_direct_filter();
@@ -1009,8 +1009,8 @@ struct ALsource {
10091009
void eax_set(const EaxCall& call);
10101010

10111011
// `alSource3i(source, AL_AUXILIARY_SEND_FILTER, ...)`
1012-
void eax_set_al_source_send(al::intrusive_ptr<ALeffectslot> slot, size_t sendidx,
1013-
const EaxAlLowPassParam &filter);
1012+
void eax_set_al_source_send(al::intrusive_ptr<al::EffectSlot> slot, usize sendidx,
1013+
EaxAlLowPassParam const &filter);
10141014

10151015
void eax_commit_active_fx_slots();
10161016
#endif // ALSOFT_EAX
@@ -1019,7 +1019,7 @@ struct ALsource {
10191019
void UpdateAllSourceProps(gsl::not_null<al::Context*> context);
10201020

10211021
struct SourceSubList {
1022-
uint64_t FreeMask{~0_u64};
1022+
u64 FreeMask{~0_u64};
10231023
gsl::owner<std::array<ALsource,64>*> Sources{nullptr};
10241024

10251025
SourceSubList() noexcept = default;

alc/context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void Context::init()
174174
{
175175
if(sDefaultEffect.type != AL_EFFECT_NULL && mDevice->Type == DeviceType::Playback)
176176
{
177-
mDefaultSlot = std::make_unique<ALeffectslot>(gsl::make_not_null(this));
177+
mDefaultSlot = std::make_unique<EffectSlot>(gsl::make_not_null(this));
178178
aluInitEffectPanning(mDefaultSlot->mSlot, this);
179179
}
180180

alc/context.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ class EaxCall;
4141
#endif // ALSOFT_EAX
4242

4343
struct ALeffect;
44-
struct ALeffectslot;
44+
namespace al {
45+
struct EffectSlot;
46+
}
4547
struct DebugGroup;
4648
struct EffectSlotSubList;
4749
struct SourceSubList;
@@ -125,7 +127,7 @@ struct Context final : ALCcontext, intrusive_ref<Context,ContextDeleter>, Contex
125127
std::mutex mEffectSlotLock;
126128

127129
/* Default effect slot */
128-
std::unique_ptr<ALeffectslot> mDefaultSlot;
130+
std::unique_ptr<EffectSlot> mDefaultSlot;
129131

130132
std::vector<std::string_view> mExtensions;
131133
std::string mExtensionsString;
@@ -256,12 +258,13 @@ struct Context final : ALCcontext, intrusive_ref<Context,ContextDeleter>, Contex
256258
auto eaxGetPrimaryFxSlotIndex() const noexcept -> EaxFxSlotIndex
257259
{ return mEaxPrimaryFxSlotIndex; }
258260

259-
const ALeffectslot& eaxGetFxSlot(EaxFxSlotIndexValue fx_slot_index) const LIFETIMEBOUND
261+
auto eaxGetFxSlot(EaxFxSlotIndexValue const fx_slot_index) const LIFETIMEBOUND
262+
-> EffectSlot const&
260263
{ return mEaxFxSlots.get(fx_slot_index); }
261-
ALeffectslot& eaxGetFxSlot(EaxFxSlotIndexValue fx_slot_index) LIFETIMEBOUND
264+
auto eaxGetFxSlot(EaxFxSlotIndexValue const fx_slot_index) LIFETIMEBOUND -> EffectSlot&
262265
{ return mEaxFxSlots.get(fx_slot_index); }
263266

264-
bool eaxNeedsCommit() const noexcept { return mEaxNeedsCommit; }
267+
auto eaxNeedsCommit() const noexcept -> bool { return mEaxNeedsCommit; }
265268
void eaxCommit();
266269

267270
void eaxCommitFxSlots() const { mEaxFxSlots.commit(); }

0 commit comments

Comments
 (0)