aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base/USong.pas1
-rw-r--r--src/media/UVisualizer.pas28
-rw-r--r--src/screens/UScreenSing.pas92
3 files changed, 66 insertions, 55 deletions
diff --git a/src/base/USong.pas b/src/base/USong.pas
index e5a7cf57..8229b9d9 100644
--- a/src/base/USong.pas
+++ b/src/base/USong.pas
@@ -80,7 +80,6 @@ type
Background: WideString;
Video: WideString;
VideoGAP: real;
- VideoLoaded: boolean; // true if the video has been loaded
NotesGAP: integer;
Start: real; // in seconds
Finish: integer; // in miliseconds
diff --git a/src/media/UVisualizer.pas b/src/media/UVisualizer.pas
index e2125201..879d6c42 100644
--- a/src/media/UVisualizer.pas
+++ b/src/media/UVisualizer.pas
@@ -78,15 +78,15 @@ type
PCMData: TPCMData;
RndPCMcount: integer;
- projMatrix: array[0..3, 0..3] of GLdouble;
- texMatrix: array[0..3, 0..3] of GLdouble;
+ ProjMatrix: array[0..3, 0..3] of GLdouble;
+ TexMatrix: array[0..3, 0..3] of GLdouble;
procedure VisualizerStart;
procedure VisualizerStop;
procedure VisualizerTogglePause;
- function GetRandomPCMData(var data: TPCMData): Cardinal;
+ function GetRandomPCMData(var Data: TPCMData): Cardinal;
procedure SaveOpenGLState();
procedure RestoreOpenGLState();
@@ -210,7 +210,7 @@ begin
// save projection-matrix
glMatrixMode(GL_PROJECTION);
- glGetDoublev(GL_PROJECTION_MATRIX, @projMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, @ProjMatrix);
{$IF PROJECTM_VERSION = 1000000} // 1.0, 1.01
// bugfix: projection-matrix is popped without being pushed first
glPushMatrix();
@@ -218,7 +218,7 @@ begin
// save texture-matrix
glMatrixMode(GL_TEXTURE);
- glGetDoublev(GL_TEXTURE_MATRIX, @texMatrix);
+ glGetDoublev(GL_TEXTURE_MATRIX, @TexMatrix);
// save modelview-matrix
glMatrixMode(GL_MODELVIEW);
@@ -243,11 +243,11 @@ begin
// restore projection-matrix
glMatrixMode(GL_PROJECTION);
- glLoadMatrixd(@projMatrix);
+ glLoadMatrixd(@ProjMatrix);
// restore texture-matrix
glMatrixMode(GL_TEXTURE);
- glLoadMatrixd(@texMatrix);
+ glLoadMatrixd(@TexMatrix);
// restore modelview-matrix
glMatrixMode(GL_MODELVIEW);
@@ -293,7 +293,8 @@ begin
// We use the latter so we do not need to load the FBO extension in USDX.
pm.RenderFrame();
- VisualizerStarted := True;
+ VisualizerPaused := false;
+ VisualizerStarted := true;
finally
RestoreOpenGLState();
end;
@@ -303,7 +304,8 @@ procedure TVideoPlayback_ProjectM.VisualizerStop;
begin
if VisualizerStarted then
begin
- VisualizerStarted := False;
+ VisualizerPaused := false;
+ VisualizerStarted := false;
FreeAndNil(pm);
end;
end;
@@ -414,21 +416,21 @@ end;
* Produces random "sound"-data in case no audio-data is available.
* Otherwise the visualization will look rather boring.
*}
-function TVideoPlayback_ProjectM.GetRandomPCMData(var data: TPCMData): Cardinal;
+function TVideoPlayback_ProjectM.GetRandomPCMData(var Data: TPCMData): Cardinal;
var
i: integer;
begin
// Produce some fake PCM data
if (RndPCMcount mod 500 = 0) then
begin
- FillChar(data, SizeOf(TPCMData), 0);
+ FillChar(Data, SizeOf(TPCMData), 0);
end
else
begin
for i := 0 to 511 do
begin
- data[i][0] := Random(High(Word)+1);
- data[i][1] := Random(High(Word)+1);
+ Data[i][0] := Random(High(Word)+1);
+ Data[i][1] := Random(High(Word)+1);
end;
end;
Inc(RndPCMcount);
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;