Skip to content

Commit

Permalink
開始位置が同じ重複音処理の修正.
Browse files Browse the repository at this point in the history
  • Loading branch information
fourthline committed Dec 21, 2014
1 parent b494f78 commit 883fd12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<property name="app.vendor" value="fourthline" />
<property name="app.id" value="MabiIcco" />
<property name="app.name" value="MabiIcco" />
<property name="app.version" value="1.0-alpha18" />
<property name="app.version" value="1.0-alpha19" />
<property name="app.main-class" value="fourthline.mabiicco.MabiIcco" />
<property name="app.preloader-class" value="fourthline.mabiicco.preloader.MabiIccoPreloader" />
<property name="splash.image" value="img/title.png" />
Expand Down
26 changes: 10 additions & 16 deletions src/fourthline/mabiicco/midi/MMLMidiTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,20 @@ private void addItem(MMLNoteEvent addEvent) {
MMLNoteEvent prevEvent = noteEventList.get( targetIndex - 1 );
if (addEvent.getNote() == prevEvent.getNote()) {
if ( prevEvent.getTickOffset() == targetTick ) {
// 開始位置が同じときには, 元あったノートの長さを最小にして, 追加するノートの開始位置をずらす.
// 前の音とテンポ指定がある場合は元あったノートのほうをずらす.
// 開始位置が同じときには, 後発音で更新する.
// 前の音とテンポ指定がある場合は元あったノートのまま.
// 後発音が V0 の場合は l64音に更新する.
if (MMLTempoEvent.searchEqualsTick(tempoList, targetTick)) {
addEvent.setTick( MMLTicks.minimumTick() );
prevEvent.setTick( prevEvent.getTick() - MMLTicks.minimumTick() );
prevEvent.setTickOffset( addEvent.getTickOffset() + MMLTicks.minimumTick() );
if (prevEvent.getTick() <= 0) {
targetIndex--;
noteEventList.remove(targetIndex);
if (addEvent.getVelocity() == 0) {
prevEvent.setTick(MMLTicks.minimumTick());
}
return;
} else {
prevEvent.setTick( MMLTicks.minimumTick() );
addEvent.setTick( addEvent.getTick() - MMLTicks.minimumTick() );;
addEvent.setTickOffset( addEvent.getTickOffset() + MMLTicks.minimumTick() );
// ずらした開始位置にもノートがある場合は、古いほうを消す.
if ( targetIndex < noteEventList.size() ) {
if (addEvent.getTickOffset() == noteEventList.get(targetIndex).getTickOffset()) {
noteEventList.remove(targetIndex);
}
if (prevEvent.getVelocity() == 0) {
addEvent.setTick(MMLTicks.minimumTick());
}
targetIndex--;
noteEventList.remove(targetIndex);
}
} else {
trimOverlapNote(prevEvent, addEvent);
Expand Down

0 comments on commit 883fd12

Please sign in to comment.