aboutsummaryrefslogtreecommitdiffstats
path: root/src/screens
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-10 18:27:53 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-10 18:27:53 +0000
commitf261cd24db299daee8a0d8e470ff7d173f1a1c75 (patch)
treeec004d8d028dbef3f4f424513ee9b3334fae04b5 /src/screens
parentf385e4be2dddc918ef87bc1be9e32784b78dc3bd (diff)
downloadusdx-f261cd24db299daee8a0d8e470ff7d173f1a1c75.tar.gz
usdx-f261cd24db299daee8a0d8e470ff7d173f1a1c75.tar.xz
usdx-f261cd24db299daee8a0d8e470ff7d173f1a1c75.zip
merge of VideoPreview branch into trunk
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2475 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/UScreenSing.pas5
-rw-r--r--src/screens/UScreenSong.pas123
2 files changed, 118 insertions, 10 deletions
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index fe8ea8e8..3e0d8078 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -522,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;
@@ -859,7 +859,8 @@ begin
fCurrentVideo.GetFrame(VideoFrameTime);
end;
- fCurrentVideo.DrawGL(ScreenAct);
+ fCurrentVideo.SetScreen(ScreenAct);
+ fCurrentVideo.Draw;
end;
// draw static menu (FG)
diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas
index 6b83d522..764a0d47 100644
--- a/src/screens/UScreenSong.pas
+++ b/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
@@ -1743,7 +1796,7 @@ begin
if CatSongs.VisibleSongs = 0 then
Exit;
-
+
Song := CatSongs.Song[Interaction];
if not assigned(Song) then
Exit;
@@ -1755,7 +1808,7 @@ begin
if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then
begin
PreviewOpened := Interaction;
-
+
AudioPlayback.Position := AudioPlayback.Length / 4;
// set preview volume
if (Ini.PreviewFading = 0) then
@@ -1779,12 +1832,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);