diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index a628eb284..1d87c9d76 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -1,7 +1,7 @@ /* * triple_oscillator.cpp - powerful instrument with three oscillators * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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( _data ) ) ); + return new tripleOscillator( static_cast( _data ) ); } } diff --git a/plugins/triple_oscillator/triple_oscillator.h b/plugins/triple_oscillator/triple_oscillator.h index c9c5aebdc..45af8e108 100644 --- a/plugins/triple_oscillator/triple_oscillator.h +++ b/plugins/triple_oscillator/triple_oscillator.h @@ -2,7 +2,7 @@ * triple_oscillator.h - declaration of class tripleOscillator a powerful * instrument-plugin with 3 oscillators * - * Copyright (c) 2004-2008 Tobias Doerffel + * Copyright (c) 2004-2009 Tobias Doerffel * * 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: