diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-21 18:27:36 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-21 18:27:36 +0000 |
commit | 868ce765441473e7d1fec9b3ad22a707f121a637 (patch) | |
tree | 8f67a0e6ff2c306603ef37ec0bc8cc0e042eb5d2 /src/screens | |
parent | 62c665cb863914c2d5e07bf4b8bd07c1c45be7ac (diff) | |
download | usdx-868ce765441473e7d1fec9b3ad22a707f121a637.tar.gz usdx-868ce765441473e7d1fec9b3ad22a707f121a637.tar.xz usdx-868ce765441473e7d1fec9b3ad22a707f121a637.zip |
- add video loop option
- allow multiple instances of a video
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2260 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/UScreenSing.pas | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 74c09b4f..5f39ec49 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -105,7 +105,8 @@ type SungToEnd: boolean; fShowVisualization: boolean; - fCurrentVideoPlaybackEngine: IVideoPlayback; + fCurrentVideo: IVideo; + fVideoClip: IVideo; // some settings to be set by plugins settings: record @@ -179,13 +180,14 @@ begin fShowVisualization := not fShowVisualization; if fShowVisualization then - fCurrentVideoPlaybackEngine := Visualization + begin + fCurrentVideo := Visualization.Open(PATH_NONE); + fCurrentVideo.play; + end else - fCurrentVideoPlaybackEngine := VideoPlayback; - - if fShowVisualization then - fCurrentVideoPlaybackEngine.play; - + begin + fCurrentVideo := fVideoClip; + end; Exit; end; Ord('P'): @@ -216,7 +218,7 @@ begin SDLK_TAB: // change visualization preset begin if fShowVisualization then - fCurrentVideoPlaybackEngine.Position := now; // move to a random position + fCurrentVideo.Position := now; // move to a random position end; SDLK_RETURN: @@ -254,7 +256,7 @@ begin // pause video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; end else // disable pause @@ -267,7 +269,7 @@ begin // video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; Paused := false; end; @@ -283,7 +285,7 @@ begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; + fCurrentVideo := nil; // create score class Scores := TSingScores.Create; @@ -358,8 +360,8 @@ begin ClearSettings; Party.CallBeforeSing; - // reset video playback engine, to play Video Clip... - fCurrentVideoPlaybackEngine := VideoPlayback; + // reset video playback engine + fCurrentVideo := nil; // setup score manager Scores.ClearPlayers; // clear old player values @@ -480,10 +482,6 @@ begin Exit; end; - // reset video playback engine, to play video clip ... - fCurrentVideoPlaybackEngine.Close; - fCurrentVideoPlaybackEngine := VideoPlayback; - {* * == Background == * We have four types of backgrounds: @@ -503,12 +501,13 @@ begin VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.IsFile then begin - if (fCurrentVideoPlaybackEngine.Open(VideoFile)) then + fVideoClip := VideoPlayback.Open(VideoFile); + fCurrentVideo := fVideoClip; + if (fVideoClip <> nil) then begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; - fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo.Position := CurrentSong.VideoGAP + CurrentSong.Start; + fCurrentVideo.Play; VideoLoaded := true; end; end; @@ -538,9 +537,9 @@ begin if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; {* @@ -550,9 +549,9 @@ begin (VideoLoaded = false)) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; // prepare lyrics timer @@ -815,14 +814,14 @@ begin // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin - if assigned(fCurrentVideoPlaybackEngine) then + if assigned(fCurrentVideo) then begin // Just call this once // when Screens = 2 if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + fCurrentVideo.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + fCurrentVideo.DrawGL(ScreenAct); end; end; @@ -902,15 +901,13 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); - if (VideoPlayback <> nil) then - VideoPlayback.Close; - - if (Visualization <> nil) then - Visualization.Close; - // to prevent drawing closed video VideoLoaded := false; + // close video files + fVideoClip := nil; + fCurrentVideo := nil; + // kill all stars and effects GoldenRec.KillAll; |