diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2022-09-08 11:32:44 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2022-09-08 12:10:02 -0700 |
| commit | abb59a781aebf89cb3d808826ffc146e0a5d34ea (patch) | |
| tree | cf9d700649e6daa692bfb9c4f6398763d1e561a3 /Source/Core/AudioCommon | |
| parent | 2dfe91336a739ba10d9bfcf7c85c1e8f4802e1b2 (diff) | |
Mixer: Use smaller array for PushWiimoteSpeakerSamples
Diffstat (limited to 'Source/Core/AudioCommon')
| -rw-r--r-- | Source/Core/AudioCommon/Mixer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 5baa02d25e..2609ff89a5 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -282,9 +282,11 @@ void Mixer::PushStreamingSamples(const short* samples, unsigned int num_samples) void Mixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples, unsigned int sample_rate_divisor) { - short samples_stereo[MAX_SAMPLES * 2]; + // Max 20 bytes/speaker report, may be 4-bit ADPCM so multiply by 2 + static constexpr u32 MAX_SPEAKER_SAMPLES = 20 * 2; + std::array<short, MAX_SPEAKER_SAMPLES * 2> samples_stereo; - if (num_samples < MAX_SAMPLES) + if (num_samples <= MAX_SPEAKER_SAMPLES) { m_wiimote_speaker_mixer.SetInputSampleRateDivisor(sample_rate_divisor); @@ -294,7 +296,7 @@ void Mixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_sam samples_stereo[i * 2 + 1] = samples[i]; } - m_wiimote_speaker_mixer.PushSamples(samples_stereo, num_samples); + m_wiimote_speaker_mixer.PushSamples(samples_stereo.data(), num_samples); } } |
