fix quantize: quantize the duration, don't extend hold notes over tap notes
without clearing them, ignore duration for tap notes
This commit is contained in:
@@ -1449,24 +1449,28 @@ void NoteDataUtil::SnapToNearestNoteType( NoteData &inout, NoteType nt1, NoteTyp
|
|||||||
|
|
||||||
for( int c=0; c<inout.GetNumTracks(); c++ )
|
for( int c=0; c<inout.GetNumTracks(); c++ )
|
||||||
{
|
{
|
||||||
if( iOldIndex == iNewIndex )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TapNote tnNew = inout.GetTapNote(c, iOldIndex);
|
TapNote tnNew = inout.GetTapNote(c, iOldIndex);
|
||||||
if( tnNew.type == TapNote::empty )
|
if( tnNew.type == TapNote::empty )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
inout.SetTapNote(c, iOldIndex, TAP_EMPTY);
|
inout.SetTapNote(c, iOldIndex, TAP_EMPTY);
|
||||||
|
|
||||||
const TapNote &tnOld = inout.GetTapNote(c, iNewIndex);
|
if( tnNew.type == TapNote::tap && inout.IsHoldNoteAtBeat(c, iNewIndex) )
|
||||||
if( tnNew.type == TapNote::tap && tnOld.type == TapNote::hold_head )
|
|
||||||
continue; // HoldNotes override TapNotes
|
continue; // HoldNotes override TapNotes
|
||||||
|
|
||||||
int iNewDuration = Quantize( tnNew.iDuration, BeatToNoteRow(fSnapInterval1) );
|
if( tnNew.type == TapNote::hold_head )
|
||||||
if( iNewDuration == 0 )
|
{
|
||||||
continue;
|
/* Quantize the duration. If the result is empty, just discard the hold. */
|
||||||
|
tnNew.iDuration = Quantize( tnNew.iDuration, BeatToNoteRow(fSnapInterval1) );
|
||||||
|
if( tnNew.iDuration == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
inout.SetTapNote(c, iNewIndex, tnNew );
|
/* We might be moving a hold note downwards, or extending its duration
|
||||||
|
* downwards. Make sure there isn't anything else in the new range. */
|
||||||
|
inout.ClearRangeForTrack( iNewIndex, iNewIndex+tnNew.iDuration+1, c );
|
||||||
|
}
|
||||||
|
|
||||||
|
inout.SetTapNote( c, iNewIndex, tnNew );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user