added randomise button to organic
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@107 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2006-03-16 Andreas Brandmaier <andreas/at/brandmaier/dot/de>
|
||||
|
||||
* plugins/organic/organic.cpp
|
||||
* plugins/organic/organic.h
|
||||
* plugins/organic/randomise.png
|
||||
added "randomise preset" button to organic plugin
|
||||
|
||||
2006-03-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/types.h:
|
||||
|
||||
@@ -179,7 +179,21 @@ organicInstrument::organicInstrument( channelTrack * _channel_track ) :
|
||||
volKnob->setInitValue( 100 );
|
||||
volKnob->setHintText( tr( "Osc %1 volume:" ).arg(
|
||||
1 ) + " ", "%" );
|
||||
|
||||
// randomise
|
||||
m_randBtn = new pixmapButton( this );
|
||||
m_randBtn->move( 100, 200 );
|
||||
m_randBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"randomise" ) );
|
||||
m_randBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
|
||||
"randomise" ) );
|
||||
//m_randBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
|
||||
// createHeuristicMask() ) );
|
||||
|
||||
connect( m_randBtn, SIGNAL ( toggled(bool) ),
|
||||
this, SLOT( randomiseSettings() ) );
|
||||
|
||||
// set harmonics
|
||||
|
||||
m_osc[0].harmonic = 0.5f; // one octave below
|
||||
m_osc[1].harmonic = 0.75f; // a fifth below
|
||||
@@ -479,6 +493,41 @@ void organicInstrument::oscButtonChanged( )
|
||||
}
|
||||
}
|
||||
|
||||
void organicInstrument::randomiseSettings()
|
||||
{
|
||||
|
||||
for (int i=0; i < m_num_oscillators; i++)
|
||||
{
|
||||
m_osc[i].volKnob->setValue(
|
||||
intRand(0,100)
|
||||
);
|
||||
|
||||
m_osc[i].detuneKnob->setValue(
|
||||
intRand(-5, 5)
|
||||
);
|
||||
|
||||
m_osc[i].panKnob->setValue(
|
||||
//(int)gaussRand(PANNING_LEFT, PANNING_RIGHT,1,0)
|
||||
0
|
||||
);
|
||||
|
||||
m_osc[i].oscKnob->setValue(
|
||||
intRand(0, 5)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int organicInstrument::intRand( int min, int max )
|
||||
{
|
||||
// int randn = min+int((max-min)*rand()/(RAND_MAX + 1.0));
|
||||
// cout << randn << endl;
|
||||
int randn = ( rand() % (max-min) ) + min ;
|
||||
return randn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
@@ -66,17 +66,19 @@ public:
|
||||
virtual void FASTCALL loadSettings( const QDomElement & _this );
|
||||
|
||||
virtual QString nodeName( void ) const;
|
||||
|
||||
int intRand( int min, int max );
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void oscButtonChanged( void );
|
||||
void randomiseSettings();
|
||||
|
||||
private:
|
||||
|
||||
float foldback(float in, float threshold);
|
||||
float saturate(float x, float t);
|
||||
float distort(float in, float dist);
|
||||
float waveshape(float in, float amount);
|
||||
float inline waveshape(float in, float amount);
|
||||
|
||||
|
||||
// fast atan, fast rather than accurate
|
||||
inline float fastatan( float x )
|
||||
@@ -108,6 +110,7 @@ private:
|
||||
|
||||
knob * fx1Knob;
|
||||
knob * volKnob;
|
||||
pixmapButton * m_randBtn;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
BIN
plugins/organic/randomise.png
Normal file
BIN
plugins/organic/randomise.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user