From 06dcfc3fcfe7a93e9ec53406077b3211579cc92f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 27 Apr 2021 16:40:22 -0700 Subject: Rename alcmain.h to device.h --- CMakeLists.txt | 3 +- al/auxeffectslot.cpp | 2 +- al/auxeffectslot.h | 2 +- al/buffer.cpp | 2 +- al/effect.cpp | 2 +- al/filter.cpp | 2 +- al/source.cpp | 2 +- al/state.cpp | 12 ++--- alc/alc.cpp | 2 +- alc/alcmain.h | 127 ----------------------------------------------- alc/backends/sdl2.cpp | 5 +- alc/backends/sdl2.h | 2 +- alc/backends/solaris.cpp | 7 ++- alc/backends/solaris.h | 2 +- alc/device.cpp | 4 ++ alc/device.h | 110 ++++++++++++++++++++++++++++++++++++++++ alc/panning.cpp | 2 +- 17 files changed, 137 insertions(+), 151 deletions(-) delete mode 100644 alc/alcmain.h create mode 100644 alc/device.cpp create mode 100644 alc/device.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b286781..ac1e31d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,12 +763,13 @@ set(OPENAL_OBJS # ALC and related routines set(ALC_OBJS alc/alc.cpp - alc/alcmain.h alc/alu.cpp alc/alu.h alc/alconfig.cpp alc/alconfig.h alc/alcontext.h + alc/device.cpp + alc/device.h alc/effectslot.cpp alc/effectslot.h alc/effects/base.h diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index eee274b1..83904a44 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -36,9 +36,9 @@ #include "AL/efx.h" #include "albit.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" #include "alc/alu.h" +#include "alc/device.h" #include "alc/inprogext.h" #include "almalloc.h" #include "alnumeric.h" diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index ca73c757..27423830 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -8,7 +8,7 @@ #include "AL/alc.h" #include "AL/efx.h" -#include "alc/alcmain.h" +#include "alc/device.h" #include "alc/effectslot.h" #include "alc/effects/base.h" #include "almalloc.h" diff --git a/al/buffer.cpp b/al/buffer.cpp index aaffddf1..4623ae30 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -43,8 +43,8 @@ #include "albit.h" #include "albyte.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" +#include "alc/device.h" #include "alc/inprogext.h" #include "almalloc.h" #include "alnumeric.h" diff --git a/al/effect.cpp b/al/effect.cpp index 2c39394f..5b10df2e 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -39,8 +39,8 @@ #include "AL/efx.h" #include "albit.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" +#include "alc/device.h" #include "alc/effects/base.h" #include "almalloc.h" #include "alnumeric.h" diff --git a/al/filter.cpp b/al/filter.cpp index 09249c81..0c4e647f 100644 --- a/al/filter.cpp +++ b/al/filter.cpp @@ -37,8 +37,8 @@ #include "AL/efx.h" #include "albit.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" +#include "alc/device.h" #include "almalloc.h" #include "alnumeric.h" #include "core/except.h" diff --git a/al/source.cpp b/al/source.cpp index 25d84f9f..9c45ebda 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -46,10 +46,10 @@ #include "AL/efx.h" #include "albit.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" #include "alc/alu.h" #include "alc/backends/base.h" +#include "alc/device.h" #include "alc/inprogext.h" #include "almalloc.h" #include "alnumeric.h" diff --git a/al/state.cpp b/al/state.cpp index b0b05972..396c15c7 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -24,25 +24,25 @@ #include #include -#include -#include #include +#include +#include #include "AL/al.h" #include "AL/alc.h" #include "AL/alext.h" -#include "alc/alcmain.h" #include "alc/alcontext.h" #include "alc/alu.h" #include "alc/inprogext.h" -#include "almalloc.h" #include "alnumeric.h" -#include "alspan.h" +#include "aloptional.h" #include "atomic.h" +#include "core/context.h" #include "core/except.h" +#include "core/mixer/defs.h" #include "core/voice.h" -#include "event.h" +#include "intrusive_ptr.h" #include "opthelpers.h" #include "strutils.h" diff --git a/alc/alc.cpp b/alc/alc.cpp index 1f7b999d..9eface89 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -66,7 +66,6 @@ #include "al/listener.h" #include "al/source.h" #include "albit.h" -#include "alcmain.h" #include "albyte.h" #include "alconfig.h" #include "alcontext.h" @@ -94,6 +93,7 @@ #include "core/logging.h" #include "core/uhjfilter.h" #include "core/voice_change.h" +#include "device.h" #include "effects/base.h" #include "inprogext.h" #include "intrusive_ptr.h" diff --git a/alc/alcmain.h b/alc/alcmain.h deleted file mode 100644 index eb25b596..00000000 --- a/alc/alcmain.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef ALC_MAIN_H -#define ALC_MAIN_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "AL/al.h" -#include "AL/alc.h" -#include "AL/alext.h" - -#include "almalloc.h" -#include "alnumeric.h" -#include "alspan.h" -#include "atomic.h" -#include "core/ambidefs.h" -#include "core/bufferline.h" -#include "core/devformat.h" -#include "core/device.h" -#include "core/filters/splitter.h" -#include "core/hrtf.h" -#include "core/mixer/defs.h" -#include "inprogext.h" -#include "intrusive_ptr.h" -#include "vector.h" - -struct ALbuffer; -struct ALeffect; -struct ALfilter; - -using uint = unsigned int; - - -struct BufferSubList { - uint64_t FreeMask{~0_u64}; - ALbuffer *Buffers{nullptr}; /* 64 */ - - BufferSubList() noexcept = default; - BufferSubList(const BufferSubList&) = delete; - BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers} - { rhs.FreeMask = ~0_u64; rhs.Buffers = nullptr; } - ~BufferSubList(); - - BufferSubList& operator=(const BufferSubList&) = delete; - BufferSubList& operator=(BufferSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; } -}; - -struct EffectSubList { - uint64_t FreeMask{~0_u64}; - ALeffect *Effects{nullptr}; /* 64 */ - - EffectSubList() noexcept = default; - EffectSubList(const EffectSubList&) = delete; - EffectSubList(EffectSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Effects{rhs.Effects} - { rhs.FreeMask = ~0_u64; rhs.Effects = nullptr; } - ~EffectSubList(); - - EffectSubList& operator=(const EffectSubList&) = delete; - EffectSubList& operator=(EffectSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(Effects, rhs.Effects); return *this; } -}; - -struct FilterSubList { - uint64_t FreeMask{~0_u64}; - ALfilter *Filters{nullptr}; /* 64 */ - - FilterSubList() noexcept = default; - FilterSubList(const FilterSubList&) = delete; - FilterSubList(FilterSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Filters{rhs.Filters} - { rhs.FreeMask = ~0_u64; rhs.Filters = nullptr; } - ~FilterSubList(); - - FilterSubList& operator=(const FilterSubList&) = delete; - FilterSubList& operator=(FilterSubList&& rhs) noexcept - { std::swap(FreeMask, rhs.FreeMask); std::swap(Filters, rhs.Filters); return *this; } -}; - - -struct ALCdevice : public al::intrusive_ref, DeviceBase { - ALCuint NumMonoSources{}; - ALCuint NumStereoSources{}; - - // Maximum number of sources that can be created - uint SourcesMax{}; - // Maximum number of slots that can be created - uint AuxiliaryEffectSlotMax{}; - - std::string mHrtfName; - al::vector mHrtfList; - ALCenum mHrtfStatus{ALC_FALSE}; - - ALCenum LimiterState{ALC_DONT_CARE_SOFT}; - - std::atomic LastError{ALC_NO_ERROR}; - - // Map of Buffers for this device - std::mutex BufferLock; - al::vector BufferList; - - // Map of Effects for this device - std::mutex EffectLock; - al::vector EffectList; - - // Map of Filters for this device - std::mutex FilterLock; - al::vector FilterList; - - - ALCdevice(DeviceType type) : DeviceBase{type} { } - ~ALCdevice(); - - void enumerateHrtfs(); - - DEF_NEWDEL(ALCdevice) -}; - -#endif diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index 800ae935..fe8ece31 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -20,16 +20,15 @@ #include "config.h" -#include "backends/sdl2.h" +#include "sdl2.h" #include #include #include #include -#include "alcmain.h" #include "almalloc.h" -#include "alu.h" +#include "core/device.h" #include "core/logging.h" #include diff --git a/alc/backends/sdl2.h b/alc/backends/sdl2.h index 3844b8bf..3bd8df86 100644 --- a/alc/backends/sdl2.h +++ b/alc/backends/sdl2.h @@ -1,7 +1,7 @@ #ifndef BACKENDS_SDL2_H #define BACKENDS_SDL2_H -#include "backends/base.h" +#include "base.h" struct SDL2BackendFactory final : public BackendFactory { public: diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp index 20414543..26f5a5c5 100644 --- a/alc/backends/solaris.cpp +++ b/alc/backends/solaris.cpp @@ -20,7 +20,7 @@ #include "config.h" -#include "backends/solaris.h" +#include "solaris.h" #include #include @@ -39,10 +39,9 @@ #include #include -#include "alcmain.h" #include "albyte.h" -#include "alu.h" -#include "alconfig.h" +#include "alc/alconfig.h" +#include "core/device.h" #include "core/helpers.h" #include "core/logging.h" #include "threads.h" diff --git a/alc/backends/solaris.h b/alc/backends/solaris.h index 4e80cf9a..5da6ad3a 100644 --- a/alc/backends/solaris.h +++ b/alc/backends/solaris.h @@ -1,7 +1,7 @@ #ifndef BACKENDS_SOLARIS_H #define BACKENDS_SOLARIS_H -#include "backends/base.h" +#include "base.h" struct SolarisBackendFactory final : public BackendFactory { public: diff --git a/alc/device.cpp b/alc/device.cpp new file mode 100644 index 00000000..954a790b --- /dev/null +++ b/alc/device.cpp @@ -0,0 +1,4 @@ + +#include "config.h" + +#include "device.h" diff --git a/alc/device.h b/alc/device.h new file mode 100644 index 00000000..2f465b16 --- /dev/null +++ b/alc/device.h @@ -0,0 +1,110 @@ +#ifndef ALC_DEVICE_H +#define ALC_DEVICE_H + +#include +#include +#include +#include +#include + +#include "AL/alc.h" +#include "AL/alext.h" + +#include "almalloc.h" +#include "alnumeric.h" +#include "core/device.h" +#include "intrusive_ptr.h" +#include "vector.h" + +struct ALbuffer; +struct ALeffect; +struct ALfilter; + +using uint = unsigned int; + + +struct BufferSubList { + uint64_t FreeMask{~0_u64}; + ALbuffer *Buffers{nullptr}; /* 64 */ + + BufferSubList() noexcept = default; + BufferSubList(const BufferSubList&) = delete; + BufferSubList(BufferSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Buffers{rhs.Buffers} + { rhs.FreeMask = ~0_u64; rhs.Buffers = nullptr; } + ~BufferSubList(); + + BufferSubList& operator=(const BufferSubList&) = delete; + BufferSubList& operator=(BufferSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Buffers, rhs.Buffers); return *this; } +}; + +struct EffectSubList { + uint64_t FreeMask{~0_u64}; + ALeffect *Effects{nullptr}; /* 64 */ + + EffectSubList() noexcept = default; + EffectSubList(const EffectSubList&) = delete; + EffectSubList(EffectSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Effects{rhs.Effects} + { rhs.FreeMask = ~0_u64; rhs.Effects = nullptr; } + ~EffectSubList(); + + EffectSubList& operator=(const EffectSubList&) = delete; + EffectSubList& operator=(EffectSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Effects, rhs.Effects); return *this; } +}; + +struct FilterSubList { + uint64_t FreeMask{~0_u64}; + ALfilter *Filters{nullptr}; /* 64 */ + + FilterSubList() noexcept = default; + FilterSubList(const FilterSubList&) = delete; + FilterSubList(FilterSubList&& rhs) noexcept : FreeMask{rhs.FreeMask}, Filters{rhs.Filters} + { rhs.FreeMask = ~0_u64; rhs.Filters = nullptr; } + ~FilterSubList(); + + FilterSubList& operator=(const FilterSubList&) = delete; + FilterSubList& operator=(FilterSubList&& rhs) noexcept + { std::swap(FreeMask, rhs.FreeMask); std::swap(Filters, rhs.Filters); return *this; } +}; + + +struct ALCdevice : public al::intrusive_ref, DeviceBase { + ALCuint NumMonoSources{}; + ALCuint NumStereoSources{}; + + // Maximum number of sources that can be created + uint SourcesMax{}; + // Maximum number of slots that can be created + uint AuxiliaryEffectSlotMax{}; + + std::string mHrtfName; + al::vector mHrtfList; + ALCenum mHrtfStatus{ALC_FALSE}; + + ALCenum LimiterState{ALC_DONT_CARE_SOFT}; + + std::atomic LastError{ALC_NO_ERROR}; + + // Map of Buffers for this device + std::mutex BufferLock; + al::vector BufferList; + + // Map of Effects for this device + std::mutex EffectLock; + al::vector EffectList; + + // Map of Filters for this device + std::mutex FilterLock; + al::vector FilterList; + + + ALCdevice(DeviceType type) : DeviceBase{type} { } + ~ALCdevice(); + + void enumerateHrtfs(); + + DEF_NEWDEL(ALCdevice) +}; + +#endif diff --git a/alc/panning.cpp b/alc/panning.cpp index 5e263111..00fe9023 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -38,7 +38,6 @@ #include "AL/alext.h" #include "al/auxeffectslot.h" -#include "alcmain.h" #include "alconfig.h" #include "alcontext.h" #include "almalloc.h" @@ -56,6 +55,7 @@ #include "core/hrtf.h" #include "core/logging.h" #include "core/uhjfilter.h" +#include "device.h" #include "math_defs.h" #include "opthelpers.h" -- cgit v1.2.3