new kicker-plugin and extended effect-lib
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@442 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -15,6 +15,7 @@ SUBDIRS = \
|
||||
bass_booster \
|
||||
bit_invader \
|
||||
flp_import \
|
||||
kicker \
|
||||
$(LADSPA_DIRS) \
|
||||
live_tool \
|
||||
midi_import \
|
||||
|
||||
33
plugins/kicker/Makefile.am
Normal file
33
plugins/kicker/Makefile.am
Normal file
@@ -0,0 +1,33 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I.
|
||||
|
||||
|
||||
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="kicker"
|
||||
|
||||
|
||||
%.moc: ./%.h
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
|
||||
MOC_FILES = ./kicker.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= libkicker.la
|
||||
|
||||
libkicker_la_SOURCES = kicker.cpp kicker.h
|
||||
|
||||
$(libkicker_la_SOURCES): ./embedded_resources.h
|
||||
BIN
plugins/kicker/artwork.png
Normal file
BIN
plugins/kicker/artwork.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
253
plugins/kicker/kicker.cpp
Normal file
253
plugins/kicker/kicker.cpp
Normal file
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* kicker.cpp - bassdrum-synthesizer
|
||||
*
|
||||
* 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 "qt3support.h"
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QtGui/QLayout>
|
||||
#include <Qt/QtXml>
|
||||
|
||||
#else
|
||||
|
||||
#include <qdom.h>
|
||||
#include <qlayout.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "kicker.h"
|
||||
#include "instrument_track.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "sweep_oscillator.h"
|
||||
#include "buffer_allocator.h"
|
||||
#include "knob.h"
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
plugin::descriptor kicker_plugin_descriptor =
|
||||
{
|
||||
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
|
||||
"Kicker",
|
||||
QT_TRANSLATE_NOOP( "pluginBrowser",
|
||||
"versatile kick- & bassdrum-synthesizer" ),
|
||||
"Tobias Doerffel <tobydox/at/users.sf.net>",
|
||||
0x0100,
|
||||
plugin::Instrument,
|
||||
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ),
|
||||
NULL
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
kickerInstrument::kickerInstrument( instrumentTrack * _instrument_track ) :
|
||||
instrument( _instrument_track, &kicker_plugin_descriptor )
|
||||
{
|
||||
QVBoxLayout * vl = new QVBoxLayout( this );
|
||||
QHBoxLayout * hl = new QHBoxLayout;
|
||||
m_startFreqKnob = new knob( knobDark_28, this, tr( "Start frequency" ),
|
||||
eng(), _instrument_track );
|
||||
m_startFreqKnob->setRange( 40.0f, 1000.0f, 1.0f );
|
||||
m_startFreqKnob->setInitValue( 150.0f );
|
||||
m_startFreqKnob->setLabel( tr( "START" ) );
|
||||
m_startFreqKnob->setHintText( tr( "Start frequency:" ) + " ", "Hz" );
|
||||
|
||||
m_endFreqKnob = new knob( knobDark_28, this, tr( "End frequency" ),
|
||||
eng(), _instrument_track );
|
||||
m_endFreqKnob->setRange( 40.0f, 1000.0f, 1.0f );
|
||||
m_endFreqKnob->setInitValue( 40.0f );
|
||||
m_endFreqKnob->setLabel( tr( "END" ) );
|
||||
m_endFreqKnob->setHintText( tr( "End frequency:" ) + " ", "Hz" );
|
||||
|
||||
m_decayKnob = new knob( knobDark_28, this, tr( "Decay" ),
|
||||
eng(), _instrument_track );
|
||||
m_decayKnob->setRange( 5.0f, 1000.0f, 1.0f );
|
||||
m_decayKnob->setInitValue( 120.0f );
|
||||
m_decayKnob->setLabel( tr( "DECAY" ) );
|
||||
m_decayKnob->setHintText( tr( "Decay:" ) + " ", "ms" );
|
||||
|
||||
m_distKnob = new knob( knobDark_28, this, tr( "Distortion" ),
|
||||
eng(), _instrument_track );
|
||||
m_distKnob->setRange( 0.00f, 0.99f, 0.01f );
|
||||
m_distKnob->setInitValue( 0.1f );
|
||||
m_distKnob->setLabel( tr( "DIST" ) );
|
||||
m_distKnob->setHintText( tr( "Distortion:" ) + " ", "" );
|
||||
|
||||
m_gainKnob = new knob( knobDark_28, this, tr( "Gain" ),
|
||||
eng(), _instrument_track );
|
||||
m_gainKnob->setRange( 0.1f, 5.0f, 0.05f );
|
||||
m_gainKnob->setInitValue( 1.0f );
|
||||
m_gainKnob->setLabel( tr( "GAIN" ) );
|
||||
m_gainKnob->setHintText( tr( "Gain:" ) + " ", "" );
|
||||
|
||||
hl->addWidget( m_startFreqKnob );
|
||||
hl->addWidget( m_endFreqKnob );
|
||||
hl->addWidget( m_decayKnob );
|
||||
hl->addWidget( m_distKnob );
|
||||
hl->addWidget( m_gainKnob );
|
||||
|
||||
vl->addLayout( hl );
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
"artwork" ) );
|
||||
setPalette( pal );
|
||||
#else
|
||||
setErasePixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
kickerInstrument::~kickerInstrument()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void kickerInstrument::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
m_startFreqKnob->saveSettings( _doc, _this, "startfreq" );
|
||||
m_endFreqKnob->saveSettings( _doc, _this, "endfreq" );
|
||||
m_decayKnob->saveSettings( _doc, _this, "decay" );
|
||||
m_distKnob->saveSettings( _doc, _this, "dist" );
|
||||
m_gainKnob->saveSettings( _doc, _this, "gain" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void kickerInstrument::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_startFreqKnob->loadSettings( _this, "startfreq" );
|
||||
m_endFreqKnob->loadSettings( _this, "endfreq" );
|
||||
m_decayKnob->loadSettings( _this, "decay" );
|
||||
m_distKnob->loadSettings( _this, "dist" );
|
||||
m_gainKnob->loadSettings( _this, "gain" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString kickerInstrument::nodeName( void ) const
|
||||
{
|
||||
return( kicker_plugin_descriptor.name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef effectLib::foldbackDistortion<> distFX;
|
||||
typedef sweepOscillator<effectLib::monoToStereoAdaptor<distFX> > sweepOsc;
|
||||
|
||||
|
||||
void kickerInstrument::playNote( notePlayHandle * _n, bool )
|
||||
{
|
||||
const float decfr = m_decayKnob->value() *
|
||||
eng()->getMixer()->sampleRate() / 1000.0f;
|
||||
const f_cnt_t tfp = _n->totalFramesPlayed();
|
||||
|
||||
if ( tfp == 0 )
|
||||
{
|
||||
_n->m_pluginData = new sweepOsc(
|
||||
distFX( 1.0f-m_distKnob->value(),
|
||||
m_gainKnob->value() ) );
|
||||
}
|
||||
else if( tfp > decfr && !_n->released() )
|
||||
{
|
||||
_n->noteOff();
|
||||
}
|
||||
|
||||
//const float freq = getInstrumentTrack()->frequency( _n ) / 2;
|
||||
const float fdiff = m_endFreqKnob->value() - m_startFreqKnob->value();
|
||||
const fpab_t frames = _n->released() ?
|
||||
tMin<f_cnt_t>( desiredReleaseFrames()-_n->releaseFramesDone(),
|
||||
eng()->getMixer()->framesPerAudioBuffer() )
|
||||
:
|
||||
eng()->getMixer()->framesPerAudioBuffer();
|
||||
const float f1 = m_startFreqKnob->value() + tfp * fdiff / decfr;
|
||||
const float f2 = m_startFreqKnob->value() + (frames+tfp-1)*fdiff/decfr;
|
||||
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
|
||||
sweepOsc * so = static_cast<sweepOsc *>( _n->m_pluginData );
|
||||
so->update( buf, frames, f1, f2, eng()->getMixer()->sampleRate() );
|
||||
|
||||
if( _n->released() )
|
||||
{
|
||||
for( fpab_t f = 0; f < frames; ++f )
|
||||
{
|
||||
const float fac = 1.0f -
|
||||
(float)( _n->releaseFramesDone()+f ) /
|
||||
desiredReleaseFrames();
|
||||
for( ch_cnt_t ch = 0; ch < DEFAULT_CHANNELS; ++ch )
|
||||
{
|
||||
buf[f][ch] *= fac;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getInstrumentTrack()->processAudioBuffer( buf, frames, _n );
|
||||
|
||||
bufferAllocator::free( buf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void kickerInstrument::deleteNotePluginData( notePlayHandle * _n )
|
||||
{
|
||||
delete static_cast<sweepOsc *>( _n->m_pluginData );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// neccessary for getting instance out of shared lib
|
||||
plugin * lmms_plugin_main( void * _data )
|
||||
{
|
||||
return( new kickerInstrument(
|
||||
static_cast<instrumentTrack *>( _data ) ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
67
plugins/kicker/kicker.h
Normal file
67
plugins/kicker/kicker.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* kicker.h - bassdrum-synthesizer
|
||||
*
|
||||
* 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 _KICKER_H
|
||||
#define _KICKER_H
|
||||
|
||||
#include "instrument.h"
|
||||
|
||||
|
||||
class notePlayHandle;
|
||||
class knob;
|
||||
|
||||
|
||||
class kickerInstrument : public instrument
|
||||
{
|
||||
public:
|
||||
kickerInstrument( instrumentTrack * _instrument_track );
|
||||
virtual ~kickerInstrument();
|
||||
|
||||
virtual void FASTCALL playNote( notePlayHandle * _n,
|
||||
bool _try_parallelizing );
|
||||
virtual void FASTCALL deleteNotePluginData( notePlayHandle * _n );
|
||||
|
||||
|
||||
virtual void FASTCALL saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _parent );
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
virtual QString nodeName( void ) const;
|
||||
|
||||
virtual f_cnt_t desiredReleaseFrames( void ) const
|
||||
{
|
||||
return( 512 );
|
||||
}
|
||||
|
||||
private:
|
||||
knob * m_startFreqKnob;
|
||||
knob * m_endFreqKnob;
|
||||
knob * m_decayKnob;
|
||||
knob * m_distKnob;
|
||||
knob * m_gainKnob;
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
BIN
plugins/kicker/logo.png
Normal file
BIN
plugins/kicker/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -69,18 +69,18 @@ plugin::descriptor pluckedstringsynth_plugin_descriptor =
|
||||
// TODO: make this synth stereo for better better spacial (room) feeling and
|
||||
// add distortion
|
||||
|
||||
pluckedStringSynth::pluckedStringSynth( instrumentTrack * _channel_track ) :
|
||||
instrument( _channel_track, &pluckedstringsynth_plugin_descriptor )
|
||||
pluckedStringSynth::pluckedStringSynth( instrumentTrack * _instrument_track ) :
|
||||
instrument( _instrument_track, &pluckedstringsynth_plugin_descriptor )
|
||||
{
|
||||
m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ),
|
||||
eng(), _channel_track );
|
||||
eng(), _instrument_track );
|
||||
m_pickKnob->setRange( 0.0f, 0.5f, 0.005f );
|
||||
m_pickKnob->setInitValue( 0.0f );
|
||||
m_pickKnob->move( 86, 134 );
|
||||
m_pickKnob->setHintText( tr( "Pick position:" ) + " ", "" );
|
||||
|
||||
m_pickupKnob = new knob( knobDark_28, this, tr( "Pickup position" ),
|
||||
eng(), _channel_track );
|
||||
eng(), _instrument_track );
|
||||
m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f );
|
||||
m_pickupKnob->setInitValue( 0.05f );
|
||||
m_pickupKnob->move( 138, 134 );
|
||||
|
||||
@@ -194,7 +194,7 @@ private:
|
||||
class pluckedStringSynth : public instrument
|
||||
{
|
||||
public:
|
||||
pluckedStringSynth( instrumentTrack * _channel_track );
|
||||
pluckedStringSynth( instrumentTrack * _instrument_track );
|
||||
virtual ~pluckedStringSynth();
|
||||
|
||||
virtual void FASTCALL playNote( notePlayHandle * _n,
|
||||
|
||||
Reference in New Issue
Block a user