Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into SampleFrameAsClas…
Browse files Browse the repository at this point in the history
…sRemoveSurroundSampleFrame

Merge upstream's master into this branch to resolve conflicts in `src/gui/widgets/Oscilloscope.cpp`.
  • Loading branch information
michaelgregorius committed Mar 27, 2024
2 parents 925a58c + 682be4e commit 2e3a33c
Show file tree
Hide file tree
Showing 60 changed files with 192 additions and 208 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ INCLUDE(GenerateExportHeader)

STRING(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE)

SET(PROJECT_YEAR 2023)
SET(PROJECT_YEAR 2024)

SET(PROJECT_AUTHOR "LMMS Developers")
SET(PROJECT_URL "https://lmms.io")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/DetectMachine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IF(WIN32)
endif()
ELSE()
# Detect target architecture based on compiler target triple e.g. "x86_64-pc-linux"
EXEC_PROGRAM( ${CMAKE_C_COMPILER} ARGS "-dumpmachine ${CMAKE_C_FLAGS}" OUTPUT_VARIABLE Machine )
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine ${CMAKE_C_FLAGS} OUTPUT_VARIABLE Machine)
MESSAGE("Machine: ${Machine}")
STRING(REGEX MATCH "i.86" IS_X86 "${Machine}")
STRING(REGEX MATCH "86_64|amd64" IS_X86_64 "${Machine}")
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/FindWine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ FIND_PROGRAM(WINE_CXX
FIND_PROGRAM(WINE_BUILD NAMES winebuild)
# Detect wine paths and handle linking problems
IF(WINE_CXX)
EXEC_PROGRAM(${WINE_CXX} ARGS "-m32 -v /dev/zero" OUTPUT_VARIABLE WINEBUILD_OUTPUT_32)
EXEC_PROGRAM(${WINE_CXX} ARGS "-m64 -v /dev/zero" OUTPUT_VARIABLE WINEBUILD_OUTPUT_64)
execute_process(COMMAND ${WINE_CXX} -m32 -v /dev/zero OUTPUT_VARIABLE WINEBUILD_OUTPUT_32)
execute_process(COMMAND ${WINE_CXX} -m64 -v /dev/zero OUTPUT_VARIABLE WINEBUILD_OUTPUT_64)
_findwine_find_flags("${WINEBUILD_OUTPUT_32}" "^-isystem/usr/include$" BUGGED_WINEGCC)
_findwine_find_flags("${WINEBUILD_OUTPUT_32}" "^-isystem" WINEGCC_INCLUDE_DIR)
_findwine_find_flags("${WINEBUILD_OUTPUT_32}" "libwinecrt0\\.a.*" WINECRT_32)
Expand Down
5 changes: 4 additions & 1 deletion data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ lmms--gui--GroupBox {
lmms--gui--Oscilloscope {
background: none;
border: none;
qproperty-normalColor: rgb(71, 253, 133);
qproperty-leftChannelColor: rgb(71, 253, 133);
qproperty-rightChannelColor: rgb(238, 253, 71);
qproperty-otherChannelsColor: rgb(71, 235, 253);
qproperty-clippingColor: rgb(255, 64, 64);
}

Expand Down Expand Up @@ -996,6 +998,7 @@ lmms--gui--CompressorControlDialog {
qproperty-textColor: rgba(209, 216, 228, 50);
qproperty-graphColor: rgba(209, 216, 228, 50);
qproperty-resetColor: rgba(200, 100, 15, 200);
qproperty-backgroundColor: rgba(7, 8, 9, 255);
}

lmms--gui--CompressorControlDialog lmms--gui--Knob {
Expand Down
5 changes: 4 additions & 1 deletion data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ lmms--gui--GroupBox {
lmms--gui--Oscilloscope {
background: none;
border: none;
qproperty-normalColor: rgb(71, 253, 133);
qproperty-leftChannelColor: rgb(71, 253, 133);
qproperty-rightChannelColor: rgb(238, 253, 71);
qproperty-otherChannelsColor: rgb(71, 235, 253);
qproperty-clippingColor: rgb(255, 64, 64);
}

Expand Down Expand Up @@ -1038,6 +1040,7 @@ lmms--gui--CompressorControlDialog {
qproperty-textColor: rgba(209, 216, 228, 50);
qproperty-graphColor: rgba(209, 216, 228, 50);
qproperty-resetColor: rgba(200, 100, 15, 200);
qproperty-backgroundColor: rgba(7, 8, 9, 255);
}

lmms--gui--CompressorControlDialog lmms--gui--Knob {
Expand Down
1 change: 1 addition & 0 deletions include/MixerChannelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ namespace lmms::gui
void moveChannelRight();

private:
bool confirmRemoval(int index);
QString elideName(const QString& name);
MixerChannel* mixerChannel() const;
auto isMasterChannel() const -> bool { return m_channelIndex == 0; }
Expand Down
1 change: 0 additions & 1 deletion include/MixerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView,

// notify the view that a mixer channel was deleted
void deleteChannel(int index);
bool confirmRemoval(int index);

// delete all unused channels
void deleteUnusedChannels();
Expand Down
20 changes: 15 additions & 5 deletions include/Oscilloscope.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,24 @@ class Oscilloscope : public QWidget
{
Q_OBJECT
public:
Q_PROPERTY( QColor normalColor READ normalColor WRITE setNormalColor )
Q_PROPERTY( QColor leftChannelColor READ leftChannelColor WRITE setLeftChannelColor )
Q_PROPERTY( QColor rightChannelColor READ rightChannelColor WRITE setRightChannelColor )
Q_PROPERTY( QColor otherChannelsColor READ otherChannelsColor WRITE setOtherChannelsColor )
Q_PROPERTY( QColor clippingColor READ clippingColor WRITE setClippingColor )

Oscilloscope( QWidget * _parent );
~Oscilloscope() override;

void setActive( bool _active );

QColor const & normalColor() const;
void setNormalColor(QColor const & normalColor);
QColor const & leftChannelColor() const;
void setLeftChannelColor(QColor const & leftChannelColor);

QColor const & rightChannelColor() const;
void setRightChannelColor(QColor const & rightChannelColor);

QColor const & otherChannelsColor() const;
void setOtherChannelsColor(QColor const & otherChannelsColor);

QColor const & clippingColor() const;
void setClippingColor(QColor const & clippingColor);
Expand All @@ -62,7 +70,7 @@ protected slots:
void updateAudioBuffer(const lmms::sampleFrame* buffer);

private:
QColor const & determineLineColor(float level) const;
bool clips(float level) const;

private:
QPixmap m_background;
Expand All @@ -71,7 +79,9 @@ protected slots:
sampleFrame * m_buffer;
bool m_active;

QColor m_normalColor;
QColor m_leftChannelColor;
QColor m_rightChannelColor;
QColor m_otherChannelsColor;
QColor m_clippingColor;
} ;

Expand Down
42 changes: 15 additions & 27 deletions include/gui_templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,33 @@

#include "lmmsconfig.h"

#include <algorithm>
#include <QApplication>
#include <QFont>
#include <QDesktopWidget>
#include <QGuiApplication>

namespace lmms
// TODO: remove once qt5 support is dropped
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
#include <QScreen>
#endif

namespace lmms::gui
{


// return DPI-independent font-size - font with returned font-size has always
// the same size in pixels
template<int SIZE>
inline QFont pointSize( QFont _f )
inline QFont pointSize(QFont fontPointer, float fontSize)
{
static const float DPI = 96;
#ifdef LMMS_BUILD_WIN32
_f.setPointSizeF( ((float) SIZE+0.5f) * DPI /
QApplication::desktop()->logicalDpiY() );
#else
_f.setPointSizeF( (float) SIZE * DPI /
QApplication::desktop()->logicalDpiY() );
#endif
return( _f );
}
// to calculate DPI of a screen to make it HiDPI ready
qreal devicePixelRatio = QGuiApplication::primaryScreen()->devicePixelRatio();
qreal scaleFactor = std::max(devicePixelRatio, 1.0); // Ensure scaleFactor is at least 1.0


inline QFont pointSizeF( QFont _f, float SIZE )
{
static const float DPI = 96;
#ifdef LMMS_BUILD_WIN32
_f.setPointSizeF( (SIZE+0.5f) * DPI /
QApplication::desktop()->logicalDpiY() );
#else
_f.setPointSizeF( SIZE * DPI /
QApplication::desktop()->logicalDpiY() );
#endif
return( _f );
fontPointer.setPointSizeF(fontSize * scaleFactor);
return fontPointer;
}


} // namespace lmms
} // namespace lmms::gui

#endif // LMMS_GUI_TEMPLATES_H
4 changes: 2 additions & 2 deletions plugins/AudioFileProcessor/AudioFileProcessorView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ AudioFileProcessorView::AudioFileProcessorView(Instrument* instrument,
// interpolation selector
m_interpBox = new ComboBox(this);
m_interpBox->setGeometry(142, 62, 82, ComboBox::DEFAULT_HEIGHT);
m_interpBox->setFont(pointSize<8>(m_interpBox->font()));
m_interpBox->setFont(pointSize(m_interpBox->font(), 8));

// wavegraph
m_waveView = 0;
Expand Down Expand Up @@ -228,7 +228,7 @@ void AudioFileProcessorView::paintEvent(QPaintEvent*)

int idx = a->sample().sampleFile().length();

p.setFont(pointSize<8>(font()));
p.setFont(pointSize(font(), 8));

QFontMetrics fm(p.font());

Expand Down
2 changes: 1 addition & 1 deletion plugins/AudioFileProcessor/AudioFileProcessorWaveView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void AudioFileProcessorWaveView::paintEvent(QPaintEvent * pe)
p.fillRect(s_padding, s_padding, m_graph.width(), 14, g);

p.setPen(QColor(255, 255, 255));
p.setFont(pointSize<8>(font()));
p.setFont(pointSize(font(), 8));

QString length_text;
const int length = m_sample->sampleDuration().count();
Expand Down
4 changes: 2 additions & 2 deletions plugins/CarlaBase/Carla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid
m_toggleUIButton->setCheckable( true );
m_toggleUIButton->setChecked( false );
m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) );
m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) );
m_toggleUIButton->setFont(pointSize(m_toggleUIButton->font(), 8));
connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) );

m_toggleUIButton->setToolTip(
Expand All @@ -642,7 +642,7 @@ CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWid
m_toggleParamsWindowButton = new QPushButton(tr("Params"), this);
m_toggleParamsWindowButton->setIcon(embed::getIconPixmap("controller"));
m_toggleParamsWindowButton->setCheckable(true);
m_toggleParamsWindowButton->setFont(pointSize<8>(m_toggleParamsWindowButton->font()));
m_toggleParamsWindowButton->setFont(pointSize(m_toggleParamsWindowButton->font(), 8));
#if CARLA_VERSION_HEX < CARLA_MIN_PARAM_VERSION
m_toggleParamsWindowButton->setEnabled(false);
m_toggleParamsWindowButton->setToolTip(tr("Available from Carla version 2.1 and up."));
Expand Down
20 changes: 3 additions & 17 deletions plugins/Compressor/CompressorControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,12 @@ namespace lmms::gui

CompressorControlDialog::CompressorControlDialog(CompressorControls* controls) :
EffectControlDialog(controls),
m_controls(controls),
m_inVolAreaColor(209, 216, 228, 17),
m_inVolColor(209, 216, 228, 100),
m_outVolAreaColor(209, 216, 228, 30),
m_outVolColor(209, 216, 228, 240),
m_gainReductionColor(180, 100, 100, 210),
m_kneeColor(39, 171, 95, 255),
m_kneeColor2(9, 171, 160, 255),
m_threshColor(39, 171, 95, 100),
m_textColor(209, 216, 228, 50),
m_graphColor(209, 216, 228, 50),
m_resetColor(200, 100, 15, 200)
m_controls(controls)
{
setAutoFillBackground(false);
setAttribute(Qt::WA_OpaquePaintEvent, true);
setAttribute(Qt::WA_NoSystemBackground, true);

QPalette pal;
pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork"));
setPalette(pal);
setMinimumSize(MIN_COMP_SCREEN_X, MIN_COMP_SCREEN_Y);
resize(COMP_SCREEN_X, COMP_SCREEN_Y);

Expand Down Expand Up @@ -615,7 +601,7 @@ void CompressorControlDialog::paintEvent(QPaintEvent *event)
m_p.begin(this);

m_p.setCompositionMode(QPainter::CompositionMode_Source);
m_p.fillRect(0, 0, m_windowSizeX, m_windowSizeY, QColor("transparent"));
m_p.fillRect(0, 0, m_windowSizeX, m_windowSizeY, m_backgroundColor);
m_p.setCompositionMode(QPainter::CompositionMode_SourceOver);

m_p.drawPixmap(0, 0, m_graphPixmap);
Expand Down Expand Up @@ -683,7 +669,7 @@ void CompressorControlDialog::drawGraph()

// Redraw graph
m_p.setPen(QPen(m_graphColor, 1));
for (int i = 1; i < m_dbRange / COMP_GRID_SPACING + 1; ++i)
for (int i = 0; i < m_dbRange / COMP_GRID_SPACING + 1; ++i)
{
m_p.drawLine(0, dbfsToYPoint(-COMP_GRID_SPACING * i), m_windowSizeX, dbfsToYPoint(-COMP_GRID_SPACING * i));
m_p.drawLine(dbfsToXPoint(-COMP_GRID_SPACING * i), 0, dbfsToXPoint(-COMP_GRID_SPACING * i), m_kneeWindowSizeY);
Expand Down
2 changes: 2 additions & 0 deletions plugins/Compressor/CompressorControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CompressorControlDialog : public EffectControlDialog
Q_PROPERTY(QColor textColor MEMBER m_textColor)
Q_PROPERTY(QColor graphColor MEMBER m_graphColor)
Q_PROPERTY(QColor resetColor MEMBER m_resetColor)
Q_PROPERTY(QColor backgroundColor MEMBER m_backgroundColor)

protected:
void resizeEvent(QResizeEvent *event) override;
Expand Down Expand Up @@ -150,6 +151,7 @@ private slots:
QColor m_textColor = QColor(209, 216, 228, 50);
QColor m_graphColor = QColor(209, 216, 228, 50);
QColor m_resetColor = QColor(200, 100, 15, 200);
QColor m_backgroundColor = QColor(7, 8, 9, 255);

float m_peakAvg;
float m_gainAvg;
Expand Down
Binary file removed plugins/Compressor/artwork.png
Binary file not shown.
4 changes: 2 additions & 2 deletions plugins/DualFilter/DualFilterControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls )

auto m_filter1ComboBox = new ComboBox(this);
m_filter1ComboBox->setGeometry( 19, 70, 137, ComboBox::DEFAULT_HEIGHT );
m_filter1ComboBox->setFont( pointSize<8>( m_filter1ComboBox->font() ) );
m_filter1ComboBox->setFont(pointSize(m_filter1ComboBox->font(), 8));
m_filter1ComboBox->setModel( &controls->m_filter1Model );

auto m_filter2ComboBox = new ComboBox(this);
m_filter2ComboBox->setGeometry( 217, 70, 137, ComboBox::DEFAULT_HEIGHT );
m_filter2ComboBox->setFont( pointSize<8>( m_filter2ComboBox->font() ) );
m_filter2ComboBox->setFont(pointSize(m_filter2ComboBox->font(), 8));
m_filter2ComboBox->setModel( &controls->m_filter2Model );
}

Expand Down
12 changes: 6 additions & 6 deletions plugins/DynamicsProcessor/DynamicsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Plugin::Descriptor PLUGIN_EXPORT dynamicsprocessor_plugin_descriptor =
}

const float DYN_NOISE_FLOOR = 0.00001f; // -100dBFS noise floor
const double DNF_LOG = 5.0;
const double DNF_LOG = -1.0;

DynProcEffect::DynProcEffect( Model * _parent,
const Descriptor::SubPluginFeatures::Key * _key ) :
Expand All @@ -82,12 +82,12 @@ DynProcEffect::~DynProcEffect()

inline void DynProcEffect::calcAttack()
{
m_attCoeff = std::pow(10.f, ( DNF_LOG / ( m_dpControls.m_attackModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() );
m_attCoeff = std::exp((DNF_LOG / (m_dpControls.m_attackModel.value() * 0.001)) / Engine::audioEngine()->processingSampleRate());
}

inline void DynProcEffect::calcRelease()
{
m_relCoeff = std::pow(10.f, ( -DNF_LOG / ( m_dpControls.m_releaseModel.value() * 0.001 ) ) / Engine::audioEngine()->processingSampleRate() );
m_relCoeff = std::exp((DNF_LOG / (m_dpControls.m_releaseModel.value() * 0.001)) / Engine::audioEngine()->processingSampleRate());
}


Expand Down Expand Up @@ -155,15 +155,15 @@ bool DynProcEffect::processAudioBuffer( sampleFrame * _buf,
const double t = m_rms[i]->update( s[i] );
if( t > m_currentPeak[i] )
{
m_currentPeak[i] = qMin( m_currentPeak[i] * m_attCoeff, t );
m_currentPeak[i] = m_currentPeak[i] * m_attCoeff + (1 - m_attCoeff) * t;
}
else
if( t < m_currentPeak[i] )
{
m_currentPeak[i] = qMax( m_currentPeak[i] * m_relCoeff, t );
m_currentPeak[i] = m_currentPeak[i] * m_relCoeff + (1 - m_relCoeff) * t;
}

m_currentPeak[i] = qBound( DYN_NOISE_FLOOR, m_currentPeak[i], 10.0f );
m_currentPeak[i] = std::max(DYN_NOISE_FLOOR, m_currentPeak[i]);
}

// account for stereo mode
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaBrowser/LadspaBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ QWidget * LadspaBrowserView::createTab( QWidget * _parent, const QString & _txt,
auto title = new QLabel(type + _txt, tab);
QFont f = title->font();
f.setBold( true );
title->setFont( pointSize<12>( f ) );
title->setFont(pointSize(f, 12));

layout->addSpacing( 5 );
layout->addWidget( title );
Expand Down
Loading

0 comments on commit 2e3a33c

Please sign in to comment.