aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-01-01 16:06:19 -0800
committerChris Robinson <[email protected]>2023-01-01 16:06:19 -0800
commit073f970788a35657537da1b1dc7c4af450888698 (patch)
tree96f9d5f5918d49f2243dedce525d98374fed22ae /alc
parentcba526e1b082150f4a7160775f2ee6cb2deb024c (diff)
Avoid some explicit casts and references
Diffstat (limited to 'alc')
-rw-r--r--alc/backends/pipewire.cpp10
-rw-r--r--alc/backends/pulseaudio.cpp18
-rw-r--r--alc/effects/convolution.cpp3
3 files changed, 16 insertions, 15 deletions
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index 3b3a72c0..9fe19e64 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -367,7 +367,7 @@ using PwStreamPtr = std::unique_ptr<pw_stream,PwStreamDeleter>;
/* Enums for bitflags... again... *sigh* */
constexpr pw_stream_flags operator|(pw_stream_flags lhs, pw_stream_flags rhs) noexcept
-{ return static_cast<pw_stream_flags>(lhs | std::underlying_type_t<pw_stream_flags>{rhs}); }
+{ return static_cast<pw_stream_flags>(lhs | al::to_underlying(rhs)); }
class ThreadMainloop {
pw_thread_loop *mLoop{};
@@ -608,7 +608,7 @@ DeviceNode *DeviceNode::Find(uint32_t id)
{ return n.mId == id; };
auto match = std::find_if(sList.begin(), sList.end(), match_id);
- if(match != sList.end()) return std::addressof(*match);
+ if(match != sList.end()) return al::to_address(match);
return nullptr;
}
@@ -862,10 +862,8 @@ void NodeProxy::infoCallback(const pw_node_info *info)
NodeType ntype{};
if(al::strcasecmp(media_class, AudioSinkClass) == 0)
ntype = NodeType::Sink;
- else if(
- al::strcasecmp(media_class, AudioSourceClass) == 0
- || al::strcasecmp(media_class, AudioSourceVirtualClass) == 0
- )
+ else if(al::strcasecmp(media_class, AudioSourceClass) == 0
+ || al::strcasecmp(media_class, AudioSourceVirtualClass) == 0)
ntype = NodeType::Source;
else if(al::strcasecmp(media_class, AudioDuplexClass) == 0)
ntype = NodeType::Duplex;
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 0e9bf268..5eef8f87 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -247,22 +247,26 @@ constexpr pa_channel_map MonoChanMap{
/* *grumble* Don't use enums for bitflags. */
-constexpr inline pa_stream_flags_t operator|(pa_stream_flags_t lhs, pa_stream_flags_t rhs)
-{ return pa_stream_flags_t(int(lhs) | int(rhs)); }
-inline pa_stream_flags_t& operator|=(pa_stream_flags_t &lhs, pa_stream_flags_t rhs)
+constexpr pa_stream_flags_t operator|(pa_stream_flags_t lhs, pa_stream_flags_t rhs)
+{ return pa_stream_flags_t(lhs | al::to_underlying(rhs)); }
+constexpr pa_stream_flags_t& operator|=(pa_stream_flags_t &lhs, pa_stream_flags_t rhs)
{
lhs = lhs | rhs;
return lhs;
}
-inline pa_stream_flags_t& operator&=(pa_stream_flags_t &lhs, int rhs)
+constexpr pa_stream_flags_t operator~(pa_stream_flags_t flag)
+{ return pa_stream_flags_t(~al::to_underlying(flag)); }
+constexpr pa_stream_flags_t& operator&=(pa_stream_flags_t &lhs, pa_stream_flags_t rhs)
{
- lhs = pa_stream_flags_t(int(lhs) & rhs);
+ lhs = pa_stream_flags_t(al::to_underlying(lhs) & rhs);
return lhs;
}
-inline pa_context_flags_t& operator|=(pa_context_flags_t &lhs, pa_context_flags_t rhs)
+constexpr pa_context_flags_t operator|(pa_context_flags_t lhs, pa_context_flags_t rhs)
+{ return pa_context_flags_t(lhs | al::to_underlying(rhs)); }
+constexpr pa_context_flags_t& operator|=(pa_context_flags_t &lhs, pa_context_flags_t rhs)
{
- lhs = pa_context_flags_t(int(lhs) | int(rhs));
+ lhs = lhs | rhs;
return lhs;
}
diff --git a/alc/effects/convolution.cpp b/alc/effects/convolution.cpp
index 20510af2..20e5eff7 100644
--- a/alc/effects/convolution.cpp
+++ b/alc/effects/convolution.cpp
@@ -517,8 +517,7 @@ void ConvolutionState::process(const size_t samplesToDo,
for(size_t c{0};c < chans.size();++c)
{
auto buf_iter = chans[c].mBuffer.begin() + base;
- apply_fir({std::addressof(*buf_iter), todo}, mInput.data()+1 + mFifoPos,
- mFilter[c].data());
+ apply_fir({buf_iter, todo}, mInput.data()+1 + mFifoPos, mFilter[c].data());
auto fifo_iter = mOutput[c].begin() + mFifoPos;
std::transform(fifo_iter, fifo_iter+todo, buf_iter, buf_iter, std::plus<>{});