TripleOscillator: dynamically change range of fine detuning knobs

Similiar to the pitch knob of a instrument track, the range of the fine
detuning knobs in TripleOscillator is now changed dynamically as well.
This allows new kind of sounds by hardsyncing with a detuning of up
to +/- 2400 cents.
This commit is contained in:
Tobias Doerffel
2009-05-16 17:20:20 +02:00
parent f514dfdbb3
commit c86f7b5104
2 changed files with 30 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
/*
* triple_oscillator.cpp - powerful instrument with three oscillators
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -244,8 +244,13 @@ tripleOscillator::tripleOscillator( instrumentTrack * _instrument_track ) :
}
updateAllPitchRange();
connect( engine::getMixer(), SIGNAL( sampleRateChanged() ),
this, SLOT( updateAllDetuning() ) );
connect( getInstrumentTrack()->pitchRangeModel(),
SIGNAL( dataChanged() ),
this, SLOT( updateAllPitchRange() ) );
}
@@ -333,7 +338,7 @@ void tripleOscillator::loadSettings( const QDomElement & _this )
QString tripleOscillator::nodeName( void ) const
{
return( tripleoscillator_plugin_descriptor.name );
return tripleoscillator_plugin_descriptor.name;
}
@@ -432,7 +437,7 @@ void tripleOscillator::deleteNotePluginData( notePlayHandle * _n )
pluginView * tripleOscillator::instantiateView( QWidget * _parent )
{
return( new tripleOscillatorView( this, _parent ) );
return new tripleOscillatorView( this, _parent );
}
@@ -450,6 +455,18 @@ void tripleOscillator::updateAllDetuning( void )
void tripleOscillator::updateAllPitchRange( void )
{
const int range = getInstrumentTrack()->pitchRangeModel()->value();
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
{
m_osc[i]->updatePitchRange( range );
}
}
class tripleOscKnob : public knob
{
public:
@@ -854,8 +871,7 @@ extern "C"
// neccessary for getting instance out of shared lib
plugin * PLUGIN_EXPORT lmms_plugin_main( model *, void * _data )
{
return( new tripleOscillator(
static_cast<instrumentTrack *>( _data ) ) );
return new tripleOscillator( static_cast<instrumentTrack *>( _data ) );
}
}

View File

@@ -2,7 +2,7 @@
* triple_oscillator.h - declaration of class tripleOscillator a powerful
* instrument-plugin with 3 oscillators
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -49,6 +49,12 @@ public:
oscillatorObject( model * _parent, int _idx );
virtual ~oscillatorObject();
void updatePitchRange( int _range )
{
m_fineLeftModel.setRange( -100 * _range, 100 * _range );
m_fineRightModel.setRange( -100 * _range, 100 * _range );
}
private:
void applyPhaseRandomness( void );
@@ -113,7 +119,7 @@ public:
virtual f_cnt_t desiredReleaseFrames( void ) const
{
return( 128 );
return 128;
}
virtual pluginView * instantiateView( QWidget * _parent );
@@ -121,6 +127,7 @@ public:
protected slots:
void updateAllDetuning( void );
void updateAllPitchRange( void );
private: