mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
Piano: Use NumericLimits<T>
This commit is contained in:
parent
9a5dba9e09
commit
0e10673c58
2 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue