-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Vectorscope #5328
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
Vectorscope #5328
Changes from 5 commits
f5b1e1d
11a0a62
e8fbae6
5afa2ee
dee9624
1b33965
2d6efec
b4ca675
763eae6
9f12710
84b4418
447c6b0
48cfb33
4c8884a
b043792
5d1e06e
51b0178
0e3359e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,7 @@ SET(LMMS_PLUGIN_LIST | |
| VstEffect | ||
| watsyn | ||
| waveshaper | ||
| Vectorscope | ||
| vibed | ||
| Xpressive | ||
| zynaddsubfx | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| INCLUDE(BuildPlugin) | ||
| BUILD_PLUGIN(vectorscope Vectorscope.cpp VecControls.cpp VecControlsDialog.cpp VectorView.cpp | ||
| MOCFILES VecControls.h VecControlsDialog.h VectorView.h EMBEDDED_RESOURCES logo.png) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Vectorscope plugin | ||
|
|
||
| ## Overview | ||
|
|
||
| Vectorscope is a simple stereo field visualizer. Samples are plotted into a graph, with left and right channels providing the coordinates. Previously drawn samples quickly fade away and are continuously replaced by new samples, creating a real-time plot of the most recently played samples. | ||
|
|
||
| Similar to other effect plugins, the top-level widget is VecControlDialog. It displays configuration knobs and the main VectorView widget. The back-end configuration class is VecControls, which holds all models and configuration values. | ||
|
|
||
| VectorView computes and shows the plot. It gets data for processing from the Vectorscope class, which handles the interface with LMMS. In order to avoid any stalling of the realtime-sensitive audio thread, data are exchanged through a lockless ring buffer. | ||
|
|
||
| ## Changelog | ||
|
|
||
| 1.0.0 2019-11-21 | ||
| - initial release |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * VecControls.cpp - definition of VecControls class. | ||
| * | ||
| * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/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 "VecControls.h" | ||
|
|
||
| #include <QtXml/QDomElement> | ||
|
|
||
| #include "VecControlsDialog.h" | ||
| #include "Vectorscope.h" | ||
|
|
||
|
|
||
| VecControls::VecControls(Vectorscope *effect) : | ||
| EffectControls(effect), | ||
| m_effect(effect), | ||
|
|
||
| // initialize models and set default values | ||
| m_persistenceModel(0.5f, 0.0f, 1.0f, 0.05f, this, tr("Display persistence amount")), | ||
| m_logarithmicModel(false, this, tr("Logarithmic scale")), | ||
| m_highQualityModel(false, this, tr("High quality")) | ||
| { | ||
| // Colors (percentages include sRGB gamma correction) | ||
| m_colorFG = QColor(60, 255, 130, 255); // ~LMMS green | ||
| m_colorGrid = QColor(76, 80, 84, 128); // ~60 % gray (slightly cold / blue), 50 % transparent | ||
| m_colorLabels = QColor(76, 80, 84, 255); // ~60 % gray (slightly cold / blue) | ||
| m_colorOutline = QColor(30, 34, 38, 255); // ~40 % gray (slightly cold / blue) | ||
| } | ||
|
|
||
|
|
||
| // Create the VecControlDialog widget which handles display of GUI elements. | ||
| EffectControlDialog* VecControls::createView() | ||
| { | ||
| return new VecControlsDialog(this); | ||
| } | ||
|
|
||
|
|
||
| void VecControls::loadSettings(const QDomElement &_this) | ||
| { | ||
| m_persistenceModel.loadSettings(_this, "Persistence"); | ||
| m_logarithmicModel.loadSettings(_this, "Logarithmic"); | ||
| m_highQualityModel.loadSettings(_this, "HighQuality"); | ||
| } | ||
|
|
||
|
|
||
| void VecControls::saveSettings(QDomDocument &doc, QDomElement &parent) | ||
| { | ||
| m_persistenceModel.saveSettings(doc, parent, "Persistence"); | ||
| m_logarithmicModel.saveSettings(doc, parent, "Logarithmic"); | ||
| m_highQualityModel.saveSettings(doc, parent, "HighQuality"); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * VecControls.h - declaration of VecControls class. | ||
| * | ||
| * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/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. | ||
| * | ||
| */ | ||
|
|
||
| #ifndef VECCONTROLS_H | ||
| #define VECCONTROLS_H | ||
|
|
||
| #include <QColor> | ||
|
|
||
| #include "EffectControls.h" | ||
|
|
||
|
|
||
| class Vectorscope; | ||
|
|
||
| // Holds all the configuration values | ||
| class VecControls : public EffectControls | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| explicit VecControls(Vectorscope* effect); | ||
| virtual ~VecControls() {} | ||
|
|
||
| EffectControlDialog* createView() override; | ||
|
|
||
| void saveSettings (QDomDocument& doc, QDomElement& parent) override; | ||
| void loadSettings (const QDomElement &_this) override; | ||
|
|
||
| QString nodeName() const override {return "Vectorscope";} | ||
| int controlCount() override {return 3;} | ||
|
|
||
| private: | ||
| Vectorscope *m_effect; | ||
|
|
||
| FloatModel m_persistenceModel; | ||
| BoolModel m_logarithmicModel; | ||
| BoolModel m_highQualityModel; | ||
|
|
||
| QColor m_colorFG; | ||
| QColor m_colorGrid; | ||
| QColor m_colorLabels; | ||
| QColor m_colorOutline; | ||
|
||
|
|
||
| friend class VecControlsDialog; | ||
| friend class VectorView; | ||
| }; | ||
| #endif // VECCONTROLS_H | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* | ||
| * VecControlsDialog.cpp - definition of VecControlsDialog class. | ||
| * | ||
| * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/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 "VecControlsDialog.h" | ||
|
|
||
| #include <QGridLayout> | ||
| #include <QLabel> | ||
| #include <QResizeEvent> | ||
| #include <QSizePolicy> | ||
| #include <QWidget> | ||
|
|
||
| #include "embed.h" | ||
| #include "LedCheckbox.h" | ||
| #include "VecControls.h" | ||
| #include "Vectorscope.h" | ||
| #include "VectorView.h" | ||
|
|
||
|
|
||
| // The entire GUI layout is built here. | ||
| VecControlsDialog::VecControlsDialog(VecControls *controls) : | ||
| EffectControlDialog(controls), | ||
| m_controls(controls) | ||
| { | ||
| QVBoxLayout *master_layout = new QVBoxLayout; | ||
| master_layout->setContentsMargins(0, 2, 0, 0); | ||
| setLayout(master_layout); | ||
|
|
||
| // Visualizer widget | ||
| // The size of 768 pixels seems to offer a good balance of speed, accuracy and trace thickness. | ||
| VectorView *display = new VectorView(controls, m_controls->m_effect->getBuffer(), 768, this); | ||
| master_layout->addWidget(display); | ||
|
|
||
| // Config area located inside visualizer | ||
| QVBoxLayout *internal_layout = new QVBoxLayout(display); | ||
| QHBoxLayout *config_layout = new QHBoxLayout(); | ||
| QVBoxLayout *switch_layout = new QVBoxLayout(); | ||
| internal_layout->addStretch(); | ||
| internal_layout->addLayout(config_layout); | ||
| config_layout->addLayout(switch_layout); | ||
|
|
||
| // High-quality switch | ||
| LedCheckBox *highQualityButton = new LedCheckBox(tr("HQ"), this); | ||
| highQualityButton->setToolTip(tr("Double the resolution and simulate continuous analog-like trace.")); | ||
| highQualityButton->setCheckable(true); | ||
| highQualityButton->setMinimumSize(70, 12); | ||
| highQualityButton->setModel(&controls->m_highQualityModel); | ||
| switch_layout->addWidget(highQualityButton); | ||
|
|
||
| // Log. scale switch | ||
| LedCheckBox *logarithmicButton = new LedCheckBox(tr("Log. scale"), this); | ||
| logarithmicButton->setToolTip(tr("Display amplitude on logarithmic scale to better see small values.")); | ||
| logarithmicButton->setCheckable(true); | ||
| logarithmicButton->setMinimumSize(70, 12); | ||
| logarithmicButton->setModel(&controls->m_logarithmicModel); | ||
| switch_layout->addWidget(logarithmicButton); | ||
|
|
||
| config_layout->addStretch(); | ||
|
|
||
| // Persistence knob | ||
| Knob *persistenceKnob = new Knob(knobSmall_17, this); | ||
| persistenceKnob->setModel(&controls->m_persistenceModel); | ||
| persistenceKnob->setLabel(tr("Persist.")); | ||
| persistenceKnob->setToolTip(tr("Trace persistence: higher amount means the trace will stay bright for longer time.")); | ||
| persistenceKnob->setHintText(tr("Trace persistence"), ""); | ||
| config_layout->addWidget(persistenceKnob); | ||
| } | ||
|
|
||
|
|
||
| // Suggest the best widget size. | ||
| QSize VecControlsDialog::sizeHint() const | ||
| { | ||
| return QSize(275, 300); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * VecControlsDialog.h - declatation of VecControlsDialog class. | ||
| * | ||
| * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/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. | ||
| * | ||
| */ | ||
|
|
||
| #ifndef VECCONTROLSDIALOG_H | ||
| #define VECCONTROLSDIALOG_H | ||
|
|
||
| #include "EffectControlDialog.h" | ||
|
|
||
| class VecControls; | ||
|
|
||
| //! Top-level widget holding the configuration GUI and vector display | ||
| class VecControlsDialog : public EffectControlDialog | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| explicit VecControlsDialog(VecControls *controls); | ||
| virtual ~VecControlsDialog() {} | ||
|
|
||
| bool isResizable() const override {return true;} | ||
| QSize sizeHint() const override; | ||
|
|
||
| private: | ||
| VecControls *m_controls; | ||
| }; | ||
|
|
||
| #endif // VECCONTROLSDIALOG_H |
Uh oh!
There was an error while loading. Please reload this page.