new distortion-class and other improvements

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@445 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-12-20 23:35:36 +00:00
parent f4ab55bce5
commit d8b005b0d4
6 changed files with 77 additions and 25 deletions

View File

@@ -1,3 +1,18 @@
2006-12-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* include/note_play_handle.h:
* src/core/note_play_handle.cpp:
added parameter to nphsOfInstrumentTrack() which will cause the method
to add note-play-handles even if they're released
* include/effect_lib.h:
made bassBoost using double-values internally
* plugins/kicker/kicker.cpp:
* include/effect_lib.h:
introduced new distortion-class which sounds better than
foldback-distortion
2006-12-20 Javier Serrano Polo <jasp00/at/terra/dot/es>
* src/widgets/rack_plugin.cpp:

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.2.1-svn20061220, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20061220)
AC_INIT(lmms, 0.2.1-svn20061221, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.2.1-svn20061221)
AM_CONFIG_HEADER(config.h)

View File

@@ -220,13 +220,13 @@ namespace effectLib
class bassBoost : public monoBase<SAMPLE>
{
public:
bassBoost( const float _selectivity,
const float _gain,
const float _ratio,
bassBoost( const double _selectivity,
const double _gain,
const double _ratio,
const bassBoost<SAMPLE> & _orig =
bassBoost<SAMPLE>() ) :
m_selectivity( tMax<SAMPLE>( _selectivity, 10.0f ) ),
m_gain1( 1.0f / ( m_selectivity + 1.0f ) ),
m_selectivity( tMax<SAMPLE>( _selectivity, 10.0 ) ),
m_gain1( 1.0 / ( m_selectivity + 1.0 ) ),
m_gain2( _gain ),
m_ratio( _ratio ),
m_cap( _orig.m_cap )
@@ -244,33 +244,33 @@ namespace effectLib
m_gain2/* )*/ );
}
void setSelectivity( const float _selectivity )
void setSelectivity( const double _selectivity )
{
m_selectivity = _selectivity;
m_gain1 = 1.0f / ( m_selectivity + 1.0f );
m_gain1 = 1.0 / ( m_selectivity + 1.0 );
}
void setGain( const float _gain )
void setGain( const double _gain )
{
m_gain2 = _gain;
}
void setRatio( const float _ratio )
void setRatio( const double _ratio )
{
m_ratio = _ratio;
}
private:
bassBoost() :
m_cap( 0.0f )
m_cap( 0.0 )
{
}
float m_selectivity;
float m_gain1;
float m_gain2;
float m_ratio;
mutable float m_cap;
double m_selectivity;
double m_gain1;
double m_gain2;
double m_ratio;
mutable double m_cap;
} ;
@@ -317,6 +317,41 @@ namespace effectLib
} ;
template<typename SAMPLE = sample_t>
class distortion : public monoBase<SAMPLE>
{
public:
distortion( const float _threshold, const float _gain ) :
m_threshold( _threshold ),
m_gain( _gain )
{
}
virtual SAMPLE nextSample( const SAMPLE _in ) const
{
return( m_gain * ( _in * ( fabsf( _in )+m_threshold ) /
( _in*_in +( m_threshold-1 )*
fabsf( _in ) + 1 ) ) );
}
void setThreshold( const float _threshold )
{
m_threshold = _threshold;
}
void setGain( const float _gain )
{
m_gain = _gain;
}
private:
float m_threshold;
float m_gain;
} ;
template<typename SAMPLE = sample_t>
class stereoEnhancer : public stereoBase<SAMPLE>
{

View File

@@ -166,9 +166,10 @@ public:
// belonging to this channel
int index( void ) const;
// note-play-handles belonging to given channel
// note-play-handles belonging to given channel, if _all_ph = TRUE,
// also released note-play-handles are returned
static constNotePlayHandleVector nphsOfInstrumentTrack(
const instrumentTrack * _ct );
const instrumentTrack * _ct, bool _all_ph = FALSE );
// return whether given note-play-handle is equal to *this
bool operator==( const notePlayHandle & _nph ) const;

View File

@@ -96,8 +96,8 @@ kickerInstrument::kickerInstrument( instrumentTrack * _instrument_track ) :
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->setRange( 0.0f, 100.0f, 0.1f );
m_distKnob->setInitValue( 0.8f );
m_distKnob->setLabel( tr( "DIST" ) );
m_distKnob->setHintText( tr( "Distortion:" ) + " ", "" );
@@ -168,7 +168,8 @@ QString kickerInstrument::nodeName( void ) const
typedef effectLib::foldbackDistortion<> distFX;
//typedef effectLib::foldbackDistortion<> distFX;
typedef effectLib::distortion<> distFX;
typedef sweepOscillator<effectLib::monoToStereoAdaptor<distFX> > sweepOsc;
@@ -181,7 +182,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, bool )
if ( tfp == 0 )
{
_n->m_pluginData = new sweepOsc(
distFX( 1.0f-m_distKnob->value(),
distFX( m_distKnob->value(),
m_gainKnob->value() ) );
}
else if( tfp > decfr && !_n->released() )

View File

@@ -383,7 +383,7 @@ int notePlayHandle::index( void ) const
constNotePlayHandleVector notePlayHandle::nphsOfInstrumentTrack(
const instrumentTrack * _it )
const instrumentTrack * _it, bool _all_ph )
{
const playHandleVector & phv = _it->eng()->getMixer()->playHandles();
constNotePlayHandleVector cnphv;
@@ -394,7 +394,7 @@ constNotePlayHandleVector notePlayHandle::nphsOfInstrumentTrack(
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph != NULL && nph->m_instrumentTrack == _it &&
nph->released() == FALSE )
( nph->released() == FALSE || _all_ph == TRUE ) )
{
cnphv.push_back( nph );
}