aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes')
-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
5 files changed, 140 insertions, 49 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.