Merge branch 'stable-1.1' of git@github.com:LMMS/lmms.git
Conflicts: src/gui/MainWindow.cpp src/gui/plugin_browser.cpp
This commit is contained in:
@@ -24,7 +24,7 @@ deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: d4a+x4Gugpss7JK2DcHjyBZDmEFFh4iVfKDfITSD50T6Mc6At4LMgojvEu+6qT6IyOY2vm3UVT6fhyeuWDTRDwW9tfFlaHVA0h8aTRD+eAXOA7pQ8rEMwQO3+WCKuKTfEqUkpL4wxhww8dpkv54tqeIs0S4TBqz9tk8UhzU7XbE=
|
||||
file: lmms-*-win*.exe
|
||||
file: lmms-${TRAVIS_TAG:1}-$TARGET_OS.exe
|
||||
on:
|
||||
tags: true
|
||||
all_branches: true
|
||||
|
||||
@@ -42,11 +42,11 @@ If you're interested in translating LMMS in another language or want to imp
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><html><head/><body><p><a href="http://lmms.sourceforge.net"><span style=" text-decoration: underline; color:#0000ff;">http://lmms.sourceforge.net</span></a></p></body></html></source>
|
||||
<source>LMMS</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LMMS</source>
|
||||
<source><html><head/><body><p><a href="http://lmms.io"><span style=" text-decoration: underline; color:#0000ff;">http://lmms.io</span></a></p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
@@ -651,6 +651,60 @@ If you're interested in translating LMMS in another language or want to imp
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DelayControls</name>
|
||||
<message>
|
||||
<source>Delay Samples</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Feedback</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Frequency</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Amount</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DelayControlsDialog</name>
|
||||
<message>
|
||||
<source>Delay</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Delay Time Samples:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Feedback</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Feedback Amount:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Hz</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Hz:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Amt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lfo Amt:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DualFilterControlDialog</name>
|
||||
<message>
|
||||
@@ -7016,6 +7070,10 @@ This chip was used in the Commodore 64 computer.</source>
|
||||
<source>A NES-like synthesizer</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>A native delay plugin</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>projectNotes</name>
|
||||
|
||||
Binary file not shown.
@@ -2741,7 +2741,7 @@ Visitare http://lmms.sf.net/wiki per la documentazione di LMMS.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xport tracks...</source>
|
||||
<translation>E&sporta traccie...</translation>
|
||||
<translation type="unfinished">E&sporta tracce...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LMMS (*.mmp *.mmpz)</source>
|
||||
|
||||
@@ -35,30 +35,40 @@
|
||||
class trackContainer;
|
||||
|
||||
|
||||
class pluginBrowser : public SideBarWidget
|
||||
class PluginBrowser : public SideBarWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
pluginBrowser( QWidget * _parent );
|
||||
virtual ~pluginBrowser();
|
||||
PluginBrowser( QWidget * _parent );
|
||||
virtual ~PluginBrowser();
|
||||
|
||||
|
||||
private:
|
||||
Plugin::DescriptorList m_pluginDescriptors;
|
||||
|
||||
QWidget * m_view;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class pluginDescWidget : public QWidget
|
||||
class PluginDescList : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
pluginDescWidget( const Plugin::Descriptor & _pd, QWidget * _parent );
|
||||
virtual ~pluginDescWidget();
|
||||
PluginDescList(QWidget* parent);
|
||||
|
||||
private:
|
||||
Plugin::DescriptorList m_pluginDescriptors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class PluginDescWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PluginDescWidget( const Plugin::Descriptor & _pd, QWidget * _parent );
|
||||
virtual ~PluginDescWidget();
|
||||
|
||||
|
||||
protected:
|
||||
@@ -81,7 +91,7 @@ private:
|
||||
bool m_mouseOver;
|
||||
int m_targetHeight;
|
||||
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@ ADD_SUBDIRECTORY(bit_invader)
|
||||
ADD_SUBDIRECTORY(carlabase)
|
||||
ADD_SUBDIRECTORY(carlapatchbay)
|
||||
ADD_SUBDIRECTORY(carlarack)
|
||||
ADD_SUBDIRECTORY(delay)
|
||||
ADD_SUBDIRECTORY(DualFilter)
|
||||
ADD_SUBDIRECTORY(dynamics_processor)
|
||||
ADD_SUBDIRECTORY(flp_import)
|
||||
|
||||
3
plugins/delay/CMakeLists.txt
Normal file
3
plugins/delay/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
INCLUDE(BuildPlugin)
|
||||
|
||||
BUILD_PLUGIN(delay delayeffect.cpp delaycontrols.cpp delaycontrolsdialog.cpp lfo.cpp stereodelay.cpp MOCFILES delaycontrols.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
|
||||
BIN
plugins/delay/artwork.png
Normal file
BIN
plugins/delay/artwork.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
72
plugins/delay/delaycontrols.cpp
Normal file
72
plugins/delay/delaycontrols.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* delaycontrols.cpp - definition of DelayControls class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 <QtXml/QDomElement>
|
||||
|
||||
#include "delaycontrols.h"
|
||||
#include "delayeffect.h"
|
||||
#include "engine.h"
|
||||
#include "song.h"
|
||||
|
||||
DelayControls::DelayControls( DelayEffect* effect ):
|
||||
EffectControls( effect ),
|
||||
m_effect ( effect ),
|
||||
m_delayTimeModel( 2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Delay Samples" )) ,
|
||||
m_feedbackModel(0.0f,0.0f,1.0f,0.01f,this,tr( "Feedback" ) ),
|
||||
m_lfoTimeModel(2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Lfo Frequency" ) ),
|
||||
m_lfoAmountModel(0.0f,0.0f,0.1f,0.0001f, this, tr ( "Lfo Amount" ) )
|
||||
{
|
||||
connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DelayControls::loadSettings( const QDomElement &_this )
|
||||
{
|
||||
m_delayTimeModel.loadSettings(_this, "DelayTimeSamples" );
|
||||
m_feedbackModel.loadSettings( _this, "FeebackAmount" );
|
||||
m_lfoTimeModel.loadSettings( _this , "LfoFrequency");
|
||||
m_lfoAmountModel.loadSettings( _this, "LfoAmount");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DelayControls::saveSettings( QDomDocument& doc, QDomElement& _this )
|
||||
{
|
||||
m_delayTimeModel.saveSettings( doc, _this, "DelayTimeSamples" );
|
||||
m_feedbackModel.saveSettings( doc, _this ,"FeebackAmount" );
|
||||
m_lfoTimeModel.saveSettings( doc, _this, "LfoFrequency" );
|
||||
m_lfoAmountModel.saveSettings( doc, _this ,"LfoAmount" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DelayControls::changeSampleRate()
|
||||
{
|
||||
m_effect->changeSampleRate();
|
||||
}
|
||||
|
||||
#include "moc_delaycontrols.cxx"
|
||||
72
plugins/delay/delaycontrols.h
Normal file
72
plugins/delay/delaycontrols.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* delaycontrols.h - declaration of DelayControl class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 DELAYCONTROLS_H
|
||||
#define DELAYCONTROLS_H
|
||||
|
||||
#include "EffectControls.h"
|
||||
#include "knob.h"
|
||||
#include "delaycontrolsdialog.h"
|
||||
|
||||
|
||||
|
||||
class DelayEffect;
|
||||
|
||||
class DelayControls : public EffectControls
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DelayControls( DelayEffect* effect );
|
||||
virtual ~DelayControls()
|
||||
{
|
||||
}
|
||||
virtual void saveSettings( QDomDocument& doc, QDomElement& parent );
|
||||
virtual void loadSettings( const QDomElement& _this );
|
||||
inline virtual QString nodeName() const
|
||||
{
|
||||
return "Delay";
|
||||
}
|
||||
virtual int controlCount(){
|
||||
return 4;
|
||||
}
|
||||
virtual EffectControlDialog* createView()
|
||||
{
|
||||
return new DelayControlsDialog( this );
|
||||
}
|
||||
|
||||
private slots:
|
||||
void changeSampleRate();
|
||||
|
||||
private:
|
||||
DelayEffect* m_effect;
|
||||
TempoSyncKnobModel m_delayTimeModel;
|
||||
FloatModel m_feedbackModel;
|
||||
TempoSyncKnobModel m_lfoTimeModel;
|
||||
FloatModel m_lfoAmountModel;
|
||||
|
||||
friend class DelayControlsDialog;
|
||||
friend class DelayEffect;
|
||||
};
|
||||
|
||||
#endif // DELAYCONTROLS_H
|
||||
70
plugins/delay/delaycontrolsdialog.cpp
Normal file
70
plugins/delay/delaycontrolsdialog.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* delaycontrolsdialog.cpp - definition of DelayControlsDialog class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 "delaycontrolsdialog.h"
|
||||
#include "delaycontrols.h"
|
||||
#include "embed.h"
|
||||
#include "TempoSyncKnob.h"
|
||||
|
||||
|
||||
|
||||
|
||||
DelayControlsDialog::DelayControlsDialog( DelayControls *controls ) :
|
||||
EffectControlDialog( controls )
|
||||
{
|
||||
setAutoFillBackground( true );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
|
||||
setPalette( pal );
|
||||
setFixedSize( 200, 75 );
|
||||
|
||||
TempoSyncKnob* sampleDelayKnob = new TempoSyncKnob( knobBright_26, this );
|
||||
sampleDelayKnob->move( 20,10 );
|
||||
sampleDelayKnob->setVolumeKnob( false );
|
||||
sampleDelayKnob->setModel( &controls->m_delayTimeModel );
|
||||
sampleDelayKnob->setLabel( tr( "Delay" ) );
|
||||
sampleDelayKnob->setHintText( tr( "Delay Time Seconds:" ) + " ", "" );
|
||||
|
||||
knob * feedbackKnob = new knob( knobBright_26, this );
|
||||
feedbackKnob->move( 63,10 );
|
||||
feedbackKnob->setVolumeKnob( true) ;
|
||||
feedbackKnob->setModel( &controls->m_feedbackModel);
|
||||
feedbackKnob->setLabel( tr( "Regen" ) );
|
||||
feedbackKnob->setHintText( tr ( "Feedback Amount:" ) + " ", "" );
|
||||
|
||||
TempoSyncKnob * lfoFreqKnob = new TempoSyncKnob( knobBright_26, this );
|
||||
lfoFreqKnob->move( 106,10 );
|
||||
lfoFreqKnob->setVolumeKnob( false );
|
||||
lfoFreqKnob->setModel( &controls->m_lfoTimeModel );
|
||||
lfoFreqKnob->setLabel( tr( "Rate" ) );
|
||||
lfoFreqKnob->setHintText( tr ( "Lfo Seconds:" ) + " ", "" );
|
||||
|
||||
knob * lfoAmtKnob = new knob( knobBright_26, this );
|
||||
lfoAmtKnob->move( 150,10 );
|
||||
lfoAmtKnob->setVolumeKnob( true );
|
||||
lfoAmtKnob->setModel( &controls->m_lfoAmountModel );
|
||||
lfoAmtKnob->setLabel( tr( "Lfo" ) );
|
||||
lfoAmtKnob->setHintText( tr ( "Lfo Amt:" ) + " ", "" );
|
||||
|
||||
}
|
||||
41
plugins/delay/delaycontrolsdialog.h
Normal file
41
plugins/delay/delaycontrolsdialog.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* delaycontrolsdialog.h - declaration of DelayControlsDialog class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 DELAYCONTROLSDIALOG_H
|
||||
#define DELAYCONTROLSDIALOG_H
|
||||
|
||||
#include "EffectControlDialog.h"
|
||||
|
||||
class DelayControls;
|
||||
|
||||
class DelayControlsDialog : public EffectControlDialog
|
||||
{
|
||||
public:
|
||||
DelayControlsDialog( DelayControls* controls );
|
||||
virtual ~DelayControlsDialog()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif // DELAYCONTROLSDIALOG_H
|
||||
124
plugins/delay/delayeffect.cpp
Normal file
124
plugins/delay/delayeffect.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* delayeffect.cpp - definition of the DelayEffect class. The Delay Plugin
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 "delayeffect.h"
|
||||
#include "engine.h"
|
||||
#include "embed.cpp"
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
Plugin::Descriptor PLUGIN_EXPORT delay_plugin_descriptor =
|
||||
{
|
||||
STRINGIFY( PLUGIN_NAME ),
|
||||
"Delay",
|
||||
QT_TRANSLATE_NOOP( "pluginBrowser", "A native delay plugin" ),
|
||||
"Dave French <contact/dot/dave/dot/french3/at/googlemail/dot/com>",
|
||||
0x0100,
|
||||
Plugin::Effect,
|
||||
new PluginPixmapLoader( "logo" ),
|
||||
NULL,
|
||||
NULL
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
DelayEffect::DelayEffect( Model* parent, const Plugin::Descriptor::SubPluginFeatures::Key* key ) :
|
||||
Effect( &delay_plugin_descriptor, parent, key ),
|
||||
m_delayControls( this )
|
||||
{
|
||||
m_delay = 0;
|
||||
m_delay = new StereoDelay( 20, engine::mixer()->processingSampleRate() );
|
||||
m_lfo = new Lfo( engine::mixer()->processingSampleRate() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DelayEffect::~DelayEffect()
|
||||
{
|
||||
if( m_delay )
|
||||
{
|
||||
delete m_delay;
|
||||
}
|
||||
if( m_lfo )
|
||||
{
|
||||
delete m_lfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
|
||||
{
|
||||
if( !isEnabled() || !isRunning () )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
double outSum = 0.0;
|
||||
const float d = dryLevel();
|
||||
const float w = wetLevel();
|
||||
const float length = m_delayControls.m_delayTimeModel.value() * engine::mixer()->processingSampleRate();
|
||||
m_lfo->setAmplitude( m_delayControls.m_lfoAmountModel.value() );
|
||||
m_lfo->setFrequency( 1.0 / m_delayControls.m_lfoTimeModel.value() );
|
||||
m_delay->setFeedback( m_delayControls.m_feedbackModel.value() );
|
||||
sample_t dryS[2];
|
||||
for( fpp_t f = 0; f < frames; ++f )
|
||||
{
|
||||
dryS[0] = buf[f][0];
|
||||
dryS[1] = buf[f][1];
|
||||
m_delay->setLength( ( float )length * ( float )m_lfo->tick() );
|
||||
m_delay->tick( buf[f] );
|
||||
|
||||
buf[f][0] = ( d * dryS[0] ) + ( w * buf[f][0] );
|
||||
buf[f][1] = ( d * dryS[1] ) + ( w * buf[f][1] );
|
||||
outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1];
|
||||
}
|
||||
checkGate( outSum / frames );
|
||||
return isRunning();
|
||||
}
|
||||
|
||||
void DelayEffect::changeSampleRate()
|
||||
{
|
||||
m_lfo->setSampleRate( engine::mixer()->processingSampleRate() );
|
||||
m_delay->setSampleRate( engine::mixer()->processingSampleRate() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
//needed for getting plugin out of shared lib
|
||||
Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data )
|
||||
{
|
||||
return new DelayEffect( parent , static_cast<const Plugin::Descriptor::SubPluginFeatures::Key *>( data ) );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
51
plugins/delay/delayeffect.h
Normal file
51
plugins/delay/delayeffect.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* delayeffect.h - declaration of DelayEffect class, the Delay plugin
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 DELAYEFFECT_H
|
||||
#define DELAYEFFECT_H
|
||||
|
||||
#include "Effect.h"
|
||||
#include "delaycontrols.h"
|
||||
#include "lfo.h"
|
||||
#include "stereodelay.h"
|
||||
|
||||
class DelayEffect : public Effect
|
||||
{
|
||||
public:
|
||||
DelayEffect(Model* parent , const Descriptor::SubPluginFeatures::Key* key );
|
||||
virtual ~DelayEffect();
|
||||
virtual bool processAudioBuffer( sampleFrame* buf, const fpp_t frames );
|
||||
virtual EffectControls* controls()
|
||||
{
|
||||
return &m_delayControls;
|
||||
}
|
||||
void changeSampleRate();
|
||||
|
||||
private:
|
||||
DelayControls m_delayControls;
|
||||
StereoDelay* m_delay;
|
||||
Lfo* m_lfo;
|
||||
};
|
||||
|
||||
#endif // DELAYEFFECT_H
|
||||
52
plugins/delay/lfo.cpp
Normal file
52
plugins/delay/lfo.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* lfo.cpp - defination of Lfo class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 "lfo.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
|
||||
|
||||
Lfo::Lfo( int samplerate )
|
||||
{
|
||||
m_samplerate = samplerate;
|
||||
m_twoPiOverSr = F_2PI / samplerate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float Lfo::tick()
|
||||
{
|
||||
float output = sinf( m_phase );
|
||||
m_phase += m_increment;
|
||||
|
||||
if( m_amplitude > 0.0001 )
|
||||
{
|
||||
return ( ( output * m_amplitude + 1.0 ) * 0.5 ) ;
|
||||
} else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
92
plugins/delay/lfo.h
Normal file
92
plugins/delay/lfo.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* lfo.h - declaration of Lfo class, a simple sine lfo
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 LFO_H
|
||||
#define LFO_H
|
||||
|
||||
#include "lmms_math.h"
|
||||
|
||||
class Lfo
|
||||
{
|
||||
public:
|
||||
Lfo( int samplerate );
|
||||
~Lfo()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline void setFrequency( double frequency )
|
||||
{
|
||||
if( frequency < 0 || frequency > ( m_samplerate / 2.0 ) || frequency == m_frequency )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_frequency = frequency;
|
||||
m_increment = m_frequency * m_twoPiOverSr;
|
||||
|
||||
if( m_phase >= F_2PI )
|
||||
{
|
||||
m_phase -= F_2PI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline void setAmplitude( float amplitude )
|
||||
{
|
||||
if( amplitude < 0.0 || amplitude > 1.0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_amplitude = amplitude;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline void setSampleRate ( int samplerate )
|
||||
{
|
||||
m_samplerate = samplerate;
|
||||
m_twoPiOverSr = F_2PI / samplerate;
|
||||
m_increment = m_frequency * m_twoPiOverSr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float tick();
|
||||
|
||||
private:
|
||||
double m_frequency;
|
||||
double m_phase;
|
||||
double m_increment;
|
||||
double m_amplitude;
|
||||
double m_twoPiOverSr;
|
||||
int m_samplerate;
|
||||
};
|
||||
|
||||
#endif // LFO_H
|
||||
BIN
plugins/delay/logo.png
Normal file
BIN
plugins/delay/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
98
plugins/delay/stereodelay.cpp
Normal file
98
plugins/delay/stereodelay.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* stereodelay.cpp - defination of StereoDelay class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 "stereodelay.h"
|
||||
#include <cstdlib>
|
||||
#include "lmms_basics.h"
|
||||
#include "interpolation.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
StereoDelay::StereoDelay( int maxTime, int sampleRate )
|
||||
{
|
||||
m_buffer = 0;
|
||||
m_maxTime = maxTime;
|
||||
m_maxLength = maxTime * sampleRate;
|
||||
m_length = m_maxLength;
|
||||
|
||||
m_index = 0;
|
||||
m_feedback = 0.0f;
|
||||
setSampleRate( sampleRate );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
StereoDelay::~StereoDelay()
|
||||
{
|
||||
if( m_buffer )
|
||||
{
|
||||
delete m_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void StereoDelay::tick( sampleFrame frame )
|
||||
{
|
||||
m_buffer[m_index][0] = frame[0];
|
||||
m_buffer[m_index][1] = frame[1];
|
||||
|
||||
int readIndex = m_index - ( int )m_length;
|
||||
if( readIndex < 0 )
|
||||
{
|
||||
readIndex += m_maxLength;
|
||||
}
|
||||
float fract = fraction( m_length );
|
||||
frame[0] = linearInterpolate( m_buffer[readIndex][0] ,
|
||||
m_buffer[( readIndex+1) % m_maxLength][0], fract );
|
||||
frame[1] = linearInterpolate( m_buffer[readIndex][1] ,
|
||||
m_buffer[( readIndex+1) % m_maxLength][1], fract );
|
||||
|
||||
m_buffer[m_index][0] += frame[0] * m_feedback;
|
||||
m_buffer[m_index][1] += frame[1] * m_feedback;
|
||||
|
||||
m_index = ( m_index + 1) % m_maxLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void StereoDelay::setSampleRate( int sampleRate )
|
||||
{
|
||||
if( m_buffer )
|
||||
{
|
||||
delete m_buffer;
|
||||
}
|
||||
|
||||
|
||||
m_buffer = new sampleFrame[( int )( sampleRate * m_maxTime )];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
60
plugins/delay/stereodelay.h
Normal file
60
plugins/delay/stereodelay.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* stereodelay.h - declaration of StereoDelay class.
|
||||
*
|
||||
* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
|
||||
*
|
||||
* This file is part of LMMS - http://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 STEREODELAY_H
|
||||
#define STEREODELAY_H
|
||||
|
||||
#include "lmms_basics.h"
|
||||
|
||||
class StereoDelay
|
||||
{
|
||||
public:
|
||||
StereoDelay( int maxLength, int sampleRate );
|
||||
~StereoDelay();
|
||||
inline void setLength( float length )
|
||||
{
|
||||
if( length <= m_maxLength && length >= 0 )
|
||||
{
|
||||
m_length = length;
|
||||
}
|
||||
}
|
||||
|
||||
inline void setFeedback( float feedback )
|
||||
{
|
||||
m_feedback = feedback;
|
||||
}
|
||||
|
||||
void tick( sampleFrame frame );
|
||||
void setSampleRate( int sampleRate );
|
||||
|
||||
private:
|
||||
sampleFrame* m_buffer;
|
||||
int m_maxLength;
|
||||
float m_length;
|
||||
int m_index;
|
||||
float m_feedback;
|
||||
float m_maxTime;
|
||||
};
|
||||
|
||||
#endif // STEREODELAY_H
|
||||
@@ -94,7 +94,7 @@ MainWindow::MainWindow() :
|
||||
splitter->setChildrenCollapsible( false );
|
||||
|
||||
QString wdir = ConfigManager::inst()->workingDir();
|
||||
sideBar->appendTab( new pluginBrowser( splitter ) );
|
||||
sideBar->appendTab( new PluginBrowser( splitter ) );
|
||||
sideBar->appendTab( new FileBrowser(
|
||||
ConfigManager::inst()->userProjectsDir() + "*" +
|
||||
ConfigManager::inst()->factoryProjectsDir(),
|
||||
|
||||
@@ -43,7 +43,7 @@ bool pluginBefore( const Plugin::Descriptor& d1, const Plugin::Descriptor& d2 )
|
||||
|
||||
|
||||
|
||||
pluginBrowser::pluginBrowser( QWidget * _parent ) :
|
||||
PluginBrowser::PluginBrowser( QWidget * _parent ) :
|
||||
SideBarWidget( tr( "Instrument plugins" ),
|
||||
embed::getIconPixmap( "plugins" ).transformed( QTransform().rotate( 90 ) ), _parent )
|
||||
{
|
||||
@@ -65,29 +65,20 @@ pluginBrowser::pluginBrowser( QWidget * _parent ) :
|
||||
m_view );
|
||||
hint->setFont( pointSize<8>( hint->font() ) );
|
||||
hint->setWordWrap( true );
|
||||
view_layout->addWidget( hint );
|
||||
|
||||
Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
|
||||
qSort( m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore );
|
||||
QScrollArea* scrollarea = new QScrollArea( m_view );
|
||||
PluginDescList* descList = new PluginDescList( m_view );
|
||||
scrollarea->setWidget(descList);
|
||||
scrollarea->setWidgetResizable(true);
|
||||
|
||||
for( Plugin::DescriptorList::ConstIterator it = m_pluginDescriptors.begin();
|
||||
it != m_pluginDescriptors.end(); ++it )
|
||||
{
|
||||
if( it->type == Plugin::Instrument )
|
||||
{
|
||||
pluginDescWidget * p = new pluginDescWidget( *it, m_view );
|
||||
p->show();
|
||||
view_layout->addWidget( p );
|
||||
}
|
||||
}
|
||||
view_layout->addStretch();
|
||||
show();
|
||||
view_layout->addWidget(hint);
|
||||
view_layout->addWidget(scrollarea);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pluginBrowser::~pluginBrowser()
|
||||
PluginBrowser::~PluginBrowser()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -96,8 +87,36 @@ pluginBrowser::~pluginBrowser()
|
||||
|
||||
|
||||
|
||||
PluginDescList::PluginDescList(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
pluginDescWidget::pluginDescWidget( const Plugin::Descriptor & _pd,
|
||||
Plugin::getDescriptorsOfAvailPlugins( m_pluginDescriptors );
|
||||
std::sort(m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore);
|
||||
|
||||
|
||||
for(Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin();
|
||||
it != m_pluginDescriptors.constEnd(); it++)
|
||||
{
|
||||
if( it->type == Plugin::Instrument )
|
||||
{
|
||||
PluginDescWidget* p = new PluginDescWidget( *it, this );
|
||||
p->show();
|
||||
layout->addWidget(p);
|
||||
}
|
||||
}
|
||||
|
||||
setLayout(layout);
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PluginDescWidget::PluginDescWidget( const Plugin::Descriptor & _pd,
|
||||
QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
m_updateTimer( this ),
|
||||
@@ -115,14 +134,14 @@ pluginDescWidget::pluginDescWidget( const Plugin::Descriptor & _pd,
|
||||
|
||||
|
||||
|
||||
pluginDescWidget::~pluginDescWidget()
|
||||
PluginDescWidget::~PluginDescWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pluginDescWidget::paintEvent( QPaintEvent * )
|
||||
void PluginDescWidget::paintEvent( QPaintEvent * )
|
||||
{
|
||||
const QColor fill_color = m_mouseOver ? QColor( 224, 224, 224 ) :
|
||||
QColor( 192, 192, 192 );
|
||||
@@ -152,7 +171,7 @@ void pluginDescWidget::paintEvent( QPaintEvent * )
|
||||
QRect br;
|
||||
p.drawText( 10 + logo_size.width(), 20, width() - 58 - 5, 999,
|
||||
Qt::TextWordWrap,
|
||||
pluginBrowser::tr( m_pluginDescriptor.description ),
|
||||
PluginBrowser::tr( m_pluginDescriptor.description ),
|
||||
&br );
|
||||
if( m_mouseOver )
|
||||
{
|
||||
@@ -165,7 +184,7 @@ void pluginDescWidget::paintEvent( QPaintEvent * )
|
||||
|
||||
|
||||
|
||||
void pluginDescWidget::enterEvent( QEvent * _e )
|
||||
void PluginDescWidget::enterEvent( QEvent * _e )
|
||||
{
|
||||
m_mouseOver = true;
|
||||
m_targetHeight = height() + 1;
|
||||
@@ -176,7 +195,7 @@ void pluginDescWidget::enterEvent( QEvent * _e )
|
||||
|
||||
|
||||
|
||||
void pluginDescWidget::leaveEvent( QEvent * _e )
|
||||
void PluginDescWidget::leaveEvent( QEvent * _e )
|
||||
{
|
||||
m_mouseOver = false;
|
||||
m_targetHeight = 24;
|
||||
@@ -187,7 +206,7 @@ void pluginDescWidget::leaveEvent( QEvent * _e )
|
||||
|
||||
|
||||
|
||||
void pluginDescWidget::mousePressEvent( QMouseEvent * _me )
|
||||
void PluginDescWidget::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton )
|
||||
{
|
||||
@@ -200,7 +219,7 @@ void pluginDescWidget::mousePressEvent( QMouseEvent * _me )
|
||||
|
||||
|
||||
|
||||
void pluginDescWidget::updateHeight()
|
||||
void PluginDescWidget::updateHeight()
|
||||
{
|
||||
if( m_targetHeight > height() )
|
||||
{
|
||||
|
||||
@@ -1279,7 +1279,14 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
flags &= ~Qt::WindowMaximizeButtonHint;
|
||||
subWin->setWindowFlags( flags );
|
||||
subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
|
||||
|
||||
// Hide the Size and Maximize options from the system menu
|
||||
// since the dialog size is fixed.
|
||||
QMenu * systemMenu = subWin->systemMenu();
|
||||
systemMenu->actions().at( 2 )->setVisible( false ); // Size
|
||||
systemMenu->actions().at( 4 )->setVisible( false ); // Maximize
|
||||
|
||||
subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
|
||||
subWin->setFixedSize( subWin->size() );
|
||||
subWin->hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user