diff options
| author | Sepalani <sepalani@hotmail.fr> | 2026-07-26 22:38:11 +0400 |
|---|---|---|
| committer | Sepalani <sepalani@hotmail.fr> | 2026-07-28 00:02:09 +0400 |
| commit | 3ba9a6df1a85ec6d111d320ac1ea22e3119720ee (patch) | |
| tree | d09dc0d5105a6bfd777ccd517fe6089c993ba055 /Source/Core | |
| parent | afee1e8ae4c0b966880e060850eed2d01ed31cfa (diff) | |
EXI_DeviceMic: Make static constants constexpr
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/Core/HW/EXI/EXI_DeviceMic.h | 10 |
2 files changed, 12 insertions, 15 deletions
diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp index 1b5b20c359..251de7ff56 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMic.cpp @@ -179,9 +179,6 @@ void CEXIMic::StreamReadOne() // buffer size settings. When the console handles the interrupt, it will send // cmdGetBuffer, which is when we actually read data from a buffer filled // in the background. - -u8 const CEXIMic::exi_id[] = {0, 0x0a, 0, 0, 0}; - CEXIMic::CEXIMic(Core::System& system, int index) : IEXIDevice(system), slot(index) #ifdef _WIN32 @@ -192,9 +189,9 @@ CEXIMic::CEXIMic(Core::System& system, int index) m_position = 0; command = 0; - sample_rate = rate_base; - buff_size = ring_base; - buff_size_samples = buff_size / sample_size; + sample_rate = RATE_BASE; + buff_size = RING_BASE; + buff_size_samples = buff_size / SAMPLE_SIZE; ring_pos = 0; std::memset(ring_buffer, 0, sizeof(ring_buffer)); @@ -280,7 +277,7 @@ void CEXIMic::TransferByte(u8& byte) switch (command) { case cmdID: - byte = exi_id[pos]; + byte = EXI_ID[pos]; break; case cmdGetStatus: @@ -301,9 +298,9 @@ void CEXIMic::TransferByte(u8& byte) // safe to do since these can only be entered if both bytes of status have been written if (!wasactive && status.is_active) { - sample_rate = rate_base << status.sample_rate; - buff_size = ring_base << status.buff_size; - buff_size_samples = buff_size / sample_size; + sample_rate = RATE_BASE << status.sample_rate; + buff_size = RING_BASE << status.buff_size; + buff_size_samples = buff_size / SAMPLE_SIZE; UpdateNextInterruptTicks(); diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMic.h b/Source/Core/Core/HW/EXI/EXI_DeviceMic.h index 143b2bf41f..ac70231039 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMic.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMic.h @@ -24,10 +24,10 @@ public: bool IsPresent() const override; private: - static u8 const exi_id[]; - static int const sample_size = sizeof(s16); - static int const rate_base = 11025; - static int const ring_base = 32; + static constexpr u8 EXI_ID[] = {0, 0x0a, 0, 0, 0}; + static constexpr int SAMPLE_SIZE = sizeof(s16); + static constexpr int RATE_BASE = 11025; + static constexpr int RING_BASE = 32; enum { @@ -68,7 +68,7 @@ private: // 64 is the max size, can be 16 or 32 as well int ring_pos; - u8 ring_buffer[64 * sample_size]; + u8 ring_buffer[64 * SAMPLE_SIZE]; // 0 to disable interrupts, else it will be checked against current CPU ticks // to determine if interrupt should be raised |
