Skip to content

Add script to generate template effect files #7910

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plugins/TemplateEffect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
INCLUDE(BuildPlugin)

BUILD_PLUGIN(templateeffect TemplateEffect.cpp TemplateEffectControls.cpp TemplateEffectControlDialog.cpp MOCFILES TemplateEffectControls.h TemplateEffectControlDialog.h EMBEDDED_RESOURCES artwork.svg logo.svg)
79 changes: 79 additions & 0 deletions plugins/TemplateEffect/TemplateEffect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* TemplateEffect.cpp - Example effect boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 "TemplateEffect.h"

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

namespace lmms
{

extern "C"
{

Check notice on line 36 in plugins/TemplateEffect/TemplateEffect.cpp

View check run for this annotation

codefactor.io / CodeFactor

plugins/TemplateEffect/TemplateEffect.cpp#L36

Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
Plugin::Descriptor PLUGIN_EXPORT templateeffect_plugin_descriptor =
{
LMMS_STRINGIFY(PLUGIN_NAME),
"TemplateHumanName",
QT_TRANSLATE_NOOP("PluginBrowser", "TemplateDescription"),
"TemplateAuthor",
0x0100,
Plugin::Type::Effect,
new PluginPixmapLoader("logo"),
nullptr,
nullptr,
} ;

Check notice on line 49 in plugins/TemplateEffect/TemplateEffect.cpp

View check run for this annotation

codefactor.io / CodeFactor

plugins/TemplateEffect/TemplateEffect.cpp#L49

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
}


TemplateEffectEffect::TemplateEffectEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key) :
Effect(&templateeffect_plugin_descriptor, parent, key),
m_controls(this)
{
}


Effect::ProcessStatus TemplateEffectEffect::processImpl(SampleFrame* buffer, const fpp_t frames)
{
// Put your audio processing code here

return ProcessStatus::ContinueIfNotQuiet;
}


extern "C"
{

Check notice on line 70 in plugins/TemplateEffect/TemplateEffect.cpp

View check run for this annotation

codefactor.io / CodeFactor

plugins/TemplateEffect/TemplateEffect.cpp#L70

Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin* lmms_plugin_main(Model* parent, void* data)
{
return new TemplateEffectEffect(parent, static_cast<const Plugin::Descriptor::SubPluginFeatures::Key*>(data));
}

Check notice on line 76 in plugins/TemplateEffect/TemplateEffect.cpp

View check run for this annotation

codefactor.io / CodeFactor

plugins/TemplateEffect/TemplateEffect.cpp#L76

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
}

} // namespace lmms
56 changes: 56 additions & 0 deletions plugins/TemplateEffect/TemplateEffect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* TemplateEffect.h - Example effect boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 LMMS_TEMPLATE_EFFECT_H
#define LMMS_TEMPLATE_EFFECT_H

#include "Effect.h"
#include "TemplateEffectControls.h"

namespace lmms
{

class TemplateEffectEffect : public Effect
{
public:
TemplateEffectEffect(Model* parent, const Descriptor::SubPluginFeatures::Key* key);
~TemplateEffectEffect() override = default;

ProcessStatus processImpl(SampleFrame* buf, const fpp_t frames) override;

EffectControls* controls() override
{
return &m_controls;
}

private:
TemplateEffectControls m_controls;

friend class TemplateEffectControls;
};

} // namespace lmms

#endif // LMMS_TEMPLATE_EFFECT_H
64 changes: 64 additions & 0 deletions plugins/TemplateEffect/TemplateEffectControlDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* TemplateEffectControlDialog.cpp - Example effect gui boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 "TemplateEffectControlDialog.h"
#include "TemplateEffectControls.h"
#include "embed.h"
#include "Knob.h"
#include "Fader.h"
#include "LedCheckBox.h"
#include "LcdSpinBox.h"

#include <QHBoxLayout>

namespace lmms::gui
{

TemplateEffectControlDialog::TemplateEffectControlDialog(TemplateEffectControls* controls) :
EffectControlDialog(controls)
{
setAutoFillBackground(true);
/* Uncomment this if you want to use a background image
QPalette pal;
pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork"));
setPalette(pal);
setFixedSize(100, 110);
*/

QHBoxLayout* mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(20,20,20,20);

TEMPLATE_KNOB_LOOP_START
Knob* knobTEMPLATE_KNOB_NUMBER = new Knob(KnobType::Bright26, this);
knobTEMPLATE_KNOB_NUMBER->setModel(&controls->m_modelTEMPLATE_KNOB_NUMBER);
knobTEMPLATE_KNOB_NUMBER->setLabel(tr("Knob TEMPLATE_KNOB_NUMBER"));
knobTEMPLATE_KNOB_NUMBER->setHintText(tr("Value description:"), " units");
mainLayout->addWidget(knobTEMPLATE_KNOB_NUMBER);

TEMPLATE_KNOB_LOOP_END

Check notice on line 61 in plugins/TemplateEffect/TemplateEffectControlDialog.cpp

View check run for this annotation

codefactor.io / CodeFactor

plugins/TemplateEffect/TemplateEffectControlDialog.cpp#L61

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
}

} // namespace lmms::gui
56 changes: 56 additions & 0 deletions plugins/TemplateEffect/TemplateEffectControlDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* TemplateEffectControlDialog.h - Example effect gui boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 LMMS_GUI_TEMPLATE_EFFECT_CONTROL_DIALOG_H
#define LMMS_GUI_TEMPLATE_EFFECT_CONTROL_DIALOG_H

#include "EffectControlDialog.h"

namespace lmms
{

class TemplateEffectControls;
class FloatModel;

namespace gui
{

class Knob;

class TemplateEffectControlDialog : public EffectControlDialog
{
Q_OBJECT
public:
TemplateEffectControlDialog(TemplateEffectControls* controls);
~TemplateEffectControlDialog() override = default;

bool isResizable() const override { return true; }
};

} // namespace gui

} // namespace lmms

#endif // LMMS_GUI_TEMPLATE_EFFECT_CONTROL_DIALOG_H
60 changes: 60 additions & 0 deletions plugins/TemplateEffect/TemplateEffectControls.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* TemplateEffectControls.cpp - Example effect control boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QDomElement>

#include "TemplateEffectControls.h"
#include "TemplateEffect.h"

namespace lmms
{

TemplateEffectControls::TemplateEffectControls(TemplateEffectEffect* effect) :
EffectControls(effect),
TEMPLATE_KNOB_LOOP_START
m_modelTEMPLATE_KNOB_NUMBER(0.5f, 0.0f, 1.0f, 0.00001f, this, tr("Knob TEMPLATE_KNOB_NUMBER")),
TEMPLATE_KNOB_LOOP_END
m_effect(effect)
{
}


void TemplateEffectControls::loadSettings(const QDomElement& parent)
{
TEMPLATE_KNOB_LOOP_START
m_modelTEMPLATE_KNOB_NUMBER.loadSettings(parent, "modelTEMPLATE_KNOB_NUMBER");
TEMPLATE_KNOB_LOOP_END
}


void TemplateEffectControls::saveSettings(QDomDocument& doc, QDomElement& parent)
{
TEMPLATE_KNOB_LOOP_START
m_modelTEMPLATE_KNOB_NUMBER.saveSettings(doc, parent, "modelTEMPLATE_KNOB_NUMBER");
TEMPLATE_KNOB_LOOP_END
}


} // namespace lmms
74 changes: 74 additions & 0 deletions plugins/TemplateEffect/TemplateEffectControls.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* TemplateEffectControls.h - Example effect control boilerplate code
*
* Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 LMMS_TEMPLATE_EFFECT_CONTROLS_H
#define LMMS_TEMPLATE_EFFECT_CONTROLS_H

#include "EffectControls.h"
#include "TemplateEffectControlDialog.h"

namespace lmms
{

class TemplateEffectEffect;

namespace gui
{
class TemplateEffectControlDialog;
}

class TemplateEffectControls : public EffectControls
{
Q_OBJECT
public:
TemplateEffectControls(TemplateEffectEffect* effect);
~TemplateEffectControls() override = default;

void saveSettings(QDomDocument& doc, QDomElement& parent) override;
void loadSettings(const QDomElement& parent) override;
inline QString nodeName() const override
{
return "TemplateEffectControls";
}
gui::EffectControlDialog* createView() override
{
return new gui::TemplateEffectControlDialog(this);
}
int controlCount() override { return TEMPLATE_NUM_KNOBS; }

private:
TEMPLATE_KNOB_LOOP_START
FloatModel m_modelTEMPLATE_KNOB_NUMBER;
TEMPLATE_KNOB_LOOP_END

TemplateEffectEffect* m_effect;

friend class gui::TemplateEffectControlDialog;
friend class TemplateEffectEffect;
};

} // namespace lmms

#endif // LMMS_TEMPLATE_EFFECT_CONTROLS_H
Loading
Loading