From 883fd128930c8e74e3ad0141d52cd29812286412 Mon Sep 17 00:00:00 2001 From: fourthline Date: Sun, 21 Dec 2014 20:55:22 +0900 Subject: [PATCH] =?UTF-8?q?=E9=96=8B=E5=A7=8B=E4=BD=8D=E7=BD=AE=E3=81=8C?= =?UTF-8?q?=E5=90=8C=E3=81=98=E9=87=8D=E8=A4=87=E9=9F=B3=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.xml | 2 +- .../mabiicco/midi/MMLMidiTrack.java | 26 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/build.xml b/build.xml index 9aa379ec..face69e6 100644 --- a/build.xml +++ b/build.xml @@ -17,7 +17,7 @@ - + diff --git a/src/fourthline/mabiicco/midi/MMLMidiTrack.java b/src/fourthline/mabiicco/midi/MMLMidiTrack.java index 0c63196a..aaad0ac0 100644 --- a/src/fourthline/mabiicco/midi/MMLMidiTrack.java +++ b/src/fourthline/mabiicco/midi/MMLMidiTrack.java @@ -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);