aboutsummaryrefslogtreecommitdiffstats
path: root/src/screens
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-13 13:02:27 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-09-13 13:02:27 +0000
commita40eb015f8dc43ee087bb8374e67c6a75eb9fbc6 (patch)
tree06dd0d674128b84805cf0b72cab3263431b61456 /src/screens
parentb0dcfe05f53197bd9f159e46d6cbc2cd3ebff5ca (diff)
downloadusdx-a40eb015f8dc43ee087bb8374e67c6a75eb9fbc6.tar.gz
usdx-a40eb015f8dc43ee087bb8374e67c6a75eb9fbc6.tar.xz
usdx-a40eb015f8dc43ee087bb8374e67c6a75eb9fbc6.zip
- stop both Video and Visualizer (because of the video-toggle with 'v'-key both could have been active) (See SF-tracker Patch 2078902)
- VideoLoaded does not belong to the song state anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1381 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/UScreenSing.pas92
1 files changed, 51 insertions, 41 deletions
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index e20a142d..b8c7612f 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -33,13 +33,13 @@ type
type
TScreenSing = class(TMenu)
+ private
+ VideoLoaded: boolean;
protected
Paused: boolean; //Pause Mod
LyricsSync: TLyricsSyncSource;
NumEmptySentences: integer;
public
- //TextTime: integer;
-
// TimeBar fields
StaticTimeProgress: integer;
TextTimeText: integer;
@@ -424,21 +424,23 @@ begin
// reset video playback engine, to play video clip...
fCurrentVideoPlaybackEngine.Close;
fCurrentVideoPlaybackEngine := VideoPlayback;
-{**
- * == Background ==
- * We have four types of backgrounds:
- * + Blank : Nothing has been set, this is our fallback
- * + Picture : Picture has been set, and exists - otherwise we fallback
- * + Video : Video has been set, and exists - otherwise we fallback
- * + Visualization: + Off : No Visialization
- * + WhenNoVideo: Overwrites Blank and Picture
- * + On : Overwrites Blank, Picture and Video
- *}
-{**
- * set background to: video
- *}
- CurrentSong.VideoLoaded := False;
- fShowVisualization := False;
+
+ {*
+ * == Background ==
+ * We have four types of backgrounds:
+ * + Blank : Nothing has been set, this is our fallback
+ * + Picture : Picture has been set, and exists - otherwise we fallback
+ * + Video : Video has been set, and exists - otherwise we fallback
+ * + Visualization: + Off : No Visialization
+ * + WhenNoVideo: Overwrites Blank and Picture
+ * + On : Overwrites Blank, Picture and Video
+ *}
+
+ {*
+ * set background to: video
+ *}
+ VideoLoaded := False;
+ fShowVisualization := False;
if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then
begin
if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then
@@ -446,15 +448,15 @@ begin
fShowVisualization := False;
fCurrentVideoPlaybackEngine := VideoPlayback;
fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start;
- CurrentSong.VideoLoaded := True;
- fCurrentVideoPlaybackEngine.play;
+ fCurrentVideoPlaybackEngine.Play;
+ VideoLoaded := True;
end;
end;
-{**
- * set background to: picture
- *}
- if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False)
+ {*
+ * set background to: picture
+ *}
+ if (CurrentSong.Background <> '') and (VideoLoaded = False)
and (TVisualizerOption(Ini.VisualizerOption) = voOff) then
try
Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background);
@@ -464,26 +466,31 @@ begin
Tex_Background.TexNum := 0;
end
else
+ begin
Tex_Background.TexNum := 0;
-{**
- * set background to: visualization (Overwrites all)
- *}
+ end;
+
+ {*
+ * set background to: visualization (Overwrites all)
+ *}
if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then
begin
fShowVisualization := True;
fCurrentVideoPlaybackEngine := Visualization;
- fCurrentVideoPlaybackEngine.play;
+ if (fCurrentVideoPlaybackEngine <> nil) then
+ fCurrentVideoPlaybackEngine.Play;
end;
-{**
- * set background to: visualization (Videos are still shown)
- *}
+ {*
+ * set background to: visualization (Videos are still shown)
+ *}
if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and
- (CurrentSong.VideoLoaded = False)) then
+ (VideoLoaded = False)) then
begin
fShowVisualization := True;
fCurrentVideoPlaybackEngine := Visualization;
- fCurrentVideoPlaybackEngine.play;
+ if (fCurrentVideoPlaybackEngine <> nil) then
+ fCurrentVideoPlaybackEngine.Play;
end;
// prepare lyrics timer
@@ -579,8 +586,8 @@ begin
end; // case
// Initialize lyrics by filling its queue
- while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <=
- High(Lines[0].Line)) do
+ while (not Lyrics.IsQueueFull) and
+ (Lyrics.LineCounter <= High(Lines[0].Line)) do
begin
Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]);
end;
@@ -718,7 +725,7 @@ begin
SingDrawBackground;
// update and draw movie
- if (ShowFinish and (CurrentSong.VideoLoaded or fShowVisualization)) then
+ if (ShowFinish and (VideoLoaded or fShowVisualization)) then
begin
if assigned(fCurrentVideoPlaybackEngine) then
begin
@@ -801,6 +808,15 @@ 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;
+
if (Ini.SavePlayback = 1) then
begin
Log.BenchmarkStart(0);
@@ -811,12 +827,6 @@ begin
Log.LogBenchmark('Creating files', 0);
end;
- if CurrentSong.VideoLoaded then
- begin
- fCurrentVideoPlaybackEngine.Close;
- CurrentSong.VideoLoaded := False; // to prevent drawing closed video
- end;
-
SetFontItalic(False);
end;