Don't apply distance attenuation when the slot's AuxSendAuto is off
[openal-soft.git] / al / buffer.h
blobf7661ec889feb71e8219ecb18cfba64f8c4983de
1 #ifndef AL_BUFFER_H
2 #define AL_BUFFER_H
4 #include <array>
5 #include <atomic>
6 #include <cstddef>
7 #include <cstdint>
8 #include <string_view>
9 #include <utility>
11 #include "AL/al.h"
12 #include "AL/alc.h"
14 #include "alc/inprogext.h"
15 #include "almalloc.h"
16 #include "alnumeric.h"
17 #include "core/buffer_storage.h"
18 #include "vector.h"
20 #ifdef ALSOFT_EAX
21 enum class EaxStorage : uint8_t {
22 Automatic,
23 Accessible,
24 Hardware
26 #endif // ALSOFT_EAX
29 struct ALbuffer : public BufferStorage {
30 ALbitfieldSOFT Access{0u};
32 al::vector<std::byte,16> mDataStorage;
34 ALuint OriginalSize{0};
36 ALuint UnpackAlign{0};
37 ALuint PackAlign{0};
38 ALuint UnpackAmbiOrder{1};
40 ALbitfieldSOFT MappedAccess{0u};
41 ALsizei MappedOffset{0};
42 ALsizei MappedSize{0};
44 ALuint mLoopStart{0u};
45 ALuint mLoopEnd{0u};
47 /* Number of times buffer was attached to a source (deletion can only occur when 0) */
48 std::atomic<ALuint> ref{0u};
50 /* Self ID */
51 ALuint id{0};
53 static void SetName(ALCcontext *context, ALuint id, std::string_view name);
55 DISABLE_ALLOC
57 #ifdef ALSOFT_EAX
58 EaxStorage eax_x_ram_mode{EaxStorage::Automatic};
59 bool eax_x_ram_is_hardware{};
60 #endif // ALSOFT_EAX
63 struct BufferSubList {
64 uint64_t FreeMask{~0_u64};
65 gsl::owner<std::array<ALbuffer,64>*> Buffers{nullptr};
67 BufferSubList() noexcept = default;
68 BufferSubList(const BufferSubList&) = delete;
69 BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers}
70 { rhs.FreeMask = ~0_u64; rhs.Buffers = nullptr; }
71 ~BufferSubList();
73 BufferSubList& operator=(const BufferSubList&) = delete;
74 BufferSubList& operator=(BufferSubList&& rhs) noexcept
75 { std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; }
78 #endif