diff --git a/include/instrument_track.h b/include/instrument_track.h index 8d700c417..199b5539a 100644 --- a/include/instrument_track.h +++ b/include/instrument_track.h @@ -161,11 +161,6 @@ public: // simple helper for removing midiport-XML-node when loading presets static void removeMidiPortNode( multimediaProject & _mmp ); - floatModel * pitchModel( void ) - { - return &m_pitchModel; - } - floatModel * volumeModel( void ) { return &m_volumeModel; @@ -176,6 +171,16 @@ public: return &m_panningModel; } + floatModel * pitchModel( void ) + { + return &m_pitchModel; + } + + intModel * pitchRangeModel( void ) + { + return &m_pitchRangeModel; + } + intModel * effectChannelModel( void ) { return &m_effectChannelModel; @@ -202,6 +207,7 @@ protected: protected slots: void updateBaseNote( void ); void updatePitch( void ); + void updatePitchRange( void ); private: @@ -219,6 +225,7 @@ private: floatModel m_volumeModel; floatModel m_panningModel; floatModel m_pitchModel; + intModel m_pitchRangeModel; intModel m_effectChannelModel; @@ -379,6 +386,7 @@ private: knob * m_volumeKnob; knob * m_panningKnob; knob * m_pitchKnob; + lcdSpinBox * m_pitchRange; lcdSpinBox * m_effectChannelNumber; QPushButton * m_saveSettingsBtn; 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: diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 8cbd31a8e..30bdef596 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -121,6 +121,8 @@ void engine::init( const bool _has_gui ) s_midiControlListener = new MidiControlListener(); + s_automationRecorder = new AutomationRecorder; + if( s_hasGUI ) { s_mainWindow = new mainWindow; @@ -131,7 +133,6 @@ void engine::init( const bool _has_gui ) s_bbEditor = new bbEditor( s_bbTrackContainer ); s_pianoRoll = new pianoRoll; s_automationEditor = new automationEditor; - s_automationRecorder = new AutomationRecorder; s_mainWindow->finalize(); } diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index 5996ed4f3..df7fdddae 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -463,7 +463,7 @@ void notePlayHandle::updateFrequency( void ) ( key() - m_instrumentTrack->baseNoteModel()->value() + engine::getSong()->masterPitch() ) / 12.0f; m_frequency = BaseFreq * powf( 2.0f, pitch + - m_instrumentTrack->m_pitchModel.value() / ( 100 * 12.0f ) ); + m_instrumentTrack->pitchModel()->value() / ( 100 * 12.0f ) ); m_unpitchedFrequency = BaseFreq * powf( 2.0f, pitch ); for( notePlayHandleVector::iterator it = m_subNotes.begin(); diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index fd45c1dda..67c3c1d34 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -1775,8 +1775,6 @@ void pianoRoll::computeSelectedNotes(bool shift) { const noteVector & notes = m_pattern->notes(); - QPolygon volumeHandles; - for( noteVector::const_iterator it = notes.begin(); it != notes.end(); ++it ) { diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 5f7033f1a..5fcc3c47a 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -104,6 +104,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f, this, tr( "Panning" ) ), m_pitchModel( 0, -100, 100, 1, this, tr( "Pitch" ) ), + m_pitchRangeModel( 1, 1, 24, this, tr( "Pitch range" ) ), m_effectChannelModel( 0, 0, NumFxChannels, this, tr( "FX channel" ) ), m_instrument( NULL ), m_soundShaping( this ), @@ -116,6 +117,8 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : this, SLOT( updateBaseNote() ) ); connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) ); + connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), + this, SLOT( updatePitchRange() ) ); for( int i = 0; i < NumKeys; ++i ) @@ -523,6 +526,15 @@ void instrumentTrack::updatePitch( void ) +void instrumentTrack::updatePitchRange( void ) +{ + const int r = m_pitchRangeModel.value(); + m_pitchModel.setRange( -100 * r, 100 * r ); +} + + + + int instrumentTrack::masterKey( int _midi_key ) const { int key = m_baseNoteModel.value() - engine::getSong()->masterPitch(); @@ -688,6 +700,7 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc, m_volumeModel.saveSettings( _doc, _this, "vol" ); m_panningModel.saveSettings( _doc, _this, "pan" ); m_pitchModel.saveSettings( _doc, _this, "pitch" ); + m_pitchRangeModel.saveSettings( _doc, _this, "pitchrange" ); m_effectChannelModel.saveSettings( _doc, _this, "fxch" ); m_baseNoteModel.saveSettings( _doc, _this, "basenote" ); @@ -731,6 +744,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this ) m_panningModel.loadSettings( _this, "pan" ); } + m_pitchRangeModel.loadSettings( _this, "pitchrange" ); m_pitchModel.loadSettings( _this, "pitch" ); m_effectChannelModel.loadSettings( _this, "fxch" ); @@ -1128,18 +1142,22 @@ void instrumentTrackView::midiConfigChanged( void ) class fxLineLcdSpinBox : public lcdSpinBox { - public: - fxLineLcdSpinBox( int _num_digits, QWidget * _parent, +public: + fxLineLcdSpinBox( int _num_digits, QWidget * _parent, const QString & _name ) : - lcdSpinBox( _num_digits, _parent, _name ) {} + lcdSpinBox( _num_digits, _parent, _name ) + { + } - protected: - virtual void mouseDoubleClickEvent ( QMouseEvent * _me ) - { - engine::getFxMixerView()->setCurrentFxLine( model()->value() ); - //engine::getFxMixerView()->raise(); - } -}; + +protected: + virtual void mouseDoubleClickEvent ( QMouseEvent * _me ) + { + engine::getFxMixerView()->setCurrentFxLine( model()->value() ); + //engine::getFxMixerView()->raise(); + } + +} ; @@ -1167,16 +1185,29 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) : m_nameLineEdit = new QLineEdit( m_generalSettingsWidget ); m_nameLineEdit->setFont( pointSize<8>( m_nameLineEdit->font() ) ); - m_nameLineEdit->setGeometry( 10, 16, 230, 18 ); + m_nameLineEdit->setGeometry( 10, 16, 196, 20 ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); + m_saveSettingsBtn = new QPushButton( embed::getIconPixmap( + "project_save" ), "", + m_generalSettingsWidget ); + m_saveSettingsBtn->setGeometry( 216, 14, 24, 24 ); + connect( m_saveSettingsBtn, SIGNAL( clicked() ), this, + SLOT( saveSettingsBtnClicked() ) ); + toolTip::add( m_saveSettingsBtn, + tr( "Save instrument track settings in a preset file" ) ); + m_saveSettingsBtn->setWhatsThis( + tr( "Click here, if you want to save current channel settings " + "in a preset-file. Later you can load this preset by " + "double-clicking it in the preset-browser." ) ); + // setup volume-knob m_volumeKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); - m_volumeKnob->move( 10, 44 ); + m_volumeKnob->move( 8, 46 ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->setLabel( tr( "VOL" ) ); @@ -1187,7 +1218,7 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) : m_panningKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Panning" ) ); m_panningKnob->move( m_volumeKnob->x() + - m_volumeKnob->width() + 16, 44 ); + m_volumeKnob->width() + 12, 46 ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" ); m_panningKnob->setLabel( tr( "PAN" ) ); @@ -1195,32 +1226,23 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) : m_pitchKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Pitch" ) ); m_pitchKnob->move( m_panningKnob->x() + - m_panningKnob->width() + 16, 44 ); + m_panningKnob->width() + 24, 46 ); m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) ); m_pitchKnob->setLabel( tr( "PITCH" ) ); + m_pitchRange = new lcdSpinBox( 2, m_generalSettingsWidget, + tr( "Pitch range (semitones)" ) ); + m_pitchRange->setLabel( tr( "RANGE" ) ); + m_pitchRange->move( m_pitchKnob->x() + + m_pitchKnob->width() + 8, 46 ); + // setup spinbox for selecting FX-channel m_effectChannelNumber = new fxLineLcdSpinBox( 2, m_generalSettingsWidget, tr( "FX channel" ) ); m_effectChannelNumber->setLabel( tr( "FX CHNL" ) ); - m_effectChannelNumber->move( m_pitchKnob->x() + - m_pitchKnob->width() + 16, 44 ); - - m_saveSettingsBtn = new QPushButton( embed::getIconPixmap( - "project_save" ), "", - m_generalSettingsWidget ); - m_saveSettingsBtn->setGeometry( m_effectChannelNumber->x() + - m_effectChannelNumber->width() + 20, 44, - 32, 32 ); - connect( m_saveSettingsBtn, SIGNAL( clicked() ), this, - SLOT( saveSettingsBtnClicked() ) ); - toolTip::add( m_saveSettingsBtn, - tr( "Save current channel settings in a preset-file" ) ); - m_saveSettingsBtn->setWhatsThis( - tr( "Click here, if you want to save current channel settings " - "in a preset-file. Later you can load this preset by " - "double-clicking it in the preset-browser." ) ); + m_effectChannelNumber->move( m_pitchRange->x() + + m_pitchRange->width() + 24, 46 ); m_tabWidget = new tabWidget( "", this ); @@ -1307,6 +1329,7 @@ void instrumentTrackWindow::modelChanged( void ) if( m_track->getInstrument() && m_track->getInstrument()->isBendable() ) { m_pitchKnob->setModel( &m_track->m_pitchModel ); + m_pitchRange->setModel( &m_track->m_pitchRangeModel ); m_pitchKnob->show(); } else