diff options
author | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 23:53:46 +0000 |
---|---|---|
committer | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 23:53:46 +0000 |
commit | 73a9bf99b8993aa69f3ed77b36b0236fb1cde2ed (patch) | |
tree | d102105c2047353bd9ca3788c48ddbe0648c0241 /Game | |
parent | 98e79f186b312510e6bb3f13d82fa7f0f03b78d7 (diff) | |
download | usdx-73a9bf99b8993aa69f3ed77b36b0236fb1cde2ed.tar.gz usdx-73a9bf99b8993aa69f3ed77b36b0236fb1cde2ed.tar.xz usdx-73a9bf99b8993aa69f3ed77b36b0236fb1cde2ed.zip |
trying to get projectM to run in linux
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@692 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r-- | Game/Code/Classes/UVisualizer.pas | 540 | ||||
-rw-r--r-- | Game/Code/lib/projectM/projectM.pas | 621 | ||||
-rw-r--r-- | Game/Code/lib/requirements.txt | 7 | ||||
-rw-r--r-- | Game/Code/switches.inc | 113 |
4 files changed, 651 insertions, 630 deletions
diff --git a/Game/Code/Classes/UVisualizer.pas b/Game/Code/Classes/UVisualizer.pas index b6b3a1cc..a49187e7 100644 --- a/Game/Code/Classes/UVisualizer.pas +++ b/Game/Code/Classes/UVisualizer.pas @@ -1,66 +1,65 @@ -{############################################################################
-# Visualizer support for UltraStar deluxe #
-# #
-# Created by hennymcc #
-# Slight modifications by Jay Binks #
-# based on UVideo.pas #
-#############################################################################}
-
-unit UVisualizer;
-
-interface
-
-{$IFDEF FPC}
- {$MODE DELPHI}
-{$ENDIF}
-
-uses SDL,
- UGraphicClasses,
- textgl,
- math,
- OpenGL12,
- SysUtils,
- UIni,
- {$ifdef DebugDisplay}
- dialogs,
- {$ENDIF}
- projectM,
- UMusic,
- windows;
-
-implementation
-
-uses
- UGraphic;
-
-var
+{############################################################################ +# Visualizer support for UltraStar deluxe # +# # +# Created by hennymcc # +# Slight modifications by Jay Binks # +# based on UVideo.pas # +#############################################################################} + +unit UVisualizer; + +interface + +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + +uses SDL, + UGraphicClasses, + textgl, + math, + OpenGL12, + SysUtils, + UIni, + {$ifdef DebugDisplay} + dialogs, + {$ENDIF} + projectM, + UMusic; + +implementation + +uses + UGraphic; + +var singleton_VideoProjectM : IVideoPlayback; -
-const
- gx = 32;
- gy = 24;
- fps = 30;
- texsize = 512;
- visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers
- projectM_Dir = visuals_Dir+'/projectM';
-
-type
- TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization )
+ +const + gx = 32; + gy = 24; + fps = 30; + texsize = 512; + visuals_Dir = 'Visuals'; // TODO: move this to a place common for all visualizers + projectM_Dir = visuals_Dir+'/projectM'; + +type + TVideoPlayback_ProjectM = class( TInterfacedObject, IVideoPlayback, IVideoVisualization ) pm : PProjectM; -
- VisualizerStarted ,
- VisualizerPaused : Boolean;
-
- VisualTex : glUint;
- PCMData : TPCMData;
- hRC : Integer;
- hDC : Integer;
+ + VisualizerStarted , + VisualizerPaused : Boolean; + + VisualTex : glUint; + PCMData : TPCMData; + hRC : Integer; + hDC : Integer; procedure VisualizerStart; procedure VisualizerStop; -
- procedure VisualizerTogglePause;
+ + procedure VisualizerTogglePause; public constructor create(); procedure init(); @@ -79,40 +78,44 @@ type procedure GetFrame(Time: Extended); procedure DrawGL(Screen: integer); end; -
-
-constructor TVideoPlayback_ProjectM.create();
+ + +constructor TVideoPlayback_ProjectM.create(); begin end; -
-
-procedure TVideoPlayback_ProjectM.init();
+ + +procedure TVideoPlayback_ProjectM.init(); begin writeln( 'TVideoPlayback_ProjectM - INITIALIZE !!!!!!!!' ); - VisualizerStarted := 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;
-
-function TVideoPlayback_ProjectM.GetName: String;
+ VisualizerStarted := 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); + + New(pm); + projectM_reset(pm); + +end; + +function TVideoPlayback_ProjectM.GetName: String; begin result := 'ProjectM'; end; -
-
-function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed
-begin
- VisualizerStart();
- result := true;
-end;
-
-procedure TVideoPlayback_ProjectM.Close;
+ + +function TVideoPlayback_ProjectM.Open( aFileName : string): boolean; // true if succeed +begin + VisualizerStart(); + result := true; +end; + +procedure TVideoPlayback_ProjectM.Close; begin end; @@ -137,33 +140,33 @@ begin // in here, we cant realy move to a specific time, since its all random generated // but a call to this function will change the preset, which changes the pattern projectM_reset(pm); -
- pm^.fullscreen := 0;
- pm^.renderTarget^.texsize := texsize;
- pm^.gx := gx;
- pm^.gy := gy;
- pm^.fps := fps;
- pm^.renderTarget^.usePbuffers := 0;
-
- pm^.fontURL := PChar(projectM_Dir+'/fonts');
- pm^.presetURL := PChar(projectM_Dir+'/presets');
-
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- projectM_init(pm);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
-
- projectM_resetGL(pm, ScreenW, ScreenH);
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
+ + pm^.fullscreen := 0; + pm^.renderTarget^.texsize := texsize; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + pm^.renderTarget^.usePbuffers := 0; + + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + projectM_resetGL(pm, ScreenW, ScreenH); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); glPopAttrib(); end; @@ -173,158 +176,165 @@ begin result := 0; end; -procedure TVideoPlayback_ProjectM.VisualizerStart;
-begin
- VisualizerStarted := True;
-
- New(pm);
- projectM_reset(pm);
-
- pm^.fullscreen := 0;
- pm^.renderTarget^.texsize := texsize;
- pm^.gx := gx;
- pm^.gy := gy;
- pm^.fps := fps;
- pm^.renderTarget^.usePbuffers := 0;
-
- pm^.fontURL := PChar(projectM_Dir+'/fonts');
- pm^.presetURL := PChar(projectM_Dir+'/presets');
-
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- projectM_init(pm);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
-
- projectM_resetGL(pm, ScreenW, ScreenH);
-
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glPopAttrib();
-end;
-
-procedure TVideoPlayback_ProjectM.VisualizerStop;
-begin
- if VisualizerStarted then begin
- VisualizerStarted := False;
- Dispose(pm);
- end;
-end;
-
-procedure TVideoPlayback_ProjectM.VisualizerTogglePause;
-begin
- VisualizerPaused := not VisualizerPaused;
-end;
-
-procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended);
-var
- i: integer;
- nSamples: cardinal;
-begin
- if not VisualizerStarted then Exit;
- if VisualizerPaused then Exit;
-
- // get audio data
- nSamples := AudioPlayback.GetPCMData(PcmData);
- addPCM16Data(PSmallInt(@PcmData), nSamples);
-
- // store OpenGL state (might be messed up otherwise)
- glPushAttrib(GL_ALL_ATTRIB_BITS);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
-
- // let projectM render a frame
- renderFrame(pm);
- glFlush();
-
- {$IFDEF UseTexture}
- glBindTexture(GL_TEXTURE_2D, VisualTex);
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0);
- {$ENDIF}
-
- // restore USDX OpenGL state
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_TEXTURE);
- glPopMatrix();
- glPopAttrib();
-
- // discard projectM's depth buffer information (avoid overlay)
- glClear(GL_DEPTH_BUFFER_BIT);
-end;
-
-procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer);
-begin
- {$IFDEF UseTexture}
- // 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);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
- end;
- // exit if there's nothing to draw
- if not VisualizerStarted then Exit;
-
- // setup display
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- gluOrtho2D(0, 1, 0, 1);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glBindTexture(GL_TEXTURE_2D, VisualTex);
- glColor4f(1, 1, 1, 1);
-
- // draw projectM frame
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glVertex2f(0, 0);
- glTexCoord2f(1, 0); glVertex2f(1, 0);
- glTexCoord2f(1, 1); glVertex2f(1, 1);
- glTexCoord2f(0, 1); glVertex2f(0, 1);
- glEnd();
-
- {
- glbegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(400-VisualWidth/2, 300-VisualHeight/2);
- glTexCoord2f(0, 1);
- glVertex2f(400-VisualWidth/2, 300+VisualHeight/2);
- glTexCoord2f(1, 1);
- glVertex2f(400+VisualWidth/2, 300+VisualHeight/2);
- glTexCoord2f(1, 0);
- glVertex2f(400+VisualWidth/2, 300-VisualHeight/2);
- glEnd;
- }
-
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
-
- // restore state
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- {$ENDIF}
-end;
-
-
+procedure TVideoPlayback_ProjectM.VisualizerStart; +begin + VisualizerStarted := True; + +// New(pm); +// projectM_reset(pm); + + writeln('Render Target'); + writeln( inttostr( integer( assigned(pm^.renderTarget) ) ) ); + + pm^.fullscreen := 0; + pm^.gx := gx; + pm^.gy := gy; + pm^.fps := fps; + + if assigned(pm^.renderTarget) then + begin + pm^.renderTarget^.texsize := texsize; + pm^.renderTarget^.usePbuffers := 0; + end; + + pm^.fontURL := PChar(projectM_Dir+'/fonts'); + pm^.presetURL := PChar(projectM_Dir+'/presets'); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + projectM_init(pm); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + projectM_resetGL(pm, ScreenW, ScreenH); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); +end; + +procedure TVideoPlayback_ProjectM.VisualizerStop; +begin + if VisualizerStarted then begin + VisualizerStarted := False; + Dispose(pm); + end; +end; + +procedure TVideoPlayback_ProjectM.VisualizerTogglePause; +begin + VisualizerPaused := not VisualizerPaused; +end; + +procedure TVideoPlayback_ProjectM.GetFrame(Time: Extended); +var + i: integer; + nSamples: cardinal; +begin + if not VisualizerStarted then Exit; + if VisualizerPaused then Exit; + + // get audio data + nSamples := AudioPlayback.GetPCMData(PcmData); + addPCM16Data(PSmallInt(@PcmData), nSamples); + + // store OpenGL state (might be messed up otherwise) + glPushAttrib(GL_ALL_ATTRIB_BITS); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glMatrixMode(GL_TEXTURE); + glPushMatrix(); + + // let projectM render a frame + renderFrame(pm); + glFlush(); + + {$IFDEF UseTexture} + glBindTexture(GL_TEXTURE_2D, VisualTex); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, VisualWidth, VisualHeight, 0); + {$ENDIF} + + // restore USDX OpenGL state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + glMatrixMode(GL_TEXTURE); + glPopMatrix(); + glPopAttrib(); + + // discard projectM's depth buffer information (avoid overlay) + glClear(GL_DEPTH_BUFFER_BIT); +end; + +procedure TVideoPlayback_ProjectM.DrawGL(Screen: integer); +begin + {$IFDEF UseTexture} + // 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); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end; + // exit if there's nothing to draw + if not VisualizerStarted then Exit; + + // setup display + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, 1, 0, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glBindTexture(GL_TEXTURE_2D, VisualTex); + glColor4f(1, 1, 1, 1); + + // draw projectM frame + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(0, 0); + glTexCoord2f(1, 0); glVertex2f(1, 0); + glTexCoord2f(1, 1); glVertex2f(1, 1); + glTexCoord2f(0, 1); glVertex2f(0, 1); + glEnd(); + + { + glbegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(400-VisualWidth/2, 300-VisualHeight/2); + glTexCoord2f(0, 1); + glVertex2f(400-VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 1); + glVertex2f(400+VisualWidth/2, 300+VisualHeight/2); + glTexCoord2f(1, 0); + glVertex2f(400+VisualWidth/2, 300-VisualHeight/2); + glEnd; + } + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // restore state + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + {$ENDIF} +end; + + initialization singleton_VideoProjectM := TVideoPlayback_ProjectM.create(); @@ -334,6 +344,6 @@ initialization finalization AudioManager.Remove( singleton_VideoProjectM ); -
-
-end.
+ + +end. diff --git a/Game/Code/lib/projectM/projectM.pas b/Game/Code/lib/projectM/projectM.pas index be6f77b1..9adf5acf 100644 --- a/Game/Code/lib/projectM/projectM.pas +++ b/Game/Code/lib/projectM/projectM.pas @@ -1,27 +1,34 @@ -unit projectM;
-
-interface
-
-uses OpenGL12;
-
-type
- FLOAT = Single;
- PFLOAT = ^FLOAT;
- PPFLOAT = ^PFLOAT;
- INT = Integer;
- SHORT = Smallint;
- LONG = Longint;
-
-type
- TPCM16 = array[0..1, 0..511] of SHORT;
-
-type
- TTextureScale = INT;
-const
- SCALE_NEAREST = 0;
- SCALE_MAGNIFY = 1;
- SCALE_MINIFY = 2;
-
+unit projectM; + +interface + +uses OpenGL12; + +const + {$IFDEF win32} + libname = 'libprojectM.dll'; + {$Else} + libname = 'libprojectM.so'; + {$endif} + +type + FLOAT = Single; + PFLOAT = ^FLOAT; + PPFLOAT = ^PFLOAT; + INT = Integer; + SHORT = Smallint; + LONG = Longint; + +type + TPCM16 = array[0..1, 0..511] of SHORT; + +type + TTextureScale = INT; +const + SCALE_NEAREST = 0; + SCALE_MAGNIFY = 1; + SCALE_MINIFY = 2; + type TContextType = INT; const @@ -69,286 +76,286 @@ type procedure lockPBuffer( target: PRenderTarget; pass: PBufferPass ); procedure unlockPBuffer( target: PRenderTarget ); function nearestPower2( value: INT; scaleRule: TTextureScale ): INT; - }
-
- PProjectM = ^TProjectM;
- TProjectM = record
- presetURL: PChar;
- presetName: PChar;
- fontURL: PChar;
-
- hasInit: INT;
-
- noSwitch: INT;
- pcmframes: INT;
- freqframes: INT;
- totalframes: INT;
-
- showfps: INT;
- showtitle: INT;
- showpreset: INT;
- showhelp: INT;
- showstats: INT;
-
- studio: INT;
-
- fbuffer: PGLubyte;
-
- {$ifndef Win32}
- { The first ticks value of the application }
- startTime: LONG; //struct timeval
- {$else}
- startTime: LONG;
- {$endif Win32}
- Time: FLOAT;
-
- { Render target texture ID }
- renderTarget: PRenderTarget;
-
- disp: array[0..79] of Char;
-
- wave_o: FLOAT;
-
- //int texsize=1024; //size of texture to do actual graphics
- fvw: INT; //fullscreen dimensions
- fvh: INT;
- wvw: INT; //windowed dimensions
- wvh: INT;
- vw: INT; //runtime dimensions
- vh: INT;
- fullscreen: INT;
-
- maxsamples: INT; //size of PCM buffer
- numsamples: INT; //size of new PCM info
- pcmdataL: PFLOAT; //holder for most recent pcm data
- pcmdataR: PFLOAT; //holder for most recent pcm data
-
- avgtime: INT; //# frames per preset
-
- title: PChar;
- drawtitle: INT;
-
- correction: INT;
-
- vol: FLOAT;
-
- //per pixel equation variables
- gridx: PPFLOAT; //grid containing interpolated mesh
- gridy: PPFLOAT;
- origtheta: PPFLOAT; //grid containing interpolated mesh reference values
- origrad: PPFLOAT;
- origx: PPFLOAT; //original mesh
- origy: PPFLOAT;
- origx2: PPFLOAT; //original mesh
- origy2: PPFLOAT;
-
- { Timing information }
- mspf: INT;
- timed: INT;
- timestart: INT;
- nohard: INT;
- count: INT;
- realfps,
- fpsstart: FLOAT;
-
- { PCM data }
- vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum)
- vdataR: array[0..511] of FLOAT;
-
- { Various toggles }
- doPerPixelEffects: INT;
- doIterative: INT;
-
- { ENGINE VARIABLES }
- { From engine_vars.h }
- preset_name: array[0..255] of Char;
-
- { PER FRAME CONSTANTS BEGIN }
- zoom: FLOAT;
- zoomexp: FLOAT;
- rot: FLOAT;
- warp: FLOAT;
-
- sx: FLOAT;
- sy: FLOAT;
- dx: FLOAT;
- dy: FLOAT;
- cx: FLOAT;
- cy: FLOAT;
-
- gy: INT;
- gx: INT;
-
- decay: FLOAT;
-
- wave_r: FLOAT;
- wave_g: FLOAT;
- wave_b: FLOAT;
- wave_x: FLOAT;
- wave_y: FLOAT;
- wave_mystery: FLOAT;
-
- ob_size: FLOAT;
- ob_r: FLOAT;
- ob_g: FLOAT;
- ob_b: FLOAT;
- ob_a: FLOAT;
-
- ib_size: FLOAT;
- ib_r: FLOAT;
- ib_g: FLOAT;
- ib_b: FLOAT;
- ib_a: FLOAT;
-
- meshx: INT;
- meshy: INT;
-
- mv_a: FLOAT;
- mv_r: FLOAT;
- mv_g: FLOAT;
- mv_b: FLOAT;
- mv_l: FLOAT;
- mv_x: FLOAT;
- mv_y: FLOAT;
- mv_dy: FLOAT;
- mv_dx: FLOAT;
-
- treb: FLOAT;
- mid: FLOAT;
- bass: FLOAT;
- bass_old: FLOAT;
- beat_sensitivity: FLOAT;
- treb_att: FLOAT;
- mid_att: FLOAT;
- bass_att: FLOAT;
- progress: FLOAT;
- frame: INT;
-
- { PER_FRAME CONSTANTS END }
-
- { PER_PIXEL CONSTANTS BEGIN }
-
- x_per_pixel: FLOAT;
- y_per_pixel: FLOAT;
- rad_per_pixel: FLOAT;
- ang_per_pixel: FLOAT;
-
- { PER_PIXEL CONSTANT END }
-
-
- fRating: FLOAT;
- fGammaAdj: FLOAT;
- fVideoEchoZoom: FLOAT;
- fVideoEchoAlpha: FLOAT;
-
- nVideoEchoOrientation: INT;
- nWaveMode: INT;
- bAdditiveWaves: INT;
- bWaveDots: INT;
- bWaveThick: INT;
- bModWaveAlphaByVolume: INT;
- bMaximizeWaveColor: INT;
- bTexWrap: INT;
- bDarkenCenter: INT;
- bRedBlueStereo: INT;
- bBrighten: INT;
- bDarken: INT;
- bSolarize: INT;
- bInvert: INT;
- bMotionVectorsOn: INT;
- fps: INT;
-
- fWaveAlpha: FLOAT;
- fWaveScale: FLOAT;
- fWaveSmoothing: FLOAT;
- fWaveParam: FLOAT;
- fModWaveAlphaStart: FLOAT;
- fModWaveAlphaEnd: FLOAT;
- fWarpAnimSpeed: FLOAT;
- fWarpScale: FLOAT;
- fShader: FLOAT;
-
-
- { Q VARIABLES START }
-
- q1: FLOAT;
- q2: FLOAT;
- q3: FLOAT;
- q4: FLOAT;
- q5: FLOAT;
- q6: FLOAT;
- q7: FLOAT;
- q8: FLOAT;
-
-
- { Q VARIABLES END }
-
- zoom_mesh: PPFLOAT;
- zoomexp_mesh: PPFLOAT;
- rot_mesh: PPFLOAT;
-
- sx_mesh: PPFLOAT;
- sy_mesh: PPFLOAT;
- dx_mesh: PPFLOAT;
- dy_mesh: PPFLOAT;
- cx_mesh: PPFLOAT;
- cy_mesh: PPFLOAT;
-
- x_mesh: PPFLOAT;
- y_mesh: PPFLOAT;
- rad_mesh: PPFLOAT;
- theta_mesh: PPFLOAT;
- end;
-
- { Functions }
- procedure projectM_init(pm: PProjectM); cdecl; external 'libprojectM.dll';
- procedure projectM_reset(pm: PProjectM); cdecl; external 'libprojectM.dll';
- procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external 'libprojectM.dll';
- procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external 'libprojectM.dll';
- procedure renderFrame(pm: PProjectM); cdecl; external 'libprojectM.dll';
-
- {
- procedure draw_help(pm: PProjectM);
- procedure draw_fps(pm: PProjectM; fps: Single);
- procedure draw_preset(pm: PProjectM);
- procedure draw_title(pm: PProjectM);
- procedure draw_stats(pm: PProjectM);
-
- procedure modulate_opacity_by_volume(pm: PProjectM);
- procedure maximize_colors(pm: PProjectM);
- procedure do_per_pixel_math(pm: PProjectM);
- procedure do_per_frame(pm: PProjectM);
- procedure render_texture_to_studio(pm: PProjectM);
- procedure darken_center(pm: PProjectM);
-
- procedure render_interpolation(pm: PProjectM);
- procedure render_texture_to_screen(pm: PProjectM);
- procedure render_texture_to_studio(pm: PProjectM);
- procedure draw_motion_vectors(pm: PProjectM);
- procedure draw_borders(pm: PProjectM);
- procedure draw_shapes(pm: PProjectM);
- procedure draw_waveform(pm: PProjectM);
- procedure draw_custom_waves(pm: PProjectM);
-
- procedure draw_title_to_screen(pm: PProjectM);
- procedure draw_title_to_texture(pm: PProjectM);
- procedure get_title(pm: PProjectM);
-
- procedure reset_per_pixel_matrices(pm: PProjectM);
- procedure init_per_pixel_matrices(pm: PProjectM);
- procedure rescale_per_pixel_matrices(pm: PProjectM);
- }
-
- { PCM.h declarations }
- {
- procedure addPCMfloat(PCMdata: PFLOAT, samples: INT);
- }
- procedure addPCM16(pcm_data: TPCM16); cdecl; external 'libprojectM.dll';
- procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external 'libprojectM.dll';
- {
- procedure addPCM8( unsigned char [2][512]);
- }
-
-implementation
-
-end.
+ } + + PProjectM = ^TProjectM; + TProjectM = record + presetURL: PChar; + presetName: PChar; + fontURL: PChar; + + hasInit: INT; + + noSwitch: INT; + pcmframes: INT; + freqframes: INT; + totalframes: INT; + + showfps: INT; + showtitle: INT; + showpreset: INT; + showhelp: INT; + showstats: INT; + + studio: INT; + + fbuffer: PGLubyte; + + {$ifndef Win32} + { The first ticks value of the application } + startTime: LONG; //struct timeval + {$else} + startTime: LONG; + {$endif Win32} + Time: FLOAT; + + { Render target texture ID } + renderTarget: PRenderTarget; + + disp: array[0..79] of Char; + + wave_o: FLOAT; + + //int texsize=1024; //size of texture to do actual graphics + fvw: INT; //fullscreen dimensions + fvh: INT; + wvw: INT; //windowed dimensions + wvh: INT; + vw: INT; //runtime dimensions + vh: INT; + fullscreen: INT; + + maxsamples: INT; //size of PCM buffer + numsamples: INT; //size of new PCM info + pcmdataL: PFLOAT; //holder for most recent pcm data + pcmdataR: PFLOAT; //holder for most recent pcm data + + avgtime: INT; //# frames per preset + + title: PChar; + drawtitle: INT; + + correction: INT; + + vol: FLOAT; + + //per pixel equation variables + gridx: PPFLOAT; //grid containing interpolated mesh + gridy: PPFLOAT; + origtheta: PPFLOAT; //grid containing interpolated mesh reference values + origrad: PPFLOAT; + origx: PPFLOAT; //original mesh + origy: PPFLOAT; + origx2: PPFLOAT; //original mesh + origy2: PPFLOAT; + + { Timing information } + mspf: INT; + timed: INT; + timestart: INT; + nohard: INT; + count: INT; + realfps, + fpsstart: FLOAT; + + { PCM data } + vdataL: array[0..511] of FLOAT; //holders for FFT data (spectrum) + vdataR: array[0..511] of FLOAT; + + { Various toggles } + doPerPixelEffects: INT; + doIterative: INT; + + { ENGINE VARIABLES } + { From engine_vars.h } + preset_name: array[0..255] of Char; + + { PER FRAME CONSTANTS BEGIN } + zoom: FLOAT; + zoomexp: FLOAT; + rot: FLOAT; + warp: FLOAT; + + sx: FLOAT; + sy: FLOAT; + dx: FLOAT; + dy: FLOAT; + cx: FLOAT; + cy: FLOAT; + + gy: INT; + gx: INT; + + decay: FLOAT; + + wave_r: FLOAT; + wave_g: FLOAT; + wave_b: FLOAT; + wave_x: FLOAT; + wave_y: FLOAT; + wave_mystery: FLOAT; + + ob_size: FLOAT; + ob_r: FLOAT; + ob_g: FLOAT; + ob_b: FLOAT; + ob_a: FLOAT; + + ib_size: FLOAT; + ib_r: FLOAT; + ib_g: FLOAT; + ib_b: FLOAT; + ib_a: FLOAT; + + meshx: INT; + meshy: INT; + + mv_a: FLOAT; + mv_r: FLOAT; + mv_g: FLOAT; + mv_b: FLOAT; + mv_l: FLOAT; + mv_x: FLOAT; + mv_y: FLOAT; + mv_dy: FLOAT; + mv_dx: FLOAT; + + treb: FLOAT; + mid: FLOAT; + bass: FLOAT; + bass_old: FLOAT; + beat_sensitivity: FLOAT; + treb_att: FLOAT; + mid_att: FLOAT; + bass_att: FLOAT; + progress: FLOAT; + frame: INT; + + { PER_FRAME CONSTANTS END } + + { PER_PIXEL CONSTANTS BEGIN } + + x_per_pixel: FLOAT; + y_per_pixel: FLOAT; + rad_per_pixel: FLOAT; + ang_per_pixel: FLOAT; + + { PER_PIXEL CONSTANT END } + + + fRating: FLOAT; + fGammaAdj: FLOAT; + fVideoEchoZoom: FLOAT; + fVideoEchoAlpha: FLOAT; + + nVideoEchoOrientation: INT; + nWaveMode: INT; + bAdditiveWaves: INT; + bWaveDots: INT; + bWaveThick: INT; + bModWaveAlphaByVolume: INT; + bMaximizeWaveColor: INT; + bTexWrap: INT; + bDarkenCenter: INT; + bRedBlueStereo: INT; + bBrighten: INT; + bDarken: INT; + bSolarize: INT; + bInvert: INT; + bMotionVectorsOn: INT; + fps: INT; + + fWaveAlpha: FLOAT; + fWaveScale: FLOAT; + fWaveSmoothing: FLOAT; + fWaveParam: FLOAT; + fModWaveAlphaStart: FLOAT; + fModWaveAlphaEnd: FLOAT; + fWarpAnimSpeed: FLOAT; + fWarpScale: FLOAT; + fShader: FLOAT; + + + { Q VARIABLES START } + + q1: FLOAT; + q2: FLOAT; + q3: FLOAT; + q4: FLOAT; + q5: FLOAT; + q6: FLOAT; + q7: FLOAT; + q8: FLOAT; + + + { Q VARIABLES END } + + zoom_mesh: PPFLOAT; + zoomexp_mesh: PPFLOAT; + rot_mesh: PPFLOAT; + + sx_mesh: PPFLOAT; + sy_mesh: PPFLOAT; + dx_mesh: PPFLOAT; + dy_mesh: PPFLOAT; + cx_mesh: PPFLOAT; + cy_mesh: PPFLOAT; + + x_mesh: PPFLOAT; + y_mesh: PPFLOAT; + rad_mesh: PPFLOAT; + theta_mesh: PPFLOAT; + end; + + { Functions } + procedure projectM_init(pm: PProjectM); cdecl; external libname; + procedure projectM_reset(pm: PProjectM); cdecl; external libname; + procedure projectM_resetGL(pm: PProjectM; width: INT; height: INT); cdecl; external libname; + procedure projectM_setTitle(pm: PProjectM; title: PChar); cdecl; external libname; + procedure renderFrame(pm: PProjectM); cdecl; external libname; + + { + procedure draw_help(pm: PProjectM); + procedure draw_fps(pm: PProjectM; fps: Single); + procedure draw_preset(pm: PProjectM); + procedure draw_title(pm: PProjectM); + procedure draw_stats(pm: PProjectM); + + procedure modulate_opacity_by_volume(pm: PProjectM); + procedure maximize_colors(pm: PProjectM); + procedure do_per_pixel_math(pm: PProjectM); + procedure do_per_frame(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure darken_center(pm: PProjectM); + + procedure render_interpolation(pm: PProjectM); + procedure render_texture_to_screen(pm: PProjectM); + procedure render_texture_to_studio(pm: PProjectM); + procedure draw_motion_vectors(pm: PProjectM); + procedure draw_borders(pm: PProjectM); + procedure draw_shapes(pm: PProjectM); + procedure draw_waveform(pm: PProjectM); + procedure draw_custom_waves(pm: PProjectM); + + procedure draw_title_to_screen(pm: PProjectM); + procedure draw_title_to_texture(pm: PProjectM); + procedure get_title(pm: PProjectM); + + procedure reset_per_pixel_matrices(pm: PProjectM); + procedure init_per_pixel_matrices(pm: PProjectM); + procedure rescale_per_pixel_matrices(pm: PProjectM); + } + + { PCM.h declarations } + { + procedure addPCMfloat(PCMdata: PFLOAT, samples: INT); + } + procedure addPCM16(pcm_data: TPCM16); cdecl; external libname; + procedure addPCM16Data(pcm_data: PSmallint; samples: Smallint); cdecl; external libname; + { + procedure addPCM8( unsigned char [2][512]); + } + +implementation + +end. diff --git a/Game/Code/lib/requirements.txt b/Game/Code/lib/requirements.txt index ebaffea7..d1775390 100644 --- a/Game/Code/lib/requirements.txt +++ b/Game/Code/lib/requirements.txt @@ -34,6 +34,9 @@ here are the instructions needed to compile on ubunty ( 7.04 ) ffmpeg :
sudo apt-get install libavcodec-dev libavformat-dev
+ +portaudio : + sudo apt-get install portaudio19-dev sqlite :
sudo apt-get install libsqlite3-dev
@@ -43,6 +46,6 @@ sdl development libraries : THERE WILL be more of them... oops I forgot to list them :P
For the Lazy... who use Debian or Ubuntu.... here is a single line
- sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev
+ sudo apt-get install libavcodec-dev libavformat-dev libsqlite3-dev libsdl-ttf2.0-dev libsdl-image1.2-dev portaudio19-dev
-
\ No newline at end of file + diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 5811979e..540ba068 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -1,56 +1,57 @@ -{$DEFINE DEBUG} // to-do : Remove b4 release
-
-// Comment by eddie:
-// The mac port currently also uses the WIN32 define.
-// Once I get the beast compiled, linked and running
-// I will change this.
-// There are some parts where the WIN32 define could not
-// be used. I changed the WIN32 to MSWINDOWS.
-// So, for Windows-only code use the MSWINDOWS define.
-
-
-{$IFDEF FPC}
- {$IFDEF DARWIN}
- {$H+}
- {$R-}
- {$DEFINE WIN32}
- {$DEFINE TRANSLATE}
- {$ELSE}
- {$DEFINE LAZARUS}
- {$ENDIF}
-
-// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux )
-
- {$DEFINE DLL_CDECL}
- {$UNDEF UseSerialPort}
- {$UNDEF UseMIDIPort}
-{$ELSE}
- {$DEFINE Delphi}
- {$DEFINE DLL_STDCALL}
- {$UNDEF UseSerialPort}
- {$DEFINE UseMIDIPort}
-{$ENDIF}
-
-
-{$IFDEF win32}
- {$DEFINE UseBASSOutput}
- {$DEFINE UseBASSInput}
-
- //{$DEFINE UsePortaudio}
- //{$DEFINE UsePortmixer}
-
- {$DEFINE UseProjectM}
-
- {$IFDEF DEBUG}
- {$IFNDEF DARWIN}
- {$APPTYPE CONSOLE}
- {$ENDIF}
- {$ENDIF}
-{$ELSE}
- //{$DEFINE FFMpegAudio}
- {$DEFINE UsePortaudio}
-{$ENDIF}
-
-{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)}
- {$DEFINE UseBASS}
-{$IFEND}
+{$DEFINE DEBUG} // to-do : Remove b4 release + +// Comment by eddie: +// The mac port currently also uses the WIN32 define. +// Once I get the beast compiled, linked and running +// I will change this. +// There are some parts where the WIN32 define could not +// be used. I changed the WIN32 to MSWINDOWS. +// So, for Windows-only code use the MSWINDOWS define. + + +{$IFDEF FPC} + {$IFDEF DARWIN} + {$H+} + {$R-} + {$DEFINE WIN32} + {$DEFINE TRANSLATE} + {$ELSE} + {$DEFINE LAZARUS} + {$ENDIF} + +// {$MODE DELPHI} // JB - This is not allowed by the free pascal compiler for some reason ( At least on linux ) + + {$DEFINE DLL_CDECL} + {$UNDEF UseSerialPort} + {$UNDEF UseMIDIPort} +{$ELSE} + {$DEFINE Delphi} + {$DEFINE DLL_STDCALL} + {$UNDEF UseSerialPort} + {$DEFINE UseMIDIPort} +{$ENDIF} + + +{$IFDEF win32} + {$DEFINE UseBASSOutput} + {$DEFINE UseBASSInput} + + //{$DEFINE UsePortaudio} + //{$DEFINE UsePortmixer} + + {$DEFINE UseProjectM} + + {$IFDEF DEBUG} + {$IFNDEF DARWIN} + {$APPTYPE CONSOLE} + {$ENDIF} + {$ENDIF} +{$ELSE} + //{$DEFINE FFMpegAudio} +// {$DEFINE UsePortaudio} + {$DEFINE UseProjectM} +{$ENDIF} + +{$IF Defined(UseBASSInput) or Defined(UseBASSOutput)} + {$DEFINE UseBASS} +{$IFEND} |