aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-12-06 09:39:49 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-12-06 09:39:49 +0000
commit486ad8796acc5883ef83f3a78cd615f6711d77f0 (patch)
tree14e379cad1e87a10056dd4b5bca160c733aa2a5f /Game/Code
parent6a6ef888e1132505da264e395d2c1ca08fffecc5 (diff)
downloadusdx-486ad8796acc5883ef83f3a78cd615f6711d77f0.tar.gz
usdx-486ad8796acc5883ef83f3a78cd615f6711d77f0.tar.xz
usdx-486ad8796acc5883ef83f3a78cd615f6711d77f0.zip
conformed projectM to IVideoPlayback
still needs a little work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@678 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UMedia_dummy.pas8
-rw-r--r--Game/Code/Classes/UMusic.pas5
-rw-r--r--Game/Code/Classes/UPlatform.pas11
-rw-r--r--Game/Code/Classes/UVideo.pas8
-rw-r--r--Game/Code/Classes/UVisualizer.pas157
-rw-r--r--Game/Code/Screens/UScreenSing.pas8
-rw-r--r--Game/Code/UltraStar.dpr5
-rw-r--r--Game/Code/switches.inc5
8 files changed, 151 insertions, 56 deletions
diff --git a/Game/Code/Classes/UMedia_dummy.pas b/Game/Code/Classes/UMedia_dummy.pas
index 42a3f1b9..630b497e 100644
--- a/Game/Code/Classes/UMedia_dummy.pas
+++ b/Game/Code/Classes/UMedia_dummy.pas
@@ -47,8 +47,8 @@ type
procedure MoveTo(Time: real);
function getPosition: real;
- procedure FFmpegGetFrame(Time: Extended);
- procedure FFmpegDrawGL(Screen: integer);
+ procedure GetFrame(Time: Extended);
+ procedure DrawGL(Screen: integer);
// IAudioInput
procedure InitializeRecord;
@@ -95,11 +95,11 @@ begin
end;
-procedure Tmedia_dummy.FFmpegGetFrame(Time: Extended);
+procedure Tmedia_dummy.GetFrame(Time: Extended);
begin
end;
-procedure Tmedia_dummy.FFmpegDrawGL(Screen: integer);
+procedure Tmedia_dummy.DrawGL(Screen: integer);
begin
end;
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index feba3f61..18ec2944 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -123,8 +123,8 @@ type
*)
procedure init();
- procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
- procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
+ procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
+ procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
end;
@@ -265,6 +265,7 @@ begin
// ( not assigned( singleton_AudioInput ) ) then
begin
singleton_AudioInput := IAudioInput( lTmpInterface );
+ Writeln(singleton_AudioInput.GetName);
end;
// if this interface is a Input, then set it as the default used
diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas
index 878c1ec2..a06914d0 100644
--- a/Game/Code/Classes/UPlatform.pas
+++ b/Game/Code/Classes/UPlatform.pas
@@ -18,10 +18,10 @@ uses Classes;
type
TDirectoryEntry = Record
- Name : WideString;
- IsDirectory : Boolean;
- IsFile : Boolean;
- end;
+ Name : WideString;
+ IsDirectory : Boolean;
+ IsFile : Boolean;
+ end;
TDirectoryEntryArray = Array of TDirectoryEntry;
@@ -81,6 +81,5 @@ initialization
{$ENDIF}
finalization
-
- Platform.Free;
+ freeandnil( Platform );
end.
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 6c9458f9..c2e42224 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -110,8 +110,8 @@ type
procedure MoveTo(Time: real);
function getPosition: real;
- procedure FFmpegGetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
- procedure FFmpegDrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
+ procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
+ procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
end;
@@ -192,7 +192,7 @@ end;
-procedure TVideoPlayback_ffmpeg.FFmpegGetFrame(Time: Extended);
+procedure TVideoPlayback_ffmpeg.GetFrame(Time: Extended);
var
FrameFinished: Integer;
AVPacket: TAVPacket;
@@ -355,7 +355,7 @@ begin
end;
end;
-procedure TVideoPlayback_ffmpeg.FFmpegDrawGL(Screen: integer);
+procedure TVideoPlayback_ffmpeg.DrawGL(Screen: integer);
begin
// have a nice black background to draw on (even if there were errors opening the vid)
if Screen=1 then
diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas
index 3bea8f54..1905358f 100644
--- a/Game/Code/Classes/UVisualizer.pas
+++ b/Game/Code/Classes/UVisualizer.pas
@@ -2,6 +2,7 @@
# Visualizer support for UltraStar deluxe #
# #
# Created by hennymcc #
+# Slight modifications by Jay Binks #
# based on UVideo.pas #
#############################################################################}
@@ -24,46 +25,122 @@ uses SDL,
dialogs,
{$ENDIF}
projectM,
+ UMusic,
windows;
-procedure Init;
-procedure VisualizerStart;
-procedure VisualizerStop;
-procedure VisualizerGetFrame(Time: Extended);
-procedure VisualizerDrawGL(Screen: integer);
-procedure VisualizerTogglePause;
+implementation
+
+var
+ singleton_VideoProjectM : IVideoPlayback;
const
- VisualWidth = 640;
- VisualHeight = 480;
- gx = 32;
- gy = 24;
- fps = 30;
- texsize = 512;
+ VisualWidth = 800; // 640
+ VisualHeight = 600; // 480
+ gx = 32;
+ gy = 24;
+ fps = 30;
+ texsize = 512;
-var
- pm: PProjectM;
- VisualizerStarted, VisualizerPaused: Boolean;
- VisualTex: glUint;
- pcm_data: TPCM16;
- hRC: Integer;
- hDC: Integer;
+type
+ TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback )
+
+ pm : PProjectM;
-implementation
+ VisualizerStarted ,
+ VisualizerPaused : Boolean;
-procedure Init;
-begin
+ VisualTex : glUint;
+ pcm_data : TPCM16;
+ hRC : Integer;
+ hDC : Integer;
+
+ procedure VisualizerStart;
+ procedure VisualizerStop;
+
+ procedure VisualizerTogglePause;
+ public
+ constructor create();
+ function GetName: String;
+
+ procedure init();
+
+ function Open( aFileName : string): boolean; // true if succeed
+ procedure Close;
+
+ procedure Play;
+ procedure Pause;
+ procedure Stop;
+
+ procedure MoveTo(Time: real);
+ function getPosition: real;
+
+ procedure GetFrame(Time: Extended); // WANT TO RENAME THESE TO BE MORE GENERIC
+ procedure DrawGL(Screen: integer); // WANT TO RENAME THESE TO BE MORE GENERIC
+ end;
+
+
+constructor TVideoPlayback_ProjectM.create();
+begin
+end;
+
+
+procedure TVideoPlayback_ProjectM.init();
+begin
+ writeln( 'TVideoPlayback_ProjectM - INITIALIZE !!!!!!!!' );
+
VisualizerStarted := False;
- VisualizerPaused := False;
+ VisualizerPaused := False;
+
glGenTextures(1, PglUint(@VisualTex));
glBindTexture(GL_TEXTURE_2D, VisualTex);
+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
end;
-procedure VisualizerStart;
+function TVideoPlayback_ProjectM.GetName: String;
+begin
+ result := 'ProjectM';
+end;
+
+
+function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed
begin
-exit;
+ VisualizerStart();
+ result := true;
+end;
+
+procedure TVideoPlayback_ProjectM.Close;
+begin
+end;
+
+procedure TVideoPlayback_ProjectM.Play;
+begin
+ VisualizerStart();
+end;
+
+procedure TVideoPlayback_ProjectM.Pause;
+begin
+ VisualizerTogglePause();
+end;
+
+procedure TVideoPlayback_ProjectM.Stop;
+begin
+ VisualizerStop();
+end;
+
+procedure TVideoPlayback_ProjectM.MoveTo(Time: real);
+begin
+end;
+
+function TVideoPlayback_ProjectM.getPosition: real;
+begin
+ result := 0;
+end;
+
+procedure TVideoPlayback_ProjectM.VisualizerStart;
+begin
+//exit;
VisualizerStarted := True;
New(pm);
@@ -76,7 +153,7 @@ exit;
pm^.fps := fps;
pm^.renderTarget^.usePbuffers := 0;
- pm^.fontURL := PChar('Visuals\fonts');
+ pm^.fontURL := PChar('Visuals\fonts');
pm^.presetURL := PChar('Visuals\presets');
glPushAttrib(GL_ALL_ATTRIB_BITS);
@@ -97,7 +174,7 @@ exit;
glPopAttrib();
end;
-procedure VisualizerStop;
+procedure TVideoPlayback_ProjectM.VisualizerStop;
begin
if VisualizerStarted then begin
VisualizerStarted := False;
@@ -105,17 +182,17 @@ begin
end;
end;
-procedure VisualizerTogglePause;
+procedure TVideoPlayback_ProjectM.VisualizerTogglePause;
begin
if VisualizerPaused then VisualizerPaused:=False
else VisualizerPaused:=True;
end;
-procedure VisualizerGetFrame(Time: Extended);
+procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended);
var
i: integer;
begin
- exit;
+// exit;
if not VisualizerStarted then Exit;
if VisualizerPaused then Exit;
@@ -168,9 +245,11 @@ begin
}
end;
-procedure VisualizerDrawGL(Screen: integer);
+procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer);
begin
-{
+
+ exit;
+
// have a nice black background to draw on (even if there were errors opening the vid)
if Screen=1 then begin
glClearColor(0,0,0,0);
@@ -195,7 +274,19 @@ begin
glEnd;
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
-}
+
end;
+
+initialization
+ singleton_VideoProjectM := TVideoPlayback_ProjectM.create();
+
+ writeln( 'UVideoProjectM - Register Playback' );
+ AudioManager.add( singleton_VideoProjectM );
+
+finalization
+ AudioManager.Remove( singleton_VideoProjectM );
+
+
+
end.
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index dd11ee07..c3bb78d2 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -851,10 +851,10 @@ begin
begin
try
writeln( 'VideoPlayback.FFmpegGetFrame' );
- VideoPlayback.FFmpegGetFrame(Czas.Teraz);
+ VideoPlayback.GetFrame(Czas.Teraz);
writeln( 'VideoPlayback.FFmpegDrawGL' );
- VideoPlayback.FFmpegDrawGL(ScreenAct);
+ VideoPlayback.DrawGL(ScreenAct);
// PlaySmpeg;
except
@@ -1125,8 +1125,8 @@ begin
// todo: find a way to determine, when a new frame is needed
// toto: same for the need to skip frames
- VideoPlayback.FFmpegGetFrame(Czas.Teraz);
- VideoPlayback.FFmpegDrawGL(ScreenAct);
+ VideoPlayback.GetFrame(Czas.Teraz);
+ VideoPlayback.DrawGL(ScreenAct);
except
on E : Exception do
begin
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index e5ace11e..6a1d0013 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -128,7 +128,7 @@ uses
//------------------------------
UMusic in 'Classes\UMusic.pas',
UMedia_dummy in 'Classes\UMedia_dummy.pas',
- UVideo in 'Classes\UVideo.pas',
+// UVideo in 'Classes\UVideo.pas',
{$ifdef UseBass}
UAudio_bass in 'Classes\UAudio_bass.pas',
{$endif}
@@ -139,6 +139,9 @@ uses
UAudio_FFMpeg in 'Classes\UAudio_FFMpeg.pas',
{$endif}
+ projectM in 'lib\projectM\projectM.pas',
+ UVisualizer in 'Classes\UVisualizer.pas',
+
//------------------------------
//Includes - Screens
//------------------------------
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
index 8d395688..15fb31bb 100644
--- a/Game/Code/switches.inc
+++ b/Game/Code/switches.inc
@@ -34,8 +34,9 @@
{$IFDEF win32}
{$DEFINE UseBASSOutput}
- {$DEFINE UseBASSInput}
- //{$DEFINE UsePortaudio}
+// {$DEFINE UseBASSInput}
+
+ {$DEFINE UsePortaudio}
//{$DEFINE UsePortmixer}
{$IFDEF DEBUG}
{$IFNDEF DARWIN}