From 5ac30f3564337b76cc12b3e5750ee12a859a9767 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Thu, 23 Dec 2010 13:22:39 +0000 Subject: - bugfix: handling medley and preview flags in editor - added voice pitch recording in editor (SHIFT+N and ALT+N) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2772 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditSub.pas | 133 +++++++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 7 deletions(-) (limited to 'Game/Code/Screens/UScreenEditSub.pas') diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index be058408..941a6a1b 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -23,8 +23,15 @@ type isEnd: boolean; //end beat is declared end; + TVoicePitch = record + beat: integer; + pitch: integer; + end; + TScreenEditSub = class(TMenu) private + PitchRecOn: boolean; + cRB, cGB, cBB: GLfloat; cRR, cGR, cBR: GLfloat; @@ -91,7 +98,7 @@ type ActTonePitch: integer; - procedure DrawPitch(x, y, Width, Height: single); + procedure DrawPitch(x, y, Width, Height: single; beat: integer); procedure StartVideo; procedure StartVideoPreview; procedure NewBeat; @@ -129,6 +136,7 @@ type procedure CopyLine(Pf, Cf, Pt, Ct: integer); procedure Refresh; public + Pitches: array of TVoicePitch; Tex_Background: TTexture; FadeOut: boolean; Path: string; @@ -175,6 +183,7 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); If (PressedDown) then begin // Key Down + PitchRecOn := false; case PressedKey of SDLK_TAB: begin @@ -587,9 +596,11 @@ begin begin if (CP = MedleyNotes.Preview.CP) and (Czesci[CP].Akt = MedleyNotes.Preview.line) and - (AktNuta[CP] = MedleyNotes.Preview.note) then //reset ? + (AktNuta[CP] = MedleyNotes.Preview.note) and + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].IsStartPreview then //reset begin - + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].IsStartPreview := false; + AktSong.PreviewStart := 0; end else //set begin if (Length(Czesci[MedleyNotes.Preview.CP].Czesc[MedleyNotes.Preview.line].Nuta)>MedleyNotes.Preview.note) then @@ -639,8 +650,70 @@ begin SDLK_N: begin - // Set actual note over pitch detection - Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[0]].Ton := ActTonePitch; + if (SDL_ModState = KMOD_LSHIFT) then + begin + // one line, mp3 + MidiOut.PutShort($81, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + PlayOneNoteMidi := false; + PlayOneSentence := true; + Click := false; + Music.Stop; + R := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].StartNote); + if R <= Music.Length then + begin + Music.MoveTo(R); + PlayStopTime := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].Koniec)+ + Ini.LipSync*0.01 + (120 + Ini.Delay*10) / 1000; + PlaySentence := true; + PlayOneNote := false; + Music.Play; + LastClick := -100; + end; + end; + + if (SDL_ModState = KMOD_LALT) then + begin + // Play whole file + MidiOut.PutShort($81, Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[MidiLastNote].Ton + 60, 127); + PlaySentenceMidi := false; + PlayOneNoteMidi := false; + Click := false; + Music.Stop; + R := GetTimeFromBeat(Czesci[CP].Czesc[Czesci[CP].Akt].StartNote); + if R <= Music.Length then + begin + Music.MoveTo(R); + PlayStopTime := Music.Length; + PlaySentence := true; + PlayOneSentence := false; + PlayOneNote := false; + Music.Play; + LastClick := -100; + end; + end; + + if PlaySentence then + begin + SetLength(Pitches, 0); + PitchRecOn := true; + noteStart := AktNuta[CP]; + lineStart := Czesci[CP].Akt; + cpStart := CP; + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Color := 0; + AktNuta[CP] := 0; + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[CP]].Color := 2; + EditorLyric[CP].Selected := AktNuta[CP]; + LineChanged[0]:=false; + LineChanged[1]:=false; + PlayVideo := false; + end; + + if (SDL_ModState = 0) then + begin + // Set actual note over pitch detection + Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[AktNuta[0]].Ton := ActTonePitch; + end; end; SDLK_C: @@ -1457,7 +1530,7 @@ begin end; end; -procedure TScreenEditSub.DrawPitch(x, y, Width, Height: single); +procedure TScreenEditSub.DrawPitch(x, y, Width, Height: single; beat: integer); var x1, y1, x2, y2: single; i: integer; @@ -1547,6 +1620,21 @@ begin SetFontPos(x-ToneStringWidth-ToneStringCenterXOffset, y-ToneStringHeight/2); glColor3f(0, 0, 0); glPrint(PChar(ToneString)); + + // rec pitches + if not PitchRecOn then + Exit; + + i := High(Pitches); + beat := Floor(GetMidBeat(GetTimeFromBeat(beat) - Ini.LipSync*0.01 - (AktSong.Gap + 120 + Ini.Delay*10) / 1000)); + + if (i = -1) or (Pitches[i].beat