aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UMedia_dummy.pas2
-rw-r--r--Game/Code/Classes/UMusic.pas24
-rw-r--r--Game/Code/Classes/UVisualizer.pas2
-rw-r--r--Game/Code/Screens/UScreenSing.pas51
-rw-r--r--Game/Code/UltraStar.dpr6
5 files changed, 61 insertions, 24 deletions
diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas
index c5fb799c..4fc39d4e 100644
--- a/Game/Code/Classes/UMedia_dummy.pas
+++ b/Game/Code/Classes/UMedia_dummy.pas
@@ -29,7 +29,7 @@ var
singleton_dummy : IVideoPlayback;
type
- Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IAudioPlayback, IAudioInput )
+ Tmedia_dummy = class( TInterfacedObject, IVideoPlayback, IVideoVisualization, IAudioPlayback, IAudioInput )
private
public
constructor create();
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index 4acbb55a..2cdcc707 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -131,6 +131,10 @@ type
end;
+ IVideoVisualization = Interface( IVideoPlayback )
+ ['{5AC17D60-B34D-478D-B632-EB00D4078017}']
+ end;
+
IAudioPlayback = Interface( IGenericPlayback )
['{E4AE0B40-3C21-4DC5-847C-20A87E0DFB96}']
procedure InitializePlayback;
@@ -195,7 +199,8 @@ var // TODO : JB --- THESE SHOULD NOT BE GLOBAL
procedure InitializeSound;
-
+
+function Visualization(): IVideoPlayback;
function VideoPlayback(): IVideoPlayback;
function AudioPlayback(): IAudioPlayback;
function AudioInput(): IAudioInput;
@@ -210,9 +215,11 @@ uses
// uLog;
var
- singleton_VideoPlayback : IVideoPlayback = nil;
+ singleton_VideoPlayback : IVideoPlayback = nil;
+ singleton_Visualization : IVideoPlayback = nil;
singleton_AudioPlayback : IAudioPlayback = nil;
singleton_AudioInput : IAudioInput = nil;
+
singleton_AudioManager : TInterfaceList = nil;
@@ -230,6 +237,11 @@ begin
result := singleton_VideoPlayback;
end;
+function Visualization(): IVideoPlayback;
+begin
+ result := singleton_Visualization;
+end;
+
function AudioPlayback(): IAudioPlayback;
begin
result := singleton_AudioPlayback;
@@ -250,6 +262,7 @@ begin
singleton_AudioPlayback := nil;
singleton_AudioInput := nil;
singleton_VideoPlayback := nil;
+ singleton_Visualization := nil;
writeln( 'InitializeSound , Enumerate Registered Audio Interfaces' );
for iCount := 0 to AudioManager.Count - 1 do
@@ -276,12 +289,19 @@ begin
// if this interface is a Input, then set it as the default used
if ( AudioManager[iCount].QueryInterface( IVideoPlayback, lTmpInterface ) = 0 ) AND
+ //( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) <> 0 ) AND
( true ) then
// ( not assigned( singleton_VideoPlayback ) ) then
begin
singleton_VideoPlayback := IVideoPlayback( lTmpInterface );
end;
+ if ( AudioManager[iCount].QueryInterface( IVideoVisualization, lTmpInterface ) = 0 ) AND
+ ( true ) then
+ begin
+ singleton_Visualization := IVideoPlayback( lTmpInterface );
+ end;
+
end;
end;
diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas
index 08e4b594..b6b3a1cc 100644
--- a/Game/Code/Classes/UVisualizer.pas
+++ b/Game/Code/Classes/UVisualizer.pas
@@ -45,7 +45,7 @@ const
projectM_Dir = visuals_Dir+'/projectM';
type
- TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback )
+ TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization )
pm : PProjectM;
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index e62b9339..75246d09 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -97,6 +97,9 @@ type
//Score Manager:
Scores: TSingScores;
+ fShowVisualization : boolean;
+ fCurrentVideoPlaybackEngine : IVideoPlayback;
+
constructor Create; override;
procedure onShow; override;
procedure onShowFinish; override;
@@ -153,15 +156,22 @@ begin
SDLK_V: //Show Visualization
begin
- AktSong.VideoLoaded := not AktSong.VideoLoaded;
- VideoPlayback.play;
+ fShowVisualization := not fShowVisualization;
+
+ if fShowVisualization then
+ fCurrentVideoPlaybackEngine := Visualization
+ else
+ fCurrentVideoPlaybackEngine := VideoPlayback;
+
+ if fShowVisualization then
+ fCurrentVideoPlaybackEngine.play;
end;
SDLK_TAB: //Change Visualization Preset
begin
- if AktSong.VideoLoaded then
- VideoPlayback.MoveTo( now ); // move to a random position
+ if fShowVisualization then
+ fCurrentVideoPlaybackEngine.MoveTo( now ); // move to a random position
end;
SDLK_RETURN:
@@ -195,7 +205,7 @@ begin
// pause Video
if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
- VideoPlayback.Pause;
+ fCurrentVideoPlaybackEngine.Pause;
end
else //Pause ausschalten
@@ -209,7 +219,7 @@ begin
// Video
if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
- VideoPlayback.Pause;
+ fCurrentVideoPlaybackEngine.Pause;
Paused := false;
end;
@@ -223,6 +233,10 @@ var
begin
inherited Create;
+ fShowVisualization := false;
+ fCurrentVideoPlaybackEngine := VideoPlayback;
+
+
//Create Score Class
Scores := TSingScores.Create;
Scores.LoadfromTheme;
@@ -288,7 +302,7 @@ begin
Lyrics := TLyricEngine.Create(80,Skin_LyricsT,640,12,80,Skin_LyricsT+36,640,12);
- VideoPlayback.Init();
+ fCurrentVideoPlaybackEngine.Init();
end;
procedure TScreenSing.onShow;
@@ -307,6 +321,9 @@ begin
Log.LogStatus('Begin', 'onShow');
FadeOut := false; // 0.5.0: early 0.5.0 problems were by this line commented
+ // reset video playback engine, to play Video Clip...
+ fCurrentVideoPlaybackEngine := VideoPlayback;
+
//SetUp Score Manager
Scores.ClearPlayers; //Clear Old Player Values
Color.R := 0; Color.G := 0; Color.B := 0; //Dummy atm
@@ -439,9 +456,9 @@ begin
if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then
begin
// todo: VideoGap and Start time verwursten
- VideoPlayback.Open( AktSong.Path + AktSong.Video );
+ fCurrentVideoPlaybackEngine.Open( AktSong.Path + AktSong.Video );
- VideoPlayback.position := AktSong.VideoGAP + AktSong.Start;
+ fCurrentVideoPlaybackEngine.position := AktSong.VideoGAP + AktSong.Start;
AktSong.VideoLoaded := true;
end;
@@ -857,10 +874,10 @@ begin
begin
try
writeln( 'VideoPlayback.FFmpegGetFrame' );
- VideoPlayback.GetFrame(Czas.Teraz);
+ fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz);
writeln( 'VideoPlayback.FFmpegDrawGL' );
- VideoPlayback.DrawGL(ScreenAct);
+ fCurrentVideoPlaybackEngine.DrawGL(ScreenAct);
// PlaySmpeg;
except
@@ -874,7 +891,7 @@ begin
Log.LogError('Corrupted File: ' + AktSong.Video);
try
// CloseSmpeg;
- VideoPlayback.Close;
+ fCurrentVideoPlaybackEngine.Close;
except
end;
@@ -1124,7 +1141,7 @@ begin
SingDrawBackground;
// update and draw movie
- if ShowFinish and AktSong.VideoLoaded then
+ if ShowFinish and ( AktSong.VideoLoaded or fShowVisualization ) then
// if ShowFinish then
begin
try
@@ -1132,8 +1149,8 @@ begin
// todo: find a way to determine, when a new frame is needed
// toto: same for the need to skip frames
- VideoPlayback.GetFrame(Czas.Teraz);
- VideoPlayback.DrawGL(ScreenAct);
+ fCurrentVideoPlaybackEngine.GetFrame(Czas.Teraz);
+ fCurrentVideoPlaybackEngine.DrawGL(ScreenAct);
except
on E : Exception do
begin
@@ -1147,7 +1164,7 @@ begin
Log.LogError('Corrupted File: ' + AktSong.Video);
try
// CloseSmpeg;
- VideoPlayback.Close;
+ fCurrentVideoPlaybackEngine.Close;
except
end;
@@ -1230,7 +1247,7 @@ begin
if AktSong.VideoLoaded then
begin
// CloseSmpeg;
- VideoPlayback.Close;
+ fCurrentVideoPlaybackEngine.Close;
AktSong.VideoLoaded := false; // to prevent drawing closed video
end;
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index 82dab1c7..6394113a 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -133,6 +133,9 @@ uses
//------------------------------
UMusic in 'Classes\UMusic.pas',
UMedia_dummy in 'Classes\UMedia_dummy.pas',
+{$IFDEF UseProjectM}
+ UVisualizer in 'Classes\UVisualizer.pas', // MUST be before Video...
+{$ENDIF}
UVideo in 'Classes\UVideo.pas',
{$ifdef UseBass}
UAudio_bass in 'Classes\UAudio_bass.pas',
@@ -144,9 +147,6 @@ uses
UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas',
{$endif}
-{$IFDEF UseProjectM}
- UVisualizer in 'Classes\UVisualizer.pas',
-{$ENDIF}
//------------------------------
//Includes - Screens