Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace tLimit() with qBound() and remove templates.h #5040

Merged
merged 2 commits into from
Jun 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/BasicFilters.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <math.h>

#include "lmms_basics.h"
#include "templates.h"
#include "lmms_constants.h"
#include "interpolation.h"
#include "MemoryManager.h"
Expand Down
3 changes: 1 addition & 2 deletions include/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "Engine.h"
#include "Model.h"
#include "JournallingObject.h"
#include "templates.h"
#include "ValueBuffer.h"

class ControllerDialog;
Expand Down Expand Up @@ -112,7 +111,7 @@ class LMMS_EXPORT Controller : public Model, public JournallingObject

inline static float fittedValue( float _val )
{
return tLimit<float>( _val, 0.0f, 1.0f );
return qBound<float>( 0.0f, _val, 1.0f );
}

static long runningPeriods()
Expand Down
1 change: 0 additions & 1 deletion include/DspEffectLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#define DSP_EFFECT_LIBRARY_H

#include "lmms_math.h"
#include "templates.h"
#include "lmms_constants.h"
#include "lmms_basics.h"

Expand Down
1 change: 0 additions & 1 deletion include/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <QtCore/QPoint>

#include "AutomatableModelView.h"
#include "templates.h"


class QPixmap;
Expand Down
1 change: 0 additions & 1 deletion include/panning.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include "lmms_basics.h"
#include "volume.h"
#include "templates.h"
#include "panning_constants.h"
#include "Midi.h"

Expand Down
39 changes: 0 additions & 39 deletions include/templates.h

This file was deleted.

1 change: 0 additions & 1 deletion plugins/bit_invader/bit_invader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
#include "templates.h"
#include "ToolTip.h"
#include "Song.h"
#include "interpolation.h"
Expand Down
1 change: 0 additions & 1 deletion plugins/lb302/lb302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
#include "templates.h"
#include "ToolTip.h"
#include "BandLimitedWave.h"

Expand Down
1 change: 0 additions & 1 deletion plugins/monstro/Monstro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "Monstro.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "templates.h"
#include "gui_templates.h"
#include "ToolTip.h"
#include "Song.h"
Expand Down
1 change: 0 additions & 1 deletion plugins/nes/Nes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "Nes.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "templates.h"
#include "ToolTip.h"
#include "Song.h"
#include "lmms_math.h"
Expand Down
1 change: 0 additions & 1 deletion plugins/organic/organic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "NotePlayHandle.h"
#include "Oscillator.h"
#include "PixmapButton.h"
#include "templates.h"
#include "ToolTip.h"

#include "embed.h"
Expand Down
1 change: 0 additions & 1 deletion plugins/sfxr/sfxr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ float frnd(float range)
#include "Knob.h"
#include "NotePlayHandle.h"
#include "PixmapButton.h"
#include "templates.h"
#include "ToolTip.h"
#include "Song.h"
#include "MidiEvent.h"
Expand Down
1 change: 0 additions & 1 deletion plugins/vibed/vibed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "CaptionMenu.h"
#include "Oscillator.h"
#include "string_container.h"
#include "templates.h"
#include "volume.h"
#include "Song.h"

Expand Down
7 changes: 3 additions & 4 deletions plugins/vibed/vibrating_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <math.h>

#include "vibrating_string.h"
#include "templates.h"
#include "interpolation.h"
#include "Mixer.h"
#include "Engine.h"
Expand Down Expand Up @@ -145,9 +144,9 @@ void vibratingString::resample( float *_src, f_cnt_t _src_frames,
_dst_frames;
const float frac_pos = src_frame_float -
static_cast<f_cnt_t>( src_frame_float );
const f_cnt_t src_frame = tLimit<f_cnt_t>(
static_cast<f_cnt_t>( src_frame_float ),
1, _src_frames - 3 );
const f_cnt_t src_frame = qBound<f_cnt_t>(
1, static_cast<f_cnt_t>( src_frame_float ),
_src_frames - 3 );
m_impulse[frame] = cubicInterpolate(
_src[src_frame - 1],
_src[src_frame + 0],
Expand Down
1 change: 0 additions & 1 deletion plugins/vst_base/VstPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
#include "MainWindow.h"
#include "Mixer.h"
#include "Song.h"
#include "templates.h"
#include "FileDialog.h"

#ifdef LMMS_BUILD_LINUX
Expand Down
1 change: 0 additions & 1 deletion plugins/watsyn/Watsyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "base64.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "templates.h"
#include "ToolTip.h"
#include "Song.h"
#include "lmms_math.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/AutomatableModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void AutomatableModel::setStep( const float step )

float AutomatableModel::fittedValue( float value ) const
{
value = tLimit<float>( value, m_minValue, m_maxValue );
value = qBound<float>( m_minValue, value, m_maxValue );

if( m_step != 0 && m_hasStrictStepSize )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ void SampleBuffer::visualize( QPainter & _p, const QRect & _dr,
const float y_space = h*0.5f;
const int nb_frames = focus_on_range ? _to_frame - _from_frame : m_frames;

const int fpp = tLimit<int>( nb_frames / w, 1, 20 );
const int fpp = qBound<int>( 1, nb_frames / w, 20 );
QPointF * l = new QPointF[nb_frames / fpp + 1];
QPointF * r = new QPointF[nb_frames / fpp + 1];
int n = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/core/audio/AudioAlsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@


AudioAlsa::AudioAlsa( bool & _success_ful, Mixer* _mixer ) :
AudioDevice( tLimit<ch_cnt_t>(
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audioalsa", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer ),
SURROUND_CHANNELS ), _mixer ),
m_handle( NULL ),
m_hwParams( NULL ),
m_swParams( NULL ),
Expand Down
9 changes: 4 additions & 5 deletions src/core/audio/AudioJack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "Engine.h"
#include "GuiApplication.h"
#include "templates.h"
#include "gui_templates.h"
#include "ConfigManager.h"
#include "LcdSpinBox.h"
Expand All @@ -44,10 +43,10 @@


AudioJack::AudioJack( bool & _success_ful, Mixer* _mixer ) :
AudioDevice( tLimit<int>( ConfigManager::inst()->value(
"audiojack", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer ),
AudioDevice( qBound<int>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiojack", "channels" ).toInt(),
SURROUND_CHANNELS ), _mixer ),
m_client( NULL ),
m_active( false ),
m_midiClient( NULL ),
Expand Down
6 changes: 3 additions & 3 deletions src/core/audio/AudioOss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@


AudioOss::AudioOss( bool & _success_ful, Mixer* _mixer ) :
AudioDevice( tLimit<ch_cnt_t>(
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiooss", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer ),
SURROUND_CHANNELS ), _mixer ),
m_convertEndian( false )
{
_success_ful = false;
Expand Down
7 changes: 3 additions & 4 deletions src/core/audio/AudioPortAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ void AudioPortAudioSetupUtil::updateChannels()
#include "Engine.h"
#include "ConfigManager.h"
#include "gui_templates.h"
#include "templates.h"
#include "ComboBox.h"
#include "Mixer.h"


AudioPortAudio::AudioPortAudio( bool & _success_ful, Mixer * _mixer ) :
AudioDevice( tLimit<ch_cnt_t>(
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audioportaudio", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer ),
SURROUND_CHANNELS ), _mixer ),
m_paStream( NULL ),
m_wasPAInitError( false ),
m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ),
Expand Down
6 changes: 3 additions & 3 deletions src/core/audio/AudioPulseAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata)


AudioPulseAudio::AudioPulseAudio( bool & _success_ful, Mixer* _mixer ) :
AudioDevice( tLimit<ch_cnt_t>(
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiopa", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer ),
SURROUND_CHANNELS ), _mixer ),
m_s( NULL ),
m_quit( false ),
m_convertEndian( false )
Expand Down
10 changes: 5 additions & 5 deletions src/core/audio/AudioSndio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "Mixer.h"
#include "Engine.h"
#include "gui_templates.h"
#include "templates.h"

#ifdef LMMS_HAVE_UNISTD_H
#include <unistd.h>
Expand All @@ -50,10 +49,11 @@


AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
AudioDevice( tLimit<ch_cnt_t>(
ConfigManager::inst()->value( "audiosndio", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ),
m_convertEndian ( false )
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiosndio", "channels" ).toInt(),
SURROUND_CHANNELS ), _mixer ),
m_convertEndian ( false )
{
_success_ful = false;

Expand Down
8 changes: 4 additions & 4 deletions src/core/audio/AudioSoundIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
#include "debug.h"
#include "ConfigManager.h"
#include "gui_templates.h"
#include "templates.h"
#include "ComboBox.h"
#include "Mixer.h"

AudioSoundIo::AudioSoundIo( bool & outSuccessful, Mixer * _mixer ) :
AudioDevice( tLimit<ch_cnt_t>(
ConfigManager::inst()->value( "audiosoundio", "channels" ).toInt(), DEFAULT_CHANNELS, SURROUND_CHANNELS ),
_mixer )
AudioDevice( qBound<ch_cnt_t>(
DEFAULT_CHANNELS,
ConfigManager::inst()->value( "audiosoundio", "channels" ).toInt(),
SURROUND_CHANNELS ), _mixer )
{
outSuccessful = false;
m_soundio = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/PianoView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ int PianoView::getKeyFromMouse( const QPoint & _p ) const
}

// some range-checking-stuff
return tLimit( key_num, 0, NumKeys - 1 );
return qBound( 0, key_num, NumKeys - 1 );
}


Expand Down
3 changes: 1 addition & 2 deletions src/gui/PluginBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "embed.h"
#include "Engine.h"
#include "templates.h"
#include "gui_templates.h"
#include "StringPairDrag.h"
#include "PluginFactory.h"
Expand Down Expand Up @@ -231,7 +230,7 @@ void PluginDescWidget::paintEvent( QPaintEvent * )
style()->drawPrimitive( QStyle::PE_Widget, &o, &p, this );

// Draw the rest
const int s = 16 + ( 32 * ( tLimit( height(), 24, 60 ) - 24 ) ) /
const int s = 16 + ( 32 * ( qBound( 24, height(), 60 ) - 24 ) ) /
( 60 - 24 );
const QSize logo_size( s, s );
QPixmap logo = m_logo.scaled( logo_size, Qt::KeepAspectRatio,
Expand Down
Loading