Proposed fix for 1345 Exclude Tracks from master pitch

This commit is contained in:
Dave French
2015-01-10 17:11:17 +00:00
parent e61a0d14f0
commit af22d39612
3 changed files with 20 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ class DataFile;
class PluginView;
class TabWidget;
class TrackLabelButton;
class LedCheckBox;
class EXPORT InstrumentTrack : public Track, public MidiEventProcessor
@@ -250,6 +251,7 @@ private:
FloatModel m_pitchModel;
IntModel m_pitchRangeModel;
IntModel m_effectChannelModel;
BoolModel m_useMasterPitchModel;
FadeButton *m_fb;
@@ -414,6 +416,7 @@ private:
Knob * m_pitchKnob;
LcdSpinBox* m_pitchRangeSpinBox;
LcdSpinBox * m_effectChannelNumber;
LedCheckBox * m_useMasterPitchBox;
// tab-widget with all children

View File

@@ -509,10 +509,11 @@ bool NotePlayHandle::operator==( const NotePlayHandle & _nph ) const
void NotePlayHandle::updateFrequency()
{
int mp = m_instrumentTrack->m_useMasterPitchModel.value() ? Engine::getSong()->masterPitch() : 0;
const float pitch =
( key() -
m_instrumentTrack->baseNoteModel()->value() +
Engine::getSong()->masterPitch() +
mp +
m_baseDetuning->value() )
/ 12.0f;
m_frequency = BaseFreq * powf( 2.0f, pitch + m_instrumentTrack->pitchModel()->value() / ( 100 * 12.0f ) );

View File

@@ -109,6 +109,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
m_pitchModel( 0, MinPitchDefault, MaxPitchDefault, 1, this, tr( "Pitch" ) ),
m_pitchRangeModel( 1, 1, 24, this, tr( "Pitch range" ) ),
m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ),
m_useMasterPitchModel( true, this, tr( "Master Pitch") ),
m_instrument( NULL ),
m_soundShaping( this ),
m_arpeggio( this ),
@@ -139,7 +140,9 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
int InstrumentTrack::baseNote() const
{
return m_baseNoteModel.value() - Engine::getSong()->masterPitch();
int mp = m_useMasterPitchModel.value() ? Engine::getSong()->masterPitch() : 0;
return m_baseNoteModel.value() - mp;
}
@@ -550,6 +553,7 @@ void InstrumentTrack::updatePitchRange()
int InstrumentTrack::masterKey( int _midi_key ) const
{
int key = baseNote();
return tLimit<int>( _midi_key - ( key - DefaultKey ), 0, NumKeys );
}
@@ -700,6 +704,7 @@ void InstrumentTrack::saveTrackSpecificSettings( QDomDocument& doc, QDomElement
m_effectChannelModel.saveSettings( doc, thisElement, "fxch" );
m_baseNoteModel.saveSettings( doc, thisElement, "basenote" );
m_useMasterPitchModel.saveSettings( doc, thisElement, "usemasterpitch");
if( m_instrument != NULL )
{
@@ -731,6 +736,7 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement
m_effectChannelModel.setRange( 0, Engine::fxMixer()->numChannels()-1 );
m_effectChannelModel.loadSettings( thisElement, "fxch" );
m_baseNoteModel.loadSettings( thisElement, "basenote" );
m_useMasterPitchModel.loadSettings( thisElement, "usemasterpitch");
// clear effect-chain just in case we load an old preset without FX-data
m_audioPort.effects()->clear();
@@ -1211,6 +1217,14 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
basicControlsLayout->addWidget( m_pitchRangeSpinBox );
basicControlsLayout->addStretch();
//setup checkbox for use master pitch
m_useMasterPitchBox = new LedCheckBox( this, tr( "Use master pitch" ),LedCheckBox::Green );
m_useMasterPitchBox->setModel( &m_track->m_useMasterPitchModel );
m_useMasterPitchBox->setToolTip( "Master Pitch" );
basicControlsLayout->addWidget( m_useMasterPitchBox );
basicControlsLayout->addStretch();
// setup spinbox for selecting FX-channel
m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) );
m_effectChannelNumber->setLabel( tr( "FX" ) );