Make that 4: Fix stuck midi notes on changing master pitch

This commit is contained in:
Vesa
2014-06-13 13:49:14 +03:00
parent 3f19478b87
commit d1eb9886fd
3 changed files with 10 additions and 3 deletions

View File

@@ -160,6 +160,8 @@ public:
{
return &m_baseNoteModel;
}
int baseNote() const;
Piano *pianoModel()
{

View File

@@ -68,7 +68,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
m_muted( false ),
m_bbTrack( NULL ),
m_origTempo( engine::getSong()->getTempo() ),
m_origBaseNote( instrumentTrack->baseNoteModel()->value() ),
m_origBaseNote( instrumentTrack->baseNote() ),
m_frequency( 0 ),
m_unpitchedFrequency( 0 ),
m_baseDetuning( NULL ),
@@ -182,7 +182,7 @@ void NotePlayHandle::setPanning( panning_t panning )
int NotePlayHandle::midiKey() const
{
return key() - m_origBaseNote + instrumentTrack()->baseNoteModel()->value();
return key() - m_origBaseNote + instrumentTrack()->baseNote();
}

View File

@@ -135,6 +135,11 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
}
int InstrumentTrack::baseNote() const
{
return m_baseNoteModel.value() - engine::getSong()->masterPitch();
}
InstrumentTrack::~InstrumentTrack()
@@ -537,7 +542,7 @@ void InstrumentTrack::updatePitchRange()
int InstrumentTrack::masterKey( int _midi_key ) const
{
int key = m_baseNoteModel.value() - engine::getSong()->masterPitch();
int key = baseNote();
return tLimit<int>( _midi_key - ( key - DefaultKey ), 0, NumKeys );
}