diff options
author | Rosen Penev <[email protected]> | 2023-01-15 13:43:27 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-01-15 13:43:27 -0800 |
commit | 0526ecd2f95877b167293e50ab8ce0ce614d03f4 (patch) | |
tree | ad80a5811292e87601020f6aadcb2f6ff138761d /alc/backends/alsa.cpp | |
parent | d9d445772c50e53c12ab77d97cc5f3a76839d83a (diff) |
clang-tidy cleanups (#800)
* clang-tidy: use bool literals
Found with modernize-use-bool-literals
Signed-off-by: Rosen Penev <[email protected]>
* clang-tidy: replace std::bind with lambdas
Found with modernize-avoid-bind
Signed-off-by: Rosen Penev <[email protected]>
* clang-tidy: use data() instead of pointer stuff
Found with readability-container-data-pointe
Signed-off-by: Rosen Penev <[email protected]>
* clang-tidy: use empty()
Found with readability-container-size-empty
Signed-off-by: Rosen Penev <[email protected]>
* clang-tidy: remove static in anon namespace
Found with readability-static-definition-in-anonymous-namespace
Signed-off-by: Rosen Penev <[email protected]>
* clang-tidy: remove const return
Found with readability-const-return-type
Signed-off-by: Rosen Penev <[email protected]>
Signed-off-by: Rosen Penev <[email protected]>
Diffstat (limited to 'alc/backends/alsa.cpp')
-rw-r--r-- | alc/backends/alsa.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index e495a34d..d620a83c 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -132,7 +132,7 @@ constexpr char alsaDevice[] = "ALSA Default"; MAGIC(snd_card_next); \ MAGIC(snd_config_update_free_global) -static void *alsa_handle; +void *alsa_handle; #define MAKE_FUNC(f) decltype(f) * p##f ALSA_FUNCS(MAKE_FUNC); #undef MAKE_FUNC @@ -330,7 +330,7 @@ al::vector<DevMap> probe_devices(snd_pcm_stream_t stream) ConfigValueStr(nullptr, "alsa", name.c_str()).value_or(main_prefix)}; int dev{-1}; - while(1) + while(true) { if(snd_ctl_pcm_next_device(handle, &dev) < 0) ERR("snd_ctl_pcm_next_device failed\n"); @@ -692,7 +692,7 @@ bool AlsaPlayback::reset() break; } - bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", 1)}; + bool allowmmap{!!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "mmap", true)}; uint periodLen{static_cast<uint>(mDevice->UpdateSize * 1000000_u64 / mDevice->Frequency)}; uint bufferLen{static_cast<uint>(mDevice->BufferSize * 1000000_u64 / mDevice->Frequency)}; uint rate{mDevice->Frequency}; @@ -750,7 +750,7 @@ bool AlsaPlayback::reset() else mDevice->FmtChans = DevFmtStereo; } /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", 0) + if(!GetConfigValueBool(mDevice->DeviceName.c_str(), "alsa", "allow-resampler", false) || !mDevice->Flags.test(FrequencyRequest)) { if(snd_pcm_hw_params_set_rate_resample(mPcmHandle, hp.get(), 0) < 0) |