-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New Spectrum Analyzer #4950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Spectrum Analyzer #4950
Changes from 43 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
d263bbf
New spectrum analyzer work in progress / init
he29-net 47fba16
Implement resizability and X axis linear/log scale
he29-net c0563e2
Rework Y axis drawing and add linear scale; various cleanup
he29-net 3e13296
Implement waterfall graph basics; variety of other stuff
he29-net c71692f
Fix that silly stereo rendering bug; minor waterfall cleanup
he29-net 95e5713
WIP commit before branch switch
he29-net dcfa7bc
window precomputing update
he29-net b2ca051
Fix bug with disappearing curves; implement averaging; ref. freeze WIP
he29-net bbaee49
WIP on FFT block size switching (currently broken)
he29-net 280bd8f
Finished block size and window type switching; many small fixes
he29-net b80b214
Log scale for waterfall
he29-net f9f4ef7
WIP on range switching
he29-net feed0fb
Implemented cursor display and readings for spectrum view
he29-net 66bea0e
Many small improvements, mainly range switching
he29-net b1b9146
paintEvent rewrite and optimization, peak hold implementation
he29-net 6d1a244
Config GUI overhaul
he29-net 44f1240
Big cleanup in progress
he29-net d48349b
Continued cleanup; finished waterfall hiding, added zero padding
he29-net 1700b80
Fine-tuning and cleanup done, ready for rebase
he29-net 1decd33
Cleanup of fft_helpers
he29-net 29d89df
Replace std::mutex with QMutex; some additional fine-tuning
he29-net d6fd391
Fix EffectView mistake; boost gamma curve slightly to make low values…
he29-net c7db22a
Update src/core/fft_helpers.cpp
he29-net 134619e
Update src/core/fft_helpers.cpp
he29-net 8ef716a
fft_helpers.h indentation fix
he29-net 5e07a28
fft_helpers: Add @return tags to function commets; mark pointer and r…
he29-net ba85822
Move opening brackets to separate line
he29-net 9e40dc4
Fix Doxygen syntax in fft_helpers
he29-net 2b59149
Fix of the previous 'Doxygen fix' fix
he29-net 0058626
Add tool-tips
he29-net b03d48d
Update plugins/SpectrumAnalyzer/SaProcessor.h
he29-net 5f18863
Update plugins/SpectrumAnalyzer/Analyzer.h
he29-net cec0768
Update plugins/SpectrumAnalyzer/SaProcessor.cpp
he29-net b9d3e0d
Update plugins/SpectrumAnalyzer/SaControlsDialog.cpp
he29-net 70b964c
Update plugins/SpectrumAnalyzer/SaControlsDialog.h
he29-net def85bc
Update plugins/SpectrumAnalyzer/SaSpectrumView.h
he29-net 57a5b6e
Remove EffectControlDialog pointer from SaControls, add a replacement…
he29-net 8c5c35a
Use markdown syntax for readme file
he29-net 4431e6e
Fix the markdown syntax I just added xD
he29-net 86f01ff
... and change changelog formatting, since apparently tabs here are 8…
he29-net d0a7f70
Arrgh! And fix a typo in the title >_<
he29-net 78d328e
Avoid waterfall history updates when there is no input
he29-net be824e1
Display black rectangle instead waterfall when no data are available
he29-net 0e6aa9e
Add 'override's to overriding methods; mark additional constructors a…
he29-net aa41b84
Remove iostream include from SaWaterfall
he29-net 1556187
Update plugins/SpectrumAnalyzer/SaProcessor.cpp
he29-net ec9615c
Update plugins/SpectrumAnalyzer/SaProcessor.cpp
he29-net ff13ca3
Update plugins/SpectrumAnalyzer/SaProcessor.cpp
he29-net 217f629
Update plugins/SpectrumAnalyzer/SaProcessor.cpp
he29-net b359881
First batch of changes for second review round
he29-net f4510ec
Make some -Weverything warnings go away (mainly implicit signed vs. u…
he29-net c8a105c
Cleanup includes, update comments in SaProcessor
he29-net 89d4703
Batch of changes for the third review
he29-net 14e9008
Restrict cursor drawing to graph ranges
JohannesLorenz 1409f1f
Spectrum View: Use existing cursor boundaries
JohannesLorenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 = | ||
| { | ||
| STRINGIFY(PLUGIN_NAME), | ||
| "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_controls(this), | ||
| m_processor(&m_controls) | ||
| { | ||
| } | ||
|
|
||
|
|
||
| // 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(); | ||
JohannesLorenz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
|
|
||
| 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.