mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
Piano: Use NumericLimits<T>
This commit is contained in:
parent
9a5dba9e09
commit
0e10673c58
Notes:
sideshowbarker
2024-07-19 07:34:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0e10673c589
@ -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…
Reference in New Issue
Block a user