Initial commit - copied files from bassbooster to modify into new plugin
This commit is contained in:
@@ -25,5 +25,6 @@ ADD_SUBDIRECTORY(triple_oscillator)
|
||||
ADD_SUBDIRECTORY(vestige)
|
||||
ADD_SUBDIRECTORY(vst_base)
|
||||
ADD_SUBDIRECTORY(vst_effect)
|
||||
ADD_SUBDIRECTORY(waveshaper)
|
||||
ADD_SUBDIRECTORY(vibed)
|
||||
ADD_SUBDIRECTORY(zynaddsubfx)
|
||||
|
||||
3
plugins/waveshaper/CMakeLists.txt
Normal file
3
plugins/waveshaper/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
INCLUDE(BuildPlugin)
|
||||
|
||||
BUILD_PLUGIN(waveshaper waveshaper.cpp waveshaper_controls.cpp waveshaper_control_dialog.cpp MOCFILES waveshaper_controls.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
BIN
plugins/waveshaper/artwork.png
Normal file
BIN
plugins/waveshaper/artwork.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
plugins/waveshaper/logo.png
Normal file
BIN
plugins/waveshaper/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
114
plugins/waveshaper/waveshaper.cpp
Normal file
114
plugins/waveshaper/waveshaper.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* bass_booster.cpp - bass-booster-effect-plugin
|
||||
*
|
||||
* * Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright (c) 2006-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 "bass_booster.h"
|
||||
|
||||
#include "embed.cpp"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
Plugin::Descriptor PLUGIN_EXPORT waveshaper_plugin_descriptor =
|
||||
{
|
||||
STRINGIFY( PLUGIN_NAME ),
|
||||
"BassBooster Effect",
|
||||
QT_TRANSLATE_NOOP( "pluginBrowser",
|
||||
"plugin for boosting bass" ),
|
||||
"Tobias Doerffel <tobydox/at/users.sf.net>",
|
||||
0x0100,
|
||||
Plugin::Effect,
|
||||
new PluginPixmapLoader( "logo" ),
|
||||
NULL,
|
||||
NULL
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bassBoosterEffect::bassBoosterEffect( Model * _parent,
|
||||
const Descriptor::SubPluginFeatures::Key * _key ) :
|
||||
Effect( &waveshaper_plugin_descriptor, _parent, _key ),
|
||||
m_bbFX( effectLib::fastBassBoost( 70.0f, 1.0f, 2.8f ) ),
|
||||
m_bbControls( this )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bassBoosterEffect::~bassBoosterEffect()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool bassBoosterEffect::processAudioBuffer( sampleFrame * _buf,
|
||||
const fpp_t _frames )
|
||||
{
|
||||
if( !isEnabled() || !isRunning () )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
|
||||
double out_sum = 0.0;
|
||||
const float d = dryLevel();
|
||||
const float w = wetLevel();
|
||||
for( fpp_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
sample_t s[2] = { _buf[f][0], _buf[f][1] };
|
||||
m_bbFX.nextSample( s[0], s[1] );
|
||||
|
||||
_buf[f][0] = d * _buf[f][0] + w * s[0];
|
||||
_buf[f][1] = d * _buf[f][1] + w * s[1];
|
||||
|
||||
out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1];
|
||||
}
|
||||
|
||||
checkGate( out_sum / _frames );
|
||||
|
||||
return( isRunning() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// necessary for getting instance out of shared lib
|
||||
Plugin * PLUGIN_EXPORT lmms_plugin_main( Model * _parent, void * _data )
|
||||
{
|
||||
return( new bassBoosterEffect( _parent,
|
||||
static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>(
|
||||
_data ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
64
plugins/waveshaper/waveshaper.h
Normal file
64
plugins/waveshaper/waveshaper.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* bass_booster.h - bass-booster-effect-plugin
|
||||
*
|
||||
* * Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 _BASS_BOOSTER_H
|
||||
#define _BASS_BOOSTER_H
|
||||
|
||||
#include "Effect.h"
|
||||
#include "effect_lib.h"
|
||||
#include "waveshaper_controls.h"
|
||||
|
||||
|
||||
|
||||
class bassBoosterEffect : public Effect
|
||||
{
|
||||
public:
|
||||
bassBoosterEffect( Model * _parent,
|
||||
const Descriptor::SubPluginFeatures::Key * _key );
|
||||
virtual ~bassBoosterEffect();
|
||||
virtual bool processAudioBuffer( sampleFrame * _buf,
|
||||
const fpp_t _frames );
|
||||
|
||||
virtual EffectControls * controls()
|
||||
{
|
||||
return( &m_bbControls );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
effectLib::monoToStereoAdaptor<effectLib::fastBassBoost> m_bbFX;
|
||||
|
||||
bassBoosterControls m_bbControls;
|
||||
|
||||
friend class bassBoosterControls;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
74
plugins/waveshaper/waveshaper_control_dialog.cpp
Normal file
74
plugins/waveshaper/waveshaper_control_dialog.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* waveshaper_control_dialog.cpp - control-dialog for waveshaper-effect
|
||||
*
|
||||
* Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright * (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 <QtGui/QLayout>
|
||||
|
||||
#include "waveshaper_control_dialog.h"
|
||||
#include "waveshaper_controls.h"
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
|
||||
bassBoosterControlDialog::bassBoosterControlDialog(
|
||||
bassBoosterControls * _controls ) :
|
||||
EffectControlDialog( _controls )
|
||||
{
|
||||
setAutoFillBackground( true );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(),
|
||||
PLUGIN_NAME::getIconPixmap( "artwork" ) );
|
||||
setPalette( pal );
|
||||
setFixedSize( 120, 104 );
|
||||
|
||||
QVBoxLayout * tl = new QVBoxLayout( this );
|
||||
tl->addSpacing( 30 );
|
||||
|
||||
QHBoxLayout * l = new QHBoxLayout;
|
||||
|
||||
knob * freqKnob = new knob( knobBright_26, this);
|
||||
freqKnob->setModel( &_controls->m_freqModel );
|
||||
freqKnob->setLabel( tr( "FREQ" ) );
|
||||
freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" );
|
||||
|
||||
knob * gainKnob = new knob( knobBright_26, this );
|
||||
gainKnob->setModel( &_controls->m_gainModel );
|
||||
gainKnob->setLabel( tr( "GAIN" ) );
|
||||
gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
|
||||
|
||||
knob * ratioKnob = new knob( knobBright_26, this );
|
||||
ratioKnob->setModel( &_controls->m_ratioModel );
|
||||
ratioKnob->setLabel( tr( "RATIO" ) );
|
||||
ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" );
|
||||
|
||||
l->addWidget( freqKnob );
|
||||
l->addWidget( gainKnob );
|
||||
l->addWidget( ratioKnob );
|
||||
|
||||
tl->addLayout( l );
|
||||
setLayout( tl );
|
||||
}
|
||||
|
||||
|
||||
45
plugins/waveshaper/waveshaper_control_dialog.h
Normal file
45
plugins/waveshaper/waveshaper_control_dialog.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* waveshaper_control_dialog.h - control-dialog for waveshaper-effect
|
||||
*
|
||||
* * Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 _WAVESHAPER_CONTROL_DIALOG_H
|
||||
#define _WAVESHAPER_CONTROL_DIALOG_H
|
||||
|
||||
#include "EffectControlDialog.h"
|
||||
|
||||
|
||||
class bassBoosterControls;
|
||||
|
||||
|
||||
class bassBoosterControlDialog : public EffectControlDialog
|
||||
{
|
||||
public:
|
||||
bassBoosterControlDialog( bassBoosterControls * _controls );
|
||||
virtual ~bassBoosterControlDialog()
|
||||
{
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
110
plugins/waveshaper/waveshaper_controls.cpp
Normal file
110
plugins/waveshaper/waveshaper_controls.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* waveshaper_controls.cpp - controls for waveshaper-effect
|
||||
*
|
||||
* Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 <QtXml/QDomElement>
|
||||
|
||||
#include "waveshaper_controls.h"
|
||||
#include "bass_booster.h"
|
||||
|
||||
|
||||
|
||||
bassBoosterControls::bassBoosterControls( bassBoosterEffect * _eff ) :
|
||||
EffectControls( _eff ),
|
||||
m_effect( _eff ),
|
||||
m_freqModel( 100.0f, 50.0f, 200.0f, 1.0f, this, tr( "Frequency" ) ),
|
||||
m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this, tr( "Gain" ) ),
|
||||
m_ratioModel( 2.0f, 0.1f, 10.0f, 0.1f, this, tr( "Ratio" ) )
|
||||
{
|
||||
connect( &m_freqModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( changeFrequency() ) );
|
||||
|
||||
connect( &m_gainModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( changeGain() ) );
|
||||
|
||||
connect( &m_ratioModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( changeRatio() ) );
|
||||
|
||||
connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
|
||||
this, SLOT( changeFrequency() ) );
|
||||
changeFrequency();
|
||||
changeGain();
|
||||
changeRatio();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControls::changeFrequency()
|
||||
{
|
||||
const sample_t fac = engine::mixer()->processingSampleRate() /
|
||||
44100.0f;
|
||||
m_effect->m_bbFX.leftFX().setFrequency( m_freqModel.value() * fac );
|
||||
m_effect->m_bbFX.rightFX().setFrequency( m_freqModel.value() * fac );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControls::changeGain()
|
||||
{
|
||||
m_effect->m_bbFX.leftFX().setGain( m_gainModel.value() );
|
||||
m_effect->m_bbFX.rightFX().setGain( m_gainModel.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControls::changeRatio()
|
||||
{
|
||||
m_effect->m_bbFX.leftFX().setRatio( m_ratioModel.value() );
|
||||
m_effect->m_bbFX.rightFX().setRatio( m_ratioModel.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControls::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_freqModel.setValue( _this.attribute( "freq" ).toFloat() );
|
||||
m_gainModel.setValue( _this.attribute( "gain" ).toFloat() );
|
||||
m_ratioModel.setValue( _this.attribute( "ratio" ).toFloat() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControls::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "freq", m_freqModel.value() );
|
||||
_this.setAttribute( "gain", m_gainModel.value() );
|
||||
_this.setAttribute( "ratio", m_ratioModel.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "moc_waveshaper_controls.cxx"
|
||||
|
||||
80
plugins/waveshaper/waveshaper_controls.h
Normal file
80
plugins/waveshaper/waveshaper_controls.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* waveshaper_controls.h - controls for waveshaper-effect
|
||||
*
|
||||
* Copyright * (c) 2006-2008 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
|
||||
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 _WAVESHAPER_CONTROLS_H
|
||||
#define _WAVESHAPER_CONTROLS_H
|
||||
|
||||
#include "EffectControls.h"
|
||||
#include "waveshaper_control_dialog.h"
|
||||
#include "knob.h"
|
||||
|
||||
|
||||
class bassBoosterEffect;
|
||||
|
||||
|
||||
class bassBoosterControls : public EffectControls
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bassBoosterControls( bassBoosterEffect * _eff );
|
||||
virtual ~bassBoosterControls()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName() const
|
||||
{
|
||||
return( "waveshapercontrols" );
|
||||
}
|
||||
|
||||
virtual int controlCount()
|
||||
{
|
||||
return( 3 );
|
||||
}
|
||||
|
||||
virtual EffectControlDialog * createView()
|
||||
{
|
||||
return( new bassBoosterControlDialog( this ) );
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void changeFrequency();
|
||||
void changeGain();
|
||||
void changeRatio();
|
||||
|
||||
|
||||
private:
|
||||
bassBoosterEffect * m_effect;
|
||||
FloatModel m_freqModel;
|
||||
FloatModel m_gainModel;
|
||||
FloatModel m_ratioModel;
|
||||
|
||||
friend class bassBoosterControlDialog;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user