diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Visualization/vis_avs/laser | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/Plugins/Visualization/vis_avs/laser')
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/LD32.H | 964 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/laser.cpp | 149 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/laserline.cpp | 218 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/laserline.h | 55 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/ld32.c | 187 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/linelist.cpp | 107 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/linelist.h | 57 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/rl_beathold.cpp | 165 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/rl_bren.cpp | 183 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/rl_cones.cpp | 363 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/rl_line.cpp | 338 | ||||
-rw-r--r-- | Src/Plugins/Visualization/vis_avs/laser/rl_trans.cpp | 338 |
12 files changed, 3124 insertions, 0 deletions
diff --git a/Src/Plugins/Visualization/vis_avs/laser/LD32.H b/Src/Plugins/Visualization/vis_avs/laser/LD32.H new file mode 100644 index 00000000..b9a55cea --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/LD32.H @@ -0,0 +1,964 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#define LDDLL_PREFIX +/************************************************************************* +* Helpful Stuff * +**************************************************************************/ + +/* +This header file defines a prefix. This is used by C++ programs to append a prefix to the definitions. +For C programs that use the LD2000.H file and associated library, use the following + #define LDDLL_PREFIX //Define the prefix in LD2000.H file as nothing + #include "ld2000.h" +For C++ programs, use the following + #define LDDLL_PREFIX extern "C" //Define the prefix in LD2000.H file as extern "C" to indicate that the names in the lib file have not been mangled + #include "ld2000.h" +*/ + +/************************************************************************* +* Error Codes * +**************************************************************************/ + +#define LDERR_OK 0 //Normal Return value + +//********** These can occur at any time except InitialQMCheck **** +#define LDERR_FIFO_READ_ERROR -1 //Fifo read zero or non even number of bytes +#define LDERR_QM32_SOFTWARE_ERROR -2 //QM32 is not responding properly + + +//********** These are reported by the loaders including LoadPalette +#define LDERR_X29_LOADED -11 //File load Successful Return +#define LDERR_LDA_LOADED -12 //values +#define LDERR_ILDA_LOADED -13 +#define LDERR_DEC3_LOADED -14 +#define LDERR_LDB_LOADED -15 +#define LDERR_LDSECURE_LOADED -16 + + +//********* Returned by ConvertToPointFrame ************** +#define LDERR_ALREADY_POINT_ORIENTED -31 //Incase somebody tries to + //create a point oriented frame + //from a point oriented frame + +//******** Currently only returned by CheckSession ************** +#define LDERR_NO_SESSION_IN_PROG -101 //CheckSession return value + +//******** Returned by LFileRequest and LPaletteRequest ********* +#define LDERR_FILE_REQUEST_CANCEL -201 //File Requestor Cancelled + +//********* Returned by file functions ************************** +#define LDERR_FILE_NOT_FOUND -401 //Loader errors +#define LDERR_WRONG_FILE_TYPE -402 +#define LDERR_DISK_FULL -403 +#define LDERR_DISK_WRITE_PROTECTED -404 +#define LDERR_FILE_WRITE_PROTECTED -405 +#define LDERR_MISC_FILE_ERROR -406 +#define LDERR_STRING_TOO_LONG -407 //Supplied filename is over 128 chars in length + +//*********** Returned by frame commands such as DisplayFrame *** +#define LDERR_FRAME_OUT_OF_RANGE -501 //Misc programming or config errors + +//*********** Returned by point commands such as writepoint ***** +#define LDERR_POINT_OUT_OF_RANGE -502 + +//*********** Returned by show control commands ***************** +#define LDERR_TDC_NOT_FOUND -511 +#define LDERR_TRANSITION_NOT_FOUND -512 +#define LDERR_EFFECT_NOT_FOUND -513 +#define LDERR_SCENE_NOT_FOUND -514 +#define LDERR_MODULE_NOT_FOUND -515 +#define LDERR_SHOW_NOT_FOUND -516 +#define LDERR_STRUCTURE_NOT_FOUND -519 + +//Once the element has been deleted, this will be returned +#define LDERR_EFFECT_DELETED -530 +#define LDERR_SCENE_DELETED -531 +#define LDERR_MODULE_DELETED -532 +#define LDERR_SHOW_DELETED -533 +#define LDERR_STRUCTURE_DELETED -539 + +//If you try to delete something which is inuse one of these will be returned +#define LDERR_EFFECT_INUSE -540 +#define LDERR_SCENE_INUSE -541 +#define LDERR_MODULE_INUSE -542 +#define LDERR_SHOW_INUSE -543 +#define LDERR_STRUCTURE_INUSE -549 + +//*********** These should be rare indeed *********************** +#define LDERR_NO_IBM_MEMORY -601 //No free IBM Memory +#define LDERR_CANT_OPEN_WINDOW -602 //Can't open Window (Debug, FileRequest) + +//*********** Alot of commands can return this one ************** +#define LDERR_NO_QM32_MEMORY -702 //No free QM32 Memory + +//*********** Ran out of memory while trying to load a file ***** +#define LDERR_FILE_TOO_LARGE -703 //No free QM32 Memory to load frames + +//********** Several unimplemented DLL commands return this ***** +#define LDERR_NOT_IMPLEMENTED -801 //DLL Command not implemented + +//*** This indicates a timeout during a long communication with the QM32 +//*** This only occurs during file loading and saving and ActiveArray functions +#define LDERR_QM32_ERROR -901 //QM32 Communication error + +//***** These should only be returned by InitialQMCheck ********* +#define LDERR_QM32_NOT_PRESENT -1001 //QM32 is not present (like it sounds) +#define LDERR_QM32_ADDRESS_CONFLICT -1002 //QM32 is not responding properly +#define LDERR_QM32_INITIALIZATION_ERROR -1003 //Same as above, but even weirder + +/************************************************************************* +* QM32 Error Codes * +**************************************************************************/ + +//*** This is a sure sign of QM32 hardware trouble +#define QM32ERROR_NullCommand 1 + +//*** Usually because of no laser code running in the QM32 but could +//*** be caused by a DLL / Q32 mismatch. +#define QM32ERROR_UndefinedCommand 2 + +//*** Should only occur during BeginSession. This indicates that a +//*** communications error has occured while loading the file LD.Q32 +#define QM32ERROR_DownloadBad 3 +#define QM32ERROR_ChecksumBad 4 + +//*** This is usually caused by a DLL / Q32 mismatch. If it happens +//*** inconsistantly then this could be a sign of QM32 hardware trouble +#define QM32ERROR_Insufficient 5 + +//*** When the QM32 is reset it does 3 ram tests. If one of them fails, this +//*** would be returned. This is a sign of QM32 hardware trouble. +#define QM32ERROR_DramTestBad 6 + +//*** If somebody tampers with the rom chip, this would be returned. Actually +//*** nothing may be returned because the QM32 would probably lock up. +#define QM32ERROR_RomTestBad 7 + +//*** This is equivalent to the Amiga's GURU meditation. It occurs when some +//*** kind of QM32 software violates the system. (divide by zero, access to memory that isn't there, etc.) +//*** In certain circomstances, it may also be caused by a hardware problem. +#define QM32ERROR_AccessError 8 + +//*************************************************************************** +// Flags used by RedrawFrameFast and other things * +//*************************************************************************** + +#define RFF_NOBLIT 64 //RedrawFrameFast should not copy the bitmap to the screen +#define RFF_NOINITMINMAX 128 //RedrawFrameFast should not init Min and Max variables to 0 +#define RFF_DOUBLEBUFFER 2048 //RedrawFrameFast should use double buffering +#define RFF_WHITEDOT 8192 //RedrawFrame should place a white dot at the first point +#define RFF_MONITORPZ 32768 //RedrawFrame should use the laser coordinates from the monitor buffer and not the laser coordinates +#define RFF_GRAYBLANKING 65536 //Show blanking lines as gray lines +#define RFF_SELECTEDZONES 131072 //Show only the selected zones, supplied in the Frame parameter of RedrawFrameFast + +//*************************************************************************** +// Flags used by DisplayUpdateEx and sometimes by PlayShowEx * +//*************************************************************************** + +#define DU_LASEROUTPUT 1 //DisplayUpdate should show laser output +#define DU_BEGINSLEW 16 //DisplayUpdate should slew beginning blanked points leading up to the first track +#define DU_CUTSCAN 256 //DisplayUpdate should immediately stop scanning buffer and start a new buffer + + +/************************************************************************** +* Structures * +***************************************************************************/ + +typedef struct tagDMXCHANNELMAP{ + LONG Function; + SHORT SlewRate; + SHORT Mode; + LONG Reserved1; + LONG Reserved2; + LONG Reserved3; + LONG StartupSource; + LONG StartupValue; + LONG ShutdownSource; + LONG ShutdownValue; + LONG ESTOPSource; + LONG ESTOPValue; + LONG DeselectedSource; + LONG DeselectedValue; + LONG Source; + LONG Value; + LONG STMin; + LONG DMXMin; + LONG STMax; + LONG DMXMax; + LONG STOrigin; + LONG STExtent; + LONG DMXOrigin; + LONG DMXExtent; + LONG DMXExtentOV2; +} DMXCHANNELMAP; + +typedef struct tagDMXMAP{ + SHORT Reserved1; + SHORT NumChannels; + SHORT Reserved2; + SHORT StartingChannel; + SHORT Reserved3; + SHORT DeviceType; + SHORT Reserved4; + SHORT Nondisplayed; +} DMXMAP; + +typedef struct tagPROJECTIONZONE{ + LONG Scanner; //Scanner for output + + LONG XSize; //Geometric Correction variable -- X Size + LONG YSize; //Geometric Correction variable -- Y Size + LONG XPosition; //Geometric Correction variable -- X Position + LONG YPosition; //Geometric Correction variable -- Y Position + LONG ZRotation; //Geometric Correction variable -- Z Rotation angle + LONG XLinearity; //Geometric Correction variable -- X Linearity + LONG YLinearity; //Geometric Correction variable -- Y Linearity + LONG XKeystone; //Geometric Correction variable -- X Keystone + LONG YKeystone; //Geometric Correction variable -- Y Keystone +//10 + LONG XPincussion; //Geometric Correction variable -- X Pin + LONG YPincussion; //Geometric Correction variable -- Y Pin + LONG XPincussionOffset; //Geometric Correction variable -- X Pin Offset + LONG YPincussionOffset; //Geometric Correction variable -- Y Pin Offset + LONG XBow; //Geometric Correction variable -- X Bow + LONG YBow; //Geometric Correction variable -- Y Bow + LONG XBowOffset; //Geometric Correction variable -- X Bow Offset + LONG YBowOffset; //Geometric Correction variable -- Y Bow Offset + LONG XShear; //Geometric Correction variable -- X Shear + LONG YShear; //Geometric Correction variable -- Y Shear +//20 + LONG XSymmetry; //Geometric Correction variable -- X Symmetry + LONG YSymmetry; //Geometric Correction variable -- Y Symmetry + LONG Reserved1; //Geometric Correction variable -- Reserved for future use + LONG Reserved2; //Geometric Correction variable -- Reserved for future use + + LONG NoMinimumPointsFlag; //BOOL: Don't require minimum points during DisplayUpdate + LONG AllowManipulationsFlag; //BOOL: Allow Scale, Rotate, Position, Perspective and other effects. + LONG AllowMasterResizeFlag; //BOOL: Allow the master size and position controls to affect this projection zone + LONG UseGeometricCorrectionData; //BOOL: Observe geometric correction data when calculating beam position + + LONG PreviewWindowXSize; //X Size of the image drawn on the preview window + LONG PreviewWindowYSize; //Y Size of the image drawn on the preview window +//30 + LONG PreviewWindowXPosition; //X Position of the image drawn on the preview window + LONG PreviewWindowYPosition; //Y Position of the image drawn on the preview window + LONG PreviewWindowXProjectorPosition; //X Position of the center of all of the beam lines + LONG PreviewWindowYProjectorPosition; //Y Position of the center of all of the beam lines + + LONG PreviewWindowMirrorXOutput; //BOOL: Produce a duplicate output with mirrored X output + LONG PreviewWindowMirrorXProjector; //BOOL: Produce a duplicate output with mirrored X position + LONG PreviewWindowShowAsBeamsFlag; //BOOL: When drawing on the preview window, show this as beams + + LONG ScannerOptimizer; //BOOL: Optimize blanking path within this projection zone + + LONG UseProtectionData; //BOOL: Observe protection data when calculating brightness + + LONG Reserved7; //Reserved for future use +//40 long words = 160 bytes + LONG Reserved8; //Reserved for future use + LONG Reserved9; + LONG Reserved10; + LONG Reserved11; + LONG Reserved12; + + char Name[24]; //40 byte name field + + char Reserved200[200]; //200 reserved bytes + + short GeometricCorrectionData[8450]; //65*65*2 integers for geometric correction + + char ProtectionZoneData[4096]; //64*64=4096 bytes for protection zone bitmap +} PROJECTIONZONE; + + + +typedef struct tagCOLORREGSTRUCT{ + LONG ColorIndex; + LONG RedScreenVal; + LONG GreenScreenVal; + LONG BlueScreenVal; + LONG RedLaserVal; + LONG GreenLaserVal; + LONG BlueLaserVal; + LONG DeepBlueLaserVal; + LONG YellowLaserVal; + LONG FocusLaserVal; + LONG IntensityLaserVal; + LONG ShutterLaserVal; +} COLORREGSTRUCT; + +typedef struct tagPTSTRUCT{ + LONG XCoord; + LONG YCoord; + LONG ZCoord; + LONG FCoord; + LONG RGBValue; + LONG X3DCoord; + LONG Y3DCoord; + LONG Group; + LONG Status; +} PTSTRUCT; + +typedef struct tagFRAMESTRUCT{ + LONG VOFlag; + LONG ScanRateMultiplier; + LONG AbstractFlag; + LONG NumPoints; + char FrameNote[24]; +} FRAMESTRUCT; + +typedef struct tagFRAMESTRUCTEX{ + LONG ChangedFlag; //Indicates that this frame has changed since the last time it was saved. This is read-only. + LONG ThreeDFlag; //Indicates that this frame is stored internally as 3D data. This is read-only. + LONG BeamBrushFlag; //Indicates that this frame stores beam brush points internally. This is read-only. + LONG VectorFlag; //Indicates that this frame is to be rendered using the vector renderer. This is read/write. + LONG AbstractFlag; //Indicates that this frame has additional abstract information and that this should be rendered as an abstract. + LONG DMXFlag; //Indicates that this frame has DMX data in addition to point and perhaps abstract data. + LONG RasterFlag; //Indicates that this frame is a raster frame. No special internal handling is done at this time. + LONG MaxRenderedFlag; //Indicates that this frame was rendered by 3D Studio MAX. + LONG SecureFrameFlag; //Indicates that this frame is secured. + LONG Reserved3; //Reserved for future use + LONG PreferredPalette; //Palette that this frame will use unless overridden by Track. + LONG PreferredProjectionZone; //Projection zone that this frame will be projected onto unless overridden by track. + LONG AnimationCount; //Number of frames to the end of the animation. Range is 0 to 65535. + LONG ClipartClass; //Number, usually bit-encoded, that describes the frame. This is only 16-bits internally. + LONG ScanRate; //Scan rate for this frame. If positive, handled as a multiplier. If negative, treated as exact sample rate in 1K increments. + LONG NumPoints; //Number of data points in this frame. + char FrameNote[24]; //23 character, plus null, frame note. +} FRAMESTRUCTEX; + + +//************************************************************************* +//* Constants +//************************************************************************* + +#define frontview 1 +#define topview 2 +#define sideview 3 +#define threeDview 4 +#define BLACK RGB(0,0,0) +#define DARKGRAY RGB(128,128,128) +#define LIGHTGRAY RGB(192,192,192) +#define WHITE RGB(255, 255, 255) + + +//********************************************************************************** +// LD2000.DLL API Functions +//********************************************************************************** + + +//------------------------------------------------------------------------------------------- +// LD Comm Window Functions +//------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI OpenLDCommWindow(void); +LDDLL_PREFIX LONG WINAPI CloseLDCommWindow(void); +LDDLL_PREFIX LONG WINAPI WriteToLDCommWindow(LPSTR SUPPLY_OutputString); +LDDLL_PREFIX LONG WINAPI QM32BeepOnError(LONG OnOff); //Controls whether or not the Comm window automatically opens + + +//-------------------------------------------------------------------------------------------- +// Port functions. Only used in the Interactive Character project. +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX unsigned short WINAPI ldInp(unsigned short PortID); + +LDDLL_PREFIX unsigned short WINAPI ldInpw(unsigned short PortID); + +LDDLL_PREFIX unsigned short WINAPI ldOutp(unsigned short PortID, short DataByte); + +LDDLL_PREFIX unsigned short WINAPI ldOutpw(unsigned short PortID, unsigned short DataWord); + +//-------------------------------------------------------------------------------------------- +// Status and setting and retrieval +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI GetLDStatus(LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI GetDates(LPLONG RETURN_DLLDate, LPLONG RETURN_LibDate, LPLONG RETURN_RomDate); + +LDDLL_PREFIX LONG WINAPI GetSerialNumber(LPLONG RETURN_SerialNumber); + + +//------------------------------------------------------------------------------------------ +// QuadMod and session functions +//------------------------------------------------------------------------------------------ + +LDDLL_PREFIX LONG WINAPI GetLDDLLModuleUsage(LPLONG ModuleUsage); + +LDDLL_PREFIX LONG WINAPI QM32AvailMemEx(LPLONG RETURN_TotalMemory, LPLONG RETURN_TotalFreeMemory, LPLONG RETURN_LargestBlock, LPLONG RETURN_NumFreeBlocks); +LDDLL_PREFIX LONG WINAPI QM32DefragmentMem(LPLONG RETURN_NumBlocksCombined); +LDDLL_PREFIX LONG WINAPI RebootQM32(void); +LDDLL_PREFIX LONG WINAPI InitialQMCheck(LPLONG RETURN_LDStatus); +LDDLL_PREFIX LONG WINAPI BeginSession(LONG MaxFrames, LONG MaxPoints, LONG MaxBuffer, LONG UndoFrames, LPLONG RETURN_LDStatus); +LDDLL_PREFIX LONG WINAPI CheckSession(LPLONG RETURN_LDStatus); +LDDLL_PREFIX LONG WINAPI CheckSessionSettings(LPLONG RETURN_MaxFrames, LPLONG RETURN_MaxPoints, LPLONG RETURN_MaxBuffer, LPLONG RETURN_UndoFrames, LPLONG RETURN_LDStatus); +LDDLL_PREFIX LONG WINAPI EndSession(void); + +LDDLL_PREFIX LONG WINAPI BeginSessionEx(LPLONG RETURN_Version, LPLONG RETURN_MaxFrames, LPLONG RETURN_MaxPoints, LPLONG RETURN_MaxBuffer, LPLONG RETURN_UndoFrames, LPLONG RETURN_LDStatus); +//Does everything necessary to start a session including checking settings and loading parameters from INI file including palette and geometric correction data + + +//------------------------------------------------------------------------------------------ +// Working Scanners, Tracks, Frames +//------------------------------------------------------------------------------------------ + +LDDLL_PREFIX LONG WINAPI SetWorkingScanners(LONG Scanner); +LDDLL_PREFIX LONG WINAPI GetWorkingScanners(LONG *RETURN_ScannerSelection); + +LDDLL_PREFIX LONG WINAPI SetWorkingTracks(LONG Track); + +LDDLL_PREFIX LONG WINAPI SetWorkingFrame(LONG FrameNumber); +LDDLL_PREFIX LONG WINAPI GetWorkingFrame(LPLONG RETURN_Frame); + + +//------------------------------------------------------------------------------------------- +// Projection Zone Functions +//------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI ReadProjectionZone(LONG ZoneNumber, PROJECTIONZONE *RETURN_PZ); + +LDDLL_PREFIX LONG WriteProjectionZone(LONG ZoneNumber, PROJECTIONZONE *SUPPLY_PZ); + +LDDLL_PREFIX LONG WINAPI LoadProjectionZones(LPSTR ZoneFilename, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI SaveProjectionZones(LPSTR ZoneFilename, LPLONG RETURN_LDStatus); + + +//----------------------------------------------------------------------------------------- +// Showtime Synchronization Functions +//----------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI QM32MultiCommand(LONG Allow); +LDDLL_PREFIX LONG WINAPI SetSyncParameters(LONG Proportional, LONG Integral, LONG Derivative); +LDDLL_PREFIX LONG WINAPI SendSync(LONG CurrentTime); +LDDLL_PREFIX LONG WINAPI SendMultiSync(LONG CurrentTime); +LDDLL_PREFIX LONG WINAPI GetShowTimeMilliseconds(LPLONG RETURN_CurrentTime); +LDDLL_PREFIX LONG WINAPI GetQMEvents(LPLONG RETURN_nEvents, LPSTR RETURN_MIDIEventStruct); +LDDLL_PREFIX LONG WINAPI SendSyncGetQMEvents(LONG CurrentTime, LPLONG RETURN_nEvents, LPSTR RETURN_MIDIEventStruct); + + +//-------------------------------------------------------------------------------------------- +// Showtime operation functions +//-------------------------------------------------------------------------------------------- + + +LDDLL_PREFIX LONG WINAPI SetResetTTL(LONG IOMask, LONG OutputData); //This may go away + +LDDLL_PREFIX LONG WINAPI PlayShowEx(LONG StartTime, LONG EndTime, LONG PlaySpeed, LONG Mode); + +LDDLL_PREFIX LONG WINAPI StopShow(void); //Correct way to stop a show in progress. + + +LDDLL_PREFIX LONG WINAPI StopShowEx(LONG Mode); //Mode parameter allows you to skip the final refresh after PlayShow has ended. + +//-------------------------------------------------------------------------------------------- +// Showtime file functions +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI LoadShowStructures(LPSTR Filename, LONG StructureTypes, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI SaveShowStructures(LPSTR Filename, LONG StructureTypes, LPINT RETURN_LDStatus); + + +//-------------------------------------------------------------------------------------------- +// Laser Display Functions +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI ResetLD(void); //Updates all track variables + +LONG WINAPI DisplayGeometricCorrection( long Enable, long YLine, short *GeometryData); //GeometryData must be in device coordinates + +LDDLL_PREFIX LONG WINAPI DisplaySize( float XSize, float YSize, float ZSize, float CSize, float FSize); // Normalized Variables + +LDDLL_PREFIX LONG WINAPI DisplayPosition( float XPosition, float YPosition ); // Normalized Variables + +LDDLL_PREFIX LONG WINAPI DisplayAuxOutput(float OutputVoltage); + +LDDLL_PREFIX LONG WINAPI lsDisplayAuxOutput(float OutputVoltage, float ZSize, float ZOffset); + +LDDLL_PREFIX LONG WINAPI DisplayMasterAngle(float XAngle, float YAngle, float ZAngle); //Normalized + + +LDDLL_PREFIX LONG WINAPI DisplayFreq3(long PointFreq, long VectorFreq, long AbstractFreq, LPLONG RETURN_ActualPointFreq, LPLONG RETURN_ActualVectorFreq, LPLONG RETURN_ActualAbstractFreq); + +LDDLL_PREFIX LONG WINAPI DisplayScanLimits(LONG FromPt, LONG ToPt); + +LDDLL_PREFIX LONG WINAPI DisplayObjectSettings(LONG VisibleBeginEmph, LONG VisibleMiddleEmph, + LONG VisibleEndEmph, LONG VisibleDensity, + LONG BlankedBeginEmph, LONG BlankedEndEmph, + LONG BlankedDensity); + +LDDLL_PREFIX LONG WINAPI DisplayAbstractSettings(LONG NumVisible, LONG NumOverscan, LONG NumOverlap); + +LDDLL_PREFIX LONG WINAPI DisplayFlags(LONG Flags); + +LDDLL_PREFIX LONG WINAPI SetGetDisplayFlags(LONG Mode, LONG TrackNumber, LPLONG RETURN_Flags); + +LDDLL_PREFIX LONG WINAPI DisplayMaskFlags(LONG MaskFlags); + +LDDLL_PREFIX LONG WINAPI DisplayScale(float XScale, float YScale, float ZScale); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayRotCenter(float XRotCent, float YRotCent, float ZRotCent); // Normalized + +LDDLL_PREFIX LONG WINAPI DisplayAngle(float XAngle, float YAngle, float ZAngle); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayAngleDegrees(float XAngle, float YAngle, float ZAngle); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayRotOrder(LONG RotationOrder); + +LDDLL_PREFIX LONG WINAPI DisplayWAngle(float XAngle, float YAngle, float ZAngle); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayWAngleDegrees(float XAngle, float YAngle, float ZAngle); //Normalized + +LDDLL_PREFIX LONG WINAPI AutoRotateInit(float InitialXAngle, float InitialYAngle, + float InitialZAngle, LONG AnimateFromFrame, + LONG AnimateToFrame, long AutoRotateTrack); + +LDDLL_PREFIX LONG WINAPI AutoRotateIncrement(float XIncrement, float YIncrement, float ZIncrement, LONG TenthFlag); + +LDDLL_PREFIX LONG WINAPI AutoRotatePlus(LONG Rotate, LONG GenerateAbstract, LONG Animate, LONG Extra); //Pretty much unneccessary now + +LDDLL_PREFIX LONG WINAPI DisplayPostTrans(float XOffs, float YOffs, float ZOffs); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayStereoSettings(float EyeSeparation, long EndOfScanDelay, + float StereoIDLEVoltage, float StereoLEFTVoltage, float StereoRIGHTVoltage); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayPerspective(float Dist, float Xobs, float Yobs, float Zobs);//Norm + +LDDLL_PREFIX LONG WINAPI DisplayWindow( float WinLeft, + float WinRight, float WinBottom, float WinTop, + float WinRear, float WinFront); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayWindowX(float WinLeft, float WinRight); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayWindowY(float WinBot, float WinTop); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayWindowZ(float WinRear, float WinFront); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayCSize(float ColorSize); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayPaletteSelect(LONG Palette1, LONG Palette2); + +LDDLL_PREFIX LONG WINAPI DisplayPaletteMix(float MixValue); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayHueOffset(LONG HueStart, LONG HueEnd, LONG HueNew); + +LDDLL_PREFIX LONG WINAPI DisplaySaturation(float SaturationLevel); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayPath(LONG Frame, LONG Point); + +LDDLL_PREFIX LONG WINAPI DisplayIris(float IrisLevel); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayColorWheel(float ColorWheelLevel); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayGoboWheel(float Gobo1, float Gobo2, float Gobo3); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayGoboRotate(float Gobo1, float Gobo2, float Gobo3); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayFrost(float Frost1, float Frost2, float Frost3); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayFocus(float FocusLevel); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayMiscControl(float M1, float M2, float M3); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayDepthCue(float DepthEffect, float MinimumZ, float MaximumZ); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayTrackAllow(long Permission); + +LDDLL_PREFIX LONG WINAPI DisplayProjectionZones(long ProjectionZoneCode); + +LDDLL_PREFIX LONG WINAPI SetGetDisplayProjectionZones(LONG Mode, LONG TrackNumber, LPLONG RETURN_ProjectionZoneCode); + +LDDLL_PREFIX LONG WINAPI DisplayFrame(LONG Frame); + +LDDLL_PREFIX LONG WINAPI SetGetDisplayFrame(LONG Mode, LONG TrackNumber, LPLONG RETURN_FrameNumber); + +LDDLL_PREFIX LONG WINAPI DisplayFrameMix(LONG ToFrame, float MixValue); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplayPreTrans( float XOffs, float YOffs, float ZOffs); //Normalized + +LDDLL_PREFIX LONG WINAPI DisplaySkew(LONG TrackDelay, LONG ColorShift, LONG FocusShift); +LDDLL_PREFIX LONG WINAPI DisplayMinimumPoints(LONG MinimumPoints); + +LDDLL_PREFIX LONG WINAPI DisplayUpdateTest(void); + +LONG WINAPI DisplayBufferStatus(LONG *RETURN_BufferIsFree, LONG *RETURN_CurrentOutputPoints); + +LDDLL_PREFIX LONG WINAPI DisplayUpdate(void); + +LDDLL_PREFIX LONG WINAPI DisplayUpdateToFrame(LONG Frame); + +LDDLL_PREFIX LONG WINAPI DisplayUpdateEx(LONG Mode); + +LDDLL_PREFIX LONG WINAPI DisplayUpdateMode(LONG SyncMode, LONG LeftRightUpdate); + +//-------------------------------------------------------------------------------------------- +// QuadMod DMX-512 functions +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI QMDMXMode(LONG DMXMode, LONG TransmitBreakLength, LONG TransmitMABLength, LONG TransmitStartCode, LONG TransmitNumChannels, LONG TransmitRestLength); + +LDDLL_PREFIX LONG WINAPI QMDMXInput(LONG ChannelNumber, LPLONG RETURN_Data); + +LDDLL_PREFIX LONG WINAPI QMDMXOutput(LONG ChannelNumber, LONG Data); + +LDDLL_PREFIX LONG WINAPI QMDMXVirtualChannels(LONG PortAStartChannel, LONG PortBStartChannel, LONG AUXOutChannel, LONG GraphicsShutterChannel); + +LDDLL_PREFIX LONG WINAPI QMDMXStartupFrame(LONG Frame); + +LDDLL_PREFIX LONG WINAPI QMDMXShutdownFrame(LONG Frame); + +LDDLL_PREFIX LONG WINAPI QMDMXESTOP(void); + +LDDLL_PREFIX LONG WINAPI DMXToFrame(void); + +LDDLL_PREFIX LONG WINAPI FrameToDMX(void); + +LDDLL_PREFIX LONG WINAPI GetDMXMap(DMXMAP *RETURN_DMXMap); + +LDDLL_PREFIX LONG WINAPI SetDMXMap(DMXMAP *SUPPLY_DMXMap); + +LDDLL_PREFIX LONG WINAPI GetDMXChannelMap(LONG ChannelNumber, DMXCHANNELMAP *RETURN_DMXChannel); + +LDDLL_PREFIX LONG WINAPI SetDMXChannelMap(LONG ChannelNumber, DMXCHANNELMAP *SUPPLY_DMXChannel); + + +//------------------------------------------------------------------------------------------- +// Frame Loading and Saving +//------------------------------------------------------------------------------------------- + + +LDDLL_PREFIX LONG WINAPI LoadLDA(LPSTR Filename, LPLONG SUPPLY_FileFromFr, LPLONG SUPPLY_FromFr, LPLONG SUPPLY_ToFr,LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI LoadLDB(LPSTR Filename, LPLONG SUPPLY_FileFromFr, LPLONG SUPPLY_FromFr, LPLONG SUPPLY_ToFr, LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI LoadLDSecure(LPSTR Filename, LPLONG SUPPLY_FileFromFr, LPLONG SUPPLY_FromFr, LPLONG SUPPLY_ToFr, LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI LoadLFile(LPSTR Filename, LPLONG SUPPLY_FromFr, LPLONG SUPPLY_ToFr, LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI ReadFileInfo(LPSTR Filename, LPSTR RETURN_Description, LPLONG RETURN_NumFrames, LPLONG RETURN_Format, LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI SaveLFile(LPSTR Filename, LPSTR Description, LPLONG SUPPLY_FromFr, LPLONG SUPPLY_ToFr, LPLONG Format, LPSTR SUPPLY_Password, LPLONG RETURN_LDStatus); + + +//------------------------------------------------------------------------------------------- +// Frame Functions +//------------------------------------------------------------------------------------------- + + +LDDLL_PREFIX LONG WINAPI FindFrame(LPSTR Frame, LPLONG RETURN_FrameNumber); + +LDDLL_PREFIX LONG WINAPI ReadMaskData(LONG TrackNumber, LONG FAR* RETURN_MaskData); + +LDDLL_PREFIX LONG WINAPI SetChangedFlag(LONG FrameNumber, LONG State); + +LDDLL_PREFIX LONG WINAPI ReadFrameStruct(LONG FrameNumber, FRAMESTRUCT *RETURN_FrameStruct); + +LDDLL_PREFIX LONG WINAPI ReadFrameStructEx(LONG FrameNumber, FRAMESTRUCTEX *RETURN_FrameStructEx); + +LDDLL_PREFIX LONG WINAPI WriteFrameStructEx(LONG FrameNumber,FRAMESTRUCTEX *SUPPLY_FrameStructEx); + +LDDLL_PREFIX LONG WINAPI ReadFrame(FRAMESTRUCT *RETURN_FrameStruct, PTSTRUCT *RETURN_PointArray); + +LDDLL_PREFIX LONG WINAPI WriteFrame(FRAMESTRUCT *SUPPLY_FrameStruct, PTSTRUCT *SUPPLY_PointArray); + +LDDLL_PREFIX LONG WINAPI WriteFrameEx(FRAMESTRUCTEX *SUPPLY_FrameStructEx, PTSTRUCT *SUPPLY_PointArray); + +LDDLL_PREFIX LONG WINAPI CopyFrameActive(LONG SourceFrame, LONG DestFrame, LPLONG SUPPLY_ActiveArray); + +LDDLL_PREFIX LONG WINAPI CopyBlock(LONG FromFrame, LONG ToFrame, LONG DestFrame); + +LDDLL_PREFIX LONG WINAPI ReverseBlock(LONG FromFrame, LONG ToFrame); + +LDDLL_PREFIX LONG WINAPI DeleteFrames(LONG FromFr, LONG ToFr); + +LDDLL_PREFIX LONG WINAPI MergeFrames(LONG source1fr, LONG source2fr, LONG destfr); + +LDDLL_PREFIX LONG WINAPI FrameToUndoActive(LPLONG SUPPLY_ActiveArray); //If no active array is used, supply a NULL pointer. + +LDDLL_PREFIX LONG WINAPI UndoToFrameActive(LPLONG RETURN_ActiveArray); //If no active array is used, supply a NULL pointer. + + +//-------------------------------------------------------------------------------------------- +// Vector Frame functions +//-------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI ConvertToVectorFrame(LONG OptimizePath, LONG PreserveBlanking, + LONG StartingX, LONG StartingY, LONG StartingZ); + +LDDLL_PREFIX LONG WINAPI ConvertToPointFrame(LONG VisibleBeginEmph, LONG VisibleMiddleEmph, + LONG VisibleEndEmph, LONG VisibleDensity, + LONG BlankedBeginEmph, LONG BlankedEndEmph, + LONG BlankedDensity); + +//------------------------------------------------------------------------------------------- +// Point Functions +//------------------------------------------------------------------------------------------- + + +LDDLL_PREFIX LONG WINAPI ReadNumPoints(LPLONG RETURN_NumPoints); + +LDDLL_PREFIX LONG WINAPI ReadPoint(LONG PointNumber, PTSTRUCT *RETURN_PtStruct); + +LDDLL_PREFIX LONG WINAPI WritePoint(LONG PointNumber, PTSTRUCT *SUPPLY_PtStruct); + +LDDLL_PREFIX LONG WINAPI SetInsertOnWrite(LONG TrueOrFalse); //For WritePoint function + + +LDDLL_PREFIX LONG WINAPI DeletePoints(LONG FromPt, LONG ToPt); + +LDDLL_PREFIX LONG WINAPI InsertPoints(LONG FromPt, LONG ToPt); + +LDDLL_PREFIX LONG WINAPI InvertPointsActive(LONG FromPt, LONG ToPt, LONG XOffs, LONG YOffs, + LONG ZOffs, LONG Mask, LPLONG SUPPLY_ActiveArray); + +LDDLL_PREFIX LONG WINAPI MovePointsActive(LONG FromPt, LONG ToPt, LONG XOffs, LONG YOffs, + LONG ZOffs, LONG Mask, LPLONG SUPPLY_ActiveArray); + +LDDLL_PREFIX LONG WINAPI ResizePointsActive(LONG FromPt, LONG ToPt, + float XResizepct, float YResizepct, float ZResizepct, + LONG XResizectr, LONG YResizectr, LONG ZResizectr, + LONG Mask, LPLONG SUPPLY_ActiveArray); + +LDDLL_PREFIX LONG WINAPI RotatePointsActive(LONG FromPt, LONG ToPt, + float XRotatepct, float YRotatepct, float ZRotatepct, + LONG XRotatectr, LONG YRotatectr, LONG ZRotatectr, + LONG Mask, LPLONG SUPPLY_ActiveArray); + +LDDLL_PREFIX LONG WINAPI Set_XYZ_TO_3D_Track(LONG Track); + +LDDLL_PREFIX LONG WINAPI XYZ_TO_3D(LONG XCoord, LONG YCoord, LONG ZCoord, LPLONG RETURN_X3D, LPLONG RETURN_Y3D, LPLONG RETURN_VisibleFlag); + +//------------------------------------------------------------------------------------------- +// Palette and color Functions +//------------------------------------------------------------------------------------------- + + +LDDLL_PREFIX LONG WINAPI LoadPalette(LPSTR ColorFilename, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI LoadPaletteDots(LPSTR ColorFilename, LONG *RETURN_PaletteDotColor1, LONG *RETURN_PaletteDotColor2, LONG *RETURN_PaletteDotColor3, LONG *RETURN_PaletteDotColor4, LONG *RETURN_PaletteDotColor5, LONG *RETURN_PaletteDotColor6, LONG *RETURN_PaletteDotColor7, LONG *RETURN_PaletteDotColor8, char *RETURN_PaletteDotName1, char *RETURN_PaletteDotName2, char *RETURN_PaletteDotName3, char *RETURN_PaletteDotName4, char *RETURN_PaletteDotName5, char *RETURN_PaletteDotName6, char *RETURN_PaletteDotName7, char *RETURN_PaletteDotName8, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI SavePalette(LPSTR ColorFilename, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI SavePaletteDots(LPSTR ColorFilename, LONG *SUPPLY_PaletteDotColor1, LONG *SUPPLY_PaletteDotColor2, LONG *SUPPLY_PaletteDotColor3, LONG *SUPPLY_PaletteDotColor4, LONG *SUPPLY_PaletteDotColor5, LONG *SUPPLY_PaletteDotColor6, LONG *SUPPLY_PaletteDotColor7, LONG *SUPPLY_PaletteDotColor8, char *SUPPLY_PaletteDotName1, char *SUPPLY_PaletteDotName2, char *SUPPLY_PaletteDotName3, char *SUPPLY_PaletteDotName4, char *SUPPLY_PaletteDotName5, char *SUPPLY_PaletteDotName6, char *SUPPLY_PaletteDotName7, char *SUPPLY_PaletteDotName8, LPLONG RETURN_LDStatus); + +LDDLL_PREFIX LONG WINAPI TrainColorSystem(void); + +LDDLL_PREFIX LONG WINAPI UseDefaultColors(void); + +LDDLL_PREFIX LONG WINAPI EliminateUnusedColors(LONG LastColorNumber); + +LDDLL_PREFIX LONG WINAPI UpdateAlternatePalettes(void); + + +LDDLL_PREFIX LONG WINAPI ReadColorReg(COLORREGSTRUCT *RETURN_ColorStruct); + +LDDLL_PREFIX LONG WINAPI ReadColorRegEx(LONG PaletteSelect, COLORREGSTRUCT *RETURN_ColorStruct); + +LDDLL_PREFIX LONG WINAPI ReadNumColors(LPLONG RETURN_NumColors); + +LDDLL_PREFIX LONG WINAPI WriteColorReg(COLORREGSTRUCT *SUPPLY_ColorStruct); + +LDDLL_PREFIX LONG WINAPI WriteColorRegEx(LONG PaletteSelect, COLORREGSTRUCT *SUPPLY_ColorStruct); + +LDDLL_PREFIX LONG WINAPI ReadActuatorColorMode(LPLONG RETURN_Mode); + +LDDLL_PREFIX LONG WINAPI WriteActuatorColorMode(LONG Mode); + +LDDLL_PREFIX LONG WINAPI RGB4toRGB1(LPLONG SUPPLY_Red, LPLONG SUPPLY_Green, LPLONG SUPPLY_Blue, + LPLONG SUPPLY_MSB, LPLONG RETURN_RGBMValue); + +LDDLL_PREFIX LONG WINAPI RGB1toRGB4(LPLONG SUPPLY_RGBMValue, LPLONG RETURN_Red, LPLONG RETURN_Green, + LPLONG RETURN_Blue, LPLONG RETURN_MSB); + +LDDLL_PREFIX LONG WINAPI RGBtoHSV(LPLONG SUPPLY_RGB, LPLONG RETURN_HSV); + +LDDLL_PREFIX LONG WINAPI HSVtoRGB(LPLONG SUPPLY_HSV, LPLONG RETURN_RGB); + + +//------------------------------------------------------------------------------------------- +// Scale setting and getting functions. Sets coordinate scale for Frame/Point reading/writing +//------------------------------------------------------------------------------------------- + + + +LDDLL_PREFIX LONG WINAPI SetWorkingScale(LONG LogicalLeft, LONG LogicalRight, + LONG LogicalBottom, LONG LogicalTop, + LONG LogicalRear, LONG LogicalFront); + + +LDDLL_PREFIX LONG WINAPI SetWorkingScaleX(LONG LogicalLeft, LONG LogicalRight, + LONG LogicalOriginX, LONG DeviceLeft, + LONG DeviceRight, LONG DeviceOriginX); + +LDDLL_PREFIX LONG WINAPI SetWorkingScaleY(LONG LogicalBottom, LONG LogicalTop, + LONG LogicalOriginY, LONG DeviceBottom, + LONG DeviceTop, LONG DeviceOriginY); + +LDDLL_PREFIX LONG WINAPI SetWorkingScaleZ(LONG LogicalRear, LONG LogicalFront, + LONG LogicalOriginZ, LONG DeviceRear, + LONG DeviceFront, LONG DeviceOriginZ); + +LDDLL_PREFIX LONG WINAPI SetWorkingScaleF(LONG LogicalMaxFocus, LONG LogicalOriginF, + LONG DeviceMaxFocus, LONG DeviceOriginF); + +LDDLL_PREFIX LONG WINAPI GetWorkingScaleX(LPLONG LogicalLeft, LPLONG LogicalRight, + LPLONG LogicalOriginX, LPLONG DeviceLeft, + LPLONG DeviceRight, LPLONG DeviceOriginX); + +LDDLL_PREFIX LONG WINAPI GetWorkingScaleY(LPLONG LogicalBottom, LPLONG LogicalTop, + LPLONG LogicalOriginY, LPLONG DeviceBottom, + LPLONG DeviceTop, LPLONG DeviceOriginY); + +LDDLL_PREFIX LONG WINAPI GetWorkingScaleZ(LPLONG LogicalRear, LPLONG LogicalFront, + LPLONG LogicalOriginZ, LPLONG DeviceRear, + LPLONG DeviceFront, LPLONG DeviceOriginZ); + +LDDLL_PREFIX LONG WINAPI GetWorkingScaleF(LPLONG LogicalMaxFocus, LPLONG LogicalOriginF, + LPLONG DeviceMaxFocus, LPLONG DeviceOriginF); + +//------------------------------------------------------------------------------------------- +// Screen Drawing Functions +//------------------------------------------------------------------------------------------- + + + +LDDLL_PREFIX LONG WINAPI SetLaserWindow(LONG LeftEdge, LONG RightEdge, LONG BottomEdge, LONG TopEdge, LONG MagLevel); + +LDDLL_PREFIX LONG WINAPI DrawGrid(HWND hWnd, LONG gridHvalue, LONG gridVvalue, LONG MClearScreen, LONG MShowZero, LONG MShowGrid); + +LDDLL_PREFIX LONG WINAPI RedrawFrame(HWND hWnd, LONG frompt, LONG topt, LONG ViewMode, + LONG ClearScreenFlag, long HiliteColor, LONG MShowColorAtPts, + LONG MShowFocus); + +LDDLL_PREFIX LONG WINAPI RedrawFrameActive(HWND hWnd, LONG frompt, LONG topt, LONG ViewMode, + LONG ClearScreenFlag, long HiliteColor, LONG MShowColorAtPts, + LONG MShowFocus, LPLONG ActiveArray); + +LDDLL_PREFIX LONG WINAPI RedrawFrameActiveEx(HWND hWnd, LONG frompt, LONG topt, LONG ViewMode, + LONG ClearScreenFlag, long HiliteColor, LONG MShowColorAtPts, + LONG MShowFocus, LONG MShowBlankedLines, LONG MShowBlankedPoints, LPLONG ActiveArray); + +LDDLL_PREFIX LONG WINAPI RedrawFrameActiveDC(HWND hWnd, HDC hDC, LONG frompt, LONG topt, LONG ViewMode, + LONG ClearScreenFlag, long HiliteColor, LONG MShowColorAtPts, + LONG MShowFocus, LPLONG ActiveArray); + +LDDLL_PREFIX LONG WINAPI RedrawFrameActiveDCEx(HWND hWnd, HDC hDC, LONG frompt, LONG topt, LONG ViewMode, + LONG ClearScreenFlag, long HiliteColor, LONG MShowColorAtPts, + LONG MShowFocus, LONG MShowBlankedLines, LONG MShowBlankedPoints, LPLONG ActiveArray); + +LDDLL_PREFIX LONG WINAPI RedrawFrameFast(HWND hWnd, LONG FrameNumber, LONG ViewMode, LONG ClearScreenFlag, LONG MShowFocus); + +LDDLL_PREFIX LONG WINAPI RedrawFrameFastDC(HWND hWnd, HDC hDC, LONG FrameNumber, LONG ViewMode, LONG ClearScreenFlag, LONG MShowFocus); + +LDDLL_PREFIX LONG WINAPI RedrawFrameFastDCRECT(HWND hWnd, HDC hDC, RECT *rect, LONG FrameNumber, LONG ViewMode, LONG ClearScreenFlag, LONG MShowFocus); + +//------------------------------------------------------------------------------------------- +// Text functions +//------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI SetLineLimits(LONG NumBlanked, LONG NumEmphasis, LONG NumPoints, LONG Density); + +LDDLL_PREFIX LONG WINAPI LoadFont(LPSTR FontFilename, LPLONG RETURN_LDStatus); +LDDLL_PREFIX LONG WINAPI SetLaserChar(LONG ViewMode, LONG TextBlanked, LONG TextEmphasis, LONG Density, LONG Width, LONG Height, LONG MaxAngle, LONG AngleDetect, long RGBColor); +LDDLL_PREFIX LONG WINAPI LaserChar(LONG Ascii, LONG XStart, LONG YStart, LONG BeginPoint, LPLONG RETURN_charXEnd, LPLONG RETURN_charYEnd, LPLONG RETURN_charEndPt); +LDDLL_PREFIX LONG WINAPI GetLaserCharExtent(LONG Ascii, LPLONG RETURN_charXExtent, LPLONG RETURN_charYExtent); + +//------------------------------------------------------------------------------------------- +// QuadMod32 Parallel Port Functions +//------------------------------------------------------------------------------------------- + +LDDLL_PREFIX LONG WINAPI ParOn(LONG BankNum, LONG LineNum); + +LDDLL_PREFIX LONG WINAPI ParOff(LONG BankNum, LONG LineNum); + +LDDLL_PREFIX LONG WINAPI ParIn(LONG BankNum, LONG LineNum, LPLONG RETURN_Value); + +LDDLL_PREFIX LONG WINAPI DisplayPortLong(long I_OMask, long OutputValue, LPLONG RETURN_Value); + +//------------------------------------------------------------------------------------------- +// Abstract Generator functions +//------------------------------------------------------------------------------------------- + + + +LDDLL_PREFIX LONG WINAPI InitAbstractOsc1(float XPhase, float YPhase, float ZPhase); + +LDDLL_PREFIX LONG WINAPI InitAbstractOsc2(float XPhase, float YPhase, float ZPhase); + +LDDLL_PREFIX LONG WINAPI InitAbstractOsc3(float XPhase, float YPhase, float ZPhase); + +LDDLL_PREFIX LONG WINAPI InitAbstractMod1(float ModPhase); + +LDDLL_PREFIX LONG WINAPI InitAbstractMod2(float ModPhase); + +LDDLL_PREFIX LONG WINAPI InitAbstractColor(LONG SequenceStart); + +LDDLL_PREFIX LONG WINAPI InitAbstractColorNew(float ColorPhase); + +LDDLL_PREFIX LONG WINAPI SetAbstractOsc1(float XFreq, float YFreq, float ZFreq, float XSize, + float YSize, float ZSize, LONG Wave); + //Normalized Size Variables + +LDDLL_PREFIX LONG WINAPI SetAbstractOsc2(float XFreq, float YFreq, float ZFreq, float XSize, + float YSize, float ZSize, LONG Wave); + //Normalized Size Variables + +LDDLL_PREFIX LONG WINAPI SetAbstractOsc3(float XFreq, float YFreq, float ZFreq, float XSize, + float YSize, float ZSize, LONG Wave); + //Normalized Size Variables + +LDDLL_PREFIX LONG WINAPI SetAbstractMod1(float ModFreq, float ModAmplitude, LONG ModWave); + //Normalized Amplitude Variable + +LDDLL_PREFIX LONG WINAPI SetAbstractMod2(float ModFreq, float ModAmplitude, LONG ModWave); + //Normalized Amplitude Variable + +LDDLL_PREFIX LONG WINAPI SetAbstractColor(LONG ColorFreq, LONG ColorWave); + +LDDLL_PREFIX LONG WINAPI SetAbstractColorNew(float ColorFreq, LONG ColorWave); + +LDDLL_PREFIX LONG WINAPI SwapWaves(void); + +LDDLL_PREFIX LONG WINAPI GenerateAbstract(LONG NumVisible, LONG NumOverscan, LONG NumOverlap); + +LDDLL_PREFIX LONG WINAPI GenerateAbstractNew(LONG NumVisible, LONG NumOverscan, LONG NumOverlap); + +LDDLL_PREFIX LONG WINAPI GetAbstractPhase(LONG SUPPLY_OscID, float *RETURN_XPhase, float *RETURN_YPhase, float *RETURN_ZPhase); + +LDDLL_PREFIX LONG WINAPI GetAbstractFreqSizeWave(LONG SUPPLY_OscID, float *RETURN_XFreq, + float *RETURN_YFreq, float *RETURN_ZFreq, + float *RETURN_XSize, float *RETURN_YSize, float *RETURN_ZSize, int *RETURN_Wave); + +LDDLL_PREFIX LONG WINAPI AbstractToFrame(void); + +LDDLL_PREFIX LONG WINAPI FrameToAbstract(void); + diff --git a/Src/Plugins/Visualization/vis_avs/laser/laser.cpp b/Src/Plugins/Visualization/vis_avs/laser/laser.cpp new file mode 100644 index 00000000..c229499b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/laser.cpp @@ -0,0 +1,149 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +extern "C" { +#include "ld32.h" +}; + +int active_state; + +int g_laser_nomessage,g_laser_zones; +int init=0; +int ld32_framebase=1; + +static void onActivate() +{ + if (active_state) return; + active_state=1; + + ResetLD(); + SetWorkingTracks(-1); + SetWorkingScanners(-1); + DisplayFlags(0); +} +static void onDeactivate() +{ + if (!active_state) return; + active_state=0; + + ResetLD(); + SetWorkingTracks(-1); + SetWorkingScanners(-1); + DisplayFlags(0); + DisplayFrame(0); + DisplayUpdate(); +} + + +void laser_connect(void) +{ + LONG v; + InitialQMCheck(&v); + if (v != LDERR_OK) + { + if (!g_laser_nomessage) MessageBox(NULL,"No QM2000 found.","AVS/Laser Error",MB_OK); + return; + } + { + LONG mf,mp,mb,uf,ver; + BeginSessionEx(&ver,&mf, &mp, &mb, &uf, &v); + if (v != LDERR_OK) + { + return; + } + GetLDDLLModuleUsage(&v); + if (v != 1) + { + if (!g_laser_nomessage) MessageBox(NULL,"QM2000 is being shared with other software.","AVS/Laser Warning",MB_OK); + } + else + { + onActivate(); + } + ld32_framebase=mf; + } + + init=1; +} +extern "C" void LaserQuit(); + + +void laser_disconnect(void) +{ + if (!init) return; + init=0; + onDeactivate(); + LaserQuit(); +} + +void laser_sendframe(void *data, int datalen) +{ + struct t + { + FRAMESTRUCTEX frame; + PTSTRUCT points[4096]; + } *framedata=(struct t *)data; + + if (!init) return; + + extern int g_laser_nomessage; + if (g_laser_nomessage&4) + { + onDeactivate(); + return; + } + if (g_laser_nomessage&2) + { + DWORD dw; + GetWindowThreadProcessId(GetForegroundWindow(),&dw); + if (dw != GetCurrentProcessId()) + { + onDeactivate(); + return; + } + } + onActivate(); + + + SetWorkingFrame(ld32_framebase); + WriteFrameEx(&framedata->frame,framedata->points); + + SetWorkingTracks(1); + DisplayFlags(0); + DisplayFrame(ld32_framebase); + DisplayProjectionZones(g_laser_zones); + + LONG bif=0, cop; + if (!(g_laser_nomessage&8)) DisplayBufferStatus(&bif,&cop); + if (!bif) + DisplayUpdate(); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/laserline.cpp b/Src/Plugins/Visualization/vis_avs/laser/laserline.cpp new file mode 100644 index 00000000..e9c44c2c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/laserline.cpp @@ -0,0 +1,218 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <math.h> +#include "../r_defs.h" +extern "C" { +#include "ld32.h" +}; + + +static int fix(int a) +{ + return ((a&0xff0000)>>16)|(a&0xff00)|((a&0xff)<<16); +} + +static int dist(int x1, int y1, int x2, int y2) +{ + x1-=x2; + y1-=y2; + return x1*x1+y1*y1; +} + +static double actdist(double x1, double y1, double x2, double y2) +{ + x1-=x2; + y1-=y2; + return sqrt(x1*x1+y1*y1); +} + +static __inline int getval(int x1, int y1, int x2, int y2, int xv) +{ + if (x1==x2) return y1; + return y1+MulDiv(xv-x1,y2-y1,x2-x1); +} + +static void doclip(int &x1, int &y1, int x2, int y2) +{ + if (x1 > 8000 && x2 <= 8000) + { + y1=getval(x1,y1,x2,y2,8000); + x1=8000; + } + if (x1 < -8000 && x2 >= -8000) + { + y1=getval(x1,y1,x2,y2,-8000); + x1=-8000; + } +} + +void LineDrawList(C_LineListBase *list, int *fb, int w, int h) +{ + LineType *ll; + + static struct + { + FRAMESTRUCTEX frame; + PTSTRUCT points[32768]; + } d; + memset(&d.frame,0,sizeof(d.frame)); + int cp=0; + int lastendx=-10000,lastendy=-10000; + + int w2=w/2; + int h2=h/2; + int numl=list->GetUsedLines(); + ll=list->GetLineList(); + while (numl-->0 && cp < sizeof(d.points)/sizeof(PTSTRUCT)-2) + { + int x1,y1,x2,y2; + // draw to screen + { + x1=(int) (ll->x1 * w2) + w2; + x2=(int) (ll->x2 * w2) + w2; + y1=(int) (ll->y1 * h2) + h2; + y2=(int) (ll->y2 * h2) + h2; + if (ll->mode==0) + { + line(fb,x1,y1,x2,y2,w,h,ll->color); + } + else + { + if (x1 >= 0 && x1 < w && y1 >= 0 && y1 < h) + { + int o=x1+y1*w; + fb[o]=BLEND(fb[o],ll->color); + } + } + } + + x1=(int) (ll->x1*8000.0); + x2=(int) (ll->x2*8000.0); + + y1=(int) (ll->y1*-8000.0); + y2=(int) (ll->y2*-8000.0); + + + if (ll->mode==0) + { + doclip(x1,y1,x2,y2); + doclip(x2,y2,x1,y1); + doclip(y1,x1,y2,x2); + doclip(y2,x2,y1,x1); + + if (x1 >= -8000 && x1 <= 8000 && y1 >= -8000 && y1 <= 8000 && + x2 >= -8000 && x2 <= 8000 && y2 >= -8000 && y2 <= 8000) + { + // x1, y1 is the new, far point + if (cp && dist(x1,y1,lastendx,lastendy) < dist(x2,y2,lastendx,lastendy)) + { + int t; + t=x1; x1=x2; x2=t; + t=y1; y1=y2; y2=t; + } + + // if new start point is too far away, blank to that point + if (dist(x2,y2,lastendx,lastendy) > 400*400 || !cp) + { + memset(&d.points[cp],0,sizeof(d.points[0])); + if (cp) + { + d.points[cp-1].Status=4096; + } + d.points[cp].Status=0; + d.points[cp].XCoord=x2; + d.points[cp].YCoord=y2; + cp++; + } + else if (cp>1 && d.points[cp-1].RGBValue) + { + double a1=atan2(d.points[cp-2].XCoord-x2,d.points[cp-2].YCoord-y2); + double a2=atan2(x2-x1,y2-y1); + if (fabs(a1-a2) >= 1.0*3.14159/180.0) + { + d.points[cp-1].Status=4096; + } + + } + lastendx=x1; + lastendy=y1; + memset(&d.points[cp],0,sizeof(d.points[0])); + d.points[cp].RGBValue=fix(ll->color); + d.points[cp].Status=0; + d.points[cp].XCoord=x1; + d.points[cp].YCoord=y1; + cp++; + } + } + else + { + if (x1 > -8000 && x1 < 8000 && y1 > -8000 && y1 < 8000) + { + if (dist(x1,y1,lastendx,lastendy) > 30*30) + { + memset(&d.points[cp],0,sizeof(d.points[0])); + d.points[cp].Status=0; + d.points[cp].XCoord=x1; + d.points[cp].YCoord=y1; + cp++; + } + memset(&d.points[cp],0,2*sizeof(d.points[0])); + d.points[cp].RGBValue=fix(ll->color); + d.points[cp].Status=4096; + d.points[cp].XCoord=x1; + d.points[cp].YCoord=y1; + cp++; + d.points[cp].Status=4096; + d.points[cp].XCoord=x1; + d.points[cp].YCoord=y1; + cp++; + lastendx=x1; + lastendy=y1; + } + } + + ll++; + } + if (cp) + { + d.points[cp-1].Status=4096; + } + + memset(&d.frame,0,sizeof(d.frame)); + d.frame.VectorFlag=1; + d.frame.NumPoints=max(cp,1); + d.frame.ScanRate=100; + memcpy(d.frame.FrameNote,"AVS/Laser Frame ",24); + + laser_sendframe(&d,sizeof(d.frame)+sizeof(PTSTRUCT)*max(cp,16)); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/laserline.h b/Src/Plugins/Visualization/vis_avs/laser/laserline.h new file mode 100644 index 00000000..4ed4d2bf --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/laserline.h @@ -0,0 +1,55 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include "linelist.h" + +void LineDrawList(C_LineListBase *list, int *fb, int w, int h); + +void laser_connect(void); +void laser_disconnect(void); +void laser_sendframe(void *data, int datalen); + +static void __inline laser_drawpoint(float x, float y, int current_color) +{ + LineType line; + line.color=current_color; + line.mode=1; + line.x2=0; + line.x1=x; + line.y2=0; + line.y1=y; + g_laser_linelist->AddLine(&line); +} + +#else +#ifndef laser_drawpoint +#define laser_drawpoint(x,y,c) +#endif +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/ld32.c b/Src/Plugins/Visualization/vis_avs/laser/ld32.c new file mode 100644 index 00000000..90a1f385 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/ld32.c @@ -0,0 +1,187 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> + +#include "ld32.h" + +static HINSTANCE hDll; + +LONG (WINAPI *_LoadPalette)(LPSTR ColorFilename, LPLONG RETURN_LDStatus); +LONG (WINAPI *_WritePoint)(LONG PointNumber, PTSTRUCT *SUPPLY_PtStruct); +LONG (WINAPI *_InitialQMCheck)(LPLONG RETURN_LDStatus); +LONG (WINAPI *_DisplayUpdate)(void); +LONG (WINAPI *_DisplayBufferStatus)(LONG *RETURN_BufferIsFree, LONG *RETURN_CurrentOutputPoints); +LONG (WINAPI *_DisplayFrame)(LONG Frame); +LONG (WINAPI *_WriteFrameEx)(FRAMESTRUCTEX *SUPPLY_FrameStruct, PTSTRUCT *SUPPLY_PointArray); +LONG (WINAPI *_SetWorkingScanners)(LONG Scanner); +LONG (WINAPI *_SetWorkingTracks)(LONG Track); +LONG (WINAPI *_SetWorkingFrame)(LONG FrameNumber); +LONG (WINAPI *_BeginSessionEx)(LPLONG RETURN_Version, LPLONG RETURN_MaxFrames, LPLONG RETURN_MaxPoints, LPLONG RETURN_MaxBuffer, LPLONG RETURN_UndoFrames, LPLONG RETURN_LDStatus); +LONG (WINAPI *_DisplayFlags)(LONG Flags); +LONG (WINAPI *_EndSession)(void); +LONG (WINAPI *_GetLDDLLModuleUsage)(LPLONG ModuleUsage); +LONG (WINAPI *_ResetLD)(void); //Updates all track variables +LONG (WINAPI *_ReadProjectionZone)(LONG ZoneNumber, PROJECTIONZONE *RETURN_PZ); +LONG (WINAPI *_OpenLDCommWindow)(void); +LONG (WINAPI *_DisplayProjectionZones)(long ProjectionZoneCode); + +LONG WINAPI InitialQMCheck(LPLONG RETURN_LDStatus) +{ + hDll=LoadLibrary("ld2000.dll"); + if (!hDll) + { +// printf("LD2000: error loading DLL\n"); + *RETURN_LDStatus=1; + return 1; + } +#define RETR(x) *((void**)&_##x)=(void*)GetProcAddress(hDll,#x); if (!_##x) { FreeLibrary(hDll); hDll=0; *RETURN_LDStatus=1; return 1; } + + // \ + // if (!_##x) printf("LD2000: error loading DLL: " #x "\n"); + + RETR(ReadProjectionZone); + RETR(InitialQMCheck); + RETR(DisplayUpdate); + RETR(DisplayBufferStatus); + RETR(DisplayFrame); + RETR(WriteFrameEx); + RETR(WritePoint); + RETR(SetWorkingScanners); + RETR(LoadPalette); + RETR(SetWorkingTracks); + RETR(SetWorkingFrame); + RETR(EndSession); + RETR(BeginSessionEx); + RETR(DisplayFlags); + RETR(ResetLD); + RETR(OpenLDCommWindow); + RETR(GetLDDLLModuleUsage); + RETR(DisplayProjectionZones); + return _InitialQMCheck(RETURN_LDStatus); +} + +LONG WINAPI DisplayProjectionZones(long ProjectionZoneCode) +{ + return _DisplayProjectionZones(ProjectionZoneCode); +} + + + +LONG WINAPI ReadProjectionZone(LONG ZoneNumber, PROJECTIONZONE *RETURN_PZ) +{ + if (!hDll||!_ReadProjectionZone) return 1; + return _ReadProjectionZone(ZoneNumber,RETURN_PZ); +} + +LONG WINAPI DisplayBufferStatus(LONG *RETURN_BufferIsFree, LONG *RETURN_CurrentOutputPoints) +{ + return _DisplayBufferStatus(RETURN_BufferIsFree,RETURN_CurrentOutputPoints); +} + +LONG WINAPI DisplayUpdate(void) +{ + return _DisplayUpdate(); +} +LONG WINAPI DisplayFrame(LONG Frame) +{ + return _DisplayFrame(Frame); +} + +LONG WINAPI WriteFrameEx(FRAMESTRUCTEX *SUPPLY_FrameStruct, PTSTRUCT *SUPPLY_PointArray) +{ + return _WriteFrameEx(SUPPLY_FrameStruct,SUPPLY_PointArray); +} + +LONG WINAPI SetWorkingScanners(LONG Scanner) +{ + return _SetWorkingScanners(Scanner); +} + +LONG WINAPI SetWorkingTracks(LONG Track) +{ + return _SetWorkingTracks(Track); +} + +LONG WINAPI SetWorkingFrame(LONG FrameNumber) +{ + return _SetWorkingFrame(FrameNumber); +} + +LONG WINAPI OpenLDCommWindow(void) +{ + return _OpenLDCommWindow(); +} + +LONG WINAPI EndSession(void) +{ + return _EndSession(); +} + +LONG WINAPI LoadPalette(LPSTR ColorFilename, LPLONG RETURN_LDStatus) +{ + return _LoadPalette(ColorFilename,RETURN_LDStatus); +} + +LONG WINAPI WritePoint(LONG PointNumber, PTSTRUCT *SUPPLY_PtStruct) +{ + return _WritePoint(PointNumber,SUPPLY_PtStruct); +} + +LONG WINAPI GetLDDLLModuleUsage(LPLONG ModuleUsage) +{ + return _GetLDDLLModuleUsage(ModuleUsage); +} + +LONG WINAPI ResetLD() +{ + return _ResetLD(); +} + +LONG WINAPI BeginSessionEx(LPLONG RETURN_Version, LPLONG RETURN_MaxFrames, LPLONG RETURN_MaxPoints, LPLONG RETURN_MaxBuffer, LPLONG RETURN_UndoFrames, LPLONG RETURN_LDStatus) +{ + return _BeginSessionEx( + RETURN_Version, RETURN_MaxFrames, + RETURN_MaxPoints, RETURN_MaxBuffer, + RETURN_UndoFrames,RETURN_LDStatus); +} +LONG WINAPI DisplayFlags(LONG Flags) +{ + return _DisplayFlags(Flags); +} + +void LaserQuit() +{ + if (hDll) FreeLibrary(hDll); + hDll=0; + _InitialQMCheck=0; +} + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/linelist.cpp b/Src/Plugins/Visualization/vis_avs/laser/linelist.cpp new file mode 100644 index 00000000..bfc36e2e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/linelist.cpp @@ -0,0 +1,107 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include "linelist.h" + +class C_LineList : public C_LineListBase +{ +private: + int max; + int used; + LineType *linelist; +public: + C_LineList() { max=16384; linelist=(LineType *)malloc(16384*sizeof(LineType)); used=0; }; + virtual ~C_LineList() { free(linelist); } + virtual int GetMaxLines(void) { return max; }; + virtual int GetUsedLines(void) { return used; }; + virtual void SetUsedLines(int usedlines) { used=usedlines; } + virtual void SetLines(LineType *list, int start, int length) { memcpy(linelist+start,list,length*sizeof(LineType)); } + virtual void SetMaxLines(int m); + virtual void ClearLineList(void); + virtual LineType *GetLineList(void); + virtual void AddLine(LineType *line); + + void swapcontents(C_LineList *other) + { + { + int tmp; + tmp=max; + max=other->max; + other->max=tmp; + + tmp=used; + used=other->used; + other->used=tmp; + } + LineType *tmp; + tmp=linelist; + linelist=other->linelist; + other->linelist=tmp; + } + +}; + +C_LineListBase *createLineList(void) +{ + return (C_LineListBase *)new C_LineList(); +} + +void LineListSwap(C_LineListBase *item1, C_LineListBase *item2) +{ + C_LineList *i1=(C_LineList*)item1; + C_LineList *i2=(C_LineList*)item2; + i1->swapcontents(i2); +} + +void C_LineList::SetMaxLines(int m) +{ + if (m > 16384) m = 16384; + max=m; + if (used > max) ClearLineList(); +} + +void C_LineList::ClearLineList(void) +{ + used=0; +} + +LineType *C_LineList::GetLineList(void) +{ + return linelist; +} + +void C_LineList::AddLine(LineType *line) +{ + if (used >= max) return; + memcpy(linelist+used,line,sizeof(LineType)); + used++; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/linelist.h b/Src/Plugins/Visualization/vis_avs/laser/linelist.h new file mode 100644 index 00000000..2d1b9ec8 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/linelist.h @@ -0,0 +1,57 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +typedef struct +{ + float x1, y1; + float x2, y2; + int color; + int mode; +} LineType; + +class C_LineListBase +{ + public: + C_LineListBase(){ }; + virtual ~C_LineListBase() { }; + + virtual int GetMaxLines(void)=0; + virtual int GetUsedLines(void)=0; + virtual void SetMaxLines(int m)=0; + virtual void SetUsedLines(int usedlines)=0; + virtual void SetLines(LineType *list, int start, int length)=0; + virtual void ClearLineList(void)=0; + virtual LineType *GetLineList(void)=0; + virtual void AddLine(LineType *line)=0; +}; + +C_LineListBase *createLineList(void); +extern C_LineListBase *g_laser_linelist; +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/rl_beathold.cpp b/Src/Plugins/Visualization/vis_avs/laser/rl_beathold.cpp new file mode 100644 index 00000000..abbb556c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/rl_beathold.cpp @@ -0,0 +1,165 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <commctrl.h> +#include "../r_defs.h" +#include "../resource.h" +#include <math.h> + +#define C_THISCLASS CLASER_BeatHoldClass +#define MOD_NAME "Misc / Beat Hold" + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // returns 1 if fbout has dest + virtual char *get_desc() { return MOD_NAME; } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int decayMS, beatSkip; + + DWORD isBeatDecay; + int beatCount; + + LineType m_linelist[1024]; + int linelist_used; +}; + +#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255; pos+=4 +#define GET_INT(a) if (len-pos>=4) { (a)=(data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)); pos += 4; } +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + int pos=0; + int x=0; + GET_INT(decayMS); + GET_INT(beatSkip); +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(decayMS); + PUT_INT(beatSkip); + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + isBeatDecay=0; + decayMS=500; + beatCount=0; + beatSkip=4; + linelist_used=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // returns 1 if fbout has dest +{ + if (isBeat&0x80000000) return 0; + if (isBeatDecay) + { + if (GetTickCount() > isBeatDecay) + { + isBeatDecay=0; + } + else + { + g_laser_linelist->SetLines(m_linelist,0,linelist_used); + g_laser_linelist->SetUsedLines(linelist_used); + } + } + else if (isBeat && ++beatCount > beatSkip) + { + beatCount=0; + isBeatDecay=GetTickCount()+decayMS; + linelist_used=g_laser_linelist->GetUsedLines(); + memcpy(m_linelist,g_laser_linelist->GetLineList(),linelist_used*sizeof(LineType)); + } + return 0; +} + +C_RBASE *RLASER_BeatHold(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +static C_THISCLASS *g_this; + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + int *a=NULL; + switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,20); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->decayMS/100); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,16); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->beatSkip); + + return 1; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + g_this->decayMS=t*100; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->beatSkip=t; + } + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_LASER_BEATHOLD,hwndParent,g_DlgProc); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/rl_bren.cpp b/Src/Plugins/Visualization/vis_avs/laser/rl_bren.cpp new file mode 100644 index 00000000..d91a310b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/rl_bren.cpp @@ -0,0 +1,183 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <commctrl.h> +#include "../r_defs.h" +#include "../resource.h" + +#include <math.h> + +#define C_THISCLASS CLASER_BrenClass +#define MOD_NAME "Render / Brennan\'s Effect" + +typedef struct { + float x, y; +} PT; + +typedef struct { + PT pt[4]; +} segment; + +#define BOUND (0.6f) +#define NSEG 48 +#define VISSEG 6 + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // returns 1 if fbout has dest + virtual char *get_desc() { return MOD_NAME; } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + segment seg[NSEG]; + PT d[4]; + float phase; + int step; +}; + +#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255 +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + int pos=0; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + return pos; +} + +float frandom() { + return (float)rand() / (float)RAND_MAX; +} + +C_THISCLASS::C_THISCLASS() +{ + int i, j; + + for (j = 0; j < NSEG; j++) { + for (i = 0; i < 4; i++) { +// seg[j].pt[i].x = frandom() * 2.0 - 1.0; + // seg[j].pt[i].y = frandom() * 2.0 - 1.0; + seg[j].pt[i].x = 0.f; + seg[j].pt[i].y = 0.f; + } + } + for (i = 0; i < 4; i++) { + d[i].x = frandom() * 0.015 + 0.005; + d[i].y = frandom() * 0.015 + 0.005; + } + + + phase = 0.0; + step = 0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + + +#define PI 3.14159 + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // returns 1 if fbout has dest +{ + if (isBeat&0x80000000) return 0; + LineType l; + int i, j; + float s; + + s = sin(phase * 2 * PI)*0.10+0.9; + //s = 1.0; + //s = 0.8 + isBeat * 0.2; + + for (i = 0; i < 4; i++) { + seg[0].pt[i].x += d[i].x * s; + seg[0].pt[i].y += d[i].y * s; + if (seg[0].pt[i].x < -BOUND || seg[0].pt[i].x > BOUND) d[i].x = -d[i].x; + if (seg[0].pt[i].y < -BOUND || seg[0].pt[i].y > BOUND) d[i].y = -d[i].y; + } + + for (j = 0; j < NSEG; j++) { + static PT p; + if ((step++ % (NSEG/VISSEG)) != 0) continue; + for (i = 0; i < 4; i++) { + l.mode=0; + l.color=RGB(0, 0, 255); + l.x1= seg[j].pt[i].x * s; + l.y1= seg[j].pt[i].y * s; + l.x2= (p.x)*s; + l.y2= (p.y)*s; + p = seg[j].pt[i]; + + g_laser_linelist->AddLine(&l); + l.x1 = l.x2; + l.y1 = l.y2; + l.mode=1; + l.color=RGB(0, 255, 0); + g_laser_linelist->AddLine(&l); + } + } + + for (i = NSEG-1; i > 0; i--) { + seg[i] = seg[i-1]; + } + + phase += 0.005f; + return 0; +} + +C_RBASE *RLASER_Bren(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +static C_THISCLASS *g_this; + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return 0;//WASABI_API_CREATEDIALOG(IDD_CFG_LINE,hwndParent,g_DlgProc); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/rl_cones.cpp b/Src/Plugins/Visualization/vis_avs/laser/rl_cones.cpp new file mode 100644 index 00000000..027b2607 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/rl_cones.cpp @@ -0,0 +1,363 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <commctrl.h> +#include "../r_defs.h" +#include "../resource.h" + +#include <math.h> + +#define C_THISCLASS CLASER_MovingConeClass +#define MOD_NAME "Render / Moving Cone" + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // returns 1 if fbout has dest + virtual char *get_desc() { return MOD_NAME; } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + + int maxdist[2],size,size2,num_seg; + + int s_pos; + int beatcnt; + + double c[2]; + double v[2]; + double p[2]; + + int mode; + + int colors[16],num_colors; + + int color_pos; +}; + +#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255 +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + int pos=0; + int x=0; + if (len-pos >= 4) { num_colors=GET_INT(); pos+=4; } + if (num_colors <= 16) while (len-pos >= 4 && x < num_colors) { colors[x++]=GET_INT(); pos+=4; } + else num_colors=0; + if (len-pos >= 4) { maxdist[0]=maxdist[1]=GET_INT(); pos+=4; } + if (len-pos >= 4) { size=GET_INT(); pos+=4; } + if (len-pos >= 4) { size2=GET_INT(); pos+=4; } + if (len-pos >= 4) { num_seg=GET_INT(); pos+=4; } + if (len-pos >= 4) { mode=GET_INT(); pos+=4; } + if (len-pos >= 4) { maxdist[1]=GET_INT(); pos+=4; } + s_pos=size; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + PUT_INT(maxdist[0]); pos+=4; + PUT_INT(size); pos+=4; + PUT_INT(size2); pos+=4; + PUT_INT(num_seg); pos+=4; + PUT_INT(mode); pos+=4; + PUT_INT(maxdist[1]); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + num_seg=8; + size=size2=s_pos=8; + maxdist[0]=maxdist[1]=16; + c[0]=c[1]=0.0f; + v[0]=-0.01551; + v[1]=0.0; + + p[0]=-0.6; + p[1]=0.3; + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + beatcnt=0; + mode=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // returns 1 if fbout has dest +{ + if (isBeat&0x80000000) return 0; + LineType l; + int x; + int current_color; + + if (!num_colors) return 0; + color_pos++; + if (color_pos >= num_colors * 64) color_pos=0; + + { + int p=color_pos/64; + int r=color_pos&63; + int c1,c2; + int r1,r2,r3; + c1=colors[p]; + if (p+1 < num_colors) + c2=colors[p+1]; + else c2=colors[0]; + + r1=(((c1&255)*(63-r))+((c2&255)*r))/64; + r2=((((c1>>8)&255)*(63-r))+(((c2>>8)&255)*r))/64; + r3=((((c1>>16)&255)*(63-r))+(((c2>>16)&255)*r))/64; + + current_color=r1|(r2<<8)|(r3<<16); + } + + float xp,yp; + + if (isBeat) + { + c[0]=((rand()%33)-16)/48.0f; + c[1]=((rand()%33)-16)/48.0f; + } + + + { + if (p[0] >= 0.0000001 || p[0] <= -0.0000001) v[0] -= 0.004*(p[0]-c[0]); + if (p[1] >= 0.0000001 || p[1] <= -0.0000001) v[1] -= 0.004*(p[1]-c[1]); + } + + p[0]+=v[0]; + p[1]+=v[1]; + + v[0]*=0.991; + v[1]*=0.991; + + xp=(float) (p[0]*(maxdist[0]/32.0)); + yp=(float) (p[1]*(maxdist[1]/32.0)); + if (isBeat) + s_pos=size2; + int sz=s_pos; + s_pos=(s_pos+size)/2; + { + float dx,dy; + float lx,ly; + lx=(float) (cos(0.0)*s_pos/75.0); + ly=(float) (sin(0.0)*s_pos/75.0); + for (x = 0; x < num_seg; x ++) + { + l.mode=mode; + l.color=current_color; + dx=(float) (cos(0.0+(x+1)*3.14159*2.0/num_seg)*s_pos/75.0); + dy=(float) (sin(0.0+(x+1)*3.14159*2.0/num_seg)*s_pos/75.0); + if (!mode) + { + l.x2=xp+lx; + l.y2=yp+ly; + } + else l.x2=l.y2=0; + l.x1=xp+dx; + l.y1=yp+dy; + lx=dx; + ly=dy; + int x=(int) (l.x1*(w/2)+(w/2)); + int y=(int) (l.y1*(h/2)+(h/2)); + + g_laser_linelist->AddLine(&l); + } + } + return 0; +} + +C_RBASE *RLASER_Cone(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +static C_THISCLASS *g_this; + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + int *a=NULL; + switch (uMsg) + { + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL && g_this->num_colors>0) + { + int x; + int w=di->rcItem.right-di->rcItem.left; + int l=0,nl; + for (x = 0; x < g_this->num_colors; x ++) + { + int color=g_this->colors[x]; + nl = (w*(x+1))/g_this->num_colors; + color = ((color>>16)&0xff)|(color&0xff00)|((color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={BS_SOLID,color,0}; + hPen = (HPEN)CreatePen(PS_SOLID,0,color); + hBrush = CreateBrushIndirect(&lb); + hOldPen=(HPEN)SelectObject(di->hDC,hPen); + hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush); + Rectangle(di->hDC,di->rcItem.left+l,di->rcItem.top,di->rcItem.left+nl,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + l=nl; + } + } + } + return 0; + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + SetDlgItemInt(hwndDlg,IDC_EDIT1,g_this->num_seg,FALSE); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->maxdist[0]); + SendDlgItemMessage(hwndDlg,IDC_SLIDER7,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER7,TBM_SETRANGEMAX,0,32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER7,TBM_SETPOS,1,g_this->maxdist[1]); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMAX,0,128); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETPOS,1,g_this->size); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMAX,0,128); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETPOS,1,g_this->size2); + if (g_this->mode) CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_RADIO1: + case IDC_RADIO2: + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) + g_this->mode=1; + else g_this->mode=0; + break; + case IDC_EDIT1: + { + int p; + BOOL tr=FALSE; + p=GetDlgItemInt(hwndDlg,IDC_EDIT1,&tr,FALSE); + if (tr) + { + g_this->num_seg=p; + } + } + break; + case IDC_NUMCOL: + { + int p; + BOOL tr=FALSE; + p=GetDlgItemInt(hwndDlg,IDC_NUMCOL,&tr,FALSE); + if (tr) + { + if (p > 16) p = 16; + g_this->num_colors=p; + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } + break; + case IDC_DEFCOL: + { + int wc=-1,w,h; + POINT p; + RECT r; + GetCursorPos(&p); + GetWindowRect(GetDlgItem(hwndDlg,IDC_DEFCOL),&r); + p.x -= r.left; + p.y -= r.top; + w=r.right-r.left; + h=r.bottom-r.top; + if (p.x >= 0 && p.x < w && p.y >= 0 && p.y < h) + { + wc = (p.x*g_this->num_colors)/w; + } + if (wc>=0) + { + GR_SelectColor(hwndDlg,g_this->colors+wc); + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } } + return 0; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + g_this->maxdist[0]=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER7)) + { + g_this->maxdist[1]=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER3)) + { + g_this->s_pos=g_this->size=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER4)) + { + g_this->s_pos=g_this->size2=t; + } + } + return 0; + + + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_LASER_CONE,hwndParent,g_DlgProc); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/rl_line.cpp b/Src/Plugins/Visualization/vis_avs/laser/rl_line.cpp new file mode 100644 index 00000000..a049532a --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/rl_line.cpp @@ -0,0 +1,338 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <commctrl.h> +#include "../r_defs.h" +#include "../resource.h" + +#include <math.h> + +#define C_THISCLASS C_MovingLineClass +#define MOD_NAME "Render / Moving Line" + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // returns 1 if fbout has dest + virtual char *get_desc() { return MOD_NAME; } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + + int maxdist,size,size2,maxbeatcnt; + + int s_pos; + int beatcnt; + + double angle,dangle; + + double c[2]; + double v[2]; + double p[2]; + + + int colors[16],num_colors; + + int color_pos; +}; + +#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255 +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + int pos=0; + int x=0; + if (len-pos >= 4) { num_colors=GET_INT(); pos+=4; } + if (num_colors <= 16) while (len-pos >= 4 && x < num_colors) { colors[x++]=GET_INT(); pos+=4; } + else num_colors=0; + if (len-pos >= 4) { maxdist=GET_INT(); pos+=4; } + if (len-pos >= 4) { size=GET_INT(); pos+=4; } + if (len-pos >= 4) { size2=GET_INT(); pos+=4; } + if (len-pos >= 4) { maxbeatcnt=GET_INT(); pos+=4; } + s_pos=size; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + PUT_INT(maxdist); pos+=4; + PUT_INT(size); pos+=4; + PUT_INT(size2); pos+=4; + PUT_INT(maxbeatcnt); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + size=size2=s_pos=8; + maxdist=16; + c[0]=c[1]=0.0f; + v[0]=-0.01551; + v[1]=0.0; + + angle=0.0; + dangle=3.14159/180.0*8.0; + p[0]=-0.6; + p[1]=0.3; + num_colors=1; + maxbeatcnt=16; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + beatcnt=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // returns 1 if fbout has dest +{ + if (isBeat&0x80000000) return 0; + LineType l; + int current_color; + + if (!num_colors) return 0; + color_pos++; + if (color_pos >= num_colors * 64) color_pos=0; + + { + int p=color_pos/64; + int r=color_pos&63; + int c1,c2; + int r1,r2,r3; + c1=colors[p]; + if (p+1 < num_colors) + c2=colors[p+1]; + else c2=colors[0]; + + r1=(((c1&255)*(63-r))+((c2&255)*r))/64; + r2=((((c1>>8)&255)*(63-r))+(((c2>>8)&255)*r))/64; + r3=((((c1>>16)&255)*(63-r))+(((c2>>16)&255)*r))/64; + + current_color=r1|(r2<<8)|(r3<<16); + } + + l.mode=0; + l.color=current_color; + + double xp,yp; + + if (isBeat) + { + if (maxbeatcnt && ++beatcnt >= maxbeatcnt) + { + beatcnt=0; + dangle=-dangle; + } + c[0]=((rand()%33)-16)/48.0f; + c[1]=((rand()%33)-16)/48.0f; + } + + + { + if (p[0] >= 0.0000001 || p[0] <= -0.0000001) v[0] -= 0.004*(p[0]-c[0]); + if (p[1] >= 0.0000001 || p[1] <= -0.0000001) v[1] -= 0.004*(p[1]-c[1]); + } + + p[0]+=v[0]; + p[1]+=v[1]; + + v[0]*=0.991; + v[1]*=0.991; + + xp=(p[0]*(maxdist/32.0)); + yp=(p[1]*(maxdist/32.0)); + if (isBeat) + s_pos=size2; + int sz=s_pos; + s_pos=(s_pos+size)/2; + { + double dx,dy; + dx=cos(angle)*s_pos/75.0; + dy=sin(angle)*s_pos/75.0; + l.x1=(float) (xp-dx); + l.y1=(float) (yp-dy); + l.x2=(float) (xp+dx); + l.y2=(float) (yp+dy); + g_laser_linelist->AddLine(&l); + angle += dangle; + } + return 0; +} + +C_RBASE *RLASER_Line(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +static C_THISCLASS *g_this; + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + int *a=NULL; + switch (uMsg) + { + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL && g_this->num_colors>0) + { + int x; + int w=di->rcItem.right-di->rcItem.left; + int l=0,nl; + for (x = 0; x < g_this->num_colors; x ++) + { + int color=g_this->colors[x]; + nl = (w*(x+1))/g_this->num_colors; + color = ((color>>16)&0xff)|(color&0xff00)|((color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={BS_SOLID,color,0}; + hPen = (HPEN)CreatePen(PS_SOLID,0,color); + hBrush = CreateBrushIndirect(&lb); + hOldPen=(HPEN)SelectObject(di->hDC,hPen); + hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush); + Rectangle(di->hDC,di->rcItem.left+l,di->rcItem.top,di->rcItem.left+nl,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + l=nl; + } + } + } + return 0; + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->maxdist); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMAX,0,128); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETPOS,1,g_this->size); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMAX,0,128); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETPOS,1,g_this->size2); + SetDlgItemInt(hwndDlg,IDC_EDIT1,g_this->maxbeatcnt,FALSE); + + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_EDIT1: + { + int p; + BOOL tr=FALSE; + p=GetDlgItemInt(hwndDlg,IDC_EDIT1,&tr,FALSE); + if (tr) + { + g_this->maxbeatcnt=p; + } + } + break; + case IDC_NUMCOL: + { + int p; + BOOL tr=FALSE; + p=GetDlgItemInt(hwndDlg,IDC_NUMCOL,&tr,FALSE); + if (tr) + { + if (p > 16) p = 16; + g_this->num_colors=p; + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } + break; + case IDC_DEFCOL: + { + int wc=-1,w,h; + POINT p; + RECT r; + GetCursorPos(&p); + GetWindowRect(GetDlgItem(hwndDlg,IDC_DEFCOL),&r); + p.x -= r.left; + p.y -= r.top; + w=r.right-r.left; + h=r.bottom-r.top; + if (p.x >= 0 && p.x < w && p.y >= 0 && p.y < h) + { + wc = (p.x*g_this->num_colors)/w; + } + if (wc>=0) + { + GR_SelectColor(hwndDlg,g_this->colors+wc); + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } } + return 0; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + g_this->maxdist=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER3)) + { + g_this->s_pos=g_this->size=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER4)) + { + g_this->s_pos=g_this->size2=t; + } + } + return 0; + + + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_LASER_LINE,hwndParent,g_DlgProc); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/laser/rl_trans.cpp b/Src/Plugins/Visualization/vis_avs/laser/rl_trans.cpp new file mode 100644 index 00000000..af4d3f70 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/laser/rl_trans.cpp @@ -0,0 +1,338 @@ +/* + LICENSE + ------- +Copyright 2005 Nullsoft, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Nullsoft nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ +#ifdef LASER +#include <windows.h> +#include <commctrl.h> +#include "../r_defs.h" +#include "../resource.h" +#include "../evallib/eval.h" +#include "../evallib/compiler.h" +#include <math.h> + +#define C_THISCLASS CLASER_Transform +#define MOD_NAME "Misc / Transform" + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // returns 1 if fbout has dest + virtual char *get_desc() { return MOD_NAME; } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + void load_string(RString &s,unsigned char *data, int &pos, int len); + void save_string(unsigned char *data, int &pos, RString &text); + + void dopoint(float &x, float &y, char visdata[2][2][576], int &color); + + varType vars[EVAL_MAX_VARS]; + NSEEL_CODEHANDLE codehandle,codehandle_b,codehandle_i,codehandle_f; + double *v_d; + double *v_r; + double *v_x; + double *v_y; + double *v_b; + double *v_red; + double *v_green; + double *v_blue; + + int rectangular; + RString effect_exp[4]; + int effect_exp_ch; + CRITICAL_SECTION rcs; +}; + +#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255 +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + int pos=0; + rectangular=GET_INT(); pos+=4; + if (data[pos] == 1) + { + pos++; + load_string(effect_exp[0],data,pos,len); + load_string(effect_exp[1],data,pos,len); + load_string(effect_exp[2],data,pos,len); + load_string(effect_exp[3],data,pos,len); + } + else + { + char buf[1025]; + if (len-pos >= 1024) + { + memcpy(buf,data+pos,1024); + pos+=1024; + buf[1024]=0; + effect_exp[3].assign(buf+768); + buf[768]=0; + effect_exp[2].assign(buf+512); + buf[512]=0; + effect_exp[1].assign(buf+256); + buf[256]=0; + effect_exp[0].assign(buf); + } + } + effect_exp_ch=1; +} + +void C_THISCLASS::load_string(RString &s,unsigned char *data, int &pos, int len) // read configuration of max length "len" from data. +{ + int size=GET_INT(); pos += 4; + if (size > 0 && len-pos >= size) + { + s.resize(size); + memcpy(s.get(), data+pos, size); + pos+=size; + } + else + { + s.resize(1); + s.get()[0]=0; + } +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(rectangular); pos+=4; + data[pos++]=1; + save_string(data,pos,effect_exp[0]); + save_string(data,pos,effect_exp[1]); + save_string(data,pos,effect_exp[2]); + save_string(data,pos,effect_exp[3]); + return pos; +} + +// special version that encodes with a 1 at the start. +void C_THISCLASS::save_string(unsigned char *data, int &pos, RString &text) +{ + if (text.get() && text.get()[0]) + { + int l=(strlen(text.get())+1); + PUT_INT(l); pos+=4; + memcpy(data+pos, text.get(), strlen(text.get())+1); + pos+=strlen(text.get())+1; + } + else + { + PUT_INT(0); + pos+=4; + } +} + +C_THISCLASS::C_THISCLASS() +{ + rectangular=0; + codehandle=0; + codehandle_b=0; + codehandle_i=0; + codehandle_f=0; + memset(vars,0,sizeof(vars)); + resetVars(vars); + v_d = registerVar("d"); + v_r = registerVar("r"); + v_x = registerVar("x"); + v_y = registerVar("y"); + v_b = registerVar("b"); + v_red = registerVar("red"); + v_green = registerVar("green"); + v_blue = registerVar("blue"); + resetVars(NULL); + effect_exp[0].assign("d=0.5;"); + effect_exp[1].assign(""); + effect_exp[2].assign(""); + effect_exp[3].assign(""); + effect_exp_ch=1; + InitializeCriticalSection(&rcs); +} + +C_THISCLASS::~C_THISCLASS() +{ + freeCode(codehandle); + freeCode(codehandle_b); + freeCode(codehandle_i); + freeCode(codehandle_f); + codehandle=0; + codehandle_b=0; + codehandle_i=0; + codehandle_f=0; + DeleteCriticalSection(&rcs); +} + +void C_THISCLASS::dopoint(float &x, float &y, char visdata[2][2][576], int &color) +{ + *v_d=sqrt(x*x+y*y); + *v_r=atan2(y,x) + 3.14159*0.5; + *v_x=x; + *v_y=y; + *v_blue=(color&0xff)/255.0; + *v_green=((color>>8)&0xff)/255.0; + *v_red=((color>>16)&0xff)/255.0; + + executeCode(codehandle,visdata); + if (rectangular) + { + x=*v_x; + y=*v_y; + } + else + { + *v_r -= 3.14159*0.5; + if (*v_r < 0.0) *v_r += 3.14159*2.0; + if (*v_r >= 3.14159*2.0) *v_r -= 3.14159*2.0; + x=cos(*v_r)* *v_d; + y=sin(*v_r)* *v_d; + } + + int a=(int)(*v_blue * 255.0); + if (a>255) a=255; + if (a<0)a=0; + color=a; + a=(int)(*v_green * 255.0); + if (a>255) a=255; + if (a<0)a=0; + color|=a<<8; + a=(int)(*v_red * 255.0); + if (a>255) a=255; + if (a<0)a=0; + color|=a<<16; + +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // returns 1 if fbout has dest +{ + if (isBeat&0x80000000) return 0; + + if (effect_exp_ch || !codehandle) + { + EnterCriticalSection(&rcs); + memset(vars,0,sizeof(vars)); + resetVars(vars); + if (codehandle) freeCode(codehandle); + if (codehandle_b) freeCode(codehandle_b); + if (codehandle_i) freeCode(codehandle_i); + if (codehandle_f) freeCode(codehandle_f); + codehandle=compileCode(effect_exp[0].get()); + codehandle_i=compileCode(effect_exp[1].get()); + codehandle_f=compileCode(effect_exp[2].get()); + codehandle_b=compileCode(effect_exp[3].get()); + effect_exp_ch=0; + resetVars(NULL); + LeaveCriticalSection(&rcs); + executeCode(codehandle_i,visdata); + } + executeCode(codehandle_f,visdata); + if (isBeat) + executeCode(codehandle_b,visdata); + if (codehandle) + { + *v_b=isBeat?1.0:0.0; + int x,num=g_laser_linelist->GetUsedLines(); + LineType *l=g_laser_linelist->GetLineList(); + for (x = 0; x < num; x ++) + { + dopoint(l->x1,l->y1,visdata,l->color); + if (l->mode == 0) dopoint(l->x2,l->y2,visdata,l->color); + l++; + } + } + return 0; +} + +C_RBASE *RLASER_Transform(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +static C_THISCLASS *g_this; + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + static int isstart; + int *a=NULL; + switch (uMsg) + { + case WM_INITDIALOG: + isstart=1; + SetDlgItemText(hwndDlg,IDC_EDIT1,g_this->effect_exp[0].get()); + SetDlgItemText(hwndDlg,IDC_EDIT2,g_this->effect_exp[1].get()); + SetDlgItemText(hwndDlg,IDC_EDIT3,g_this->effect_exp[2].get()); + SetDlgItemText(hwndDlg,IDC_EDIT4,g_this->effect_exp[3].get()); + isstart=0; + if (g_this->rectangular) + CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + return 1; + case WM_COMMAND: + if (( + LOWORD(wParam) == IDC_EDIT1 || + LOWORD(wParam) == IDC_EDIT2 || + LOWORD(wParam) == IDC_EDIT3 || + LOWORD(wParam) == IDC_EDIT4 + + ) + && HIWORD(wParam) == EN_CHANGE) + { + if (!isstart) + { + EnterCriticalSection(&g_this->rcs); + g_this->effect_exp[0].get_from_dlgitem(hwndDlg,IDC_EDIT1); + g_this->effect_exp[1].get_from_dlgitem(hwndDlg,IDC_EDIT2); + g_this->effect_exp[2].get_from_dlgitem(hwndDlg,IDC_EDIT3); + g_this->effect_exp[3].get_from_dlgitem(hwndDlg,IDC_EDIT4); + g_this->effect_exp_ch=1; + LeaveCriticalSection(&g_this->rcs); + } + } + if (LOWORD(wParam) == IDC_CHECK3) + { + EnterCriticalSection(&g_this->rcs); + g_this->rectangular=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?1:0; + g_this->effect_exp_ch=1; + LeaveCriticalSection(&g_this->rcs); + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_LASER_TRANSFORM,hwndParent,g_DlgProc); +} +#endif
\ No newline at end of file |