-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Phaser effect to LMMS #6540
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
Draft
LostRobotMusic
wants to merge
12
commits into
LMMS:master
Choose a base branch
from
LostRobotMusic:phaser-new
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fc41895
Add Phaser effect
LostRobotMusic 2f68a42
Replace exp10 with pow
LostRobotMusic 3c2a10a
Minor style improvements
LostRobotMusic a99c482
Replace oversampling vectors with arrays
LostRobotMusic 6211fcd
Replace oversampling vectors with arrays
LostRobotMusic a24bebe
Fix plugin descriptor
LostRobotMusic 0dd43c2
Merge branch 'LMMS:master' into phaser-new
LostRobotMusic 565b8e1
Merge branch 'LMMS:master' into phaser-new
LostRobotMusic c5f76b4
Use HIIR library for oversampling
LostRobotMusic 274ab0e
Oversampling bandwidth requirement
LostRobotMusic eced4d1
Revert oversampling BW change
LostRobotMusic 1c7bc28
I don't know how to rebase, so have a commit instead
LostRobotMusic 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,7 @@ SET(LMMS_PLUGIN_LIST | |
| FreeBoy | ||
| Patman | ||
| PeakControllerEffect | ||
| Phaser | ||
| GigPlayer | ||
| ReverbSC | ||
| Sf2Player | ||
|
|
||
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,3 @@ | ||
| INCLUDE(BuildPlugin) | ||
|
|
||
| BUILD_PLUGIN(Phaser PhaserEffect.cpp PhaserControls.cpp PhaserControlDialog.cpp MOCFILES PhaserEffect.h PhaserControls.h PhaserControlDialog.h ../Eq/EqFader.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png") | ||
LostRobotMusic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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,242 @@ | ||
| /* | ||
| * PhaserControlDialog.cpp | ||
| * | ||
| * Copyright (c) 2019 Lost Robot <[email protected]> | ||
| * | ||
| * 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 <QLayout> | ||
|
|
||
| #include "PhaserControlDialog.h" | ||
| #include "PhaserControls.h" | ||
| #include "PhaserEffect.h" | ||
|
|
||
| #include "../Eq/EqFader.h" | ||
| #include "embed.h" | ||
| #include "gui_templates.h" | ||
| #include "LedCheckBox.h" | ||
| #include "lmms_math.h" | ||
| #include "PixmapButton.h" | ||
| #include "TempoSyncKnob.h" | ||
|
|
||
| namespace lmms::gui | ||
| { | ||
|
|
||
| constexpr int PHA_DOT_SLIDER_LENGTH = 338; | ||
| constexpr float PHA_MIN_FREQ = 20; | ||
| constexpr float PHA_MAX_FREQ = 20000; | ||
|
|
||
|
|
||
| PhaserControlDialog::PhaserControlDialog(PhaserControls* controls) : | ||
| EffectControlDialog(controls), | ||
| m_controls(controls) | ||
| { | ||
| setAutoFillBackground(true); | ||
| QPalette pal; | ||
| pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork")); | ||
| setPalette(pal); | ||
| setFixedSize(370, 200); | ||
|
|
||
| Knob * cutoffKnob = new Knob(knobBright_26, this); | ||
| cutoffKnob -> move(64, 50); | ||
| cutoffKnob->setModel(&controls->m_cutoffModel); | ||
| cutoffKnob->setHintText(tr("Cutoff:"), " Hz"); | ||
| cutoffKnob->setToolTip(tr("Center frequency of allpass filters")); | ||
|
|
||
| Knob * resonanceKnob = new Knob(knobBright_26, this); | ||
| resonanceKnob -> move(102, 50); | ||
| resonanceKnob->setModel(&controls->m_resonanceModel); | ||
| resonanceKnob->setHintText(tr("Resonance:"), ""); | ||
| resonanceKnob->setToolTip(tr("Resonance of allpass filters")); | ||
|
|
||
| Knob * feedbackKnob = new Knob(knobBright_26, this); | ||
| feedbackKnob -> move(158, 50); | ||
| feedbackKnob->setModel(&controls->m_feedbackModel); | ||
| feedbackKnob->setHintText(tr("Feedback:"), "%"); | ||
| feedbackKnob->setToolTip(tr("Feedback amount for allpass filters")); | ||
|
|
||
| LcdSpinBox * m_orderBox = new LcdSpinBox(2, this, "Order"); | ||
| m_orderBox->setModel(&controls->m_orderModel); | ||
| m_orderBox->move(247, 61); | ||
| m_orderBox->setToolTip(tr("Number of allpass filters")); | ||
|
|
||
| Knob * delayKnob = new Knob(knobBright_26, this); | ||
| delayKnob -> move(196, 50); | ||
| delayKnob->setModel(&controls->m_delayModel); | ||
| delayKnob->setHintText(tr("Delay:"), " ms"); | ||
| delayKnob->setToolTip(tr("Delay length of allpass filter feedback")); | ||
|
|
||
| TempoSyncKnob * rateKnob = new TempoSyncKnob(knobBright_26, this); | ||
| rateKnob -> move(103, 126); | ||
| rateKnob->setModel(&controls->m_rateModel); | ||
| rateKnob->setHintText(tr("Rate:"), " Sec"); | ||
| rateKnob->setToolTip(tr("LFO frequency")); | ||
|
|
||
| Knob * amountKnob = new Knob(knobBright_26, this); | ||
| amountKnob -> move(65, 126); | ||
| amountKnob->setModel(&controls->m_amountModel); | ||
| amountKnob->setHintText(tr("Amount:"), " octaves"); | ||
| amountKnob->setToolTip(tr("LFO amplitude")); | ||
|
|
||
| Knob * phaseKnob = new Knob(knobBright_26, this); | ||
| phaseKnob -> move(141, 126); | ||
| phaseKnob->setModel(&controls->m_phaseModel); | ||
| phaseKnob->setHintText(tr("Phase:"), " degrees"); | ||
| phaseKnob->setToolTip(tr("LFO stereo phase")); | ||
|
|
||
| Knob * inFollowKnob = new Knob(knobBright_26, this); | ||
| inFollowKnob -> move(202, 126); | ||
| inFollowKnob->setModel(&controls->m_inFollowModel); | ||
| inFollowKnob->setHintText(tr("Input Following:"), " octaves"); | ||
| inFollowKnob->setToolTip(tr("Input follower amplitude")); | ||
|
|
||
| Knob * attackKnob = new Knob(knobBright_26, this); | ||
| attackKnob -> move(240, 126); | ||
| attackKnob->setModel(&controls->m_attackModel); | ||
| attackKnob->setHintText(tr("Attack:"), " ms"); | ||
| attackKnob->setToolTip(tr("Input follower attack")); | ||
|
|
||
| Knob * releaseKnob = new Knob(knobBright_26, this); | ||
| releaseKnob -> move(278, 126); | ||
| releaseKnob->setModel(&controls->m_releaseModel); | ||
| releaseKnob->setHintText(tr("Release:"), " ms"); | ||
| releaseKnob->setToolTip(tr("Input follower release")); | ||
|
|
||
| Knob * distortionKnob = new Knob(knobSmall_17, this); | ||
| distortionKnob -> move(292, 63); | ||
| distortionKnob->setModel(&controls->m_distortionModel); | ||
| distortionKnob->setHintText(tr("Distortion:"), "%"); | ||
| distortionKnob->setToolTip(tr("Feedback rectifier")); | ||
|
|
||
| Knob * analogDistKnob = new Knob(knobSmall_17, this); | ||
| analogDistKnob -> move(243, 8); | ||
| analogDistKnob->setModel(&controls->m_analogDistModel); | ||
| analogDistKnob->setHintText(tr("Analog Distortion:"), "x"); | ||
| analogDistKnob->setToolTip(tr("Analog distortion amount")); | ||
|
|
||
| Knob * delayControlKnob = new Knob(knobSmall_17, this); | ||
| delayControlKnob -> move(344, 8); | ||
| delayControlKnob->setModel(&controls->m_delayControlModel); | ||
| delayControlKnob->setHintText(tr("Delay Control:"), "x"); | ||
| delayControlKnob->setToolTip(tr("Delay control amount")); | ||
|
|
||
| Knob * cutoffControlKnob = new Knob(knobSmall_17, this); | ||
| cutoffControlKnob -> move(300, 8); | ||
| cutoffControlKnob->setModel(&controls->m_cutoffControlModel); | ||
| cutoffControlKnob->setHintText(tr("Cutoff Control:"), "x"); | ||
| cutoffControlKnob->setToolTip(tr("Cutoff control amount")); | ||
|
|
||
| ComboBox * m_modeBox = new ComboBox(this); | ||
| m_modeBox->setGeometry(6, 6, 74, 22); | ||
| m_modeBox->setFont(pointSize<8>(m_modeBox->font())); | ||
| m_modeBox->setModel(&m_controls->m_modeModel); | ||
| m_modeBox->setToolTip(tr("Change Phaser feedback circuit")); | ||
|
|
||
| QPixmap cutoffDotLeftImg = PLUGIN_NAME::getIconPixmap("cutoffDotLeft"); | ||
| m_cutoffDotLeftLabel = new QLabel(this); | ||
| m_cutoffDotLeftLabel->setPixmap(cutoffDotLeftImg); | ||
| m_cutoffDotLeftLabel->setAttribute(Qt::WA_TransparentForMouseEvents); | ||
| m_cutoffDotLeftLabel->move(182, 183); | ||
|
|
||
| QPixmap cutoffDotRightImg = PLUGIN_NAME::getIconPixmap("cutoffDotRight"); | ||
| m_cutoffDotRightLabel = new QLabel(this); | ||
| m_cutoffDotRightLabel->setPixmap(cutoffDotRightImg); | ||
| m_cutoffDotRightLabel->setAttribute(Qt::WA_TransparentForMouseEvents); | ||
| m_cutoffDotRightLabel->move(182, 183); | ||
|
|
||
| LedCheckBox * enableLFO = new LedCheckBox("", this, tr("Enable LFO"), LedCheckBox::Green); | ||
| enableLFO->setModel(&controls->m_enableLFOModel); | ||
| enableLFO->move(159, 104); | ||
| enableLFO->setToolTip(tr("Enable LFO")); | ||
|
|
||
| PixmapButton * invertButton = new PixmapButton(this, tr("Invert wet signal")); | ||
| invertButton->move(241, 42); | ||
| invertButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("invert_active")); | ||
| invertButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("invert_inactive")); | ||
| invertButton->setCheckable(true); | ||
| invertButton->setModel(&controls->m_invertModel); | ||
| invertButton->setToolTip(tr("Invert wet signal")); | ||
|
|
||
| PixmapButton * wetButton = new PixmapButton(this, tr("Wet")); | ||
| wetButton->move(287, 42); | ||
| wetButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("wet_active")); | ||
| wetButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("wet_inactive")); | ||
| wetButton->setCheckable(true); | ||
| wetButton->setModel(&controls->m_wetModel); | ||
| wetButton->setToolTip(tr("Isolate wet signal")); | ||
|
|
||
| PixmapButton * analogButton = new PixmapButton(this, tr("Analog")); | ||
| analogButton->move(188, 9); | ||
| analogButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("analog_active")); | ||
| analogButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("analog_inactive")); | ||
| analogButton->setCheckable(true); | ||
| analogButton->setModel(&controls->m_analogModel); | ||
| analogButton->setToolTip(tr("Saturate feedback signal")); | ||
|
|
||
| PixmapButton * doubleButton = new PixmapButton(this, tr("Double")); | ||
| doubleButton->move(88, 9); | ||
| doubleButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("double_active")); | ||
| doubleButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("double_inactive")); | ||
| doubleButton->setCheckable(true); | ||
| doubleButton->setModel(&controls->m_doubleModel); | ||
| doubleButton->setToolTip(tr("Send through allpass filters twice")); | ||
|
|
||
| PixmapButton * aliasButton = new PixmapButton(this, tr("Alias")); | ||
| aliasButton->move(143, 9); | ||
| aliasButton->setActiveGraphic(PLUGIN_NAME::getIconPixmap("alias_active")); | ||
| aliasButton->setInactiveGraphic(PLUGIN_NAME::getIconPixmap("alias_inactive")); | ||
| aliasButton->setCheckable(true); | ||
| aliasButton->setModel(&controls->m_aliasModel); | ||
| aliasButton->setToolTip(tr("Linearly invert spectrum before/after allpass filters")); | ||
|
|
||
| EqFader * outFader = new EqFader(&controls->m_outGainModel,tr("Output gain"), | ||
| this, &controls->m_outPeakL, &controls->m_outPeakR); | ||
| outFader->setMinimumHeight(84); | ||
| outFader->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); | ||
| outFader->resize(23, 94); | ||
| outFader->move(333, 67); | ||
| outFader->setDisplayConversion(false); | ||
| outFader->setHintText(tr("Gain"), "dBFS"); | ||
| outFader->setToolTip(tr("Output gain")); | ||
|
|
||
| EqFader * inFader = new EqFader(&controls->m_inGainModel,tr("Input gain"), | ||
| this, &controls->m_inPeakL, &controls->m_inPeakR); | ||
| inFader->setMinimumHeight(84); | ||
| inFader->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); | ||
| inFader->resize(23, 94); | ||
| inFader->move(14, 67); | ||
| inFader->setDisplayConversion(false); | ||
| inFader->setHintText(tr("Gain"), "dBFS"); | ||
| inFader->setToolTip(tr("Input gain")); | ||
|
|
||
| connect(getGUI()->mainWindow(), SIGNAL(periodicUpdate()), this, SLOT(updateSliders())); | ||
| } | ||
|
|
||
|
|
||
| void PhaserControlDialog::updateSliders() | ||
| { | ||
| // Magic. Do not touch. | ||
| m_cutoffDotLeftLabel->move((int((log2(m_controls->m_effect->getCutoff(0)) - log2(PHA_MIN_FREQ)) / | ||
| log2(PHA_MAX_FREQ / PHA_MIN_FREQ) * PHA_DOT_SLIDER_LENGTH)) + 12, 183); | ||
| m_cutoffDotRightLabel->move((int((log2(m_controls->m_effect->getCutoff(1)) - log2(PHA_MIN_FREQ)) / | ||
| log2(PHA_MAX_FREQ / PHA_MIN_FREQ) * PHA_DOT_SLIDER_LENGTH)) + 12, 183); | ||
| } | ||
|
|
||
| } // namespace lmms::gui |
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,67 @@ | ||
| /* | ||
| * PhaserControlDialog.h | ||
| * | ||
| * Copyright (c) 2019 Lost Robot <[email protected]> | ||
| * | ||
| * 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 PHASER_CONTROL_DIALOG_H | ||
| #define PHASER_CONTROL_DIALOG_H | ||
|
|
||
| #include <QLabel> | ||
|
|
||
| #include "ComboBox.h" | ||
| #include "EffectControlDialog.h" | ||
| #include "Fader.h" | ||
|
|
||
|
|
||
| namespace lmms | ||
| { | ||
|
|
||
| class PhaserControls; | ||
|
|
||
| namespace gui | ||
| { | ||
|
|
||
| class PhaserControlDialog : public EffectControlDialog | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| PhaserControlDialog(PhaserControls* controls); | ||
| ~PhaserControlDialog() override | ||
| { | ||
| } | ||
|
|
||
| QLabel * m_cutoffDotLeftLabel; | ||
| QLabel * m_cutoffDotRightLabel; | ||
|
|
||
| private slots: | ||
| void updateSliders(); | ||
|
|
||
| private: | ||
| PhaserControls * m_controls; | ||
| } ; | ||
|
|
||
| } // namespace gui | ||
|
|
||
| } // namespace lmms | ||
|
|
||
| #endif | ||
|
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
EqFader.his reused here it would be a good candidate to move tosrc/gui/widgets