diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-15 21:28:52 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-15 21:28:52 +0000 |
commit | 115255f6a3c2be422680710b5d6ba4226c3383a6 (patch) | |
tree | 3bbe81786e12808220efa589adb799e0412d20a2 /us_maker_edition/src/screens | |
parent | cf141f470e4cb45b8c886e1536846a8254cdd302 (diff) | |
download | usdx-115255f6a3c2be422680710b5d6ba4226c3383a6.tar.gz usdx-115255f6a3c2be422680710b5d6ba4226c3383a6.tar.xz usdx-115255f6a3c2be422680710b5d6ba4226c3383a6.zip |
merged trunk r2528 into us_maker branch
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2530 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'us_maker_edition/src/screens')
-rw-r--r-- | us_maker_edition/src/screens/UScreenEditSub.pas | 167 | ||||
-rw-r--r-- | us_maker_edition/src/screens/UScreenOptionsRecord.pas | 32 | ||||
-rw-r--r-- | us_maker_edition/src/screens/UScreenOptionsThemes.pas | 8 | ||||
-rw-r--r-- | us_maker_edition/src/screens/UScreenSing.pas | 134 | ||||
-rw-r--r-- | us_maker_edition/src/screens/UScreenSong.pas | 131 |
5 files changed, 317 insertions, 155 deletions
diff --git a/us_maker_edition/src/screens/UScreenEditSub.pas b/us_maker_edition/src/screens/UScreenEditSub.pas index 400053c0..51e1df42 100644 --- a/us_maker_edition/src/screens/UScreenEditSub.pas +++ b/us_maker_edition/src/screens/UScreenEditSub.pas @@ -52,6 +52,7 @@ uses gl, {$IFDEF UseMIDIPort} MidiOut, + MidiCons, {$ENDIF} UThemes, UPath; @@ -485,7 +486,11 @@ begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal else Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntFreestyle; - GoldenRec.KillAll; + GoldenRec.KillAll; + + // update lyrics + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; Exit; end; SDLK_Z: @@ -667,18 +672,35 @@ begin SDLK_SPACE: begin - // Play Sentence - PlaySentenceMidi := false; // stop midi - PlaySentence := true; - Click := false; - AudioPlayback.Stop; - AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - PlayStopTime := (GetTimeFromBeat( - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); - AudioPlayback.SetVolume(SelectsS[VolumeAudioSlideId].SelectedOption / 100); - AudioPlayback.Play; - LastClick := -100; + if (SDL_ModState = 0) or (SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL) then + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + AudioPlayback.Stop; + AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + PlayStopTime := (GetTimeFromBeat( + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); + AudioPlayback.SetVolume(SelectsS[VolumeAudioSlideId].SelectedOption / 100); + AudioPlayback.Play; + LastClick := -100; + end; + + if (SDL_ModState = KMOD_LSHIFT) or (SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL) then + begin + // Play Midi + PlaySentenceMidi := true; + + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + MidiStop := GetTimeFromBeat( + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + + LastClick := -100; + end; end; SDLK_RETURN: @@ -718,7 +740,7 @@ begin begin if SDL_ModState = KMOD_LCTRL then begin - // moves text to right in current sentence + // deletes current note CopyToUndo; DeleteNote; GoldenRec.KillAll; @@ -878,7 +900,7 @@ begin begin {$IFDEF UseMIDIPort} MidiOut.PutShort($B1, $7, floor(1.27*SelectsS[VolumeMidiSlideId].SelectedOption)); - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; {$ENDIF} @@ -915,7 +937,7 @@ begin AudioPlayback.Stop; PlaySentence := false; {$IFDEF UseMIDIPort} - MidiOut.PutShort($B1, $7, floor(1.27*SelectsS[VolumeMidiSlideId].SelectedOption)); + MidiOut.PutShort(MIDI_NOTEOFF or 1, $7, floor(1.27*SelectsS[VolumeMidiSlideId].SelectedOption)); MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; {$endif} @@ -1445,13 +1467,21 @@ begin Note[N] := Note[N-1]; end; - // me slightly modify new note - Note[CurrentNote].Length := 1; - Inc(Note[CurrentNote+1].Start); - Dec(Note[CurrentNote+1].Length); - Note[CurrentNote+1].Text := '- '; + // Note[Cur] and Note[Cur + 1] is identical at this point + // modify first note + Note[CurrentNote].Length := Note[CurrentNote+1].Length div 2 + Note[CurrentNote+1].Length mod 2; + + // 2nd note + Note[CurrentNote+1].Start := Note[CurrentNote].Start + Note[CurrentNote].Length; + Note[CurrentNote+1].Length := Note[CurrentNote + 1].Length div 2; + + Note[CurrentNote+1].Text := '~'; Note[CurrentNote+1].Color := 1; end; + + // update lyric display + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; end; procedure TScreenEditSub.DeleteNote; @@ -1462,9 +1492,8 @@ begin C := Lines[0].Current; //Do Not delete Last Note - if (Lines[0].High > 0) or (Lines[0].Line[C].HighNote > 0) then + if (Lines[0].Line[C].HighNote > 0) then begin - // we copy all notes from the next to the selected one for N := CurrentNote+1 to Lines[0].Line[C].HighNote do begin @@ -1472,37 +1501,47 @@ begin end; Dec(Lines[0].Line[C].HighNote); - if (Lines[0].Line[C].HighNote >= 0) then - begin - SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); - // me slightly modify new note - if CurrentNote > Lines[0].Line[C].HighNote then - Dec(CurrentNote); - - Lines[0].Line[C].Note[CurrentNote].Color := 2; - end - //Last Note of current Sentence Deleted - > Delete Sentence - else + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); + + // last note was deleted + if (CurrentNote > Lines[0].Line[C].HighNote) then begin - //Move all Sentences after the current to the Left - for N := C+1 to Lines[0].High do - Lines[0].Line[N-1] := Lines[0].Line[N]; - - //Delete Last Sentence - SetLength(Lines[0].Line, Lines[0].High); - Lines[0].High := High(Lines[0].Line); - Lines[0].Number := Length(Lines[0].Line); - - CurrentNote := 0; - if (C > 0) then - Lines[0].Current := C - 1 - else - Lines[0].Current := 0; - - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; + // select new last note + CurrentNote := Lines[0].Line[C].HighNote; + + // correct Line ending + with Lines[0].Line[C] do + End_ := Note[HighNote].Start + Note[HighNote].Length; end; + + Lines[0].Line[C].Note[CurrentNote].Color := 2; + end + // Last Note of current Sentence Deleted - > Delete Sentence + // if there are more than two left + else if (Lines[0].High > 1) then + begin + //Move all Sentences after the current to the Left + for N := C+1 to Lines[0].High do + Lines[0].Line[N-1] := Lines[0].Line[N]; + + //Delete Last Sentence + SetLength(Lines[0].Line, Lines[0].High); + Lines[0].High := High(Lines[0].Line); + Lines[0].Number := Length(Lines[0].Line); + + CurrentNote := 0; + if (C > 0) then + Lines[0].Current := C - 1 + else + Lines[0].Current := 0; + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; end; + + // update lyric display + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; end; procedure TScreenEditSub.TransposeNote(Transpose: integer); @@ -1896,6 +1935,7 @@ end; procedure TScreenEditSub.DrawInfoBar(x, y, w, h: integer); var start, end_: integer; + SongStart, SongEnd: integer; ww: integer; pos: real; @@ -1910,9 +1950,9 @@ begin if(numLines=0) then Exit; - start := Lines[0].Line[0].Start; - end_ := Lines[0].Line[numLines-1].End_; - ww := end_ - start; + SongStart := Lines[0].Line[0].Note[0].Start; + SongEnd := Lines[0].Line[numLines-1].End_; + ww := SongEnd - SongStart; glColor4f(0, 0, 0, 1); glDisable(GL_BLEND); @@ -1945,7 +1985,7 @@ begin end_ := Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Start+ Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Length; - pos := start/ww*w; + pos := (start - SongStart)/ww*w; br := (end_-start)/ww*w; glbegin(gl_quads); @@ -1954,26 +1994,19 @@ begin glVertex2f(x+pos+br, y+h); glVertex2f(x+pos+br, y); glEnd; - { - numNotes := Length(Lines[0].Line[line].Nuta); - - for note := 0 to numNotes - 1 do - begin - - end; } end; if(PlaySentence or PlaySentenceMidi) then begin glColor4f(0, 0, 0, 0.5); pos := 0; - br := AktBeat/ww*w; + br := (AktBeat - SongStart)/ww*w; if (br>w) then br := w; end else begin glColor4f(1, 0, 0, 1); - pos := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start/ww*w; + pos := (Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start - SongStart)/ww*w; br := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length/ww*w; if (br<1) then br := 1; @@ -2316,7 +2349,7 @@ begin end; -// Interaction := 0; + //Interaction := 0; TextEditMode := false; TitleEditMode := false; ArtistEditMode := false; @@ -2344,7 +2377,7 @@ begin if (MidiPos > MidiStop) then begin MidiOut.PutShort($B1, $7, floor(1.27*SelectsS[VolumeMidiSlideId].SelectedOption)); - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; end; {$ENDIF} @@ -2363,7 +2396,7 @@ begin {$IFDEF UseMIDIPort} MidiOut.PutShort($B1, $7, floor(1.27*SelectsS[VolumeMidiSlideId].SelectedOption)); if i > 0 then - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[i-1].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, Lines[0].Line[Lines[0].Current].Note[i-1].Tone + 60, 127); MidiOut.PutShort($91, Lines[0].Line[Lines[0].Current].Note[i].Tone + 60, 127); MidiLastNote := i; {$ENDIF} @@ -2421,7 +2454,7 @@ begin // click if (Click) and (PlaySentence) then begin -// AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + //AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then diff --git a/us_maker_edition/src/screens/UScreenOptionsRecord.pas b/us_maker_edition/src/screens/UScreenOptionsRecord.pas index 0f9cd49a..dc4a355f 100644 --- a/us_maker_edition/src/screens/UScreenOptionsRecord.pas +++ b/us_maker_edition/src/screens/UScreenOptionsRecord.pas @@ -88,6 +88,7 @@ type procedure StartPreview; procedure StopPreview; procedure UpdateInputDevice; + function ValidateSettings: boolean; procedure ChangeVolume(VolumeChange: single); procedure DrawVolume(x, y, Width, Height: single); procedure DrawVUMeter(const State: TDrawState; x, y, Width, Height: single); @@ -120,6 +121,7 @@ uses TextGL, UGraphic, UDraw, + ULanguage, UMain, UMenuSelectSlide, UMenuText, @@ -168,7 +170,7 @@ begin SDLK_BACKSPACE: begin // TODO: Show Save/Abort screen - if (AudioInputProcessor.ValidateSettings()) then + if (ValidateSettings()) then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); @@ -179,7 +181,7 @@ begin begin if (SelInteraction = ExitButtonIID) then begin - if (AudioInputProcessor.ValidateSettings()) then + if (ValidateSettings()) then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); @@ -213,6 +215,24 @@ begin end; end; +function TScreenOptionsRecord.ValidateSettings: boolean; +var + BadPlayer: integer; +begin + BadPlayer := AudioInputProcessor.ValidateSettings(); + if (BadPlayer <> 0) then + begin + ScreenPopupError.ShowPopup( + Format(Language.Translate('ERROR_PLAYER_DEVICE_ASSIGNMENT'), + [BadPlayer])); + Result := false; + end + else + begin + Result := true; + end; +end; + constructor TScreenOptionsRecord.Create; var DeviceIndex: integer; @@ -321,12 +341,6 @@ begin end; // add Exit-button - //ButtonTheme := Theme.OptionsRecord.ButtonExit; - // adjust button position - //if (WidgetYPos <> 0) then - // ButtonTheme.Y := WidgetYPos; - //AddButton(ButtonTheme); - // <mog> I uncommented the stuff above, because it's not skinable :X AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text) = 0) then AddButtonText(20, 5, Theme.Options.Description[7]); @@ -783,7 +797,7 @@ begin for ChannelIndex := 0 to High(Device.CaptureChannel) do begin // load player color mapped to current input channel - if (DeviceCfg.ChannelToPlayerMap[ChannelIndex] > 0) then + if (DeviceCfg.ChannelToPlayerMap[ChannelIndex] <> CHANNEL_OFF) then begin // set mapped channel to corresponding player-color LoadColor(State.R, State.G, State.B, 'P'+ IntToStr(DeviceCfg.ChannelToPlayerMap[ChannelIndex]) + 'Dark'); diff --git a/us_maker_edition/src/screens/UScreenOptionsThemes.pas b/us_maker_edition/src/screens/UScreenOptionsThemes.pas index 94475cc7..29d8a9dc 100644 --- a/us_maker_edition/src/screens/UScreenOptionsThemes.pas +++ b/us_maker_edition/src/screens/UScreenOptionsThemes.pas @@ -92,6 +92,10 @@ begin UGraphic.LoadScreens(); AudioPlayback.PlaySound(SoundLib.Back); + + // select theme button in new created options screen + ScreenOptions.Interaction := 4; + FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -106,6 +110,10 @@ begin UGraphic.LoadScreens(); AudioPlayback.PlaySound(SoundLib.Back); + + // select theme button in new created options screen + ScreenOptions.Interaction := 4; + FadeTo(@ScreenOptions); end; end; diff --git a/us_maker_edition/src/screens/UScreenSing.pas b/us_maker_edition/src/screens/UScreenSing.pas index 233f1e38..3e0d8078 100644 --- a/us_maker_edition/src/screens/UScreenSing.pas +++ b/us_maker_edition/src/screens/UScreenSing.pas @@ -62,6 +62,12 @@ type function GetClock(): real; override; end; + TTimebarMode = ( + tbmCurrent, // current song position + tbmRemaining, // remaining time + tbmTotal // total time + ); + type TScreenSing = class(TMenu) private @@ -70,6 +76,7 @@ type fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; fMusicSync: TMusicSyncSource; + fTimebarMode: TTimebarMode; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -178,7 +185,9 @@ begin Result := false; Exit; end; - Ord('V'): // show visualization + + // show visualization + Ord('V'): begin fShowVisualization := not fShowVisualization; @@ -193,11 +202,23 @@ begin end; Exit; end; + + // pause Ord('P'): begin Pause; Exit; end; + + // toggle time display + Ord('T'): + begin + if (fTimebarMode = High(TTimebarMode)) then + fTimebarMode := Low(TTimebarMode) + else + Inc(fTimebarMode); + Exit; + end; end; // check special keys @@ -349,6 +370,7 @@ var Color: TRGB; VideoFile, BgFile: IPath; success: boolean; + BadPlayer: integer; begin inherited; @@ -450,6 +472,8 @@ begin Statics[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; + fTimebarMode := tbmCurrent; + // FIXME: sets path and filename to '' ResetSingTemp; @@ -498,7 +522,7 @@ begin *} fShowVisualization := false; VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.IsFile then + if (Ini.VideoEnabled = 1) and CurrentSong.Video.IsSet() and VideoFile.IsFile then begin fVideoClip := VideoPlayback.Open(VideoFile); fCurrentVideo := fVideoClip; @@ -562,6 +586,14 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); + BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay); + if (BadPlayer <> 0) then + begin + ScreenPopupError.ShowPopup( + Format(Language.Translate('ERROR_PLAYER_NO_DEVICE_ASSIGNMENT'), + [BadPlayer])); + end; + // prepare and start voice-capture AudioInput.CaptureStart; @@ -725,8 +757,10 @@ end; function TScreenSing.Draw: boolean; var - Min: integer; - Sec: integer; + DisplayTime: real; + DisplayPrefix: string; + DisplayMin: integer; + DisplaySec: integer; T: integer; CurLyricsTime: real; VideoFrameTime: Extended; @@ -769,53 +803,31 @@ begin end; // case end; // if - //// - // dual screen, part 1 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff. Commenting this stuff out, nothing - // was missing on screen w/ 6 players - so do we even need this stuff? - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } - - {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } - - {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // end of weird stuff - { - Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; } - - { for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; } - // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match CurLyricsTime := LyricsState.GetCurrentTime(); - Min := Round(CurLyricsTime) div 60; - Sec := Round(CurLyricsTime) mod 60; + + // retrieve time for timebar text + case (fTimebarMode) of + tbmRemaining: begin + DisplayTime := LyricsState.TotalTime - CurLyricsTime; + DisplayPrefix := '-'; + end; + tbmTotal: begin + DisplayTime := LyricsState.TotalTime; + DisplayPrefix := '#'; + end; + else begin + DisplayTime := CurLyricsTime; + DisplayPrefix := ''; + end; + end; + DisplayMin := Round(DisplayTime) div 60; + DisplaySec := Round(DisplayTime) mod 60; // update static menu with time ... - Text[TextTimeText].Text := ''; - if Min < 10 then - Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then - Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - - // draw static menu (BG) - // Note: there is no menu and the animated background brakes the video playback - //DrawBG; + Text[TextTimeText].Text := Format('%s%.2d:%.2d', + [DisplayPrefix, DisplayMin, DisplaySec]); //the song was sung to the end? Line := Lyrics.GetUpperLine(); @@ -847,7 +859,8 @@ begin fCurrentVideo.GetFrame(VideoFrameTime); end; - fCurrentVideo.DrawGL(ScreenAct); + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Draw; end; // draw static menu (FG) @@ -857,8 +870,10 @@ begin //Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish)); if ShowFinish then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or - (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then + if (not AudioPlayback.Finished) and + ((CurrentSong.Finish = 0) or + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and + (not Settings.Finish) then begin // analyze song if not paused if (not Paused) then @@ -886,27 +901,6 @@ begin // draw scores Scores.Draw; - //// - // dual screen, part 2 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff - - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; - - Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; - - // end of weird - - Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; } - // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects // maybe someone could find a better solution diff --git a/us_maker_edition/src/screens/UScreenSong.pas b/us_maker_edition/src/screens/UScreenSong.pas index 6b83d522..6fe8d204 100644 --- a/us_maker_edition/src/screens/UScreenSong.pas +++ b/us_maker_edition/src/screens/UScreenSong.pas @@ -62,8 +62,12 @@ type isScrolling: boolean; // true if song flow is about to move + fCurrentVideo: IVideo; + procedure StartMusicPreview(); procedure StopMusicPreview(); + procedure StartVideoPreview(); + procedure StopVideoPreview(); public TextArtist: integer; TextTitle: integer; @@ -128,6 +132,7 @@ type function Draw: boolean; override; procedure GenerateThumbnails(); procedure OnShow; override; + procedure OnShowFinish; override; procedure OnHide; override; procedure SelectNext; procedure SelectPrev; @@ -886,6 +891,8 @@ begin PreviewOpened := -1; isScrolling := false; + + fCurrentVideo := nil; end; procedure TScreenSong.GenerateThumbnails(); @@ -960,6 +967,7 @@ begin if (Ini.PreviewVolume <> 0) then begin StartMusicPreview; + StartVideoPreview; end; // fade in detailed cover @@ -973,6 +981,7 @@ begin UnLoadDetailedCover; StopMusicPreview(); + StopVideoPreview(); PreviewOpened := -1; end; @@ -1506,6 +1515,9 @@ begin AudioPlayback.Stop; PreviewOpened := -1; + // reset video playback engine + fCurrentVideo := nil; + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; @@ -1544,11 +1556,17 @@ begin end; end; - isScrolling := true; + isScrolling := false; SetJoker; SetStatics; end; +procedure TScreenSong.OnShowFinish; +begin + isScrolling := true; + CoverTime := 10; +end; + procedure TScreenSong.OnHide; begin // turn music volume to 100% @@ -1556,6 +1574,7 @@ begin // stop preview StopMusicPreview(); + StopVideoPreview(); end; procedure TScreenSong.DrawExtensions; @@ -1573,9 +1592,10 @@ end; function TScreenSong.Draw: boolean; var - dx: real; - dt: real; - I: integer; + dx: real; + dt: real; + I: integer; + VideoAlpha: real; begin if isScrolling then begin @@ -1611,7 +1631,7 @@ begin //Log.LogBenchmark('SetScroll4', 5); //Fading Functions, Only if Covertime is under 5 Seconds - if (CoverTime < 5) then + if (CoverTime < 9) then begin // cover fade if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then @@ -1641,10 +1661,43 @@ begin //Draw BG DrawBG; + VideoAlpha := Button[interaction].Texture.Alpha*(CoverTime-1); //Instead of Draw FG Procedure: //We draw Buttons for our own for I := 0 to Length(Button) - 1 do - Button[I].Draw; + begin + if (I<>Interaction) or not Assigned(fCurrentVideo) or (VideoAlpha<1) or AudioPlayback.Finished then + Button[I].Draw; + end; + + if AudioPlayback.Finished then + StopVideoPreview; + + if Assigned(fCurrentVideo) then + begin + // Just call this once + // when Screens = 2 + if (ScreenAct = 1) then + fCurrentVideo.GetFrame(CatSongs.Song[Interaction].VideoGAP + AudioPlayback.Position); + + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Alpha := VideoAlpha; + + //set up window + with Button[interaction] do + begin + fCurrentVideo.SetScreenPosition(X, Y, Z); + fCurrentVideo.Width := W; + fCurrentVideo.Height := H; + fCurrentVideo.ReflectionSpacing := Reflectionspacing; + end; + fCurrentVideo.AspectCorrection := acoCrop; + + fCurrentVideo.Draw; + + if Button[interaction].Reflection then + fCurrentVideo.DrawReflection; + end; // Statics for I := 0 to Length(Statics) - 1 do @@ -1738,12 +1791,13 @@ end; procedure TScreenSong.StartMusicPreview(); var Song: TSong; + PreviewPos: real; begin AudioPlayback.Close(); if CatSongs.VisibleSongs = 0 then Exit; - + Song := CatSongs.Song[Interaction]; if not assigned(Song) then Exit; @@ -1755,8 +1809,13 @@ begin if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then begin PreviewOpened := Interaction; - - AudioPlayback.Position := AudioPlayback.Length / 4; + + PreviewPos := AudioPlayback.Length / 4; + // fix for invalid music file lengths + if (PreviewPos > 60.0) then + PreviewPos := 60.0; + AudioPlayback.Position := PreviewPos; + // set preview volume if (Ini.PreviewFading = 0) then begin @@ -1779,12 +1838,66 @@ begin AudioPlayback.Stop; end; +procedure TScreenSong.StartVideoPreview(); +var + VideoFile: IPath; + Song: TSong; + +begin + if (Ini.VideoPreview=0) then + Exit; + + if Assigned(fCurrentVideo) then + begin + fCurrentVideo.Stop(); + fCurrentVideo := nil; + end; + + //if no audio open => exit + if (PreviewOpened = -1) then + Exit; + + if CatSongs.VisibleSongs = 0 then + Exit; + + Song := CatSongs.Song[Interaction]; + if not assigned(Song) then + Exit; + + //fix: if main cat than there is nothing to play + if Song.main then + Exit; + + VideoFile := Song.Path.Append(Song.Video); + if (Song.Video.IsSet) and VideoFile.IsFile then + begin + fCurrentVideo := VideoPlayback.Open(VideoFile); + if (fCurrentVideo <> nil) then + begin + fCurrentVideo.Position := Song.VideoGAP + AudioPlayback.Position; + fCurrentVideo.Play; + end; + end; +end; + +procedure TScreenSong.StopVideoPreview(); +begin + // Stop video preview of previous song + if Assigned(fCurrentVideo) then + begin + fCurrentVideo.Stop(); + fCurrentVideo := nil; + end; +end; + // Changes previewed song procedure TScreenSong.ChangeMusic; begin StopMusicPreview(); + StopVideoPreview(); PreviewOpened := -1; StartMusicPreview(); + StartVideoPreview(); end; procedure TScreenSong.SkipTo(Target: cardinal); |