Skip to content

Commit

Permalink
Merge branch 'master' into Knife
Browse files Browse the repository at this point in the history
  • Loading branch information
Spekular authored Jul 27, 2019
2 parents 8132fb3 + 1c715bc commit 6fb8653
Show file tree
Hide file tree
Showing 100 changed files with 60,174 additions and 12,530 deletions.
12,662 changes: 10,253 additions & 2,409 deletions data/locale/cs.ts

Large diffs are not rendered by default.

8,369 changes: 7,679 additions & 690 deletions data/locale/en.ts

Large diffs are not rendered by default.

7,085 changes: 5,687 additions & 1,398 deletions data/locale/ko.ts

Large diffs are not rendered by default.

12,795 changes: 10,391 additions & 2,404 deletions data/locale/ru.ts

Large diffs are not rendered by default.

12,780 changes: 10,382 additions & 2,398 deletions data/locale/uk.ts

Large diffs are not rendered by default.

12,774 changes: 10,349 additions & 2,425 deletions data/locale/zh_TW.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/DummyInstrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DummyInstrument : public Instrument

virtual PluginView * instantiateView( QWidget * _parent )
{
return new InstrumentView( this, _parent );
return new InstrumentViewFixedSize( this, _parent );
}
} ;

Expand Down
2 changes: 2 additions & 0 deletions include/EffectControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class LMMS_EXPORT EffectControlDialog : public QWidget, public ModelView
EffectControlDialog( EffectControls * _controls );
virtual ~EffectControlDialog();

virtual bool isResizable() const {return false;}


signals:
void closed();
Expand Down
5 changes: 3 additions & 2 deletions include/FxLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ class FxLine : public QWidget

static const int FxLineHeight;

void renameChannel();

bool eventFilter (QObject *dist, QEvent *event);

private:
Expand All @@ -101,6 +99,9 @@ class FxLine : public QWidget
QLineEdit * m_renameLineEdit;
QGraphicsView * m_view;

public slots:
void renameChannel();

private slots:
void renameFinished();
void removeChannel();
Expand Down
19 changes: 17 additions & 2 deletions include/InstrumentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
class InstrumentTrackWindow;


//! Instrument view with variable size
class LMMS_EXPORT InstrumentView : public PluginView
{
public:
InstrumentView( Instrument * _instrument, QWidget * _parent );
virtual ~InstrumentView();
~InstrumentView() override;

Instrument * model()
{
Expand All @@ -48,11 +49,25 @@ class LMMS_EXPORT InstrumentView : public PluginView
return( castModel<Instrument>() );
}

virtual void setModel( Model * _model, bool = false );
void setModel( Model * _model, bool = false ) override;

InstrumentTrackWindow * instrumentTrackWindow();

} ;




//! Instrument view with fixed LMMS-default size
class LMMS_EXPORT InstrumentViewFixedSize : public InstrumentView
{
QSize sizeHint() const override { return QSize(250, 250); }
QSize minimumSizeHint() const override { return sizeHint(); }

public:
using InstrumentView::InstrumentView;
~InstrumentViewFixedSize() override;
} ;


#endif
1 change: 0 additions & 1 deletion include/SubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <QGraphicsDropShadowEffect>
#include <QMdiSubWindow>
#include <QLabel>
#include <QPainter>
#include <QPushButton>
#include <QString>

Expand Down
1 change: 1 addition & 0 deletions include/TabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class TabWidget : public QWidget
virtual void resizeEvent( QResizeEvent * _re );
virtual void wheelEvent( QWheelEvent * _we );
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;

private:
struct widgetDesc
Expand Down
94 changes: 64 additions & 30 deletions include/fft_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* fft_helpers.h - some functions around FFT analysis
*
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2019 Martin Pavelek <he29.HS/at/gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
Expand All @@ -28,57 +29,90 @@

#include "lmms_export.h"

#include <vector>
#include <fftw3.h>

const int FFT_BUFFER_SIZE = 2048;
// NOTE: FFT_BUFFER_SIZE should be considered deprecated!
// It is used by Eq plugin and some older code here, but this should be a user
// switchable parameter, not a constant. Use a value from FFT_BLOCK_SIZES
const unsigned int FFT_BUFFER_SIZE = 2048;

enum WINDOWS
// Allowed FFT block sizes. Ranging from barely useful to barely acceptable
// because of performance and latency reasons.
const std::vector<unsigned int> FFT_BLOCK_SIZES = {256, 512, 1024, 2048, 4096, 8192, 16384};

// List of FFT window functions supported by precomputeWindow()
enum FFT_WINDOWS
{
KAISER=1,
RECTANGLE,
HANNING,
HAMMING
RECTANGULAR = 0,
BLACKMAN_HARRIS,
HAMMING,
HANNING
};

/* returns biggest value from abs_spectrum[spec_size] array

/** Returns biggest value from abs_spectrum[spec_size] array.
*
* @return -1 on error, 0 on success
*/
float LMMS_EXPORT maximum(const float *abs_spectrum, unsigned int spec_size);
float LMMS_EXPORT maximum(const std::vector<float> &abs_spectrum);


/** Normalize the abs_spectrum array of absolute values to a 0..1 range
* based on supplied energy and stores it in the norm_spectrum array.
*
* @return -1 on error
*/
int LMMS_EXPORT normalize(const float *abs_spectrum, float *norm_spectrum, unsigned int bin_count, unsigned int block_size);
int LMMS_EXPORT normalize(const std::vector<float> &abs_spectrum, std::vector<float> &norm_spectrum, unsigned int block_size);


/** Check if the spectrum contains any non-zero value.
*
* returns -1 on error
* @return 1 if spectrum contains any non-zero value
* @return 0 otherwise
*/
float LMMS_EXPORT maximum( float * _abs_spectrum, unsigned int _spec_size );
int LMMS_EXPORT notEmpty(const std::vector<float> &spectrum);


/* apply hanning or hamming window to channel
/** Precompute a window function for later real-time use.
* Set normalized to false if you do not want to apply amplitude correction.
*
* returns -1 on error
* @return -1 on error
*/
int LMMS_EXPORT hanming( float * _timebuffer, int _length, WINDOWS _type );
int LMMS_EXPORT precomputeWindow(float *window, unsigned int length, FFT_WINDOWS type, bool normalized = true);

/* compute absolute values of complex_buffer, save to absspec_buffer
* take care that - compl_len is not bigger than complex_buffer!
* - absspec buffer is big enough!

/** Compute absolute values of complex_buffer, save to absspec_buffer.
* Take care that - compl_len is not bigger than complex_buffer!
* - absspec buffer is big enough!
*
* returns 0 on success, else -1
* @return 0 on success, else -1
*/
int LMMS_EXPORT absspec( fftwf_complex * _complex_buffer, float * _absspec_buffer,
int _compl_length );
int LMMS_EXPORT absspec(const fftwf_complex *complex_buffer, float *absspec_buffer,
unsigned int compl_length);


/* build fewer subbands from many absolute spectrum values
* take care that - compressedbands[] array num_new elements long
* - num_old > num_new
/** Build fewer subbands from many absolute spectrum values.
* Take care that - compressedbands[] array num_new elements long
* - num_old > num_new
*
* returns 0 on success, else -1
* @return 0 on success, else -1
*/
int LMMS_EXPORT compressbands( float * _absspec_buffer, float * _compressedband,
int _num_old, int _num_new, int _bottom, int _top );
int LMMS_EXPORT compressbands(const float * _absspec_buffer, float * _compressedband,
int _num_old, int _num_new, int _bottom, int _top);


int LMMS_EXPORT calc13octaveband31(float * _absspec_buffer, float * _subbands,
int _num_spec, float _max_frequency);

int LMMS_EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands,
int _num_spec, float _max_frequency );

/* compute power of finite time sequence
* take care num_values is length of timesignal[]
/** Compute power of finite time sequence.
* Take care num_values is length of timesignal[].
*
* returns power on success, else -1
* @return power on success, else -1
*/
float LMMS_EXPORT signalpower(float *timesignal, int num_values);
float LMMS_EXPORT signalpower(const float *timesignal, int num_values);

#endif
2 changes: 1 addition & 1 deletion plugins/FreeBoy/FreeBoy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class FreeBoyKnob : public Knob

FreeBoyInstrumentView::FreeBoyInstrumentView( Instrument * _instrument,
QWidget * _parent ) :
InstrumentView( _instrument, _parent )
InstrumentViewFixedSize( _instrument, _parent )
{

setAutoFillBackground( true );
Expand Down
2 changes: 1 addition & 1 deletion plugins/FreeBoy/FreeBoy.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class FreeBoyInstrument : public Instrument
} ;


class FreeBoyInstrumentView : public InstrumentView
class FreeBoyInstrumentView : public InstrumentViewFixedSize
{
Q_OBJECT
public:
Expand Down
2 changes: 1 addition & 1 deletion plugins/GigPlayer/GigPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ class gigKnob : public Knob


GigInstrumentView::GigInstrumentView( Instrument * _instrument, QWidget * _parent ) :
InstrumentView( _instrument, _parent )
InstrumentViewFixedSize( _instrument, _parent )
{
GigInstrument * k = castModel<GigInstrument>();

Expand Down
2 changes: 1 addition & 1 deletion plugins/GigPlayer/GigPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public slots:



class GigInstrumentView : public InstrumentView
class GigInstrumentView : public InstrumentViewFixedSize
{
Q_OBJECT
public:
Expand Down
2 changes: 1 addition & 1 deletion plugins/OpulenZ/OpulenZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ void OpulenzInstrument::loadFile( const QString& file ) {

OpulenzInstrumentView::OpulenzInstrumentView( Instrument * _instrument,
QWidget * _parent ) :
InstrumentView( _instrument, _parent )
InstrumentViewFixedSize( _instrument, _parent )
{

#define KNOB_GEN(knobname, hinttext, hintunit,xpos,ypos) \
Expand Down
2 changes: 1 addition & 1 deletion plugins/OpulenZ/OpulenZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private slots:



class OpulenzInstrumentView : public InstrumentView
class OpulenzInstrumentView : public InstrumentViewFixedSize
{
Q_OBJECT
public:
Expand Down
75 changes: 75 additions & 0 deletions plugins/SpectrumAnalyzer/Analyzer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Analyzer.cpp - definition of Analyzer class.
*
* Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/com>
*
* Based partially on Eq plugin code,
* Copyright (c) 2014-2017, David French <dave/dot/french3/at/googlemail/dot/com>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#include "Analyzer.h"

#include "embed.h"
#include "plugin_export.h"


extern "C" {
Plugin::Descriptor PLUGIN_EXPORT analyzer_plugin_descriptor =
{
"spectrumanalyzer",
"Spectrum Analyzer",
QT_TRANSLATE_NOOP("pluginBrowser", "A graphical spectrum analyzer."),
"Martin Pavelek <he29/dot/HS/at/gmail/dot/com>",
0x0100,
Plugin::Effect,
new PluginPixmapLoader("logo"),
NULL,
NULL
};
}


Analyzer::Analyzer(Model *parent, const Plugin::Descriptor::SubPluginFeatures::Key *key) :
Effect(&analyzer_plugin_descriptor, parent, key),
m_processor(&m_controls),
m_controls(this)
{
}


// Take audio data and pass them to the spectrum processor.
// Skip processing if the controls dialog isn't visible, it would only waste CPU cycles.
bool Analyzer::processAudioBuffer(sampleFrame *buffer, const fpp_t frame_count)
{
if (!isEnabled() || !isRunning ()) {return false;}
if (m_controls.isViewVisible()) {m_processor.analyse(buffer, frame_count);}
return isRunning();
}


extern "C" {
// needed for getting plugin out of shared lib
PLUGIN_EXPORT Plugin *lmms_plugin_main(Model *parent, void *data)
{
return new Analyzer(parent, static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>(data));
}
}

Loading

0 comments on commit 6fb8653

Please sign in to comment.