Remove typeInfo struct from lmms_basics.h (#7380)
* remove typeInfo struct from lmms_basics.h * Code review Co-authored-by: saker <sakertooth@gmail.com> * converted epsilon to a constant * renamed to approximatelyEqual and moved to top --------- Co-authored-by: saker <sakertooth@gmail.com>
This commit is contained in:
@@ -354,8 +354,7 @@ float AutomatableModel::inverseScaledValue( float value ) const
|
||||
template<class T>
|
||||
void roundAt( T& value, const T& where, const T& step_size )
|
||||
{
|
||||
if (std::abs(value - where)
|
||||
< typeInfo<float>::minEps() * std::abs(step_size))
|
||||
if (std::abs(value - where) < F_EPSILON * std::abs(step_size))
|
||||
{
|
||||
value = where;
|
||||
}
|
||||
@@ -583,7 +582,7 @@ float AutomatableModel::controllerValue( int frameOffset ) const
|
||||
"lacks implementation for a scale type");
|
||||
break;
|
||||
}
|
||||
if( typeInfo<float>::isEqual( m_step, 1 ) && m_hasStrictStepSize )
|
||||
if (approximatelyEqual(m_step, 1) && m_hasStrictStepSize)
|
||||
{
|
||||
return std::round(v);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "SampleFrame.h"
|
||||
#include "lmms_constants.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
@@ -154,7 +155,7 @@ void Effect::checkGate( double _out_sum )
|
||||
|
||||
// Check whether we need to continue processing input. Restart the
|
||||
// counter if the threshold has been exceeded.
|
||||
if( _out_sum - gate() <= typeInfo<float>::minEps() )
|
||||
if (_out_sum - gate() <= F_EPSILON)
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( bufferCount() > timeout() )
|
||||
|
||||
@@ -568,7 +568,7 @@ void NotePlayHandle::processTimePos(const TimePos& time, float pitchValue, bool
|
||||
else
|
||||
{
|
||||
const float v = detuning()->automationClip()->valueAt(time - songGlobalParentOffset() - pos());
|
||||
if (!typeInfo<float>::isEqual(v, m_baseDetuning->value()))
|
||||
if (!approximatelyEqual(v, m_baseDetuning->value()))
|
||||
{
|
||||
m_baseDetuning->setValue(v);
|
||||
updateFrequency();
|
||||
|
||||
@@ -535,7 +535,7 @@ void Oscillator::updateFM( SampleFrame* _ab, const fpp_t _frames,
|
||||
// should be called every time phase-offset is changed...
|
||||
inline void Oscillator::recalcPhase()
|
||||
{
|
||||
if( !typeInfo<float>::isEqual( m_phaseOffset, m_ext_phaseOffset ) )
|
||||
if (!approximatelyEqual(m_phaseOffset, m_ext_phaseOffset))
|
||||
{
|
||||
m_phase -= m_phaseOffset;
|
||||
m_phaseOffset = m_ext_phaseOffset;
|
||||
|
||||
@@ -175,7 +175,7 @@ PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file,
|
||||
// create note-play-handle for it
|
||||
m_previewNote = NotePlayHandleManager::acquire(
|
||||
s_previewTC->previewInstrumentTrack(), 0,
|
||||
typeInfo<f_cnt_t>::max() / 2,
|
||||
std::numeric_limits<f_cnt_t>::max() / 2,
|
||||
Note( 0, 0, DefaultKey, 100 ) );
|
||||
|
||||
setAudioPort( s_previewTC->previewInstrumentTrack()->audioPort() );
|
||||
|
||||
@@ -342,7 +342,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const TimePos& tim
|
||||
NotePlayHandle* nph =
|
||||
NotePlayHandleManager::acquire(
|
||||
this, offset,
|
||||
typeInfo<f_cnt_t>::max() / 2,
|
||||
std::numeric_limits<f_cnt_t>::max() / 2,
|
||||
Note(TimePos(), Engine::getSong()->getPlayPos(Engine::getSong()->playMode()),
|
||||
event.key(), event.volume(midiPort()->baseVelocity())),
|
||||
nullptr, event.channel(),
|
||||
|
||||
Reference in New Issue
Block a user