diff options
Diffstat (limited to 'src/devices/sound/qsoundhle.cpp')
-rw-r--r-- | src/devices/sound/qsoundhle.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp index 913d22baed1..a9595a4b00d 100644 --- a/src/devices/sound/qsoundhle.cpp +++ b/src/devices/sound/qsoundhle.cpp @@ -416,7 +416,7 @@ int16_t qsound_hle_device::qsound_voice::update(qsound_hle_device &dsp, int32_t if ((new_phase >> 12) >= m_end_addr) new_phase -= (m_loop_len << 12); - new_phase = std::min<int32_t>(std::max<int32_t>(new_phase, -0x8000000), 0x7FFFFFF); + new_phase = std::clamp<int32_t>(new_phase, -0x8000000, 0x7FFFFFF); m_addr = new_phase >> 12; m_phase = (new_phase << 4)&0xffff; @@ -465,10 +465,10 @@ int16_t qsound_hle_device::qsound_adpcm::update(qsound_hle_device &dsp, int16_t if (step <= 0) delta = -delta; delta += curr_sample; - delta = std::min<int32_t>(std::max<int32_t>(delta, -32768), 32767); + delta = std::clamp<int32_t>(delta, -32768, 32767); m_step_size = (dsp.read_dsp_rom(DATA_ADPCM_TAB + 8 + step) * m_step_size) >> 6; - m_step_size = std::min<int16_t>(std::max<int16_t>(m_step_size, 1), 2000); + m_step_size = std::clamp<int16_t>(m_step_size, 1, 2000); return (delta * m_cur_vol) >> 16; } @@ -504,7 +504,7 @@ void qsound_hle_device::state_normal_update() else m_echo.m_length = m_echo.m_end_pos - DELAY_BASE_OFFSET; - m_echo.m_length = std::min<int16_t>(std::max<int16_t>(m_echo.m_length, 0), 1024); + m_echo.m_length = std::clamp<int16_t>(m_echo.m_length, 0, 1024); // update PCM voices int32_t echo_input = 0; @@ -534,8 +534,8 @@ void qsound_hle_device::state_normal_update() wet -= (m_voice_output[i] * (int16_t)read_dsp_rom(pan_index + PAN_TABLE_WET)); } // Saturate accumulated voices - dry = (std::min<int32_t>(std::max<int32_t>(dry, -0x1fffffff), 0x1fffffff)) << 2; - wet = (std::min<int32_t>(std::max<int32_t>(wet, -0x1fffffff), 0x1fffffff)) << 2; + dry = std::clamp<int32_t>(dry, -0x1fffffff, 0x1fffffff) << 2; + wet = std::clamp<int32_t>(wet, -0x1fffffff, 0x1fffffff) << 2; // Apply FIR filter on 'wet' input wet = m_filter[ch].apply(wet >> 16); @@ -549,7 +549,7 @@ void qsound_hle_device::state_normal_update() // DSP round function output = (output + 0x2000) & ~0x3fff; - m_out[ch] = (std::min<int32_t>(std::max<int32_t>(output >> 14, -0x7fff), 0x7fff)); + m_out[ch] = std::clamp<int32_t>(output >> 14, -0x7fff, 0x7fff); if (m_delay_update) { |