[Misc] Replaced const with constexpr where possible

This commit is contained in:
Xphalnos
2025-03-20 21:16:32 +01:00
committed by Radosław Gliński
parent d20620eb5e
commit 5f918ef28d
64 changed files with 191 additions and 190 deletions

View File

@@ -18,12 +18,12 @@ namespace apu {
class AudioDriver {
public:
static const uint32_t kFrameFrequencyDefault = 48000;
static const uint32_t kFrameChannelsDefault = 6;
static const uint32_t kChannelSamplesDefault = 256;
static const uint32_t kFrameSamplesMax =
static constexpr uint32_t kFrameFrequencyDefault = 48000;
static constexpr uint32_t kFrameChannelsDefault = 6;
static constexpr uint32_t kChannelSamplesDefault = 256;
static constexpr uint32_t kFrameSamplesMax =
kFrameChannelsDefault * kChannelSamplesDefault;
static const uint32_t kFrameSizeMax = sizeof(float) * kFrameSamplesMax;
static constexpr uint32_t kFrameSizeMax = sizeof(float) * kFrameSamplesMax;
virtual ~AudioDriver();

View File

@@ -165,7 +165,7 @@ bool XAudio2AudioDriver::InitializeObjects(Objects& objects) {
waveformat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
waveformat.Samples.wValidBitsPerSample = waveformat.Format.wBitsPerSample;
static const DWORD kChannelMasks[] = {
static constexpr DWORD kChannelMasks[] = {
0,
0,
SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT,

View File

@@ -18,7 +18,7 @@ namespace xe {
namespace apu {
namespace xma {
static const uint32_t kMaxFrameLength = 0x7FFF;
static constexpr uint32_t kMaxFrameLength = 0x7FFF;
// Get number of frames that /begin/ in this packet. This is valid only for XMA2
// packets

View File

@@ -32,7 +32,7 @@ class XmaRegisterFile {
static const XmaRegisterInfo* GetRegisterInfo(uint32_t index);
static const size_t kRegisterCount = (0xFFFF + 1) / 4;
static constexpr size_t kRegisterCount = (0xFFFF + 1) / 4;
uint32_t values[kRegisterCount];
uint32_t operator[](uint32_t reg) const { return values[reg]; }