added bassbooster-effect and effect-lib
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@439 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -10,5 +10,5 @@ if STK_SUPPORT
|
||||
STK_DIR=stk
|
||||
endif
|
||||
|
||||
SUBDIRS = audio_file_processor bit_invader flp_import $(LADSPA_DIRS) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VST_DIRS) vibed
|
||||
SUBDIRS = audio_file_processor bass_booster bit_invader flp_import $(LADSPA_DIRS) midi_import organic plucked_string_synth $(STK_DIR) triple_oscillator $(VST_DIRS) vibed
|
||||
|
||||
|
||||
36
plugins/bass_booster/Makefile.am
Normal file
36
plugins/bass_booster/Makefile.am
Normal file
@@ -0,0 +1,36 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib
|
||||
|
||||
|
||||
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bassbooster"
|
||||
|
||||
|
||||
%.moc: ./%.h
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
|
||||
MOC_FILES = ./bassbooster_control_dialog.moc
|
||||
|
||||
BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h
|
||||
EMBEDDED_RESOURCES = $(wildcard *png)
|
||||
|
||||
./embedded_resources.h: $(EMBEDDED_RESOURCES)
|
||||
$(BIN2RES) $(EMBEDDED_RESOURCES) > $@
|
||||
|
||||
EXTRA_DIST = $(EMBEDDED_RESOURCES)
|
||||
|
||||
|
||||
CLEANFILES = $(MOC_FILES) ./embedded_resources.h
|
||||
|
||||
|
||||
|
||||
pkglib_LTLIBRARIES= libbassbooster.la
|
||||
|
||||
libbassbooster_la_SOURCES = bass_booster.cpp \
|
||||
bass_booster.h \
|
||||
bassbooster_control_dialog.cpp \
|
||||
bassbooster_control_dialog.h
|
||||
|
||||
$(libbassbooster_la_SOURCES): ./embedded_resources.h
|
||||
123
plugins/bass_booster/bass_booster.cpp
Normal file
123
plugins/bass_booster/bass_booster.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* bass_booster.cpp - bass-booster-effect-plugin
|
||||
*
|
||||
* Copyright (c) 2006 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"
|
||||
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
plugin::descriptor bassbooster_plugin_descriptor =
|
||||
{
|
||||
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
|
||||
"BassBooster Effect",
|
||||
QT_TRANSLATE_NOOP( "pluginBrowser",
|
||||
"plugin for using arbitrary VST-effects "
|
||||
"inside LMMS." ),
|
||||
"Tobias Doerffel <tobydox/at/users.sf.net>",
|
||||
0x0100,
|
||||
plugin::Effect,
|
||||
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ),
|
||||
NULL
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bassBoosterEffect::bassBoosterEffect( effect::constructionData * _cdata ) :
|
||||
effect( &bassbooster_plugin_descriptor, _cdata ),
|
||||
m_bbFX( effectLib::bassBoost<>( 70.0f, 1.0f, 2.8f ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bassBoosterEffect::~bassBoosterEffect()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool FASTCALL bassBoosterEffect::processAudioBuffer( surroundSampleFrame * _buf,
|
||||
const fpab_t _frames )
|
||||
{
|
||||
if( isBypassed() || !isRunning () )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
double out_sum = 0.0;
|
||||
for( fpab_t f = 0; f < _frames; ++f )
|
||||
{
|
||||
sample_t s[2] = { _buf[f][0], _buf[f][1] };
|
||||
m_bbFX.nextSample( s[0], s[1] );
|
||||
for( ch_cnt_t ch = 0; ch < SURROUND_CHANNELS; ++ch )
|
||||
{
|
||||
_buf[f][ch] = getDryLevel() * _buf[f][ch] +
|
||||
getWetLevel() *
|
||||
s[ch%DEFAULT_CHANNELS];
|
||||
out_sum += _buf[f][ch]*_buf[f][ch];
|
||||
}
|
||||
}
|
||||
|
||||
if( out_sum <= getGate() )
|
||||
{
|
||||
incrementBufferCount();
|
||||
if( getBufferCount() > getTimeout() )
|
||||
{
|
||||
stopRunning();
|
||||
resetBufferCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resetBufferCount();
|
||||
}
|
||||
return( isRunning() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// neccessary for getting instance out of shared lib
|
||||
plugin * lmms_plugin_main( void * _data )
|
||||
{
|
||||
return( new bassBoosterEffect(
|
||||
static_cast<effect::constructionData *>( _data ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
67
plugins/bass_booster/bass_booster.h
Normal file
67
plugins/bass_booster/bass_booster.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* bass_booster.h - bass-booster-effect-plugin
|
||||
*
|
||||
* Copyright (c) 2006 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 "main_window.h"
|
||||
#include "bassbooster_control_dialog.h"
|
||||
|
||||
|
||||
|
||||
class bassBoosterEffect : public effect
|
||||
{
|
||||
public:
|
||||
bassBoosterEffect( effect::constructionData * _cdata );
|
||||
virtual ~bassBoosterEffect();
|
||||
virtual bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf,
|
||||
const fpab_t _frames );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "bassboostereffect" );
|
||||
}
|
||||
|
||||
virtual inline effectControlDialog * createControlDialog( track * )
|
||||
{
|
||||
return( new bassBoosterControlDialog(
|
||||
eng()->getMainWindow()->workspace(),
|
||||
this ) );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
effectLib::monoToStereoAdaptor<effectLib::bassBoost<> > m_bbFX;
|
||||
|
||||
friend class bassBoosterControlDialog;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
140
plugins/bass_booster/bassbooster_control_dialog.cpp
Normal file
140
plugins/bass_booster/bassbooster_control_dialog.cpp
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* bassbooster_control_dialog.cpp - control-dialog for bassbooster-effect
|
||||
*
|
||||
* Copyright (c) 2006 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QtGui/QLayout>
|
||||
|
||||
#else
|
||||
|
||||
#include <qlayout.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "bass_booster.h"
|
||||
#include "knob.h"
|
||||
|
||||
|
||||
|
||||
bassBoosterControlDialog::bassBoosterControlDialog( QWidget * _parent,
|
||||
bassBoosterEffect * _eff ) :
|
||||
effectControlDialog( _parent, _eff ),
|
||||
m_effect( _eff )
|
||||
{
|
||||
QHBoxLayout * l = new QHBoxLayout( this );
|
||||
|
||||
m_freqKnob = new knob( knobBright_26, this, tr( "Frequency" ),
|
||||
eng(), NULL );
|
||||
m_freqKnob->setRange( 50.0f, 200.0f, 1.0f );
|
||||
m_freqKnob->setInitValue( 100.0f );
|
||||
m_freqKnob->setLabel( tr( "FREQ" ) );
|
||||
m_freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" );
|
||||
connect( m_freqKnob, SIGNAL( valueChanged( float ) ),
|
||||
this, SLOT( changeFrequency( float ) ) );
|
||||
|
||||
m_gainKnob = new knob( knobBright_26, this, tr( "Gain" ), eng(), NULL );
|
||||
m_gainKnob->setRange( 0.1f, 5.0f, 0.1f );
|
||||
m_gainKnob->setInitValue( 1.0f );
|
||||
m_gainKnob->setLabel( tr( "GAIN" ) );
|
||||
m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
|
||||
connect( m_gainKnob, SIGNAL( valueChanged( float ) ),
|
||||
this, SLOT( changeGain( float ) ) );
|
||||
|
||||
m_ratioKnob = new knob( knobBright_26, this, tr( "Ratio" ), eng(),
|
||||
NULL );
|
||||
m_ratioKnob->setRange( 0.1f, 10.0f, 0.1f );
|
||||
m_ratioKnob->setInitValue( 2.0f );
|
||||
m_ratioKnob->setLabel( tr( "RATIO" ) );
|
||||
m_ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" );
|
||||
connect( m_ratioKnob, SIGNAL( valueChanged( float ) ),
|
||||
this, SLOT( changeRatio( float ) ) );
|
||||
|
||||
l->addWidget( m_freqKnob );
|
||||
l->addWidget( m_gainKnob );
|
||||
l->addWidget( m_ratioKnob );
|
||||
|
||||
updateEffect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControlDialog::changeFrequency( float )
|
||||
{
|
||||
updateEffect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControlDialog::changeGain( float )
|
||||
{
|
||||
updateEffect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControlDialog::changeRatio( float )
|
||||
{
|
||||
updateEffect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void bassBoosterControlDialog::updateEffect( void )
|
||||
{
|
||||
// TODO: try to preserve effect and just change params
|
||||
m_effect->m_bbFX = effectLib::bassBoost<>( m_freqKnob->value(),
|
||||
m_gainKnob->value(), m_ratioKnob->value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FASTCALL bassBoosterControlDialog::loadSettings(
|
||||
const QDomElement & _this )
|
||||
{
|
||||
m_freqKnob->setValue( _this.attribute( "freq" ).toFloat() );
|
||||
m_gainKnob->setValue( _this.attribute( "gain" ).toFloat() );
|
||||
m_ratioKnob->setValue( _this.attribute( "ratio" ).toFloat() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FASTCALL bassBoosterControlDialog::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "freq", m_freqKnob->value() );
|
||||
_this.setAttribute( "gain", m_gainKnob->value() );
|
||||
_this.setAttribute( "ratio", m_ratioKnob->value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "bassbooster_control_dialog.moc"
|
||||
|
||||
73
plugins/bass_booster/bassbooster_control_dialog.h
Normal file
73
plugins/bass_booster/bassbooster_control_dialog.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* bassbooster_control_dialog.h - control-dialog for bassbooster-effect
|
||||
*
|
||||
* Copyright (c) 2006 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 _BASSBOOSTER_CONTROL_DIALOG_H
|
||||
#define _BASSBOOSTER_CONTROL_DIALOG_H
|
||||
|
||||
#include "effect_control_dialog.h"
|
||||
|
||||
class knob;
|
||||
class bassBoosterEffect;
|
||||
|
||||
|
||||
class bassBoosterControlDialog : public effectControlDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bassBoosterControlDialog( QWidget * _parent, bassBoosterEffect * _eff );
|
||||
virtual ~bassBoosterControlDialog()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
inline virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "bassboostercontrols" );
|
||||
}
|
||||
|
||||
virtual ch_cnt_t getControlCount( void )
|
||||
{
|
||||
return( 3 );
|
||||
}
|
||||
|
||||
|
||||
private slots:
|
||||
void changeFrequency( float );
|
||||
void changeGain( float );
|
||||
void changeRatio( float );
|
||||
|
||||
|
||||
private:
|
||||
void updateEffect( void );
|
||||
|
||||
bassBoosterEffect * m_effect;
|
||||
knob * m_freqKnob;
|
||||
knob * m_gainKnob;
|
||||
knob * m_ratioKnob;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
BIN
plugins/bass_booster/logo.png
Normal file
BIN
plugins/bass_booster/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user