-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace old spectrum analyzer by new one with higher resolution and many new features. Resolves #2847.
- Loading branch information
1 parent
73c2c70
commit c3b4d51
Showing
42 changed files
with
5,327 additions
and
749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
INCLUDE(BuildPlugin) | ||
INCLUDE_DIRECTORIES(${FFTW3F_INCLUDE_DIRS}) | ||
LINK_LIBRARIES(${FFTW3F_LIBRARIES}) | ||
BUILD_PLUGIN(spectrumanalyzer SpectrumAnalyzer.cpp SpectrumAnalyzerControls.cpp SpectrumAnalyzerControlDialog.cpp SpectrumAnalyzer.h SpectrumAnalyzerControls.h SpectrumAnalyzerControlDialog.h MOCFILES SpectrumAnalyzerControlDialog.h SpectrumAnalyzerControls.h EMBEDDED_RESOURCES *.png) | ||
BUILD_PLUGIN(analyzer Analyzer.cpp SaProcessor.cpp SaControls.cpp SaControlsDialog.cpp SaSpectrumView.cpp SaWaterfallView.cpp | ||
MOCFILES SaProcessor.h SaControls.h SaControlsDialog.h SaSpectrumView.h SaWaterfallView.h EMBEDDED_RESOURCES *.svg logo.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Spectrum Analyzer plugin | ||
|
||
## Overview | ||
|
||
This plugin consists of three widgets and back-end code to provide them with required data. | ||
|
||
The top-level widget is SaControlDialog. It populates a configuration widget (created dynamically) and instantiates spectrum display widgets. Its main back-end class is SaControls, which holds all configuration values and globally valid constants (e.g. range definitions). | ||
|
||
SaSpectrumDisplay and SaWaterfallDisplay show the result of spectrum analysis. Their main back-end class is SaProcessor, which performs FFT analysis on data received from the Analyzer class, which in turn handles the interface with LMMS. | ||
|
||
|
||
## Changelog | ||
|
||
1.0.1 2019-06-02 | ||
- code style changes | ||
- added tool-tips | ||
- use const for unmodified arrays passed to fft_helpers | ||
1.0.0 2019-04-07 | ||
- initial release |
Oops, something went wrong.