diff options
author | Chris Robinson <[email protected]> | 2023-12-11 18:59:54 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-11 18:59:54 -0800 |
commit | 60aa22f20d63a3da9f06b9398a2a8656ebbd0342 (patch) | |
tree | c6067ff97fd013906309d2fafd5e41a5447fee29 /alc/backends/alsa.cpp | |
parent | e79e5a978df22a5e5967169cf62cf46f3456d833 (diff) |
Mostly finish cleanup for backends
Except CoreAudio and Solaris backends
Diffstat (limited to 'alc/backends/alsa.cpp')
-rw-r--r-- | alc/backends/alsa.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index 47c6385e..fa34e4f9 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -53,6 +53,7 @@ namespace { +/* NOLINTNEXTLINE(*-avoid-c-arrays) */ constexpr char alsaDevice[] = "ALSA Default"; @@ -715,17 +716,18 @@ bool AlsaPlayback::reset() /* test and set format (implicitly sets sample bits) */ if(snd_pcm_hw_params_test_format(mPcmHandle, hp.get(), format) < 0) { - static const struct { + struct FormatMap { snd_pcm_format_t format; DevFmtType fmttype; - } formatlist[] = { - { SND_PCM_FORMAT_FLOAT, DevFmtFloat }, - { SND_PCM_FORMAT_S32, DevFmtInt }, - { SND_PCM_FORMAT_U32, DevFmtUInt }, - { SND_PCM_FORMAT_S16, DevFmtShort }, - { SND_PCM_FORMAT_U16, DevFmtUShort }, - { SND_PCM_FORMAT_S8, DevFmtByte }, - { SND_PCM_FORMAT_U8, DevFmtUByte }, + }; + static constexpr std::array formatlist{ + FormatMap{SND_PCM_FORMAT_FLOAT, DevFmtFloat }, + FormatMap{SND_PCM_FORMAT_S32, DevFmtInt }, + FormatMap{SND_PCM_FORMAT_U32, DevFmtUInt }, + FormatMap{SND_PCM_FORMAT_S16, DevFmtShort }, + FormatMap{SND_PCM_FORMAT_U16, DevFmtUShort}, + FormatMap{SND_PCM_FORMAT_S8, DevFmtByte }, + FormatMap{SND_PCM_FORMAT_U8, DevFmtUByte }, }; for(const auto &fmt : formatlist) |