Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into actions-caching
Browse files Browse the repository at this point in the history
  • Loading branch information
DomClark committed Sep 20, 2023
2 parents ffec096 + 7e8c79a commit 7487c5e
Show file tree
Hide file tree
Showing 26 changed files with 472 additions and 119 deletions.
55 changes: 51 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function(enable_policy_if_exists id)
endif()
endfunction()

# Needed for the SWH Ladspa plugins. See below.
enable_policy_if_exists(CMP0074) # find_package() uses <PackageName>_ROOT variables.
# Needed for ccache support with MSVC
enable_policy_if_exists(CMP0141) # MSVC debug information format flags are selected by an abstraction.

PROJECT(lmms)
Expand Down Expand Up @@ -93,6 +96,10 @@ OPTION(WANT_VST_32 "Include 32-bit VST support" ON)
OPTION(WANT_VST_64 "Include 64-bit VST support" ON)
OPTION(WANT_WINMM "Include WinMM MIDI support" OFF)
OPTION(WANT_DEBUG_FPE "Debug floating point exceptions" OFF)
option(WANT_DEBUG_ASAN "Enable AddressSanitizer" OFF)
option(WANT_DEBUG_TSAN "Enable ThreadSanitizer" OFF)
option(WANT_DEBUG_MSAN "Enable MemorySanitizer" OFF)
option(WANT_DEBUG_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
OPTION(BUNDLE_QT_TRANSLATIONS "Install Qt translation files for LMMS" OFF)


Expand Down Expand Up @@ -277,8 +284,17 @@ ELSE(WANT_CMT)
ENDIF(WANT_CMT)

IF(WANT_SWH)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
IF(LMMS_BUILD_APPLE)
# Prefer system perl over Homebrew, MacPorts, etc
SET(Perl_ROOT "/usr/bin")
ENDIF()
FIND_PACKAGE(Perl)
IF(PERL_FOUND)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
ELSE()
SET(STATUS_SWH "Skipping, perl is missing")
ENDIF()
ELSE(WANT_SWH)
SET(STATUS_SWH "not built as requested")
ENDIF(WANT_SWH)
Expand Down Expand Up @@ -662,8 +678,36 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
ENDIF(WIN32)
elseif(MSVC)
# Use UTF-8 as the source and execution character set
add_compile_options("/utf-8")
ENDIF()

# add enabled sanitizers
function(add_sanitizer sanitizer supported_compilers want_flag status_flag)
if(${want_flag})
if(CMAKE_CXX_COMPILER_ID MATCHES "${supported_compilers}")
set("${status_flag}" "Enabled" PARENT_SCOPE)
string(REPLACE ";" " " additional_flags "${ARGN}")
# todo CMake 3.13: use add_compile_options/add_link_options instead
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fsanitize=${sanitizer} ${additional_flags}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=${sanitizer} ${additional_flags}" PARENT_SCOPE)
else()
set("${status_flag}" "Wanted but disabled due to unsupported compiler" PARENT_SCOPE)
endif()
else()
set("${status_flag}" "Disabled" PARENT_SCOPE)
endif()
endfunction()

add_sanitizer(address "GNU|Clang|MSVC" WANT_DEBUG_ASAN STATUS_DEBUG_ASAN)
add_sanitizer(thread "GNU|Clang" WANT_DEBUG_TSAN STATUS_DEBUG_TSAN)
add_sanitizer(memory "Clang" WANT_DEBUG_MSAN STATUS_DEBUG_MSAN -fno-omit-frame-pointer)
# UBSan does not link with vptr enabled due to a problem with references from PeakControllerEffect
# not being found by PeakController
add_sanitizer(undefined "GNU|Clang" WANT_DEBUG_UBSAN STATUS_DEBUG_UBSAN -fno-sanitize=vptr)


# use ccache
include(CompileCache)

Expand Down Expand Up @@ -732,7 +776,6 @@ ADD_CUSTOM_TARGET(uninstall
COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/uninstall.cmake"
)


#
# display configuration information
#
Expand Down Expand Up @@ -798,7 +841,11 @@ MESSAGE(
MESSAGE(
"Developer options\n"
"-----------------------------------------\n"
"* Debug FP exceptions : ${STATUS_DEBUG_FPE}\n"
"* Debug FP exceptions : ${STATUS_DEBUG_FPE}\n"
"* Debug using AddressSanitizer : ${STATUS_DEBUG_ASAN}\n"
"* Debug using ThreadSanitizer : ${STATUS_DEBUG_TSAN}\n"
"* Debug using MemorySanitizer : ${STATUS_DEBUG_MSAN}\n"
"* Debug using UBSanitizer : ${STATUS_DEBUG_UBSAN}\n"
)

MESSAGE(
Expand Down
1 change: 1 addition & 0 deletions data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ lmms--gui--Oscilloscope {
lmms--gui--CPULoadWidget {
border: none;
background: url(resources:cpuload_bg.png);
qproperty-stepSize: 4;
}

/* scrollbar: trough */
Expand Down
1 change: 1 addition & 0 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ lmms--gui--Oscilloscope {
lmms--gui--CPULoadWidget {
border: none;
background: url(resources:cpuload_bg.png);
qproperty-stepSize: 1;
}

/* scrollbar: trough */
Expand Down
9 changes: 9 additions & 0 deletions include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ class LMMS_EXPORT AudioEngine : public QObject
return m_profiler.cpuLoad();
}

int detailLoad(const AudioEngineProfiler::DetailType type) const
{
return m_profiler.detailLoad(type);
}

const qualitySettings & currentQualitySettings() const
{
return m_qualitySettings;
Expand Down Expand Up @@ -401,6 +406,10 @@ class LMMS_EXPORT AudioEngine : public QObject
AudioDevice * tryAudioDevices();
MidiClient * tryMidiClients();

void renderStageNoteSetup();
void renderStageInstruments();
void renderStageEffects();
void renderStageMix();

const surroundSampleFrame * renderNextBuffer();

Expand Down
48 changes: 47 additions & 1 deletion include/AudioEngineProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef LMMS_AUDIO_ENGINE_PROFILER_H
#define LMMS_AUDIO_ENGINE_PROFILER_H

#include <array>
#include <atomic>
#include <QFile>

#include "lmms_basics.h"
Expand Down Expand Up @@ -53,11 +55,55 @@ class AudioEngineProfiler

void setOutputFile( const QString& outputFile );

enum class DetailType {
NoteSetup,
Instruments,
Effects,
Mixing,
Count
};

constexpr static auto DetailCount = static_cast<std::size_t>(DetailType::Count);

int detailLoad(const DetailType type) const
{
return m_detailLoad[static_cast<std::size_t>(type)].load(std::memory_order_relaxed);
}

class Probe
{
public:
Probe(AudioEngineProfiler& profiler, AudioEngineProfiler::DetailType type)
: m_profiler(profiler)
, m_type(type)
{
profiler.startDetail(type);
}
~Probe() { m_profiler.finishDetail(m_type); }
Probe& operator=(const Probe&) = delete;
Probe(const Probe&) = delete;
Probe(Probe&&) = delete;

private:
AudioEngineProfiler &m_profiler;
const AudioEngineProfiler::DetailType m_type;
};

private:
void startDetail(const DetailType type) { m_detailTimer[static_cast<std::size_t>(type)].reset(); }
void finishDetail(const DetailType type)
{
m_detailTime[static_cast<std::size_t>(type)] = m_detailTimer[static_cast<std::size_t>(type)].elapsed();
}

MicroTimer m_periodTimer;
int m_cpuLoad;
std::atomic<float> m_cpuLoad;
QFile m_outputFile;

// Use arrays to avoid dynamic allocations in realtime code
std::array<MicroTimer, DetailCount> m_detailTimer;
std::array<int, DetailCount> m_detailTime{0};
std::array<std::atomic<float>, DetailCount> m_detailLoad{0};
};

} // namespace lmms
Expand Down
6 changes: 6 additions & 0 deletions include/CPULoadWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef LMMS_GUI_CPU_LOAD_WIDGET_H
#define LMMS_GUI_CPU_LOAD_WIDGET_H

#include <algorithm>
#include <QTimer>
#include <QPixmap>
#include <QWidget>
Expand All @@ -40,6 +41,7 @@ namespace lmms::gui
class CPULoadWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(int stepSize MEMBER m_stepSize)
public:
CPULoadWidget( QWidget * _parent );
~CPULoadWidget() override = default;
Expand All @@ -54,6 +56,8 @@ protected slots:


private:
int stepSize() const { return std::max(1, m_stepSize); }

int m_currentLoad;

QPixmap m_temp;
Expand All @@ -64,6 +68,8 @@ protected slots:

QTimer m_updateTimer;

int m_stepSize;

} ;


Expand Down
1 change: 1 addition & 0 deletions include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class LMMS_EXPORT DataFile : public QDomDocument
void upgrade_defaultTripleOscillatorHQ();
void upgrade_mixerRename();
void upgrade_bbTcoRename();
void upgrade_sampleAndHold();

// List of all upgrade methods
static const std::vector<UpgradeMethod> UPGRADE_METHODS;
Expand Down
9 changes: 6 additions & 3 deletions include/FileBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ class FileBrowser : public SideBarWidget
private slots:
void reloadTree();
void expandItems( QTreeWidgetItem * item=nullptr, QList<QString> expandedDirs = QList<QString>() );
// call with item=NULL to filter the entire tree
bool filterItems( const QString & filter, QTreeWidgetItem * item=nullptr );
bool filterAndExpandItems(const QString & filter, QTreeWidgetItem * item = nullptr);
void giveFocusToFilter();

private:
void keyPressEvent( QKeyEvent * ke ) override;

void addItems( const QString & path );

void saveDirectoriesStates();
void restoreDirectoriesStates();

FileBrowserTreeWidget * m_fileBrowserTreeWidget;

QLineEdit * m_filterEdit;
Expand All @@ -99,6 +101,8 @@ private slots:
QCheckBox* m_showFactoryContent = nullptr;
QString m_userDir;
QString m_factoryDir;
QList<QString> m_savedExpandedDirs;
QString m_previousFilterValue;
} ;


Expand All @@ -115,7 +119,6 @@ class FileBrowserTreeWidget : public QTreeWidget
//! that are expanded in the tree.
QList<QString> expandedDirs( QTreeWidgetItem * item = nullptr ) const;


protected:
void contextMenuEvent( QContextMenuEvent * e ) override;
void mousePressEvent( QMouseEvent * me ) override;
Expand Down
1 change: 1 addition & 0 deletions include/LfoController.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public slots:
sample_t (*m_sampleFunction)( const float );

private:
float m_heldSample;
SampleBuffer * m_userDefSampleBuffer;

protected slots:
Expand Down
4 changes: 2 additions & 2 deletions plugins/Compressor/Compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ bool CompressorEffect::processAudioBuffer(sampleFrame* buf, const fpp_t frames)
float inputValue = feedback ? m_prevOut[i] : s[i];

// Calculate the crest factor of the audio by diving the peak by the RMS
m_crestPeakVal[i] = qMax(inputValue * inputValue, m_crestTimeConst * m_crestPeakVal[i] + (1 - m_crestTimeConst) * (inputValue * inputValue));
m_crestRmsVal[i] = m_crestTimeConst * m_crestRmsVal[i] + ((1 - m_crestTimeConst) * (inputValue * inputValue));
m_crestPeakVal[i] = qMax(qMax(COMP_NOISE_FLOOR, inputValue * inputValue), m_crestTimeConst * m_crestPeakVal[i] + (1 - m_crestTimeConst) * (inputValue * inputValue));
m_crestRmsVal[i] = qMax(COMP_NOISE_FLOOR, m_crestTimeConst * m_crestRmsVal[i] + ((1 - m_crestTimeConst) * (inputValue * inputValue)));
m_crestFactorVal[i] = m_crestPeakVal[i] / m_crestRmsVal[i];

m_rmsVal[i] = m_rmsTimeConst * m_rmsVal[i] + ((1 - m_rmsTimeConst) * (inputValue * inputValue));
Expand Down
6 changes: 3 additions & 3 deletions plugins/LadspaEffect/calf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ TARGET_COMPILE_DEFINITIONS(veal PRIVATE DISABLE_OSC=1)

SET(INLINE_FLAGS "")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(INLINE_FLAGS "-finline-functions-called-once -finline-limit=80")
SET(INLINE_FLAGS -finline-functions-called-once -finline-limit=80)
ENDIF()
SET_TARGET_PROPERTIES(veal PROPERTIES COMPILE_FLAGS "-fexceptions -O2 -finline-functions ${INLINE_FLAGS}")
target_compile_options(veal PRIVATE -fexceptions -O2 -finline-functions ${INLINE_FLAGS})

if(LMMS_BUILD_WIN32)
add_custom_command(
Expand All @@ -50,5 +50,5 @@ if(LMMS_BUILD_WIN32)
)
endif()
IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
SET_TARGET_PROPERTIES(veal PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
target_link_libraries(veal PRIVATE -shared)
ENDIF()
6 changes: 3 additions & 3 deletions plugins/LadspaEffect/cmt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ADD_LIBRARY(cmt MODULE ${SOURCES})
INSTALL(TARGETS cmt LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")

SET_TARGET_PROPERTIES(cmt PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(cmt PROPERTIES COMPILE_FLAGS "-Wall -O3 -fno-strict-aliasing")
target_compile_options(cmt PRIVATE -Wall -O3 -fno-strict-aliasing)

if(LMMS_BUILD_WIN32)
add_custom_command(
Expand All @@ -18,10 +18,10 @@ if(LMMS_BUILD_WIN32)
endif()

if(NOT LMMS_BUILD_WIN32)
set_target_properties(cmt PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC")
target_compile_options(cmt PRIVATE -fPIC)
endif()

IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
SET_TARGET_PROPERTIES(cmt PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
target_link_libraries(cmt PRIVATE -shared)
ENDIF()

3 changes: 2 additions & 1 deletion plugins/LadspaEffect/swh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SET(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}")
# Loop over every XML file
FILE(GLOB XML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/*.xml")
LIST(SORT XML_SOURCES)

FOREACH(_item ${XML_SOURCES})
# Get library name and (soon to be) C file
GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
Expand All @@ -24,7 +25,7 @@ FOREACH(_item ${XML_SOURCES})
# Coerce XML source file to C
ADD_CUSTOM_COMMAND(
OUTPUT "${_out_file}"
COMMAND ./makestub.pl "${_item}" > "${_out_file}"
COMMAND "${PERL_EXECUTABLE}" ./makestub.pl "${_item}" > "${_out_file}"
DEPENDS "${_item}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa"
VERBATIM
Expand Down
12 changes: 10 additions & 2 deletions plugins/Patman/Patman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ namespace gui

PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) :
InstrumentViewFixedSize( _instrument, _parent ),
m_pi( nullptr )
m_pi(castModel<PatmanInstrument>())
{
setAutoFillBackground( true );
QPalette pal;
Expand Down Expand Up @@ -487,7 +487,15 @@ PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) :
"tune_off" ) );
m_tuneButton->setToolTip(tr("Tune mode"));

m_displayFilename = tr( "No file selected" );

if (m_pi->m_patchFile.isEmpty())
{
m_displayFilename = tr("No file selected");
}
else
{
updateFilename();
}

setAcceptDrops( true );
}
Expand Down
6 changes: 5 additions & 1 deletion plugins/VstEffect/VstSubPluginFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ void VstSubPluginFeatures::addPluginsFromDir( QStringList* filenames, QString pa
}
}
QStringList dlls = QDir( ConfigManager::inst()->vstDir() + path ).
entryList( QStringList() << "*.dll",
entryList( QStringList() << "*.dll"
#ifdef LMMS_BUILD_LINUX
<< "*.so"
#endif
,
QDir::Files, QDir::Name );
for( int i = 0; i < dlls.size(); i++ )
{
Expand Down
Loading

0 comments on commit 7487c5e

Please sign in to comment.