EXI_DeviceMic: Make static constants constexpr

This commit is contained in:
Sepalani committed 2026-07-28 00:02:09 +04:00
1 parent afee1e8ae4
commit 3ba9a6df1a
2 files changed
+12 -15

No files matched your search

+7 -10
View File
@@ -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();
+5 -5
View File
@@ -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