From 7c2636bf64774b5a39d768a37a872b834bfec914 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Wed, 20 Apr 2011 08:23:44 +0000 Subject: Fix: Shift+Space sometimes plays more than 1 note. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2824 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 55 ++++++------------------------------ 1 file changed, 8 insertions(+), 47 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index fc2f9364..39ddbf68 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1015,8 +1015,10 @@ begin PlayOneNote := false; MidiTime := USTime.GetTime; MidiStart := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start); - MidiStop := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc); + MidiStop := MidiStart + GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc); LastClick := Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start-1; + MidiOut.PutShort($91, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Ton + 60, 127); + MidiLastNote := AktNuta[CP]; end else if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then @@ -1026,7 +1028,7 @@ begin PlayOneNoteMidi := true; MidiTime := USTime.GetTime; MidiStart := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start); - MidiStop := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc); + MidiStop := MidiStart + GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc); PlaySentence := false; PlayOneNote := true; @@ -1038,6 +1040,8 @@ begin Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc)); Music.Play; LastClick := Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start-1; + MidiOut.PutShort($91, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Ton + 60, 127); + MidiLastNote := AktNuta[CP]; end Else @@ -1053,8 +1057,8 @@ begin Music.MoveTo(GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start)); PlayStopTime := (GetTimeFromBeat( - Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start + - Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc)); + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start + + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Dlugosc)); Music.Play; LastClick := Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Start-1; end; @@ -3234,27 +3238,6 @@ begin Music.Stop; PlayOneNote := false; end; - - // click - if (Click) and (PlaySentence) then - begin - AktBeat := Floor(GetMidBeat(Music.Position - AktSong.GAP / 1000)); - Text[TextDebug].Text := IntToStr(AktBeat); - if AktBeat <> LastClick then - begin - for beat := LastClick+1 to AktBeat do - begin - for Pet := 0 to Czesci[CP].Czesc[Czesci[CP].Akt].HighNut do - begin - if (Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet].Start = beat) then - begin - Music.PlayClick; - LastClick := beat; - end; - end; - end; //for beat - end; - end; // click end; // if PlayOneNote // midi music @@ -3267,28 +3250,6 @@ begin MidiOut.PutShort($81, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[MidiLastNote].Ton + 60, 127); PlayOneNoteMidi := false; end; - - // click - AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); - Text[TextDebug].Text := IntToStr(AktBeat); - - if AktBeat <> LastClick then - begin - for beat := LastClick+1 to AktBeat do - begin - for Pet := 0 to Czesci[CP].Czesc[Czesci[CP].Akt].HighNut do - begin - if (Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet].Start = beat) then - begin - LastClick := beat; - if Pet > 0 then - MidiOut.PutShort($81, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet-1].Ton + 60, 127); - MidiOut.PutShort($91, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet].Ton + 60, 127); - MidiLastNote := Pet; - end; - end; - end; //for beat - end; end; // if PlayOneNoteMidi Text[TextSentence].Text := 'Line: ' + IntToStr(Czesci[CP].Akt + 1) + '/' + IntToStr(Czesci[CP].Ilosc); -- cgit v1.2.3