Piano: Use NumericLimits<T>

This commit is contained in:
Andreas Kling 2020-04-15 16:51:53 +02:00
parent 9a5dba9e09
commit 0e10673c58
Notes: sideshowbarker 2024-07-19 07:34:34 +09:00
2 changed files with 4 additions and 4 deletions

View File

@ -26,8 +26,8 @@
*/
#include "AudioEngine.h"
#include <AK/NumericLimits.h>
#include <LibAudio/WavLoader.h>
#include <limits>
#include <math.h>
AudioEngine::AudioEngine()
@ -274,7 +274,7 @@ void AudioEngine::set_note(int note, Switch switch_note)
}
}
ASSERT(m_note_on[note] != std::numeric_limits<u8>::max());
ASSERT(m_note_on[note] != NumericLimits<u8>::max());
ASSERT(m_power[note] >= 0);
}

View File

@ -27,8 +27,8 @@
#include "WaveWidget.h"
#include "AudioEngine.h"
#include <AK/NumericLimits.h>
#include <LibGUI/Painter.h>
#include <limits>
WaveWidget::WaveWidget(AudioEngine& audio_engine)
: m_audio_engine(audio_engine)
@ -43,7 +43,7 @@ int WaveWidget::sample_to_y(int sample) const
{
constexpr int nice_scale_factor = 4;
sample *= nice_scale_factor;
constexpr double sample_max = std::numeric_limits<i16>::max();
constexpr double sample_max = NumericLimits<i16>::max();
double percentage = sample / sample_max;
double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);
double y = (frame_inner_rect().height() / 2.0) + portion_of_half_height;