Skip to content

Commit 7367750

Browse files
authored
[Code Cleanup] Cleaned up some header files and move a bit of debugging logic to cmake (#7677)
* Renamed lmms_basics.h to LmmsTypes.h and scoped it down for that purpose. * Shifted the LMMS_STRINGIFY macro to it's own header. * Removed the debug.h header file and use cmake to handle the macro logic. * Remove some unused headers and include directives
1 parent db9ccbe commit 7367750

File tree

95 files changed

+108
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+108
-206
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,20 @@ ENDIF()
634634
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLMMS_DEBUG")
635635
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLMMS_DEBUG")
636636

637+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
638+
add_compile_definitions(NDEBUG)
639+
SET(STATUS_ASSERTIONS "Disabled")
640+
else()
641+
remove_definitions(-DNDEBUG)
642+
SET(STATUS_ASSERTIONS "Enabled")
643+
endif()
644+
637645
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16")
638646
set(NOOP_COMMAND "${CMAKE_COMMAND}" "-E" "true")
639647
else()
640648
set(NOOP_COMMAND "${CMAKE_COMMAND}" "-E" "echo")
641649
endif()
650+
642651
if(STRIP)
643652
# TODO CMake 3.19: Now that CONFIG generator expressions support testing for
644653
# multiple configurations, combine the OR into a single CONFIG expression.
@@ -865,6 +874,7 @@ MESSAGE(
865874
"* Debug using UBSanitizer : ${STATUS_DEBUG_UBSAN}\n"
866875
"* Debug packaging commands : ${STATUS_DEBUG_CPACK}\n"
867876
"* Profile using GNU profiler : ${STATUS_GPROF}\n"
877+
"* Debug assertions : ${STATUS_ASSERTIONS}\n"
868878
)
869879

870880
MESSAGE(

include/AudioDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <QMutex>
2929
#include <samplerate.h>
3030

31-
#include "lmms_basics.h"
31+
#include "LmmsTypes.h"
3232

3333
class QThread;
3434

include/AudioEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <vector>
3535

3636
#include "AudioDevice.h"
37-
#include "lmms_basics.h"
37+
#include "LmmsTypes.h"
3838
#include "SampleFrame.h"
3939
#include "LocklessList.h"
4040
#include "FifoBuffer.h"

include/AudioEngineProfiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <atomic>
3030
#include <QFile>
3131

32-
#include "lmms_basics.h"
32+
#include "LmmsTypes.h"
3333
#include "MicroTimer.h"
3434

3535
namespace lmms

include/AutomationEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "MidiClip.h"
3838
#include "SampleClip.h"
3939
#include "TimePos.h"
40-
#include "lmms_basics.h"
40+
#include "LmmsTypes.h"
4141
#include "SampleThumbnail.h"
4242

4343
class QPainter;

include/BandLimitedWave.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QString;
3131

3232
#include "lmms_export.h"
3333
#include "interpolation.h"
34-
#include "lmms_basics.h"
34+
#include "LmmsTypes.h"
3535
#include "lmms_math.h"
3636
#include "Engine.h"
3737
#include "AudioEngine.h"

include/BasicFilters.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
#include <cmath>
3737
#include <numbers>
3838

39-
#include "lmms_basics.h"
39+
#include "lmms_constants.h"
40+
#include "LmmsTypes.h"
41+
4042

4143
namespace lmms
4244
{
@@ -207,7 +209,7 @@ class OnePole
207209

208210
inline float update( float s, ch_cnt_t ch )
209211
{
210-
if (std::abs(s) < 1.0e-10f && std::abs(m_z1[ch]) < 1.0e-10f) { return 0.0f; }
212+
if (std::abs(s) < F_EPSILON && std::abs(m_z1[ch]) < F_EPSILON) { return 0.0f; }
211213
return m_z1[ch] = s * m_a0 + m_z1[ch] * m_b1;
212214
}
213215

@@ -593,7 +595,7 @@ class BasicFilters
593595
case FilterType::Formantfilter:
594596
case FilterType::FastFormant:
595597
{
596-
if (std::abs(_in0) < 1.0e-10f && std::abs(m_vflast[0][_chnl]) < 1.0e-10f) { return 0.0f; } // performance hack - skip processing when the numbers get too small
598+
if (std::abs(_in0) < F_EPSILON && std::abs(m_vflast[0][_chnl]) < F_EPSILON) { return 0.0f; } // performance hack - skip processing when the numbers get too small
597599

598600
const int os = m_type == FilterType::FastFormant ? 1 : 4; // no oversampling for fast formant
599601
for( int o = 0; o < os; ++o )

include/BufferManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define LMMS_BUFFER_MANAGER_H
2828

2929
#include "lmms_export.h"
30-
#include "lmms_basics.h"
30+
#include "LmmsTypes.h"
3131

3232
namespace lmms
3333
{

include/CPULoadWidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <QPixmap>
3232
#include <QWidget>
3333

34-
#include "lmms_basics.h"
34+
#include "LmmsTypes.h"
3535

3636

3737
namespace lmms::gui

include/ControllerRackView.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <QCloseEvent>
3030

3131
#include "SerializingObject.h"
32-
#include "lmms_basics.h"
3332

3433

3534
class QPushButton;

0 commit comments

Comments
 (0)