diff options
Diffstat (limited to 'Src/Plugins/Visualization/vis_avs')
160 files changed, 48618 insertions, 0 deletions
diff --git a/Src/Plugins/Visualization/vis_avs/FRONTEND.H b/Src/Plugins/Visualization/vis_avs/FRONTEND.H new file mode 100644 index 00000000..b977d182 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/FRONTEND.H @@ -0,0 +1,370 @@ +/* + 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. + +*/ +#ifndef _WAFE_H_ +#define _WAFE_H_ +/* +** Winamp frontend/plug-in control API documentation v1.0. +** By Justin Frankel. +** Copyright (C) 1997-1999, Nullsoft Inc. +** Last updated: JAN.8.1999. +** +** Introduction +** ----------------------- +** This file describes a means to easily communicate to Winamp +** via the classic Win32 Message API. +** +** These definitions/code assume C/C++. Porting to VB/Delphi shouldn't +** be too hard. +** +** First, you find the HWND of the Winamp main window. From a plug-in +** you can easily extract this from the plug-in structure (hMainWindow, +** hwndParent, whatever). For external apps, use: +** +** HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL); +** +** (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility) +** +** Once you have the hwnd_winamp, it's a good idea to check the version +** number. To do this, you send a WM_WA_IPC message to hwnd_winamp. +** Note that WM_WA_IPC is defined as Win32's WM_USER. +** +** Note that sometimes you might want to use PostMessage instead of +** SendMessage. +*/ + +#define WM_WA_IPC WM_USER + +/**************************************************************************/ + +#define IPC_GETVERSION 0 + +/* +** int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); +** +** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0 +** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know. +** +** The basic format for sending messages to Winamp is: +** int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command); +** (for the version check, command_data is 0). +*/ + + +#define IPC_DELETE 101 + +/* +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); +** +** You can use IPC_DELETE to clear Winamp's internal playlist. +*/ + + +#define IPC_STARTPLAY 102 + +/* +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); +** +** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly. +*/ + + +#define IPC_ISPLAYING 104 + +/* +** int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); +** +** IPC_ISPLAYING returns the status of playback. +** If it returns 1, it is playing. if it returns 3, it is paused, +** if it returns 0, it is not playing. +*/ + + +#define IPC_GETOUTPUTTIME 105 + +/* +** int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); +** +** IPC_GETOUTPUTTIME returns the position in milliseconds of the +** current song (mode = 0), or the song length, in seconds (mode = 1). +** Returns -1 if not playing or error. +*/ + + +#define IPC_JUMPTOTIME 106 + +/* (requires Winamp 1.60+) +** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME); +** IPC_JUMPTOTIME sets the position in milliseconds of the +** current song (approximately). +** Returns -1 if not playing, 1 on eof, or 0 if successful +*/ + + +#define IPC_WRITEPLAYLIST 120 + +/* (requires Winamp 1.666+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST); +** +** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u, +** and returns the current playlist position. +** Kinda obsoleted by some of the 2.x new stuff, but still good for when +** using a front-end (instead of a plug-in) +*/ + + +#define IPC_SETPLAYLISTPOS 121 + +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS) +** +** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'. +*/ + + +#define IPC_SETVOLUME 122 + +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME); +** +** IPC_SETVOLUME sets the volume of Winamp (from 0-255). +*/ + + +#define IPC_SETPANNING 123 + +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING); +** +** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)). +*/ + + +#define IPC_GETLISTLENGTH 124 + +/* (requires Winamp 2.0+) +** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); +** +** IPC_GETLISTLENGTH returns the length of the current playlist, in +** tracks. +*/ + + +#define IPC_SETSKIN 200 + +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN); +** +** IPC_SETSKIN sets the current skin to "skinname". Note that skinname +** can be the name of a skin, a skin .zip file, with or without path. +** If path isn't specified, the default search path is the winamp skins +** directory. +*/ + + +#define IPC_GETSKIN 201 + +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN); +** +** IPC_GETSKIN puts the directory where skin bitmaps can be found +** into skinname_buffer. +** skinname_buffer must be MAX_PATH characters in length. +** When using a .zip'd skin file, it'll return a temporary directory +** where the ZIP was decompressed. +*/ + + +#define IPC_EXECPLUG 202 + +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG); +** +** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM. +** the format of this string can be: +** "vis_whatever.dll" +** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir) +** "C:\\dir\\vis_whatever.dll,1" +*/ + + +#define IPC_GETPLAYLISTFILE 211 + +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE); +** +** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETPLAYLISTTITLE 212 + +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE); +** +** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETLISTPOS 125 + +/* (requires Winamp 2.05+) +** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); +** +** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST +** only faster since it doesn't have to write out the list. Heh, silly me. +*/ + + +#define IPC_GETINFO 126 + +/* (requires Winamp 2.05+) +** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO); +** +** IPC_GETINFO returns info about the current playing song. The value +** it returns depends on the value of 'mode'. +** Mode Meaning +** ------------------ +** 0 Samplerate (i.e. 44100) +** 1 Bitrate (i.e. 128) +** 2 Channels (i.e. 2) +*/ + + +#define IPC_GETEQDATA 127 + +/* (requires Winamp 2.05+) +** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); +** +** IPC_GETEQDATA queries the status of the EQ. +** The value returned depends on what 'pos' is set to: +** Value Meaning +** ------------------ +** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db) +** 10 The preamp value. 0-63 (+20db - -20db) +** 11 Enabled. zero if disabled, nonzero if enabled. +** 12 Autoload. zero if disabled, nonzero if enabled. +*/ + + +#define IPC_SETEQDATA 128 + +/* (requires Winamp 2.05+) +** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA); +** +** IPC_SETEQDATA sets the value of the last position retrieved +** by IPC_GETEQDATA. +*/ + +/**************************************************************************/ + +/* +** Some API calls tend to require that you send data via WM_COPYDATA +** instead of WM_USER. Such as IPC_PLAYFILE: +*/ + +#define IPC_PLAYFILE 100 + +/* +** COPYDATASTRUCT cds; +** cds.dwData = IPC_PLAYFILE; +** cds.lpData = (void *) "file.mp3"; +** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); +** +** This will play the file "file.mp3". +** +*/ + + +#define IPC_CHDIR 103 + +/* +** COPYDATASTRUCT cds; +** cds.dwData = IPC_CHDIR; +** cds.lpData = (void *) "c:\\download"; +** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); +** +** This will make Winamp change to the directory C:\\download +** +*/ + + +/**************************************************************************/ + +/* +** Finally there are some WM_COMMAND messages that you can use to send +** Winamp misc commands. +** +** To send these, use: +** +** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0); +*/ + +#define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window +#define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window +#define WINAMP_VOLUMEUP 40058 // turns the volume up a little +#define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little +#define WINAMP_FFWD5S 40060 // fast forwards 5 seconds +#define WINAMP_REW5S 40061 // rewinds 5 seconds + +// the following are the five main control buttons, with optionally shift +// or control pressed +// (for the exact functions of each, just try it out) +#define WINAMP_BUTTON1 40044 +#define WINAMP_BUTTON2 40045 +#define WINAMP_BUTTON3 40046 +#define WINAMP_BUTTON4 40047 +#define WINAMP_BUTTON5 40048 +#define WINAMP_BUTTON1_SHIFT 40144 +#define WINAMP_BUTTON2_SHIFT 40145 +#define WINAMP_BUTTON3_SHIFT 40146 +#define WINAMP_BUTTON4_SHIFT 40147 +#define WINAMP_BUTTON5_SHIFT 40148 +#define WINAMP_BUTTON1_CTRL 40154 +#define WINAMP_BUTTON2_CTRL 40155 +#define WINAMP_BUTTON3_CTRL 40156 +#define WINAMP_BUTTON4_CTRL 40157 +#define WINAMP_BUTTON5_CTRL 40158 + +#define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box +#define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences +#define WINAMP_OPTIONS_AOT 40019 // toggles always on top +#define WINAMP_HELP_ABOUT 40041 // pops up the about box :) + + +/* +** EOF.. Enjoy. +*/ + +#endif diff --git a/Src/Plugins/Visualization/vis_avs/LICENSE.TXT b/Src/Plugins/Visualization/vis_avs/LICENSE.TXT new file mode 100644 index 00000000..7510f1aa --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/LICENSE.TXT @@ -0,0 +1,24 @@ +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.
diff --git a/Src/Plugins/Visualization/vis_avs/TIMING.C b/Src/Plugins/Visualization/vis_avs/TIMING.C new file mode 100644 index 00000000..b32b8743 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/TIMING.C @@ -0,0 +1,69 @@ +#include "timing.h" + +#ifdef TIMING +#ifndef __alpha + +#include <stdio.h> + +static struct { + unsigned int st_time[2]; + unsigned int cycles; + unsigned int calls; +} timingInfo[64]; + +static int timingEnters; + +static void rdtsc(unsigned int t[2]) +{ + __asm + { + mov esi, t + _emit 0xf + _emit 0x31 + mov [esi], eax + mov [esi+4], edx + } +} + +void _timingInit(void) +{ + memset(timingInfo,0,sizeof(timingInfo)); +} + +void _timingEnter(int which) +{ + // if (!timingEnters++) __asm cli + rdtsc(timingInfo[which].st_time); +} + +void _timingLeave(int which) +{ + unsigned int t[2]; + rdtsc(t); +// if (!--timingEnters) __asm sti + if (t[1]==timingInfo[which].st_time[1]) + { + timingInfo[which].cycles += t[0]-timingInfo[which].st_time[0]; + } + else + { + timingInfo[which].cycles += t[0]+(0xffffffff-timingInfo[which].st_time[0]); + } + timingInfo[which].calls++; +} + +void _timingPrint(void) +{ + int x; + FILE *fp = fopen("C:\\timings.txt","wt"); + for (x = 0; x < sizeof(timingInfo)/sizeof(timingInfo[0]); x ++) + { + if (timingInfo[x].calls) + fprintf(fp,"%d: %d calls, %d clocks/call\n",x,timingInfo[x].calls,timingInfo[x].cycles/timingInfo[x].calls); + } + timingInit(); + fclose(fp); +} + +#endif +#endif diff --git a/Src/Plugins/Visualization/vis_avs/Timing.h b/Src/Plugins/Visualization/vis_avs/Timing.h new file mode 100644 index 00000000..504c9386 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/Timing.h @@ -0,0 +1,32 @@ + +#ifndef _TIMING_H_ +#define _TIMING_H_ + + +//#define TIMING + + + +#if defined(TIMING) && !defined(__alpha) +#ifdef __cplusplus +extern "C" { +#endif +void _timingInit(void); +void _timingPrint(void); +void _timingEnter(int); +void _timingLeave(int); +#ifdef __cplusplus +} +#endif +#define timingPrint() _timingPrint() +#define timingInit() _timingInit() +#define timingLeave(x) _timingLeave(x) +#define timingEnter(x) _timingEnter(x) +#else +#define timingPrint() +#define timingInit() +#define timingLeave(x) +#define timingEnter(x) +#endif + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/VIS.H b/Src/Plugins/Visualization/vis_avs/VIS.H new file mode 100644 index 00000000..98d13957 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/VIS.H @@ -0,0 +1,76 @@ +/* + 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. + +*/ +// notes: +// any window that remains in foreground should optimally pass +// keystrokes to the parent (winamp's) window, so that the user +// can still control it. unless escape is hit, or some option +// key specific to the vis is hit. As for storing configuration, +// Configuration data should be stored in <dll directory>\plugin.ini +// Look at the example plugin for a framework. + +// ints are 32 bits, and structure members are aligned on the default 8 byte boundaries +// tested with VC++ 4.2 and 5.0 + + +typedef struct winampVisModule { + char *description; // description of module + HWND hwndParent; // parent window (filled in by calling app) + HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app) + int sRate; // sample rate (filled in by calling app) + int nCh; // number of channels (filled in...) + int latencyMs; // latency from call of RenderFrame to actual drawing + // (calling app looks at this value when getting data) + int delayMs; // delay between calls in ms + + // the data is filled in according to the respective Nch entry + int spectrumNch; + int waveformNch; + unsigned char spectrumData[2][576]; + unsigned char waveformData[2][576]; + + void (*Config)(struct winampVisModule *this_mod); // configuration dialog + int (*Init)(struct winampVisModule *this_mod); // 0 on success, creates window, etc + int (*Render)(struct winampVisModule *this_mod); // returns 0 if successful, 1 if vis should end + void (*Quit)(struct winampVisModule *this_mod); // call when done + + void *userData; // user data, optional +} winampVisModule; + +typedef struct { + int version; // VID_HDRVER + char *description; // description of library + winampVisModule* (*getModule)(int); +} winampVisHeader; + +// exported symbols +typedef winampVisHeader* (*winampVisGetHeaderType)(); + +// version of current module (0x101 == 1.01) +#define VIS_HDRVER 0x101
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/ape.h b/Src/Plugins/Visualization/vis_avs/ape.h new file mode 100644 index 00000000..b4bb6483 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/ape.h @@ -0,0 +1,96 @@ +/* + 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. + +*/ + +#ifndef _APE_H_ +#define _APE_H_ + + +//extended APE stuff + +// to use this, you should have: +// APEinfo *g_extinfo; +// void __declspec(dllexport) AVS_APE_SetExtInfo(HINSTANCE hDllInstance, APEinfo *ptr) +// { +// g_extinfo = ptr; +// } + +typedef void *VM_CONTEXT; +typedef void *VM_CODEHANDLE; +typedef struct +{ + int ver; // ver=1 to start + double *global_registers; // 100 of these + + // lineblendmode: 0xbbccdd + // bb is line width (minimum 1) + // dd is blend mode: + // 0=replace + // 1=add + // 2=max + // 3=avg + // 4=subtractive (1-2) + // 5=subtractive (2-1) + // 6=multiplicative + // 7=adjustable (cc=blend ratio) + // 8=xor + // 9=minimum + int *lineblendmode; + + //evallib interface + VM_CONTEXT (*allocVM)(); // return a handle + void (*freeVM)(VM_CONTEXT); // free when done with a VM and ALL of its code have been freed, as well + + // you should only use these when no code handles are around (i.e. it's okay to use these before + // compiling code, or right before you are going to recompile your code. + void (*resetVM)(VM_CONTEXT); + double * (*regVMvariable)(VM_CONTEXT, const char *name); + + // compile code to a handle + VM_CODEHANDLE (*compileVMcode)(VM_CONTEXT, char *code); + + // execute code from a handle + void (*executeCode)(VM_CODEHANDLE, char visdata[2][2][576]); + + // free a code block + void (*freeCode)(VM_CODEHANDLE); + + // requires ver >= 2 + void (*doscripthelp)(HWND hwndDlg,char *mytext); // mytext can be NULL for no custom page + + /// requires ver >= 3 + void *(*getNbuffer)(int w, int h, int n, int do_alloc); // do_alloc should be 0 if you dont want it to allocate if empty + // w and h should be the current width and height + // n should be 0-7 + +} APEinfo; + + + +#endif//_APE_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/ape.rc b/Src/Plugins/Visualization/vis_avs/apesdk/ape.rc new file mode 100644 index 00000000..33539d2d --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/ape.rc @@ -0,0 +1,80 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CONFIG DIALOG DISCARDABLE 0, 0, 137, 137 +STYLE WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Enable Tutorial Effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,25,86,84,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,39,29, + 53,49 + LTEXT "Color",IDC_STATIC,56,14,17,8 +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/avs_ape.h b/Src/Plugins/Visualization/vis_avs/apesdk/avs_ape.h new file mode 100644 index 00000000..cab80a31 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/avs_ape.h @@ -0,0 +1,110 @@ +// AVS APE (Plug-in Effect) header + +// base class to derive from +class C_RBASE { + public: + C_RBASE() { } + virtual ~C_RBASE() { }; + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)=0; // returns 1 if fbout has dest, 0 if framebuffer has dest + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent){return 0;}; + virtual char *get_desc()=0; + virtual void load_config(unsigned char *data, int len) { } + virtual int save_config(unsigned char *data) { return 0; } +}; + +// if you want to support SMP rendering, you can derive from this class instead, +// and expose the creator via: _AVS_APE_RetrFuncEXT2 +// (in general, exposing both for compatibility is a good idea) +class C_RBASE2 : public C_RBASE { + public: + C_RBASE2() { } + virtual ~C_RBASE2() { }; + + int getRenderVer2() { return 2; } + + + virtual int smp_getflags() { return 0; } // return 1 to enable smp support + + // returns # of threads you desire, <= max_threads, or 0 to not do anything + // default should return max_threads if you are flexible + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; } + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { }; + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; }; // return value is that of render() for fbstuff etc + +}; + +// lovely helper functions for blending +static unsigned int __inline BLEND(unsigned int a, unsigned int b) +{ + register unsigned int r,t; + r=(a&255)+((b)&255); + t=min(r,255); + r=((a>>8)&255)+((b>>8)&255); + t|=min(r,255)<<8; + r=((a>>16)&255)+((b>>16)&255); + return t|min(r,255)<<16; +} + +static unsigned int __inline BLEND_AVG(unsigned int a, unsigned int b) +{ + return ((a>>1)&~((1<<7)|(1<<15)|(1<<23)))+((b>>1)&~((1<<7)|(1<<15)|(1<<23))); +} + +//extended APE stuff + +// to use this, you should have: +// APEinfo *g_extinfo; +// void __declspec(dllexport) AVS_APE_SetExtInfo(HINSTANCE hDllInstance, APEinfo *ptr) +// { +// g_extinfo = ptr; +// } + +typedef void *VM_CONTEXT; +typedef void *VM_CODEHANDLE; +typedef struct +{ + int ver; // ver=1 to start + double *global_registers; // 100 of these + + // lineblendmode: 0xbbccdd + // bb is line width (minimum 1) + // dd is blend mode: + // 0=replace + // 1=add + // 2=max + // 3=avg + // 4=subtractive (1-2) + // 5=subtractive (2-1) + // 6=multiplicative + // 7=adjustable (cc=blend ratio) + // 8=xor + // 9=minimum + int *lineblendmode; + + //evallib interface + VM_CONTEXT (*allocVM)(); // return a handle + void (*freeVM)(VM_CONTEXT); // free when done with a VM and ALL of its code have been freed, as well + + // you should only use these when no code handles are around (i.e. it's okay to use these before + // compiling code, or right before you are going to recompile your code. + void (*resetVM)(VM_CONTEXT); + double * (*regVMvariable)(VM_CONTEXT, char *name); + + // compile code to a handle + VM_CODEHANDLE (*compileVMcode)(VM_CONTEXT, char *code); + + // execute code from a handle + void (*executeCode)(VM_CODEHANDLE, char visdata[2][2][576]); + + // free a code block + void (*freeCode)(VM_CODEHANDLE); + + // requires ver >= 2 + void (*doscripthelp)(HWND hwndDlg,char *mytext); // mytext can be NULL for no custom page + + /// requires ver >= 3 + void *(*getNbuffer)(int w, int h, int n, int do_alloc); // do_alloc should be 0 if you dont want it to allocate if empty + // w and h should be the current width and height + // n should be 0-7 + +} APEinfo;
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.avs b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.avs Binary files differnew file mode 100644 index 00000000..5bb3d7d8 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.avs diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.cpp b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.cpp new file mode 100644 index 00000000..e1c12f0f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.cpp @@ -0,0 +1,294 @@ + +/** + Example Winamp AVS plug-in + Copyright (c) 2000, Nullsoft Inc. + + Hello, welcome to the first Advanced Visualization + Studio tutorial! + The hope is that together, we can learn to utilize + AVS's powerful features: Namely direct access to the + frame buffer, EZ beat detection, and the ability to + stack plug-ins written by other developers for an + infinite array of possible effects. + + I hereby present: + Tutorial 0: BOX- + Simplicity at its finest. Displays a rectangle on + screen on every beat. Oh, and you can change its color + too... Check avstut00.avs for a demonstration of a + spinning rectangle's power! + + good luck and have fun! +**/ + +#include <windows.h> +#include "resource.h" +#include "avs_ape.h" + + +#define MOD_NAME "Tutorials / BOX v1.0" +#define UNIQUEIDSTRING "Nullsoft Tut0: BOX" + +// extended APE api support +APEinfo *g_extinfo; +extern "C" +{ + void __declspec(dllexport) _AVS_APE_SetExtInfo(HINSTANCE hDllInstance, APEinfo *ptr) + { + g_extinfo = ptr; + } +} + + + +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); + + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int enabled; // toggles plug-in on and off + int color; // color of rectangle +}; + +// global configuration dialog pointer +static C_THISCLASS *g_ConfigThis; +// global DLL instance pointer (not needed in this example, but could be useful) +static HINSTANCE g_hDllInstance; + + + +// this is where we deal with the configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + + if (g_ConfigThis->enabled) + { + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + } + return 1; + + case WM_DRAWITEM: + + DRAWITEMSTRUCT *di; + + di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) + { + int w; + int color; + + w=di->rcItem.right-di->rcItem.left; + color=g_ConfigThis->color; + color = ((color>>16)&0xff)|(color&0xff00)|((color<<16)&0xff0000); + + // paint nifty color button + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={BS_SOLID,color,0}; + hBrush = CreateBrushIndirect(&lb); + hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush); + Rectangle(di->hDC,di->rcItem.left,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + + } + return 0; + + case WM_COMMAND: + + // see if enable checkbox is checked + if (LOWORD(wParam) == IDC_CHECK1) + { + g_ConfigThis->enabled= (IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0); + } + + // is colorbox is selected? + if (LOWORD(wParam) == IDC_DEFCOL) + { + static COLORREF custcolors[16]; + int *a; + CHOOSECOLOR cs; + + a=&g_ConfigThis->color; + + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + + // go to windows color selection screen + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + + } + return 0; + } + return 0; +} + + + + +// set up default configuration +C_THISCLASS::C_THISCLASS() +{ + //set initial color + color=RGB(255,0,0); + enabled=1; +} + +// virtual destructor +C_THISCLASS::~C_THISCLASS() +{ +} + + +// RENDER FUNCTION: +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the-*/ width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int halfw; + int halfh; + + // is this effect on? + if (!enabled) + { + return 0; + } + + // did we just hit a beat? + if(isBeat) + { + // draw our magic box + halfw=w/2; + halfh=h/2; + + framebuffer+=(((halfh/2)*w)+ (halfw/2)); + + for(int j=0;j<halfh;j++) + { + for(int i=0;i<halfw;i++) + { + framebuffer[i]=color; + } + framebuffer+=w; + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return CreateDialog(hInstance,MAKEINTRESOURCE(IDD_CONFIG),hwndParent,g_DlgProc); +} + + +char *C_THISCLASS::get_desc(void) +{ + return MOD_NAME; +} + + +// load_/save_config are called when saving and loading presets (.avs files) + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + + // always ensure there is data to be loaded + if (len-pos >= 4) + { + // load activation toggle + enabled=GET_INT(); + pos+=4; + } + + if (len-pos >= 4) + { + // load the box color + color=GET_INT(); + pos+=4; + } +} + + +// write configuration to data, return length. config data should not exceed 64k. +#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 +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + + PUT_INT(enabled); + pos+=4; + + PUT_INT(color); + pos+=4; + + return pos; +} + + + + + + + +// export stuff +C_RBASE *R_RetrFunc(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) + { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_THISCLASS(); +} + +extern "C" +{ + __declspec (dllexport) int _AVS_APE_RetrFunc(HINSTANCE hDllInstance, char **info, int *create) // return 0 on failure + { + g_hDllInstance=hDllInstance; + *info=UNIQUEIDSTRING; + *create=(int)(void*)R_RetrFunc; + return 1; + } +}; + + +/** + Final Thoughts: + Alright! Hopefully you guys can take the next step + and display more than just a colored rectangle ;) The + exciting thing is, each time you write an AVS plug-in, + you exponentially increase AVS's potential, unlocking + the possibility of an effect you never expected. Good + luck, I hope this has helped! + + See you next time! +**/
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsp b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsp new file mode 100644 index 00000000..19cab2be --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsp @@ -0,0 +1,120 @@ +# Microsoft Developer Studio Project File - Name="avstut00" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=avstut00 - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "avstut00.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "avstut00.mak" CFG="avstut00 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "avstut00 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "avstut00 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "avstut00 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "AVSTUT00_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "AVSTUT00_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"c:/program files/winamp/plugins/avs/avstut00.ape" + +!ELSEIF "$(CFG)" == "avstut00 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 1 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "AVSTUT00_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /WX /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "AVSTUT00_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /machine:I386 /nodefaultlib /out:"c:/program files/winamp/plugins/avs/avstut00.ape" /pdbtype:sept +# SUBTRACT LINK32 /debug + +!ENDIF + +# Begin Target + +# Name "avstut00 - Win32 Release" +# Name "avstut00 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ape.rc +# End Source File +# Begin Source File + +SOURCE=.\avstut00.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\avs_ape.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsw b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsw new file mode 100644 index 00000000..f15a1851 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/avstut00.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "avstut00"=".\avstut00.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Src/Plugins/Visualization/vis_avs/apesdk/resource.h b/Src/Plugins/Visualization/vis_avs/apesdk/resource.h new file mode 100644 index 00000000..744de4f7 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/apesdk/resource.h @@ -0,0 +1,19 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ape.rc +// +#define IDD_CONFIG 109 +#define IDC_CHECK1 1000 +#define IDC_DEFCOL 1036 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/Visualization/vis_avs/avs-hilited.png b/Src/Plugins/Visualization/vis_avs/avs-hilited.png Binary files differnew file mode 100644 index 00000000..62cea6a3 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/avs-hilited.png diff --git a/Src/Plugins/Visualization/vis_avs/avs-normal.png b/Src/Plugins/Visualization/vis_avs/avs-normal.png Binary files differnew file mode 100644 index 00000000..f043035a --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/avs-normal.png diff --git a/Src/Plugins/Visualization/vis_avs/avs-selected.png b/Src/Plugins/Visualization/vis_avs/avs-selected.png Binary files differnew file mode 100644 index 00000000..e593769b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/avs-selected.png diff --git a/Src/Plugins/Visualization/vis_avs/avs_eelif.cpp b/Src/Plugins/Visualization/vis_avs/avs_eelif.cpp new file mode 100644 index 00000000..a9141809 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/avs_eelif.cpp @@ -0,0 +1,235 @@ +/* + 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. + +*/ +#include <windows.h> +#include "../ns-eel2/ns-eel-int.h" +#include "../ns-eel2/ns-eel-addfuncs.h" +#include "avs_eelif.h" + + + +char last_error_string[1024]; +int g_log_errors; +CRITICAL_SECTION g_eval_cs; +static char *g_evallib_visdata; + + + +/////////////////////// begin AVS specific script functions + + + +static double NSEEL_CGEN_CALL getvis(unsigned char *visdata, int bc, int bw, int ch, int xorv) +{ + int x; + int accum=0; + if (ch && ch != 1 && ch != 2) return 0.0; + + if (bw < 1) bw=1; + bc-=bw/2; + if (bc < 0) + { + bw+=bc; + bc=0; + } + if (bc > 575) bc=575; + if (bc+bw > 576) bw=576-bc; + + + if (!ch) + { + for (x = 0; x < bw; x ++) + { + accum+=(visdata[bc]^xorv)-xorv; + accum+=(visdata[bc+576]^xorv)-xorv; + bc++; + } + return (double)accum / ((double)bw*255.0); + } + else + { + if (ch == 2) visdata+=576; + for (x = 0; x < bw; x ++) accum+=(visdata[bc++]^xorv)-xorv; + return (double)accum / ((double)bw*127.5); + } +} + +static double NSEEL_CGEN_CALL getspec_(void *_this, double *band, double *bandw, double *chan) +{ + if (!g_evallib_visdata) return 0.0; + return getvis((unsigned char *)g_evallib_visdata,(int)(*band*576.0),(int)(*bandw*576.0),(int)(*chan+0.5),0)*0.5; +} + +static double NSEEL_CGEN_CALL getosc_(void *_this, double *band, double *bandw, double *chan) +{ + if (!g_evallib_visdata) return 0.0; + return getvis((unsigned char *)g_evallib_visdata+576*2,(int)(*band*576.0),(int)(*bandw*576.0),(int)(*chan+0.5),128); +} + +static double NSEEL_CGEN_CALL gettime_(void *_this, double *sc) +{ + int ispos; + if ((ispos=(*sc > -1.001 && *sc < -0.999)) || (*sc > -2.001 && *sc < -1.999)) + { + int pos=0; + + extern HWND hwnd_WinampParent; + if (IsWindow(hwnd_WinampParent)) + { + if (!SendMessageTimeout( hwnd_WinampParent, WM_USER,(WPARAM)!ispos,(LPARAM)105,SMTO_BLOCK,50,(LPDWORD)&pos)) pos=0; + } + if (!ispos) return (double)pos; + return pos / 1000.0; + } + + return GetTickCount()/1000.0 - *sc; +} + +static double NSEEL_CGEN_CALL setmousepos_(void *_this, double *x, double *y) +{ + //fucko: implement me + return 0.0; +} + + +extern double DDraw_translatePoint(POINT p, int isY); + +static double NSEEL_CGEN_CALL getmouse_(void *_this, double *which) +{ + int w=(int)(*which+0.5); + + if (w > 5) + return (GetAsyncKeyState(w)&0x8000)?1.0:0.0; + + if (w == 1 || w == 2) + { + POINT p; + GetCursorPos(&p); + return DDraw_translatePoint(p,w==2); + } + if (w == 3) return (GetAsyncKeyState(MK_LBUTTON)&0x8000)?1.0:0.0; + if (w == 4) return (GetAsyncKeyState(MK_RBUTTON)&0x8000)?1.0:0.0; + if (w == 5) return (GetAsyncKeyState(MK_MBUTTON)&0x8000)?1.0:0.0; + return 0.0; +} + + + +/////////////////////// end AVS specific script functions + +void NSEEL_HOSTSTUB_EnterMutex() +{ + EnterCriticalSection(&g_eval_cs); +} +void NSEEL_HOSTSTUB_LeaveMutex() +{ + LeaveCriticalSection(&g_eval_cs); +} + +void AVS_EEL_IF_init() +{ + InitializeCriticalSection(&g_eval_cs); + NSEEL_init(); + + // todo: check to see that parameter orders are correct + NSEEL_addfunctionex("getosc",3,(char *)_asm_generic3parm_retd,(char *)_asm_generic3parm_retd_end-(char *)_asm_generic3parm_retd,NSEEL_PProc_THIS,(void*)getosc_); + NSEEL_addfunctionex("getspec",3,(char *)_asm_generic3parm_retd,(char *)_asm_generic3parm_retd_end-(char *)_asm_generic3parm_retd,NSEEL_PProc_THIS,(void*)getspec_); + + NSEEL_addfunctionex("gettime",1,(char *)_asm_generic1parm_retd,(char *)_asm_generic1parm_retd_end-(char *)_asm_generic1parm_retd,NSEEL_PProc_THIS,(void*)gettime_); + NSEEL_addfunctionex("getkbmouse",1,(char *)_asm_generic1parm_retd,(char *)_asm_generic1parm_retd_end-(char *)_asm_generic1parm_retd,NSEEL_PProc_THIS,(void*)getmouse_); + + NSEEL_addfunctionex("setmousepos",2,(char *)_asm_generic2parm_retd,(char *)_asm_generic2parm_retd_end-(char *)_asm_generic2parm_retd,NSEEL_PProc_THIS,(void*)setmousepos_); +} +void AVS_EEL_IF_quit() +{ + DeleteCriticalSection(&g_eval_cs); + NSEEL_quit(); +} + +static void movestringover(char *str, int amount) +{ + char tmp[1024+8]; + + int l=(int)strlen(str); + l=min(1024-amount-1,l); + + memcpy(tmp,str,l+1); + + while (l >= 0 && tmp[l]!='\n') l--; + l++; + + tmp[l]=0;//ensure we null terminate + + memcpy(str+amount,tmp,l+1); +} + +NSEEL_CODEHANDLE AVS_EEL_IF_Compile(void *context, char *code) +{ + NSEEL_CODEHANDLE ret; + EnterCriticalSection(&g_eval_cs); + ret=NSEEL_code_compile((NSEEL_VMCTX)context,code,0); + if (!ret) + { + if (g_log_errors) + { + char *expr = NSEEL_code_getcodeerror((NSEEL_VMCTX)context); + if (expr) + { + int l=strlen(expr); + if (l > 512) l=512; + movestringover(last_error_string,l+2); + memcpy(last_error_string,expr,l); + last_error_string[l]='\r'; + last_error_string[l+1]='\n'; + } + } + } + LeaveCriticalSection(&g_eval_cs); + return ret; +} + +void AVS_EEL_IF_Execute(NSEEL_CODEHANDLE handle, char visdata[2][2][576]) +{ + if (handle) + { + EnterCriticalSection(&g_eval_cs); + g_evallib_visdata=(char*)visdata; + NSEEL_code_execute((NSEEL_CODEHANDLE)handle); + g_evallib_visdata=NULL; + LeaveCriticalSection(&g_eval_cs); + } +} + + +void AVS_EEL_IF_resetvars(NSEEL_VMCTX ctx) +{ + NSEEL_VM_freeRAM(ctx); + NSEEL_VM_remove_all_nonreg_vars(ctx); +} + diff --git a/Src/Plugins/Visualization/vis_avs/avs_eelif.h b/Src/Plugins/Visualization/vis_avs/avs_eelif.h new file mode 100644 index 00000000..9bbbc9fa --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/avs_eelif.h @@ -0,0 +1,59 @@ +/* + 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. + +*/ +#ifndef _AVS_EEL_IF_H_ +#define _AVS_EEL_IF_H_ + +#include "../ns-eel2/ns-eel.h" + +void AVS_EEL_IF_init(); +void AVS_EEL_IF_quit(); + +NSEEL_CODEHANDLE AVS_EEL_IF_Compile(void *ctx, char *code); +void AVS_EEL_IF_Execute(NSEEL_CODEHANDLE handle, char visdata[2][2][576]); +void AVS_EEL_IF_resetvars(NSEEL_VMCTX ctx); +#define AVS_EEL_IF_VM_free(x) NSEEL_VM_free(x) +extern char last_error_string[1024]; +extern int g_log_errors; +extern CRITICAL_SECTION g_eval_cs; + +// our old-style interface +#define compileCode(exp) AVS_EEL_IF_Compile(AVS_EEL_CONTEXTNAME,(exp)) +#define executeCode(x,y) AVS_EEL_IF_Execute(x,y) +#define freeCode(h) NSEEL_code_free(h) +#define resetVars(x) FIXME+++++++++ +#define registerVar(x) NSEEL_VM_regvar(AVS_EEL_CONTEXTNAME,(x)) +#define clearVars() AVS_EEL_IF_resetvars(AVS_EEL_CONTEXTNAME) + +#define AVS_EEL_INITINST() AVS_EEL_CONTEXTNAME=NSEEL_VM_alloc() + +#define AVS_EEL_QUITINST() NSEEL_VM_free(AVS_EEL_CONTEXTNAME) + + +#endif//_AVS_EEL_IF_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/bpm.cpp b/Src/Plugins/Visualization/vis_avs/bpm.cpp new file mode 100644 index 00000000..1ab80f79 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/bpm.cpp @@ -0,0 +1,711 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include <stdio.h> +#include "draw.h" +#include "wnd.h" +#include "r_defs.h" +#include "render.h" +#include "vis.h" +#include "cfgwnd.h" +#include "resource.h" +#include "bpm.h" +#include "../Agave/Language/api_language.h" + +int refineBeat(int isBeat); +BOOL TCHistStep(BeatType *t, DWORD _Avg, int *_halfDiscriminated, int *_hdPos, DWORD *_lastTC, DWORD TC, int Type); +void InsertHistStep(BeatType *t, DWORD TC, int Type, int i); +void CalcBPM(void); +BOOL ReadyToLearn(void); +BOOL ReadyToGuess(void); +void doubleBeat(void); +void halfBeat(void); +void ResetAdapt(void); +void SliderStep(int Ctl, int *slide); +void initBpm(void); +extern int g_fakeinit; + +int cfg_smartbeat=0; +int cfg_smartbeatsticky=1; +int cfg_smartbeatresetnewsong=1; +int cfg_smartbeatonlysticky=0; +int sticked=0; +int arbVal, skipVal; // Values of arbitrary beat and beat skip +int Bpm, Confidence, Confidence1, Confidence2; // Calculated BPM (realtime), Confidence computation +DWORD lastTC; // Last beat Tick count +DWORD lastTC2; // Last beat tick count 2 +BeatType TCHist[8]; // History of last 8 beats +BeatType TCHist2[8]; // History of last 8 beats +int Smoother[8]; // History of last 8 Bpm values, used to smooth changes +int halfDiscriminated[8]; // Discriminated beats table +int halfDiscriminated2[8]; // Discriminated beats table +int hdPos; // Position in discrimination table +int hdPos2; // Position in discrimination table +int smPtr, smSize; // Smoother pointer and size +int TCHistPtr; // Tick count history pointer +int TCHistSize; // Tick count history size +int offIMax; // Max divisor/multiplier used to guess/discriminate beats +int lastBPM; // Last calculated BPM, used by the smoother to detect new entry +int insertionCount; // Remembers how many beats were guessed +DWORD predictionLastTC; // Last tick count of guessed/accepted beat +DWORD Avg; // Average tick count interval between beats +DWORD Avg2; // Average tick count interval between beats +int skipCount; // Beat counter used by beat skipper +int inInc, outInc; // +1/-1, Used by the nifty beatsynced sliders +int inSlide, outSlide; // Positions of sliders +int oldInSlide, oldOutSlide; // Used by timer to detect changes in sliders +int oldsticked; // Used by timer to detect changes in sticked state +char txt[256]; // Contains txt about current BPM and confidence +int halfCount, doubleCount; // Counter used to autodetect if double/half beat needed +int TCUsed; // Remembers how many beats in the history were actually used for computation +int predictionBpm; // Contains BPM actually used to prediction (eliminates Bpm driftings) +int oldDisplayBpm, oldDisplayConfidence; // Detects stuff to redraw +int bestConfidence; // Best confidence we had so far +char lastSongName[256]; // Last song name, used to detect song changes in winamp +HWND winampWnd; // Winamp window +int forceNewBeat; // Force new bpm adoption +int betterConfidenceCount; // Used to decide when to adpot new beat +int topConfidenceCount; // Used to decide when to adpot new beat +int stickyConfidenceCount; // Used to decided when to go sticky +BOOL doResyncBpm=FALSE; + +// configuration dialog stuff +BOOL CALLBACK DlgProc_Bpm(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + inInc = 1; + outInc = 1; + inSlide = 0; + outSlide = 0; + oldDisplayBpm=-1; + oldDisplayConfidence=-1; + oldInSlide=-1; + oldOutSlide=-1; + if (cfg_smartbeat) CheckDlgButton(hwndDlg,IDC_BPMADV,BST_CHECKED); else CheckDlgButton(hwndDlg,IDC_BPMSTD,BST_CHECKED); + if (cfg_smartbeatsticky) CheckDlgButton(hwndDlg,IDC_STICKY,BST_CHECKED); + if (cfg_smartbeatresetnewsong) CheckDlgButton(hwndDlg,IDC_NEWRESET,BST_CHECKED); else CheckDlgButton(hwndDlg,IDC_NEWADAPT,BST_CHECKED); + if (cfg_smartbeatonlysticky) CheckDlgButton(hwndDlg,IDC_ONLYSTICKY,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETRANGE, TRUE, MAKELONG(0, 8)); + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETRANGE, TRUE, MAKELONG(0, 8)); + if (predictionBpm) + { + ShowWindow(GetDlgItem(hwndDlg, IDC_STICK), sticked ? SW_HIDE : SW_NORMAL); + ShowWindow(GetDlgItem(hwndDlg, IDC_UNSTICK), sticked ? SW_NORMAL : SW_HIDE); + } + else + { + ShowWindow(GetDlgItem(hwndDlg, IDC_STICK), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_UNSTICK), SW_HIDE); + } +/* ShowWindow(GetDlgItem(hwndDlg, IDC_CURBPM), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CURCONF), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_BPM), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CONFIDENCE), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_RESET), cfg_smartbeat ? SW_NORMAL : SW_HIDE);*/ + SetTimer(hwndDlg, 0, 50, NULL); + return 1; + case WM_TIMER: + { + if (oldInSlide != inSlide) { + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETPOS, TRUE, inSlide); oldInSlide=inSlide; } + if (oldOutSlide != outSlide) { + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETPOS, TRUE, outSlide); oldOutSlide=outSlide; } + if (oldDisplayBpm != predictionBpm || oldsticked != sticked) { + char lBuf[16]; + wsprintf(txt, predictionBpm ? "%d%s"/*/%d"*/ : WASABI_API_LNGSTRING_BUF(IDS_LEARNING,lBuf,16), predictionBpm, cfg_smartbeatsticky && sticked ? WASABI_API_LNGSTRING(IDS_GOT_IT) : ""/*, Bpm*/); + SetDlgItemText(hwndDlg, IDC_BPM, txt); + oldDisplayBpm=predictionBpm; + oldsticked=sticked; + if (predictionBpm) + { + ShowWindow(GetDlgItem(hwndDlg, IDC_STICK), sticked ? SW_HIDE : SW_NORMAL); + ShowWindow(GetDlgItem(hwndDlg, IDC_UNSTICK), sticked ? SW_NORMAL : SW_HIDE); + } + else + { + ShowWindow(GetDlgItem(hwndDlg, IDC_STICK), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_UNSTICK), SW_HIDE); + } + } + if (oldDisplayConfidence != Confidence) { + wsprintf(txt, "%d%%"/* (%d%%/%d%% - %d)"*/, Confidence/*, Confidence1, Confidence2, TCUsed*/); + SetDlgItemText(hwndDlg, IDC_CONFIDENCE, txt); + oldDisplayConfidence=Confidence; + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_BPMSTD) || + (LOWORD(wParam) == IDC_BPMADV) || + (LOWORD(wParam) == IDC_NEWRESET) || + (LOWORD(wParam) == IDC_NEWADAPT) || + (LOWORD(wParam) == IDC_ONLYSTICKY) || + (LOWORD(wParam) == IDC_STICKY)) + { + cfg_smartbeat=IsDlgButtonChecked(hwndDlg,IDC_BPMADV)?1:0; + cfg_smartbeatsticky=IsDlgButtonChecked(hwndDlg,IDC_STICKY)?1:0; + cfg_smartbeatresetnewsong=IsDlgButtonChecked(hwndDlg,IDC_NEWRESET)?1:0; + cfg_smartbeatonlysticky=IsDlgButtonChecked(hwndDlg,IDC_ONLYSTICKY)?1:0; + oldsticked=-1; +/* ShowWindow(GetDlgItem(hwndDlg, IDC_CURBPM), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CURCONF), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_BPM), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CONFIDENCE), cfg_smartbeat ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_RESET), cfg_smartbeat ? SW_NORMAL : SW_HIDE);*/ + } + if (LOWORD(wParam) == IDC_2X) + doubleBeat(); + if (LOWORD(wParam) == IDC_DIV2) + halfBeat(); + if (LOWORD(wParam) == IDC_RESET) + ResetAdapt(); + if (LOWORD(wParam) == IDC_STICK) + { + sticked=1; + stickyConfidenceCount=0; + } + if (LOWORD(wParam) == IDC_UNSTICK) + { + sticked=0; + stickyConfidenceCount=0; + } + return 0; + case WM_DESTROY: + KillTimer(hwndDlg, 0); + return 0; + } +return 0; +} + +void initBpm(void) +{ + if (g_fakeinit) return; + TCUsed=0; + *txt=0; + betterConfidenceCount=0; + topConfidenceCount=0; + forceNewBeat=0; + hdPos=0; + hdPos2=0; + inSlide=0; + outSlide=0; + oldDisplayBpm=-1; + oldDisplayConfidence=-1; + oldInSlide=0; + oldOutSlide=0; + Bpm = 0; + Avg = 0; + Avg2 = 0; + smPtr = 0; + smSize = 8; + offIMax = 8; + insertionCount = 0; + predictionLastTC = 0; + Confidence = 0; + Confidence1 = 0; + Confidence2 = 0; + halfCount=0; + doubleCount=0; + TCHistSize = 8; + predictionBpm=0; + lastTC=GetTickCount(); + stickyConfidenceCount=0; + memset(TCHist, 0, TCHistSize*sizeof(BeatType)); + memset(Smoother, 0, smSize*sizeof(int)); + memset(halfDiscriminated, 0, TCHistSize*sizeof(int)); + memset(halfDiscriminated2, 0, TCHistSize*sizeof(int)); + winampWnd = FindWindow("Winamp v1.x", NULL); + *lastSongName=0; + sticked=0; + oldsticked=-1; +} + +BOOL songChanged(DWORD TCNow) +{ +static DWORD lastCheck=0; +if (TCNow > lastCheck+1000) + { + char songName[256]; + lastCheck=TCNow; + GetWindowText(winampWnd, songName, 255); + if (strcmp(songName, lastSongName)) + { + strcpy(lastSongName, songName); + return TRUE; + } + } +return FALSE; +} + +void ResetAdapt(void) +{ +// Reset adaptive learning +*txt=0; +TCUsed=0; +hdPos=0; +Avg = 0; +Confidence=0; +Confidence1=0; +Confidence2=0; +betterConfidenceCount=0; +topConfidenceCount=0; +Bpm = 0; +smPtr = 0; +smSize = 8; +offIMax = 8; +insertionCount = 0; +predictionLastTC = 0; +halfCount=0; +doubleCount=0; +TCHistSize = 8; +predictionBpm=0; +bestConfidence=0; +lastTC=GetTickCount(); +sticked=0; +oldsticked=-1; +stickyConfidenceCount=0; +memset(TCHist, 0, TCHistSize*sizeof(BeatType)); +memset(TCHist2, 0, TCHistSize*sizeof(BeatType)); +memset(Smoother, 0, smSize*sizeof(int)); +memset(halfDiscriminated, 0, TCHistSize*sizeof(int)); +} + +// Insert a beat in history table. May be either real beat or guessed +void InsertHistStep(BeatType *t, DWORD TC, int Type, int i) +{ +if (i >= TCHistSize) return; +if (t == TCHist && insertionCount < TCHistSize*2) insertionCount++; +memmove(t+i+1, t+i, sizeof(BeatType)*(TCHistSize-(i+1))); +t[0].TC = TC; +t[0].Type = Type; +} + +// Doubles current beat +void doubleBeat(void) +{ +int i; +int iv[8]; + +if (sticked && Bpm > MIN_BPM) return; + +for (i=0;i<TCHistSize-1;i++) + iv[i] = TCHist[i].TC - TCHist[i+1].TC; + +for (i=1;i<TCHistSize;i++) + TCHist[i].TC = TCHist[i-1].TC-iv[i-1]/2; + +Avg /= 2; +Bpm *= 2; +doubleCount=0; +memset(Smoother, 0, smSize*sizeof(int)); +memset(halfDiscriminated, 0, TCHistSize*sizeof(int)); +//forceNewBeat=1; +} + +// Halfs current beat +void halfBeat(void) +{ +int i; +int iv[8]; + +if (sticked && Bpm < MIN_BPM) return; + +for (i=0;i<TCHistSize-1;i++) + iv[i] = TCHist[i].TC - TCHist[i+1].TC; + +for (i=1;i<TCHistSize;i++) + TCHist[i].TC = TCHist[i-1].TC-iv[i-1]*2; + +Avg *= 2; +Bpm /= 2; +halfCount=0; +memset(Smoother, 0, smSize*sizeof(int)); +memset(halfDiscriminated, 0, TCHistSize*sizeof(int)); +} + +// Called whenever isBeat was true in render +BOOL TCHistStep(BeatType *t, DWORD _Avg, int *_halfDiscriminated, int *_hdPos, DWORD *_lastTC, DWORD TC, int Type) +{ +int i=0; +int offI; +DWORD thisLen; +BOOL learning = ReadyToLearn(); +thisLen = TC-lastTC; + +// If this beat is sooner than half the average - 20%, throw it away +if (thisLen < Avg/2 - Avg*0.2) + { + if (learning) + { + if (labs(Avg - (TC - t[1].TC)) < labs(Avg - (t[0].TC - t[1].TC))) + { +/* if (predictionLastTC && t[0].Type == BEAT_GUESSED && Type == BEAT_REAL) + predictionLastTC += (TC - t[0].TC)/2;*/ + t[0].TC = TC; + t[0].Type = Type; + return TRUE; + } + } + return FALSE; + } + +if (learning) + for (offI=2;offI<offIMax;offI++) // Try to see if this beat is in the middle of our current Bpm, or maybe 1/3, 1/4 etc... to offIMax + if ((float)labs((Avg/offI)-thisLen) < (float)(Avg/offI)*0.2) + { + _halfDiscriminated[(*_hdPos)++]=1; // Should test if offI==2 before doing that, but seems to have better results ? I'll have to investigate this + (*_hdPos)%=8; + return FALSE; + } + +// This beat is accepted, so set this discrimination entry to false +_halfDiscriminated[hdPos++]=0; +(*_hdPos)%=8; + +// Check if we missed some beats +/*if (learning && thisLen > 1000 || (float)abs(Avg-thisLen) > (float)Avg*0.3) + for (offI=2;offI<offIMax;offI++) + { + if ((float)abs((Avg*offI)-thisLen) < (float)Avg*0.2) + { + for (j=1;j<offI;j++) // Oh yeah we definitly did, add one! + InsertHistStep(TC - (Avg*j), BEAT_GUESSED, offI-1); // beat has been guessed so report it so confidence can be calculated + break; + } + }*/ + + +// Remember this tick count +*_lastTC = TC; +// Insert this beat. +InsertHistStep(t, TC, Type, 0); +return TRUE; +} + +// Am i ready to learn ? +BOOL ReadyToLearn(void) +{ +int i; +for (i=0;i<TCHistSize;i++) + if (TCHist[i].TC==0) return FALSE; +return TRUE; +} + +// Am i ready to guess ? +BOOL ReadyToGuess(void) +{ +return insertionCount == TCHistSize*2; +} + +void newBpm(int thisBpm) +{ +Smoother[smPtr++] = thisBpm; +smPtr %= smSize; +} + +int GetBpm(void) +{ +int i; +int smN=0; +int smSum=0; +// Calculate smoothed Bpm +for (i=0;i<smSize;i++) + if (Smoother[i] > 0) { + smSum += Smoother[i]; + smN++; + } +if (smN) return smSum / smN; +return 0; +} + +// Calculate BPM according to beat history +void CalcBPM(void) +{ +int i; +int hdCount=0; +int r=0; +int totalTC=0, totalN=0; +float rC, etC; +int v; +double sc=0; +int mx=0; +float et; +int smSum=0, smN=0; + +if (!ReadyToLearn()) + return; + +// First calculate average beat +for (i=0;i<TCHistSize-1;i++) + totalTC += TCHist[i].TC - TCHist[i+1].TC; + +Avg = totalTC/(TCHistSize-1); + +// Count how many of then are real as opposed to guessed +for (i=0;i<TCHistSize;i++) + if (TCHist[i].Type == BEAT_REAL) + r++; + +// Calculate part 1 of confidence +rC = (float)min((float)((float)r / (float)TCHistSize) * 2, 1); + +// Calculate typical drift +for (i=0;i<TCHistSize-1;i++) + { + v = TCHist[i].TC - TCHist[i+1].TC; + mx = max(mx, v); + sc += v*v; + } +et = (float)sqrt(sc / (TCHistSize-1) - Avg*Avg); +// Calculate confidence based on typical drift and max derivation +etC = 1 - ((float)et / (float)mx); + +// Calculate confidence +Confidence = max(0, (int)(((rC * etC) * 100.0) - 50) * 2); +Confidence1 = (int)(rC * 100); +Confidence2 = (int)(etC * 100); + +// Now apply second layer, recalculate average using only beats within range of typical drift +// Also, count how many of them we are keeping +totalTC=0; +for (i=0;i<TCHistSize-1;i++) + { + v += TCHist[i].TC - TCHist[i+1].TC; + if (labs(Avg-v) < et) + { + totalTC += v; + totalN++; + v = 0; + } + else + if ((float)v > Avg) + v = 0; + } +TCUsed = totalN; +// If no beat was within typical drift (how would it be possible? well lets cover our ass) then keep the simple +// average calculated earlier, else recalculate average of beats within range +if (totalN) + Avg = totalTC/totalN; + +if (ReadyToGuess()) + { + if (Avg) // Avg = 0 ? Ahem.. + Bpm = 60000 / Avg; + + + if (Bpm != lastBPM) + { + newBpm(Bpm); // If realtime Bpm has changed since last time, then insert it in the smoothing tab;e + lastBPM = Bpm; + + if (cfg_smartbeatsticky && predictionBpm && Confidence >= ((predictionBpm < 90) ? STICKY_THRESHOLD_LOW : STICKY_THRESHOLD)) + { + stickyConfidenceCount++; + if (stickyConfidenceCount >= MIN_STICKY) + sticked=1; + } + else + stickyConfidenceCount=0; + } + + Bpm = GetBpm(); + + // Count how many beats we discriminated + for (i=0;i<TCHistSize;i++) + if (halfDiscriminated[i]) hdCount++; + + if (hdCount >= TCHistSize/2) // If we removed at least half of our beats, then we are off course. We should double our bpm + { + if (Bpm * 2 < MAX_BPM) // Lets do so only if the doubled bpm is < MAX_BPM + { + doubleBeat(); + memset(halfDiscriminated, 0, TCHistSize*sizeof(int)); // Reset discrimination table + } + } + if (Bpm > 500 || Bpm < 0) + { + ResetAdapt(); + } + if (Bpm < MIN_BPM) + { + if (++doubleCount > 4) // We're going too slow, lets double our bpm + doubleBeat(); + } + else + doubleCount=0; + if (Bpm > MAX_BPM) // We're going too fast, lets slow our bpm by a factor of 2 + { + if (++halfCount > 4) + halfBeat(); + } + else + halfCount=0; + } +} + +void SliderStep(int Ctl, int *slide) +{ +*slide += Ctl == IDC_IN ? inInc : outInc; +if (!*slide || *slide == 8) (Ctl == IDC_IN ? inInc : outInc) *= -1; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int refineBeat(int isBeat) +{ + BOOL accepted=FALSE; + BOOL predicted=FALSE; + BOOL resyncin=FALSE; + BOOL resyncout=FALSE; + + if (isBeat) // Show the beat received from AVS + SliderStep(IDC_IN, &inSlide); + + DWORD TCNow = GetTickCount(); + + if (songChanged(TCNow)) + { + bestConfidence=(int)((float)bestConfidence*0.5); + sticked=0; + stickyConfidenceCount=0; + if (cfg_smartbeatresetnewsong) + ResetAdapt(); + } + + // Try to predict if this frame should be a beat + if (Bpm && TCNow > predictionLastTC + (60000 / Bpm)) + predicted = TRUE; + + + if (isBeat) // If it is a real beat, do discrimination/guessing and computations, then see if it is accepted + accepted = TCHistStep(TCHist, Avg, halfDiscriminated, &hdPos, &lastTC, TCNow, BEAT_REAL); + + // Calculate current Bpm + CalcBPM(); + + // If prediction Bpm has not yet been set + // or if prediction bpm is too high or too low + // or if 3/4 of our history buffer contains beats within the range of typical drift + // the accept the calculated Bpm as the new prediction Bpm + // This allows keeping the beat going on when the music fades out, and readapt to the new beat as soon as + // the music fades in again + if ((accepted || predicted) && !sticked && (!predictionBpm || predictionBpm > MAX_BPM || predictionBpm < MIN_BPM)) + { + if (Confidence >= bestConfidence) + { +/* betterConfidenceCount++; + if (!predictionBpm || betterConfidenceCount == BETTER_CONF_ADOPT) + {*/ + forceNewBeat=1; +/* betterConfidenceCount=0; + }*/ + } + if (Confidence >= 50) + { + topConfidenceCount++; + if (topConfidenceCount == TOP_CONF_ADOPT) + { + forceNewBeat=1; + topConfidenceCount=0; + } + } + if (forceNewBeat) + { + forceNewBeat=0; + bestConfidence = Confidence; + predictionBpm=Bpm; + } + } + + if (!sticked) predictionBpm = Bpm; + Bpm=predictionBpm; + + +/* resync = (predictionBpm && + (predictionLastTC < TCNow - (30000/predictionBpm) - (60000/predictionBpm)*0.2) || + (predictionLastTC < TCNow - (30000/predictionBpm) - (60000/predictionBpm)*0.2));*/ + if (predictionBpm && accepted && !predicted) + { + int b=0; + if (TCNow > predictionLastTC + (60000 / predictionBpm)*0.7) + { + resyncin = TRUE; + b = (int)((float)predictionBpm * 1.01); + } + if (TCNow < predictionLastTC + (60000 / predictionBpm)*0.3) + { + resyncout = TRUE; + b = (int)((float)predictionBpm * 0.98); + } + if (!sticked && doResyncBpm && (resyncin || resyncout)) + { + newBpm(b); + predictionBpm = GetBpm(); + } + } + + if (resyncin) + { + predictionLastTC = TCNow; + SliderStep(IDC_OUT, &outSlide); + doResyncBpm=TRUE; + return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 1 : isBeat; + } + if (predicted) + { + predictionLastTC = TCNow; + if (Confidence > 25) TCHistStep(TCHist, Avg, halfDiscriminated, &hdPos, &lastTC, TCNow, BEAT_GUESSED); + SliderStep(IDC_OUT, &outSlide); + doResyncBpm=FALSE; + return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 1 : isBeat; + } + if (resyncout) + { + predictionLastTC = TCNow; + doResyncBpm=TRUE; + return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 0 : isBeat; + } + + return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? (predictionBpm ? 0 : isBeat) : isBeat; +} + + + diff --git a/Src/Plugins/Visualization/vis_avs/bpm.h b/Src/Plugins/Visualization/vis_avs/bpm.h new file mode 100644 index 00000000..8b20bff7 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/bpm.h @@ -0,0 +1,56 @@ +/* + 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. + +*/ +#ifndef __BPM_H +#define __BPM_H + +#define BEAT_REAL 1 +#define BEAT_GUESSED 2 + +#define MAX_BPM 170 +#define MIN_BPM 60 + +#define BETTER_CONF_ADOPT 2 +#define TOP_CONF_ADOPT 8 +#define MIN_STICKY 8 +#define STICKY_THRESHOLD 70 +#define STICKY_THRESHOLD_LOW 85 + +typedef struct { + DWORD TC; // Tick count + int Type; // Real/guessed + }BeatType; + + +BOOL CALLBACK DlgProc_Bpm(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +void initBpm(void); +int refineBeat(int isBeat); + + +#endif diff --git a/Src/Plugins/Visualization/vis_avs/bump_lig.bin b/Src/Plugins/Visualization/vis_avs/bump_lig.bin new file mode 100644 index 00000000..e7227805 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/bump_lig.bin @@ -0,0 +1,22 @@ +How to use the custom light position evaluator: + * Init code will be executed each time the window size is changed + or when the effect loads + * Frame code is executed before rendering a new frame + * Beat code is executed when a beat is detected + +Predefined variables: + x : Light x position, ranges from 0 (left) to 1 (right) (0.5 = center) + y : Light y position, ranges from 0 (top) to 1 (bottom) (0.5 = center) + isBeat : 1 if no beat, -1 if beat (weird, but old) + isLBeat: same as isBeat but persists according to 'shorter/longer' settings + (usable only with OnBeat checked) + bi: Bump intensity, ranges from 0 (flat) to 1 (max specified bump, default) + You may also use temporary variables accross code segments + +Some examples: + Circular move + Init : t=0 + Frame: x=0.5+cos(t)*0.3; y=0.5+sin(t)*0.3; t=t+0.1; + Nice motion: + Init : t=0;u=0 + Frame: x=0.5+cos(t)*0.3; y=0.5+cos(u)*0.3; t=t+0.1; u=u+0.012;
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/cfgwin.cpp b/Src/Plugins/Visualization/vis_avs/cfgwin.cpp new file mode 100644 index 00000000..d16a3ba2 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/cfgwin.cpp @@ -0,0 +1,1918 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdio.h> +#include <commctrl.h> +#include "r_defs.h" +#include "vis.h" +#include "cfgwnd.h" +#include "resource.h" +#include "render.h" +#include "rlib.h" +#include "draw.h" +#include "wnd.h" +#include "bpm.h" +#include "avs_eelif.h" +#include "undo.h" +#include "../Agave/Language/api_language.h" +#include "../WAT/WAT.h" + +#ifdef LASER +extern "C" { +#include "laser/ld32.h" +} +#endif +static void _do_add(HWND hwnd, HTREEITEM h, C_RenderListClass *list); +static int treeview_hack; +static HTREEITEM g_hroot; + +extern int g_config_smp_mt,g_config_smp; +extern struct winampVisModule *g_mod; +extern int cfg_cancelfs_on_deactivate; + +HWND g_debugwnd; + +char g_noeffectstr[48]; +//extern char *verstr; +static HWND cur_hwnd; +int is_aux_wnd=0; +int config_prompt_save_preset=1,config_reuseonresize=1; +//int g_preset_dirty; + +// extern BOOL CALLBACK aboutProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +extern BOOL CALLBACK DlgProc_Bpm(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +extern int readyToLoadPreset(HWND parent, int isnew); + +extern char *extension(char *fn) ; + +int g_dlg_fps,g_dlg_w,g_dlg_h; + +int cfg_cfgwnd_x=50,cfg_cfgwnd_y=50,cfg_cfgwnd_open=0; + +int cfg_fs_w=0,cfg_fs_h=0,cfg_fs_d=2,cfg_fs_bpp=0,cfg_fs_fps=0,cfg_fs_rnd=1, +#ifdef LASER +cfg_fs_flip=6, +#else +cfg_fs_flip=0, +#endif +cfg_fs_height=80,cfg_speed=5,cfg_fs_rnd_time=10,cfg_fs_use_overlay=0; +int cfg_trans=0,cfg_trans_amount=128; +int cfg_dont_min_avs=0; +int cfg_transitions=4; +int cfg_transitions2=4|32; +int cfg_transitions_speed=8; +int cfg_transition_mode=0x8001; +int cfg_bkgnd_render=0,cfg_bkgnd_render_color=0x1F000F; +int cfg_render_prio=0; + +char config_pres_subdir[MAX_PATH]; +char last_preset[2048]; + +static BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +HWND g_hwndDlg; + +extern HWND g_hwnd; + +#ifdef WA2_EMBED +#include "wa_ipc.h" +extern embedWindowState myWindowState; +#endif + +/* +HINSTANCE g_hDllInstance; +HWND g_hwndParent; +HANDLE hcfgThread; +DWORD WINAPI cfgwnd_thread(LPVOID p) +{ + g_hwndDlg=CreateDialog(g_hDllInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,dlgProc); + while (1) + { + MSG msg; + if (!GetMessage(&msg,NULL,0,0)) break; + if (!IsDialogMessage(g_hwndDlg,&msg)) DispatchMessage(&msg); + } + return 0; +} +*/ +static int ExtractWindowsVersion(void) +{ + int dwVersion,dwWindowsMajorVersion,dwWindowsMinorVersion,WindowsType,dwBuild; + + dwVersion = GetVersion(); + + // Get major and minor version numbers of Windows + + dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + + // Get build numbers for Windows NT or Win32s + if (dwVersion < 0x80000000) // Windows NT + { + dwBuild = (DWORD)(HIWORD(dwVersion)); + WindowsType = 0x4; // VER_WINNT + } + else if (dwWindowsMajorVersion < 4) // Win32s + { + dwBuild = (DWORD)(HIWORD(dwVersion) & ~0x8000); + WindowsType = 0x2; // VER_WIN32S + } + else // Windows 95 -- No build numbers provided + { + dwBuild = 0; + WindowsType = 0x1; // VER_WIN95 + } + + return dwWindowsMajorVersion; +} + +void CfgWnd_Create(struct winampVisModule *this_mod) +{ + WASABI_API_CREATEDIALOG(IDD_DIALOG1,this_mod->hwndParent,dlgProc); + //CreateDialogA(this_mod->hDllInstance,MAKEINTRESOURCE(IDD_DIALOG1),this_mod->hwndParent,dlgProc); +} + +void CfgWnd_Destroy(void) +{ + if (g_hwndDlg && IsWindow(g_hwndDlg)) + { + RECT r; + GetWindowRect(g_hwndDlg,&r); + cfg_cfgwnd_x=r.left; + cfg_cfgwnd_y=r.top; + DestroyWindow(g_hwndDlg); + } + g_hwndDlg=0; + if (g_debugwnd) DestroyWindow(g_debugwnd); + /* + if (hcfgThread) + { + SendMessage(g_hwndDlg,WM_USER+6,0,0); + g_hwndDlg=0; + WaitForSingleObject(hcfgThread,INFINITE); + CloseHandle(hcfgThread); + hcfgThread=0; + } + */ +} + +static void recursiveAddDirList(HMENU menu, UINT *id, char *path, int pathlen) +{ + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[4096]; + wsprintf(dirmask,"%s\\*.*",path); + + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do { + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[0] != '.') + { + wsprintf(dirmask,"%s\\%s",path,d.cFileName); + + MENUITEMINFO i={sizeof(i),}; + i.fType=MFT_STRING; + i.fMask=MIIM_TYPE|MIIM_ID; + i.dwTypeData = dirmask+pathlen+1; + i.cch = strlen(i.dwTypeData); + i.wID=*id; + InsertMenuItem(menu,*id+2-1025,TRUE,&i); + (*id)++; + + recursiveAddDirList(menu,id,dirmask,pathlen); + } + } while (FindNextFile(h,&d)); + FindClose(h); + } +} + +static BOOL CALLBACK DlgProc_Preset(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 0; x < 12; x ++) + { + char s[123]; + wsprintf(s,"F%d",x+1); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)s); + } + for (x = 0; x < 10; x ++) + { + char s[123]; + wsprintf(s,"%d",x); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)s); + } + for (x = 0; x < 10; x ++) + { + char s[123]; + wsprintf(s,WASABI_API_LNGSTRING(IDS_SHIFT_X),x); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)s); + } + + CheckDlgButton(hwndDlg,IDC_CHECK3,cfg_fs_rnd?BST_CHECKED:BST_UNCHECKED); + SetDlgItemInt(hwndDlg,IDC_EDIT1,cfg_fs_rnd_time,FALSE); + if (config_prompt_save_preset) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + + if (config_pres_subdir[0]) + SetDlgItemText(hwndDlg,IDC_BUTTON3,config_pres_subdir); + else + SetDlgItemText(hwndDlg,IDC_BUTTON3,WASABI_API_LNGSTRING(IDS_ALL)); + } + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_BUTTON3: + { + MENUITEMINFO i={sizeof(i),}; + + HMENU hMenu; + hMenu=CreatePopupMenu(); + i.fMask=MIIM_TYPE|MIIM_ID; + i.fType=MFT_STRING; + i.wID = 1024; + i.dwTypeData=WASABI_API_LNGSTRING(IDS_ALL); + i.cch=strlen(i.dwTypeData); + InsertMenuItem(hMenu,0,TRUE,&i); + i.wID=0; + i.fType=MFT_SEPARATOR; + InsertMenuItem(hMenu,1,TRUE,&i); + + UINT id=1025; + recursiveAddDirList(hMenu,&id,g_path,strlen(g_path)); + + RECT r; + GetWindowRect(GetDlgItem(hwndDlg,IDC_BUTTON3),&r); + + int x=TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,r.left,r.bottom,0,hwndDlg,NULL); + if (x == 1024) + { + config_pres_subdir[0]=0; + SetDlgItemText(hwndDlg,IDC_BUTTON3,WASABI_API_LNGSTRING(IDS_ALL)); + } + else if (x >= 1025) + { + MENUITEMINFO mi={sizeof(mi),MIIM_TYPE,}; + mi.dwTypeData=config_pres_subdir; + mi.cch = sizeof(config_pres_subdir); + GetMenuItemInfo(hMenu,x,FALSE,&mi); + SetDlgItemText(hwndDlg,IDC_BUTTON3,config_pres_subdir); + } + DestroyMenu(hMenu); + } + return 0; + case IDC_CHECK1: + config_prompt_save_preset=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + return 0; + case IDC_CHECK3: + cfg_fs_rnd=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?1:0; + #ifdef WA2_EMBED + SendMessage(g_mod->hwndParent,WM_WA_IPC,cfg_fs_rnd,IPC_CB_VISRANDOM); + #endif + return 0; + case IDC_EDIT1: + if (HIWORD(wParam) == EN_CHANGE) + { + BOOL f; + int r=GetDlgItemInt(hwndDlg,IDC_EDIT1,&f,0); + if (f) + { + cfg_fs_rnd_time=r; + } + } + return 0; + case IDC_BUTTON1: + { + int w=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (w != CB_ERR) + { + extern void WritePreset(int preset); + WritePreset(w); + } + } + return 0; + case IDC_BUTTON2: + if (readyToLoadPreset(hwndDlg,0)) + { + int w=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (w != CB_ERR) + { + extern int LoadPreset(int preset); + LoadPreset(w); + } + } + return 0; + } + } + return 0; +} + +static BOOL CALLBACK DlgProc_Disp(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + if (ExtractWindowsVersion()<5) + { + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANS_CHECK),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANS_SLIDER),0); + } + else + { + CheckDlgButton(hwndDlg,IDC_TRANS_CHECK,cfg_trans?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_TRANS_SLIDER, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(16,255)); + SendDlgItemMessage(hwndDlg,IDC_TRANS_SLIDER, TBM_SETTICFREQ, 10, (LPARAM)0); + SendDlgItemMessage(hwndDlg,IDC_TRANS_SLIDER, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)cfg_trans_amount); + } +#ifdef LASER + extern int g_laser_nomessage,g_laser_zones; + ShowWindow(GetDlgItem(hwndDlg,IDC_L_SUPPRESS_OUTPUT),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_L_SYNC),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_L_SUPPRESS_DIALOGS),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_L_PROJZONES),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_L_FRAME),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_L_ACTIVEOUTPUT),SW_SHOWNA); + ShowWindow(GetDlgItem(hwndDlg,IDC_THREADSBORDER),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_CHECK4),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_EDIT1),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_THREADS),SW_HIDE); + CheckDlgButton(hwndDlg,IDC_L_SUPPRESS_DIALOGS,(g_laser_nomessage&1)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_L_SUPPRESS_OUTPUT,(g_laser_nomessage&4)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_L_SYNC,(g_laser_nomessage&8)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_L_ACTIVEOUTPUT,(g_laser_nomessage&2)?BST_CHECKED:BST_UNCHECKED); +#else + CheckDlgButton(hwndDlg,IDC_CHECK4,g_config_smp?BST_CHECKED:0); + SetDlgItemInt(hwndDlg,IDC_EDIT1,g_config_smp_mt,FALSE); +#endif + } +#ifdef WA2_EMBED + { + HWND w = myWindowState.me; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) w = GetParent(w); + char classname[256]; + GetClassName(w, classname, 255); classname[255] = 0; + if (!stricmp(classname, "BaseWindow_RootWnd")) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_ALPHA), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANS_CHECK), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_TRANS_SLIDER), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_TRANS_TOTAL), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_TRANS_NONE), FALSE); + } + } +#endif + CheckDlgButton(hwndDlg,IDC_CHECK1,(cfg_fs_d&2)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK6,(cfg_fs_flip&4)?BST_UNCHECKED:BST_CHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK3,(cfg_fs_fps&2)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK5,(cfg_fs_fps&4)?BST_CHECKED:BST_UNCHECKED); + //CheckDlgButton(hwndDlg,IDC_DONT_MIN_AVS,cfg_dont_min_avs?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK2,config_reuseonresize?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_BKGND_RENDER,(cfg_bkgnd_render&1)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_SETDESKTOPCOLOR,(cfg_bkgnd_render&2)?BST_CHECKED:BST_UNCHECKED); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,80); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,cfg_speed&0xff); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_SAME_AS_WINAMP)); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_IDLE)); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_LOWEST)); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_NORMAL)); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_HIGHEST)); + SendDlgItemMessage(hwndDlg, IDC_THREAD_PRIORITY, CB_SETCURSEL, cfg_render_prio, 0); + return 1; + + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + switch (di->CtlID) + { + case IDC_OVERLAYCOLOR: + GR_DrawColoredButton(di,cfg_bkgnd_render_color); + break; + } + } + return 0; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + cfg_speed&=~0xff; + cfg_speed|=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_TRANS_SLIDER)) + { + cfg_trans_amount=t; + SetTransparency(g_hwnd,cfg_trans,cfg_trans_amount); + } + } + return 0; + case WM_COMMAND: + switch (LOWORD(wParam)) + { +#ifdef LASER + case IDC_L_PROJZONES: + { + extern int g_laser_zones; + HMENU hMenu=CreatePopupMenu(); + int x; + for (x=0;x <20; x++) + { + PROJECTIONZONE pz; + if (ReadProjectionZone(x+1,&pz)) + wsprintf(pz.Name,"Zone %d",x); + if (!pz.Name[0]) break; + + MENUITEMINFO i={sizeof(i),}; + i.wID = x+1; + i.fMask=MIIM_TYPE|MIIM_ID|MIIM_STATE; + i.fState=(g_laser_zones&(1<<x))?MFS_CHECKED:0; + i.fType=MFT_STRING; + i.dwTypeData=pz.Name; + i.cch=strlen(pz.Name); + InsertMenuItem(hMenu,x,TRUE,&i); + } + + RECT r; + GetWindowRect(GetDlgItem(hwndDlg,IDC_L_PROJZONES),&r); + + int v=TrackPopupMenu(hMenu,TPM_NONOTIFY|TPM_RETURNCMD,r.right,r.top,0,GetDlgItem(hwndDlg,IDC_L_PROJZONES),NULL); + DestroyMenu(hMenu); + if (v > 0) + { + g_laser_zones^=1<<(v-1); + if (!g_laser_zones) g_laser_zones=1; + } + } + + return 0; + case IDC_L_SYNC: + { + extern int g_laser_nomessage; + g_laser_nomessage&=~8; + g_laser_nomessage|=IsDlgButtonChecked(hwndDlg,IDC_L_SYNC)?8:0; + } + return 0; + case IDC_L_SUPPRESS_OUTPUT: + { + extern int g_laser_nomessage; + g_laser_nomessage&=~4; + g_laser_nomessage|=IsDlgButtonChecked(hwndDlg,IDC_L_SUPPRESS_OUTPUT)?4:0; + } + return 0; + case IDC_L_SUPPRESS_DIALOGS: + { + extern int g_laser_nomessage; + g_laser_nomessage&=~1; + g_laser_nomessage|=IsDlgButtonChecked(hwndDlg,IDC_L_SUPPRESS_DIALOGS)?1:0; + } + return 0; + case IDC_L_ACTIVEOUTPUT: + { + extern int g_laser_nomessage; + g_laser_nomessage&=~2; + g_laser_nomessage|=IsDlgButtonChecked(hwndDlg,IDC_L_ACTIVEOUTPUT)?2:0; + } + return 0; +#else + case IDC_CHECK4: + g_config_smp=!!IsDlgButtonChecked(hwndDlg,IDC_CHECK4); + return 0; + case IDC_EDIT1: + { + BOOL t; + g_config_smp_mt=GetDlgItemInt(hwndDlg,IDC_EDIT1,&t,FALSE); + } + return 0; +#endif + case IDC_TRANS_CHECK: + cfg_trans=IsDlgButtonChecked(hwndDlg,IDC_TRANS_CHECK)?1:0; + SetTransparency(g_hwnd,cfg_trans,cfg_trans_amount); + return 0; + case IDC_CHECK1: + cfg_fs_d&=~2; + cfg_fs_d|=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?2:0; + { + RECT r; + extern void GetClientRect_adj(HWND hwnd, RECT *r); + GetClientRect_adj(g_hwnd,&r); + DDraw_Resize(r.right,r.bottom,cfg_fs_d&2); + } + + return 0; + case IDC_CHECK6: + cfg_fs_flip&=~4; + cfg_fs_flip|=IsDlgButtonChecked(hwndDlg,IDC_CHECK6)?0:4; + return 0; + case IDC_CHECK3: + cfg_fs_fps&=~2; + cfg_fs_fps|=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?2:0; + return 0; + case IDC_CHECK5: + cfg_fs_fps&=~4; + cfg_fs_fps|=IsDlgButtonChecked(hwndDlg,IDC_CHECK5)?4:0; + return 0; + case IDC_CHECK2: + config_reuseonresize = !!IsDlgButtonChecked(hwndDlg,IDC_CHECK2); + return 0; +// case IDC_DONT_MIN_AVS: + // cfg_dont_min_avs=IsDlgButtonChecked(hwndDlg,IDC_DONT_MIN_AVS)?1:0; + case IDC_DEFOVERLAYCOLOR: + cfg_bkgnd_render_color=0x1F000F; + InvalidateRect(GetDlgItem(hwndDlg,IDC_OVERLAYCOLOR),NULL,FALSE); + goto update_overlayshit; + case IDC_OVERLAYCOLOR: + GR_SelectColor(hwndDlg,&cfg_bkgnd_render_color); + InvalidateRect(GetDlgItem(hwndDlg,IDC_OVERLAYCOLOR),NULL,FALSE); + goto update_overlayshit; + case IDC_SETDESKTOPCOLOR: + case IDC_BKGND_RENDER: + cfg_bkgnd_render=(IsDlgButtonChecked(hwndDlg,IDC_BKGND_RENDER)?1:0) | + (IsDlgButtonChecked(hwndDlg,IDC_SETDESKTOPCOLOR)?2:0); + update_overlayshit: + { + RECT r; + extern void GetClientRect_adj(HWND hwnd, RECT *r); + GetClientRect_adj(g_hwnd,&r); + DDraw_Resize(r.right,r.bottom,cfg_fs_d&2); + } + return 0; + case IDC_THREAD_PRIORITY: + extern void main_setRenderThreadPriority(); + cfg_render_prio=SendDlgItemMessage(hwndDlg,IDC_THREAD_PRIORITY,CB_GETCURSEL,0,0); + main_setRenderThreadPriority(); + return 0; + } + return 0; + } + return 0; +} + +static void enableFSWindows(HWND hwndDlg, int v) +{ + EnableWindow(GetDlgItem(hwndDlg,IDC_BPP_CONV),v); + //EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),v); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK4),v); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK2),v); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),v); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK5),v); +} + +extern int cfg_fs_dblclk; + +static BOOL CALLBACK DlgProc_FS(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + int l; + DDraw_EnumDispModes(GetDlgItem(hwndDlg,IDC_COMBO1)); + l=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCOUNT,0,0); + if (l < 1 || l == CB_ERR) + { + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)WASABI_API_LNGSTRING(IDS_NO_SUITABLE_MODES_FOUND)); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_SETCURSEL,0,0); + } + else + { + int x; + for (x = 0; x < l; x ++) + { + char b[256],*p=b; + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETLBTEXT,x,(long)b); + int w,h,bpp; + w=atoi(p); + while (*p >= '0' && *p <= '9') p++; + if (!*p) continue; + h=atoi(++p); + while (*p >= '0' && *p <= '9') p++; + if (!*p) continue; + bpp=atoi(++p); + if (w == cfg_fs_w && h == cfg_fs_h && bpp == cfg_fs_bpp) + break; + } + if (x != l) + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_SETCURSEL,x,0); + } + CheckDlgButton(hwndDlg,IDC_USE_OVERLAY,cfg_fs_use_overlay?BST_CHECKED:BST_UNCHECKED); + enableFSWindows(hwndDlg,!cfg_fs_use_overlay); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK8), cfg_fs_use_overlay); + CheckDlgButton(hwndDlg,IDC_CHECK1,(cfg_fs_d&1)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK2,(cfg_fs_fps&1)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK3,(cfg_fs_fps&8)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK5,(cfg_fs_fps&16)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK4,(cfg_fs_flip&1)?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK7,(cfg_fs_flip&2)?BST_UNCHECKED:BST_CHECKED); + CheckDlgButton(hwndDlg,IDC_CHECK8,(cfg_cancelfs_on_deactivate)?BST_UNCHECKED:BST_CHECKED); + CheckDlgButton(hwndDlg,IDC_BPP_CONV,(cfg_fs_flip&8)?BST_UNCHECKED:BST_CHECKED); + SetDlgItemInt(hwndDlg,IDC_EDIT1,cfg_fs_height,FALSE); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,80); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,(cfg_speed>>8)&0xff); + CheckDlgButton(hwndDlg,IDC_CHECK6,cfg_fs_dblclk?BST_CHECKED:BST_UNCHECKED); + } + return 1; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + cfg_speed&=~0xff00; + cfg_speed|=(t<<8); + } + } + return 0; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_BUTTON1: + if (IsDlgButtonChecked(hwndDlg,IDC_USE_OVERLAY) || DDraw_IsMode(cfg_fs_w,cfg_fs_h,cfg_fs_bpp)) + { + SetForegroundWindow(g_hwnd); + PostMessage(g_hwnd,WM_USER+32,0,0); + } else + { + char title[32]; + MessageBox(hwndDlg,WASABI_API_LNGSTRING(IDS_CHOOSE_A_VIDEO_MODE), + WASABI_API_LNGSTRING_BUF(IDS_AVS_FULLSCREEN,title,32),MB_OK); + } + return 0; + case IDC_BPP_CONV: + cfg_fs_flip&=~8; + cfg_fs_flip|=IsDlgButtonChecked(hwndDlg,IDC_BPP_CONV)?0:8; + return 0; + case IDC_CHECK6: + cfg_fs_dblclk=!!IsDlgButtonChecked(hwndDlg,IDC_CHECK6); + return 0; + case IDC_CHECK1: + cfg_fs_d&=~1; + cfg_fs_d|=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + return 0; + case IDC_CHECK2: + cfg_fs_fps&=~1; + cfg_fs_fps|=IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?1:0; + return 0; + case IDC_CHECK3: + cfg_fs_fps&=~8; + cfg_fs_fps|=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?8:0; + return 0; + case IDC_CHECK5: + cfg_fs_fps&=~16; + cfg_fs_fps|=IsDlgButtonChecked(hwndDlg,IDC_CHECK5)?16:0; + return 0; + case IDC_CHECK4: + cfg_fs_flip&=~1; + cfg_fs_flip|=IsDlgButtonChecked(hwndDlg,IDC_CHECK4)?1:0; + return 0; + case IDC_CHECK7: + cfg_fs_flip&=~2; + cfg_fs_flip|=IsDlgButtonChecked(hwndDlg,IDC_CHECK7)?0:2; + return 0; + case IDC_CHECK8: + cfg_cancelfs_on_deactivate = IsDlgButtonChecked(hwndDlg,IDC_CHECK8)?0:1; + return 0; + case IDC_EDIT1: + if (HIWORD(wParam) == EN_CHANGE) { + BOOL t; + int r=GetDlgItemInt(hwndDlg,IDC_EDIT1,&t,FALSE); + if (r > 0 && r <= 100 && t) + cfg_fs_height=r; + } + return 0; + case IDC_COMBO1: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int bps=-1; + char b[256],*p=b; + int l=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (l == CB_ERR) return 0; + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETLBTEXT,l,(long)b); + int w,h; + while (*p >= '0' && *p <= '9') p++; + if (!*p) return 0; + *p++=0; + w=atoi(b); + while (*p < '0' && *p > '9' && *p) p ++; + h=atoi(p); + while (*p >= '0' && *p <= '9') p++; + if (!*p) return 0; + p++; + bps=atoi(p); + if (w < 1|| h < 1 || bps < 1) return 0; + cfg_fs_h=h; + cfg_fs_w=w; + cfg_fs_bpp=bps; + } + return 0; + case IDC_USE_OVERLAY: + cfg_fs_use_overlay=IsDlgButtonChecked(hwndDlg,IDC_USE_OVERLAY)?1:0; + enableFSWindows(hwndDlg,!cfg_fs_use_overlay); + EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK8), cfg_fs_use_overlay); + return 0; + } + return 0; + } + return 0; +} + + +static void _insertintomenu2(HMENU hMenu, int wid, int id, char *str) +{ + int x; + for (x=0; x < 4096; x ++) + { + MENUITEMINFO mi={sizeof(mi),MIIM_DATA|MIIM_TYPE|MIIM_SUBMENU,MFT_STRING}; + char c[512]; + mi.dwTypeData=c; + mi.cch = 512; + if (!GetMenuItemInfo(hMenu,x,TRUE,&mi)) break; + if (strcmp(str,c)<0 && !mi.hSubMenu) + break; + } + + MENUITEMINFO i={sizeof(i),}; + i.wID = wid; + i.fMask=MIIM_TYPE|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.dwItemData=id; + i.dwTypeData=str; + i.cch=strlen(str); + InsertMenuItem(hMenu,x,TRUE,&i); +} + +static HMENU _findsubmenu(HMENU hmenu, char *str) +{ + int x; + for (x=0; x < 4096; x ++) + { + MENUITEMINFO mi={sizeof(mi),MIIM_DATA|MIIM_TYPE|MIIM_SUBMENU,MFT_STRING}; + char c[512]; + mi.dwTypeData=c; + mi.cch = 512; + if (!GetMenuItemInfo(hmenu,x,TRUE,&mi)) break; + if (!strcmp(str,c) && mi.hSubMenu) return mi.hSubMenu; + } + return 0; +} + +static void _insertintomenu(HMENU hMenu, int wid, int id, char *str) +{ + char ostr[1024]; + strncpy(ostr,str,1023); + char *first=str; + char *second=str; + while (*second && *second != '/') second++; + if (*second) *second++=0; + if (*second) + { + while (*second == ' ' || *second == '/') second++; + if (*second) + { + HMENU hs; + + if (!(hs=_findsubmenu(hMenu,first))) + { + MENUITEMINFO i={sizeof(i),}; + i.fMask=MIIM_TYPE|MIIM_SUBMENU|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.dwTypeData = first; + i.cch = strlen(first); + i.hSubMenu=hs=CreatePopupMenu(); + i.wID=0; + InsertMenuItem(hMenu,0,TRUE,&i); + } + _insertintomenu2(hs,wid,id,second); + return; + } + } + _insertintomenu2(hMenu,wid,id,ostr); + +} +static HTREEITEM g_dragsource_item,g_dragsource_parent, g_draglastdest, g_dragplace; +static int g_dragplaceisbelow; +extern int findInMenu(HMENU parent, HMENU sub, UINT id, char *buf, int buf_len); + +#define UNDO_TIMER_INTERVAL 333 + +static WNDPROC sniffConfigWindow_oldProc; +static BOOL CALLBACK sniffConfigWindow_newProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + bool dirty = false; + if (uMsg == WM_COMMAND || uMsg == WM_HSCROLL || uMsg == WM_VSCROLL) + { + if (uMsg != WM_COMMAND || HIWORD(wParam) == EN_CHANGE || + HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == LBN_SELCHANGE || + HIWORD(wParam) == CBN_SELCHANGE + + ) + dirty = true; + } + + BOOL retval = CallWindowProc(sniffConfigWindow_oldProc,hwndDlg,uMsg,wParam,lParam); + + // Don't save the new state until the window proc handles it. :) + if (dirty) + { + KillTimer(GetParent(hwndDlg),69); + SetTimer(GetParent(hwndDlg),69,UNDO_TIMER_INTERVAL,NULL); + + +// g_preset_dirty=1; + } + + return retval; +} + + +int dosavePreset(HWND hwndDlg) +{ + int r=1; + char temp[2048]; + OPENFILENAME l={sizeof(l),0}; + char buf1[2048],buf2[2048]; + char filter[128], *ptr = filter; + char savePreset[64]; + + WASABI_API_LNGSTRING_BUF(IDS_AVS_FILTER_STRING,filter,128); + while(*ptr) + { + if (*ptr=='|') *ptr=0; + ptr++; + } + temp[0]=0; + GetCurrentDirectory(sizeof(buf2),buf2); + strcpy(buf1,g_path); + l.hwndOwner = hwndDlg; + l.lpstrFilter = filter; + l.lpstrFile = temp; + strcpy(temp,last_preset); + l.nMaxFile = 2048-1; + l.lpstrTitle = WASABI_API_LNGSTRING_BUF(IDS_SAVE_PRESET,savePreset,64); + l.lpstrDefExt = "AVS"; + l.lpstrInitialDir = buf1; + l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER|OFN_OVERWRITEPROMPT; + if (GetSaveFileName(&l)) + { + strcpy(last_preset,temp); // this was changed from: lstrcpyn(last_preset,temp, 2048); + r=g_render_effects->__SavePreset(temp); + if (r==1) MessageBox(hwndDlg,WASABI_API_LNGSTRING(IDS_ERROR_SAVING_PRESET),savePreset,MB_OK); + else if (r==2) MessageBox(hwndDlg,WASABI_API_LNGSTRING(IDS_PRESET_TOO_LARGE),savePreset,MB_OK); + else if (r==-1) MessageBox(hwndDlg,WASABI_API_LNGSTRING(IDS_OUT_OF_MEMORY),savePreset,MB_OK); + else + { + C_UndoStack::cleardirty(); + // g_preset_dirty=0; + } + } + SetCurrentDirectory(buf2); + return r; +} + +extern int g_config_seh; + +static BOOL CALLBACK debugProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + extern int debug_reg[8]; + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 0; x < 8; x ++) + { + SetDlgItemInt(hwndDlg,IDC_DEBUGREG_1+x*2,debug_reg[x],FALSE); + } + SetTimer(hwndDlg,1,250,NULL); + } + if (g_log_errors) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_reset_vars_on_recompile) CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (!g_config_seh) CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + + return 0; + case WM_TIMER: + if (wParam == 1) + { + int x; + for (x = 0; x < 8; x ++) + { + char buf[128]; + int v=debug_reg[x]; + if (v >=0 && v < 100) + sprintf(buf,"%.14f",NSEEL_getglobalregs()[v]); + else strcpy(buf,"?"); + SetDlgItemText(hwndDlg,IDC_DEBUGREG_1+x*2+1,buf); + } + + if (g_log_errors) + { + //IDC_EDIT1 + EnterCriticalSection(&g_eval_cs); + char buf[1025]; + GetDlgItemText(hwndDlg,IDC_EDIT1,buf,sizeof(buf)-1); + buf[sizeof(buf)-1]=0; + if (strcmp(buf,last_error_string)) + SetDlgItemText(hwndDlg,IDC_EDIT1,last_error_string); + LeaveCriticalSection(&g_eval_cs); + } + + { + char buf[512]; + int *g_evallib_stats=NSEEL_getstats(); + wsprintf(buf,WASABI_API_LNGSTRING(IDS_EVAL_CODE_STATS_ETC), + g_evallib_stats[4],g_evallib_stats[0],g_evallib_stats[1],g_evallib_stats[2],g_evallib_stats[3]); + SetDlgItemText(hwndDlg,IDC_EDIT2,buf); + } + + } + return 0; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CHECK1: + g_log_errors = !!IsDlgButtonChecked(hwndDlg,IDC_CHECK1); + return 0; + case IDC_CHECK2: + g_reset_vars_on_recompile = !!IsDlgButtonChecked(hwndDlg,IDC_CHECK2); + return 0; + case IDC_CHECK3: + g_config_seh = !IsDlgButtonChecked(hwndDlg,IDC_CHECK3); + return 0; + case IDC_BUTTON1: + EnterCriticalSection(&g_eval_cs); + last_error_string[0]=0; + SetDlgItemText(hwndDlg,IDC_EDIT1,""); + LeaveCriticalSection(&g_eval_cs); + return 0; + case IDOK: + case IDCANCEL: + DestroyWindow(hwndDlg); + return 0; + default: + if (HIWORD(wParam) == EN_CHANGE && LOWORD(wParam) >= IDC_DEBUGREG_1 && LOWORD(wParam) <= IDC_DEBUGREG_16) + { + int x=LOWORD(wParam)-IDC_DEBUGREG_1; + if (!(x&1)) + { + x/=2; + if (x > 7) x= 7; + BOOL t; + int v=GetDlgItemInt(hwndDlg,IDC_DEBUGREG_1+x*2,&t,FALSE); + if (t) debug_reg[x]=v; + } + } + break; + } + return 0; + case WM_DESTROY: + g_debugwnd=0; + return 0; + } + return 0; +} + +static BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + static HMENU presetTreeMenu; + static int presetTreeCount; + extern int need_redock; + extern int inWharf; + extern void toggleWharfAmpDock(HWND hwnd); + + switch (uMsg) + { + case WM_INITMENU: + EnableMenuItem((HMENU)wParam,IDM_UNDO,MF_BYCOMMAND|(C_UndoStack::can_undo()?MF_ENABLED:MF_GRAYED)); + EnableMenuItem((HMENU)wParam,IDM_REDO,MF_BYCOMMAND|(C_UndoStack::can_redo()?MF_ENABLED:MF_GRAYED)); + return 0; + case WM_INITMENUPOPUP: + if (!HIWORD(lParam) && presetTreeMenu && !GetMenuItemCount((HMENU)wParam)) + { + char buf[2048]; + buf[0]=0; + if (findInMenu(presetTreeMenu,(HMENU)wParam,0,buf,2048)) + { + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[4096]; + wsprintf(dirmask,"%s%s\\*.*",g_path,buf); + int directory_pos=0, insert_pos=0; + // build menu + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[0] != '.') + { + MENUITEMINFO mi={sizeof(mi),MIIM_SUBMENU|MIIM_TYPE,MFT_STRING,MFS_DEFAULT }; + mi.hSubMenu=CreatePopupMenu(); + mi.dwTypeData=d.cFileName; + mi.cch = strlen(d.cFileName); + InsertMenuItem((HMENU)wParam,directory_pos++,TRUE,&mi); + insert_pos++; + } + else if (!stricmp(extension(d.cFileName),"avs")) + { + extension(d.cFileName)[-1]=0; + MENUITEMINFO i={sizeof(i),MIIM_TYPE|MIIM_DATA|MIIM_ID,MFT_STRING,MFS_DEFAULT }; + i.dwTypeData = d.cFileName; + i.cch = strlen(d.cFileName); + i.dwItemData=0xFFFFFFFF;//preset + i.wID=presetTreeCount++; + InsertMenuItem((HMENU)wParam,insert_pos++,TRUE,&i); + } + } while (FindNextFile(h,&d)); + FindClose(h); + } + } + } + return 0; + case WM_USER+20: + CfgWnd_Unpopulate(); + CfgWnd_Populate(); + return 0; + case WM_CLOSE: + if (inWharf) + { +#ifdef WA2_EMBED + toggleWharfAmpDock(g_hwnd); + } +#else + PostMessage(g_hwnd,WM_CLOSE,0,0); + } + else +#endif + { + cfg_cfgwnd_open=0; + ShowWindow(hwndDlg,SW_HIDE); + } + return 0; + case WM_DESTROY: + return 0; + case WM_INITDIALOG: + { + #ifdef LASER + HMENU m=GetMenu(hwndDlg); + m=GetSubMenu(m,1); + DeleteMenu(m,IDM_TRANSITIONS,MF_BYCOMMAND); + #endif + g_hwndDlg=hwndDlg; + //SetDlgItemText(hwndDlg,IDC_AVS_VER,verstr); + WASABI_API_LNGSTRING_BUF(IDS_NO_EFFECT_SETTING_SELECTED,g_noeffectstr,48); + + TreeView_SetIndent(GetDlgItem(hwndDlg,IDC_TREE1),8); + SetTimer(hwndDlg,1,250,NULL); + if (cfg_cfgwnd_open) + ShowWindow(hwndDlg,SW_SHOWNA); + CfgWnd_Populate(); + SetWindowPos(hwndDlg,NULL,cfg_cfgwnd_x,cfg_cfgwnd_y,0,0,SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER); + if (need_redock) + { + need_redock=0; + toggleWharfAmpDock(g_hwnd); + } + else + { + RECT r,r2; + // hide IDC_RRECT, resize IDC_TREE1 up + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_RRECT),&r); + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_TREE1),&r2); + ShowWindow(GetDlgItem(g_hwndDlg,IDC_RRECT),SW_HIDE); + SetWindowPos(GetDlgItem(g_hwndDlg,IDC_TREE1),NULL,0,0,r2.right-r2.left,r.bottom - r2.top - 2,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); + } + } + return TRUE; + case WM_TIMER: + if (wParam == 1) + { + char s[1024]; + char *tp=last_preset; + while (*tp) tp++; + while (tp >= last_preset && *tp != '\\') + tp--; + tp++; + wsprintf(s,"%d.%d FPS @ %dx%d%s%s",g_dlg_fps/10,g_dlg_fps%10,g_dlg_w,g_dlg_h,*tp?" - ":".",tp); + tp=s; + while (*tp) tp++; + while (tp > s && *tp != '.' && *tp != '-') tp--; + if (*tp == '.') *tp=0; + SetDlgItemText(hwndDlg,IDC_FPS,s); + } + if (wParam == 69) + { + KillTimer(hwndDlg,69); + C_UndoStack::saveundo(); + } + return FALSE; + case WM_MOUSEMOVE: + if (g_dragsource_item) + { + TVHITTESTINFO hti={0,}; + HWND hwnd=GetDlgItem(hwndDlg,IDC_TREE1); + hti.pt.x=(int)LOWORD(lParam); + hti.pt.y=(int)HIWORD(lParam); + ClientToScreen(hwndDlg,&hti.pt); + ScreenToClient(hwnd,&hti.pt); + HTREEITEM h=TreeView_HitTest(hwnd,&hti); + if (hti.flags&TVHT_ABOVE) + { + SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,NULL); + } + if (hti.flags&TVHT_BELOW) + { + SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,NULL); + } + if (hti.flags&TVHT_NOWHERE) + { + h=g_hroot; + } + if ((hti.flags&(TVHT_NOWHERE|TVHT_ONITEMINDENT|TVHT_ONITEMRIGHT|TVHT_ONITEM|TVHT_ONITEMBUTTON))&&h) + { + HTREEITEM temp=h; + while (temp && temp != TVI_ROOT) + { + if (temp==g_dragsource_item) + { + h=g_dragsource_item; + break; + } + temp=TreeView_GetParent(hwnd,temp); + } + if (h == g_dragsource_item) + { + SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_NO))); + if (g_dragplace) TreeView_DeleteItem(hwnd,g_dragplace); + g_dragplace=0; + } + else + { + SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW))); + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,h,0,0,0,0,0}; + TreeView_GetItem(hwnd,&i); + if(i.lParam) + { + RECT r; + TreeView_GetItemRect(hwnd,h,&r,FALSE); + if (hti.pt.y > r.bottom-(r.bottom-r.top)/2) g_dragplaceisbelow=1; + else g_dragplaceisbelow=0; + HTREEITEM parenth; + g_draglastdest=h; + C_RenderListClass::T_RenderListType *it=(C_RenderListClass::T_RenderListType *)i.lParam; + + if (it->effect_index==LIST_ID && (hti.flags&(TVHT_ONITEMINDENT|TVHT_ONITEMBUTTON)||h==g_hroot)) + { + if (g_dragplace && (TreeView_GetParent(hwnd,g_dragplace)!=h || + TreeView_GetNextSibling(hwnd,g_dragplace))) + { + TreeView_DeleteItem(hwnd,g_dragplace); + g_dragplace=0; + } + + g_dragplaceisbelow=2; + parenth=h; + h=TVI_LAST; + } + else + { + parenth=TreeView_GetParent(hwnd,h); + if (g_dragplace && ((g_dragplaceisbelow&1)? + TreeView_GetNextSibling(hwnd,h)!=g_dragplace: + TreeView_GetPrevSibling(hwnd,h)!=g_dragplace)) + { + TreeView_DeleteItem(hwnd,g_dragplace); + g_dragplace=0; + } + if (!g_dragplaceisbelow) + { + h=TreeView_GetPrevSibling(hwnd,h); + if (!h) h=TVI_FIRST; + } + } + if (!g_dragplace) + { + TV_INSERTSTRUCT is={parenth,h,{TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN,0,0,0, + WASABI_API_LNGSTRING(IDS_MOVE_HERE),0,0,0,0,(int)0}}; + g_dragplace=TreeView_InsertItem(hwnd,&is); + if (g_dragplaceisbelow==2) + SendMessage(hwnd,TVM_EXPAND,TVE_EXPAND,(long)parenth); + } + } + } + } + return 0; + } + break; + case WM_LBUTTONUP: + if (g_dragsource_item) + { + HWND hwnd=GetDlgItem(hwndDlg,IDC_TREE1); + SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW))); + if (g_dragplace) + { + TreeView_DeleteItem(hwnd,g_dragplace); + g_dragplace=0; + } + HTREEITEM h=g_draglastdest; + if (h) + { + C_RenderListClass::T_RenderListType *source, *source_parent; + C_RenderListClass::T_RenderListType *dest, // handle of item to insert above. NULL if end. + *dest_parent=NULL; // handle of parent to insert into + HTREEITEM dest_handle=h, // handle of item to insert above. NULL if folder. + dest_parent_handle=TreeView_GetParent(hwnd,h); // handle of parent + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,dest_handle,0,0,0,0,0}; + TreeView_GetItem(hwnd,&i); + dest=(C_RenderListClass::T_RenderListType *)i.lParam; + } + if (dest_parent_handle) + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,dest_parent_handle,0,0,0,0,0}; + TreeView_GetItem(hwnd,&i); + dest_parent=(C_RenderListClass::T_RenderListType *)i.lParam; + } + if (dest->effect_index==LIST_ID && (!dest_parent_handle||g_dragplaceisbelow==2)) + { + dest_parent_handle=dest_handle; + dest_handle=NULL; + dest_parent=dest; + dest=NULL; + } + + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM|TVIF_STATE,g_dragsource_item,0,TVIS_EXPANDED,0,0,0}; + TreeView_GetItem(hwnd,&i); + int expand=i.state&TVIS_EXPANDED; + source=(C_RenderListClass::T_RenderListType *)i.lParam; + + TV_ITEM i2={TVIF_HANDLE|TVIF_PARAM,g_dragsource_parent,0,0,0,0,0}; + TreeView_GetItem(hwnd,&i2); + source_parent=(C_RenderListClass::T_RenderListType *)i2.lParam; + + int recurse_okay=1; + { + HTREEITEM temp=dest_parent_handle; + while (temp && temp != TVI_ROOT) + { + if (temp==g_dragsource_item) recurse_okay=0; + temp=TreeView_GetParent(hwnd,temp); + } + } + if (dest_handle != g_dragsource_item && recurse_okay) + { + C_RenderListClass *s=(C_RenderListClass *)source_parent->render; + C_RenderListClass *d=(C_RenderListClass *)dest_parent->render; + int os=0; + int a=s->findRender(source); + int b=d->findRender(dest); + int err=1; + if (a >= 0) + { + EnterCriticalSection(&g_render_cs); + err=s->removeRender(a,0); + if (!err) + { + d->insertRender(source,b+(g_dragplaceisbelow&1)); + } + LeaveCriticalSection(&g_render_cs); + } + if (err) + { + char title[48]; + MessageBox(NULL,WASABI_API_LNGSTRING(IDS_ERROR_TREE_INCONSISTANCY), + WASABI_API_LNGSTRING_BUF(IDS_CRITICAL_ERROR_OCCURRED,title,48),MB_OK); + } + + treeview_hack=1; + TreeView_DeleteItem(hwnd,g_dragsource_item); + + TV_INSERTSTRUCT is={dest_parent_handle,0,{TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN,0,0,0,source->render->get_desc(),0,0,0,source->effect_index==LIST_ID?1:0,(int)source}}; + + if (dest_handle) + { + if (g_dragplaceisbelow&1) is.hInsertAfter=dest_handle; + else + { + is.hInsertAfter=TreeView_GetPrevSibling(hwnd,dest_handle); + if (!is.hInsertAfter) is.hInsertAfter=TVI_FIRST; + } + } + else is.hInsertAfter=TVI_LAST; + + HTREEITEM newi=TreeView_InsertItem(hwnd,&is); + if (source->effect_index == LIST_ID) + { + _do_add(hwnd,newi,(C_RenderListClass *)source->render); + if (expand) SendMessage(hwnd,TVM_EXPAND,TVE_EXPAND,(long)newi); + } + TreeView_Select(hwnd,newi,TVGN_CARET); + treeview_hack=0; + + // After everything is changed, then save the undo and set the dirty bit. + KillTimer(hwndDlg,69); + SetTimer(hwndDlg,69,UNDO_TIMER_INTERVAL,NULL); + // g_preset_dirty=1; + } + } + TreeView_Select(hwnd,NULL,TVGN_DROPHILITE); + ReleaseCapture(); + g_dragsource_item=0; + return 0; + } + break; + + case WM_NOTIFY: + { + NM_TREEVIEW* p = (NM_TREEVIEW*)lParam; + if (p->hdr.hwndFrom == GetDlgItem(hwndDlg, IDC_TREE1)) + { + // Element is being dragged + if (p->hdr.code==TVN_BEGINDRAG) + { + if (p->itemNew.hItem != g_hroot) + { + g_draglastdest=0; + g_dragsource_parent=TreeView_GetParent(p->hdr.hwndFrom,p->itemNew.hItem); + if (g_dragsource_parent) + { + SetCapture(hwndDlg); + g_dragsource_item=p->itemNew.hItem; + g_dragplace=0; + + TreeView_Select(p->hdr.hwndFrom,g_dragsource_item,TVGN_CARET); + SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_APPSTARTING))); + } + else + g_dragsource_item=NULL; + } + else + g_dragsource_item=NULL; + } + // new element is selected selectis + if ((p->hdr.code== TVN_SELCHANGEDW || p->hdr.code == TVN_SELCHANGEDA) && !treeview_hack) + { + HTREEITEM hTreeItem = TreeView_GetSelection(p->hdr.hwndFrom); + if (hTreeItem) + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,hTreeItem,0,0,0,0,0}; + TreeView_GetItem(p->hdr.hwndFrom,&i); + C_RenderListClass::T_RenderListType *tp=(C_RenderListClass::T_RenderListType *)i.lParam; + is_aux_wnd=0; + if (tp&&tp->render) + { + SetDlgItemText(hwndDlg,IDC_EFNAME,tp->render->get_desc()); + if (cur_hwnd) + DestroyWindow(cur_hwnd); + cur_hwnd=tp->render->conf(g_render_library->GetRendererInstance(tp->effect_index,g_hInstance),hwndDlg); + if (cur_hwnd) + sniffConfigWindow_oldProc=(WNDPROC)SetWindowLong(cur_hwnd, GWLP_WNDPROC,(LONG)sniffConfigWindow_newProc); + } + if (cur_hwnd) + { + RECT r; + GetWindowRect(GetDlgItem(hwndDlg,IDC_EFFECTRECT),&r); + ScreenToClient(hwndDlg,(LPPOINT)&r); + SetWindowPos(cur_hwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); + ShowWindow(cur_hwnd,SW_SHOWNA); + } else + SetDlgItemText(hwndDlg,IDC_EFNAME,g_noeffectstr); + } + } + // a tree view item has been clicked + + } + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_RRECT: + if (HIWORD(wParam)==1) + { + toggleWharfAmpDock(g_hwnd); + } + return 0; + case IDM_HELP_DEBUGWND: + if (!g_debugwnd) g_debugwnd=WASABI_API_CREATEDIALOG(IDD_DEBUG,g_hwnd,debugProc); + ShowWindow(g_debugwnd,SW_SHOW); + return 0; + case IDM_ABOUT: + // DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwndDlg,aboutProc); + about(hwndDlg); + return 0; + case IDM_DISPLAY: + case IDM_FULLSCREEN: + case IDM_PRESETS: + case IDM_BPM: + case IDM_TRANSITIONS: + { + int name_ids[5]={IDS_DISPLAY,IDS_FULLSCREEN_SETTINGS,IDS_PRESET_HOTKEYS,IDS_BEAT_DETECTION,IDS_TRANSITIONS}; + int x=0; + if (LOWORD(wParam) == IDM_DISPLAY) x=1; + if (LOWORD(wParam) == IDM_FULLSCREEN) x=2; + if (LOWORD(wParam) == IDM_PRESETS) x=3; + if (LOWORD(wParam) == IDM_BPM) x=4; + if (LOWORD(wParam) == IDM_TRANSITIONS) x=5; + + if (x >= 1 && x <= 5) + { + SetDlgItemText(hwndDlg,IDC_EFNAME,WASABI_API_LNGSTRING(name_ids[x-1])); + TreeView_Select(GetDlgItem(hwndDlg,IDC_TREE1),NULL,TVGN_CARET); + if (cur_hwnd) DestroyWindow(cur_hwnd); + if (x==1) + cur_hwnd=WASABI_API_CREATEDIALOG(IDD_GCFG_DISP,hwndDlg,DlgProc_Disp); + if (x==2) + cur_hwnd=WASABI_API_CREATEDIALOG(IDD_GCFG_FS,hwndDlg,DlgProc_FS); + if (x==3) + cur_hwnd=WASABI_API_CREATEDIALOG(IDD_GCFG_PRESET,hwndDlg,DlgProc_Preset); + if (x==4) + cur_hwnd=WASABI_API_CREATEDIALOG(IDD_GCFG_BPM,hwndDlg,DlgProc_Bpm); + if (x==5) + cur_hwnd=g_render_transition->conf(g_hInstance,hwndDlg); + if (cur_hwnd) + { + RECT r; + is_aux_wnd=1; + GetWindowRect(GetDlgItem(hwndDlg,IDC_EFFECTRECT),&r); + ScreenToClient(hwndDlg,(LPPOINT)&r); + SetWindowPos(cur_hwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); + ShowWindow(cur_hwnd,SW_SHOWNA); + } + else + SetDlgItemText(hwndDlg,IDC_EFNAME,g_noeffectstr); + } + } + return 0; + case IDC_ADD: + { + C_RenderListClass::T_RenderListType ren={0}; + RECT r; + presetTreeMenu=CreatePopupMenu(); + + HMENU hAddMenu=CreatePopupMenu(); + + // int insert_pos=0; + int p=64; + int x=0; + while (1) + { + char str[1024]; + if (!g_render_library->GetRendererDesc(x,str)) + break; + + if (str[0]) + _insertintomenu(hAddMenu,p++,x,str); + + x++; + } + x=DLLRENDERBASE; + while (1) + { + char str[1024]; + int id=g_render_library->GetRendererDesc(x++, str); + if (!id) break; + if (str[0]) _insertintomenu(hAddMenu,p++,id,str); + } + _insertintomenu(hAddMenu,p++,LIST_ID,WASABI_API_LNGSTRING(IDS_EFFECT_LIST)); + + int preset_base=presetTreeCount=p; + // add presets + { + MENUITEMINFO i={sizeof(i),}; + i.hSubMenu=presetTreeMenu; + i.fMask=MIIM_SUBMENU|MIIM_TYPE|MIIM_ID; + i.fType=MFT_STRING; + i.dwTypeData = WASABI_API_LNGSTRING(IDS_PRESETS); + i.cch = strlen((char*)i.dwTypeData); + InsertMenuItem(hAddMenu,0,TRUE,&i); + i.hSubMenu=0; + i.fMask=MIIM_TYPE|MIIM_ID; + i.fType=MFT_SEPARATOR; + InsertMenuItem(hAddMenu,1,TRUE,&i); + + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[1024]; + wsprintf(dirmask,"%s\\*.*",g_path); + + int directory_pos=0,insert_pos=0; + + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[0] != '.') + { + MENUITEMINFO mi={sizeof(mi),MIIM_SUBMENU|MIIM_TYPE,MFT_STRING,MFS_DEFAULT}; + mi.hSubMenu=CreatePopupMenu(); + mi.dwTypeData=d.cFileName; + mi.cch = strlen(d.cFileName); + InsertMenuItem(presetTreeMenu,directory_pos++,TRUE,&mi); + insert_pos++; + } + else if (!stricmp(extension(d.cFileName),"avs")) + { + extension(d.cFileName)[-1]=0; + MENUITEMINFO i={sizeof(i),MIIM_DATA|MIIM_TYPE|MIIM_ID,MFT_STRING,MFS_DEFAULT }; + i.dwTypeData = d.cFileName; + i.cch = strlen(d.cFileName); + i.dwItemData=0xffffffff; + i.wID=presetTreeCount++; + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + } + } while (FindNextFile(h,&d)); + FindClose(h); + } + } + + GetWindowRect(GetDlgItem(hwndDlg,IDC_ADD),&r); + int t=TrackPopupMenu(hAddMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,r.right,r.top,0,hwndDlg,NULL); + if (t) + { + char buf[2048]; + buf[0]=0; + if (t >= preset_base) + { + if (findInMenu(presetTreeMenu,0,t,buf,2048)) + { + //preset + C_RenderListClass *r; + char temp[4096]; + ren.effect_index=LIST_ID; + wsprintf(temp,"%s%s.avs",g_path,buf); + r=new C_RenderListClass(); + if (!r->__LoadPreset(temp,1)) + { + ren.render=(C_RBASE*)r; + } + else + { + delete r; + ren.render=NULL; + } + } + } + else + { + MENUITEMINFO mi={sizeof(mi),MIIM_DATA,}; + GetMenuItemInfo(hAddMenu,t,FALSE,&mi); + if (mi.dwItemData != 0xffffffff) // effect + { + ren.effect_index=mi.dwItemData; + ren.render=g_render_library->CreateRenderer(&ren.effect_index,&ren.has_rbase2); + } + } + + if (ren.render) + { + int insert_pos=0; + HTREEITEM hTreeItem = TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_TREE1)); + C_RenderListClass *parentrender=g_render_effects; + HTREEITEM parenthandle=g_hroot; + if (hTreeItem) + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,hTreeItem,0,0,0,0,0}; + TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i); + C_RenderListClass::T_RenderListType *tp=(C_RenderListClass::T_RenderListType *)i.lParam; + if (tp->effect_index == LIST_ID) + { + parentrender=(C_RenderListClass *)tp->render; + parenthandle=hTreeItem; + } + else + { + HTREEITEM hParent=TreeView_GetParent(GetDlgItem(hwndDlg,IDC_TREE1),hTreeItem); + if (hParent && hParent != TVI_ROOT) + { + TV_ITEM i2={TVIF_HANDLE|TVIF_PARAM,hParent,0,0,0,0,0}; + TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i2); + C_RenderListClass::T_RenderListType *tparent=(C_RenderListClass::T_RenderListType *)i2.lParam; + parentrender=(C_RenderListClass *)tparent->render; + parenthandle=hParent; + } + for (insert_pos=0; insert_pos<parentrender->getNumRenders() + && parentrender->getRender(insert_pos)->render != tp->render; insert_pos++); + } + } + + EnterCriticalSection(&g_render_cs); + parentrender->insertRender(&ren,insert_pos); + LeaveCriticalSection(&g_render_cs); + C_RenderListClass::T_RenderListType *newt=(C_RenderListClass::T_RenderListType *)GlobalAlloc(GMEM_FIXED,sizeof(C_RenderListClass::T_RenderListType)); + *newt=ren; + TV_INSERTSTRUCT is={parenthandle,0,{TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN,0,0,0,ren.render->get_desc(),0,0,0,newt->effect_index==LIST_ID?1:0,(int)newt}}; + if (!hTreeItem || parenthandle==hTreeItem) + { + is.hInsertAfter=TVI_FIRST; + } + else + { + is.hInsertAfter=TreeView_GetPrevSibling(GetDlgItem(hwndDlg,IDC_TREE1),hTreeItem); + if (!is.hInsertAfter) is.hInsertAfter=TVI_FIRST; + } + HTREEITEM newh=TreeView_InsertItem(GetDlgItem(hwndDlg,IDC_TREE1),&is); + TreeView_Select(GetDlgItem(hwndDlg,IDC_TREE1),newh,TVGN_CARET); + if (ren.effect_index == LIST_ID) + _do_add(GetDlgItem(hwndDlg,IDC_TREE1),newh,(C_RenderListClass *)ren.render); + + // Always do undo last. + KillTimer(hwndDlg,69); + SetTimer(hwndDlg,69,UNDO_TIMER_INTERVAL,NULL); + // g_preset_dirty=1; + } + } + DestroyMenu(hAddMenu); + presetTreeMenu=0; + } // end of IDC_ADD + return 0; + case IDC_CLEAR: + if (readyToLoadPreset(hwndDlg,1)) + { + if (g_render_transition->LoadPreset("",0) != 2) + last_preset[0]=0; + } + return 0; + case IDC_REMSEL: + { + HTREEITEM hTreeItem = TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_TREE1)); + if (hTreeItem == g_hroot) + { + CfgWnd_Unpopulate(); + EnterCriticalSection(&g_render_cs); + g_render_effects->clearRenders(); + LeaveCriticalSection(&g_render_cs); + CfgWnd_Populate(); + } + else if (hTreeItem) + { + C_RenderListClass *parentrender; + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,hTreeItem,0,0,0,0,0}; + if (TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i)) + { + C_RenderListClass::T_RenderListType *tp=(C_RenderListClass::T_RenderListType *)i.lParam; + HTREEITEM hParent=TreeView_GetParent(GetDlgItem(hwndDlg,IDC_TREE1),hTreeItem); + if (hParent != NULL) + { + TV_ITEM i2={TVIF_HANDLE|TVIF_PARAM,hParent,0,0,0,0,0}; + TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i2); + C_RenderListClass::T_RenderListType *tparent=(C_RenderListClass::T_RenderListType *)i2.lParam; + parentrender=(C_RenderListClass*)tparent->render; + EnterCriticalSection(&g_render_cs); + if (!parentrender->removeRenderFrom(tp,1)) + { + TreeView_DeleteItem(GetDlgItem(hwndDlg,IDC_TREE1),hTreeItem); + if (tp) + GlobalFree((HGLOBAL)tp); + } + LeaveCriticalSection(&g_render_cs); + } + } + } + // Always save undo last. + KillTimer(hwndDlg,69); + SetTimer(hwndDlg,69,UNDO_TIMER_INTERVAL,NULL); + // g_preset_dirty=1; + } + return 0; + case IDC_CLONESEL: + { + C_RenderListClass::T_RenderListType ren={0,}; + int insert_pos=-1; + + HTREEITEM hTreeItem = TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_TREE1)); + if (hTreeItem && hTreeItem != g_hroot) + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,hTreeItem,0,0,0,0,0}; + TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i); + C_RenderListClass::T_RenderListType *tp=(C_RenderListClass::T_RenderListType *)i.lParam; + ren.effect_index=tp->effect_index; + ren.render=g_render_library->CreateRenderer(&ren.effect_index,&ren.has_rbase2); + if (ren.render) + { + HTREEITEM hParent=TreeView_GetParent(GetDlgItem(hwndDlg,IDC_TREE1),hTreeItem); + if (hParent && hParent != TVI_ROOT) + { + TV_ITEM i2={TVIF_HANDLE|TVIF_PARAM,hParent,0,0,0,0,0}; + TreeView_GetItem(GetDlgItem(hwndDlg,IDC_TREE1),&i2); + C_RenderListClass::T_RenderListType *tparent=(C_RenderListClass::T_RenderListType *)i2.lParam; + C_RenderListClass *parentrender=(C_RenderListClass *)tparent->render; + for (insert_pos=0; insert_pos<parentrender->getNumRenders() + && parentrender->getRender(insert_pos)->render != tp->render; insert_pos++); + insert_pos++; + unsigned char *buf = (unsigned char *) GlobalAlloc(GPTR,1024*1024); + if (buf) + { + int len=tp->render->save_config(buf); + ren.render->load_config(buf,len); + GlobalFree((HGLOBAL)buf); + } + EnterCriticalSection(&g_render_cs); + parentrender->insertRender(&ren,insert_pos); + LeaveCriticalSection(&g_render_cs); + + C_RenderListClass::T_RenderListType *newt=(C_RenderListClass::T_RenderListType *)GlobalAlloc(GMEM_FIXED,sizeof(C_RenderListClass::T_RenderListType)); + *newt=ren; + TV_INSERTSTRUCT is={hParent,0,{TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN,0,0,0,ren.render->get_desc(),0,0,0,newt->effect_index==LIST_ID?1:0,(int)newt}}; + is.hInsertAfter=hTreeItem; + HTREEITEM newh=TreeView_InsertItem(GetDlgItem(hwndDlg,IDC_TREE1),&is); + TreeView_Select(GetDlgItem(hwndDlg,IDC_TREE1),newh,TVGN_CARET); + if (ren.effect_index == LIST_ID) + _do_add(GetDlgItem(hwndDlg,IDC_TREE1),newh,(C_RenderListClass *)ren.render); + } + } + // Always save undo last. + KillTimer(hwndDlg,69); + SetTimer(hwndDlg,69,UNDO_TIMER_INTERVAL,NULL); + // g_preset_dirty=1; + } + } + return 0; + case IDC_LOAD: + { + char temp[2048]; + OPENFILENAME l={sizeof(l),0}; + char buf1[2048],buf2[2048]; + char filter[128], *ptr = filter; + char loadPreset[64]; + + WASABI_API_LNGSTRING_BUF(IDS_AVS_FILTER_STRING,filter,128); + while(*ptr) + { + if (*ptr=='|') *ptr=0; + ptr++; + } + + GetCurrentDirectory(sizeof(buf2),buf2); + strcpy(buf1,g_path); // this was changed from: lstrcpyn(buf1,g_path,sizeof(buf1)); + temp[0]=0; + l.lpstrInitialDir = buf1; + l.hwndOwner = hwndDlg; + l.lpstrFilter = filter; + l.lpstrFile = temp; + l.nMaxFile = 2048-1; + l.lpstrTitle = WASABI_API_LNGSTRING_BUF(IDS_LOAD_PRESET,loadPreset,48); + l.lpstrDefExt = "AVS"; + l.Flags = OFN_HIDEREADONLY|OFN_EXPLORER; + if (readyToLoadPreset(hwndDlg,0) && GetOpenFileName(&l)) + { + int x=g_render_transition->LoadPreset(temp,0); + if (x == 2) + MessageBox(hwndDlg,WASABI_API_LNGSTRING(IDS_STILL_INITIALIZING_PREVIOUS_PRESET),loadPreset,MB_OK); + else + lstrcpyn(last_preset,temp,sizeof(last_preset)); + } + SetCurrentDirectory(buf2); + } + return 0; + case IDC_SAVE: + dosavePreset(hwndDlg); + return 0; + case IDM_UNDO: + C_UndoStack::undo(); + return 0; + case IDM_REDO: + C_UndoStack::redo(); + return 0; + } // end of switch(LOWORD(Param)) + return 0; + }// end of switch(uMsg) + return 0; +} + +static void _do_add(HWND hwnd, HTREEITEM h, C_RenderListClass *list) +{ + int x,l; + l=list->getNumRenders(); + for (x = 0; x < l; x ++) + { + C_RenderListClass::T_RenderListType *t=list->getRender(x); + if (t) + { + C_RenderListClass::T_RenderListType *newt=(C_RenderListClass::T_RenderListType *)GlobalAlloc(GMEM_FIXED,sizeof(C_RenderListClass::T_RenderListType)); + memcpy(newt,t,sizeof(C_RenderListClass::T_RenderListType)); + TV_INSERTSTRUCT is; + memset(&is,0,sizeof(is)); + + is.hParent=h; + is.hInsertAfter=TVI_LAST; + is.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN; + is.item.pszText=t->render->get_desc(); + is.item.cChildren=t->effect_index==LIST_ID?1:0; + is.item.lParam=(int)newt; + + HTREEITEM h2=TreeView_InsertItem(hwnd,&is); + if (t->effect_index==LIST_ID) + { + _do_add(hwnd,h2,(C_RenderListClass *)t->render); + } + } + } + SendMessage(hwnd,TVM_EXPAND,TVE_EXPAND,(long)h); +} + +static void _do_free(HWND hwnd, HTREEITEM h) +{ + while (h) + { + TV_ITEM i={TVIF_HANDLE|TVIF_PARAM,h,0,0,0,0,0}; + TreeView_GetItem(hwnd,&i); + if (i.lParam) GlobalFree((HGLOBAL)(void*)i.lParam); + HTREEITEM h2=TreeView_GetChild(hwnd,h); + if (h2) _do_free(hwnd,h2); + h=TreeView_GetNextSibling(hwnd,h); + } +} + +int need_repop; + +void CfgWnd_RePopIfNeeded(void) +{ + if (need_repop) + { + CfgWnd_Unpopulate(1); + CfgWnd_Populate(1); + need_repop=0; + } +} + +void CfgWnd_Unpopulate(int force) +{ + if (force || (IsWindowVisible(g_hwndDlg)&&!DDraw_IsFullScreen())) + { + HWND hwnd=GetDlgItem(g_hwndDlg,IDC_TREE1); + if (!is_aux_wnd) + { + if (cur_hwnd) DestroyWindow(cur_hwnd); + cur_hwnd=0; + SetDlgItemText(g_hwndDlg,IDC_EFNAME,g_noeffectstr); + } + treeview_hack=1; + _do_free(hwnd,TreeView_GetChild(hwnd,TVI_ROOT)); + TreeView_DeleteAllItems(hwnd); + treeview_hack=0; + } + else need_repop=1; +} + +void CfgWnd_Populate(int force) +{ + if (force || (IsWindowVisible(g_hwndDlg)&&!DDraw_IsFullScreen())) + { + treeview_hack=1; + HWND hwnd=GetDlgItem(g_hwndDlg,IDC_TREE1); + C_RenderListClass::T_RenderListType *newt=(C_RenderListClass::T_RenderListType *)GlobalAlloc(GMEM_FIXED,sizeof(C_RenderListClass::T_RenderListType)); + newt->render=g_render_effects; + newt->effect_index=LIST_ID; + TV_INSERTSTRUCT is; + memset(&is,0,sizeof(is)); + is.hParent=TVI_ROOT; + is.hInsertAfter=TVI_LAST; + is.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_CHILDREN; + is.item.pszText=WASABI_API_LNGSTRING(IDS_MAIN); + is.item.cChildren=1; + is.item.lParam=(int)newt; + g_hroot=TreeView_InsertItem(hwnd,&is); + if (g_hroot) + { + _do_add(hwnd,g_hroot,g_render_effects); + SendMessage(hwnd,TVM_EXPAND,TVE_EXPAND,(long)g_hroot); + } + treeview_hack=0; + } + else need_repop=1; +} diff --git a/Src/Plugins/Visualization/vis_avs/cfgwnd.h b/Src/Plugins/Visualization/vis_avs/cfgwnd.h new file mode 100644 index 00000000..fe6a0b9b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/cfgwnd.h @@ -0,0 +1,47 @@ +/* + 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. + +*/ +void CfgWnd_Create(struct winampVisModule *this_mod); +void CfgWnd_Destroy(void); + +void CfgWnd_Populate(int force=0); +void CfgWnd_Unpopulate(int force=0); +void CfgWnd_RePopIfNeeded(void); + +extern int cfg_fs_w,cfg_fs_h,cfg_fs_d,cfg_fs_bpp,cfg_fs_fps,cfg_fs_rnd,cfg_fs_flip,cfg_fs_height,cfg_speed,cfg_fs_rnd_time; +extern int cfg_cfgwnd_x,cfg_cfgwnd_y,cfg_cfgwnd_open; +extern int cfg_trans,cfg_trans_amount; +extern int cfg_dont_min_avs; +extern int cfg_smartbeat, cfg_smartbeatsticky, cfg_smartbeatresetnewsong, cfg_smartbeatonlysticky; +extern int cfg_transitions, cfg_transitions2, cfg_transitions_speed, cfg_transition_mode; +extern int cfg_bkgnd_render,cfg_bkgnd_render_color; +extern int cfg_render_prio; + +extern char config_pres_subdir[MAX_PATH]; +extern HWND g_hwndDlg; diff --git a/Src/Plugins/Visualization/vis_avs/color_mo.bin b/Src/Plugins/Visualization/vis_avs/color_mo.bin new file mode 100644 index 00000000..da03dc87 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/color_mo.bin @@ -0,0 +1,11 @@ +The color modifier allows you to modify the intensity of each color +channel with respect to itself. For example, you could reverse the red +channel, double the green channel, or half the blue channel. + +The code in the 'level' section should adjust the variables +'red', 'green', and 'blue', whose value represent the channel +intensity (0..1). +Code in the 'frame' or 'level' sections can also use the variable +'beat' to detect if it is currently a beat. + +Try loading an example via the 'Load Example' button for examples.
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/draw.cpp b/Src/Plugins/Visualization/vis_avs/draw.cpp new file mode 100644 index 00000000..5eddc451 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/draw.cpp @@ -0,0 +1,1476 @@ +/* + 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. + +*/ +#include <windows.h> +#include <ddraw.h> +#include "draw.h" +#include <stdio.h> +#include <process.h> +#include "r_defs.h" +#include "resource.h" +#include "vis.h" +#include "../Agave/Language/api_language.h" + +extern HINSTANCE g_hInstance; + +#define RESIZE_ONRESIZE +int draw_title_p=0; +int cfg_cancelfs_on_deactivate=1; +extern int g_dlg_fps,g_dlg_w,g_dlg_h; +extern int cfg_fs_fps,cfg_fs_flip,cfg_fs_height,cfg_fs_use_overlay; +extern int cfg_bkgnd_render, cfg_bkgnd_render_color; +static LPDIRECTDRAW g_lpDD; +static LPDIRECTDRAWSURFACE g_lpRenderSurf[2], g_lpPrimSurf, g_lpPrimSurfBack; +static int g_bpp, g_fs, g_noshoww; +int g_w, g_h, g_dsw, g_dsh; +extern HWND g_hwnd; +static CRITICAL_SECTION g_cs; +static int g_windowed_dsize; +static int g_initted, g_fs_flip, g_fs_height, g_fs_w, g_fs_h; +static int nodraw=0; +extern int inWharf; +#ifdef RESIZE_ONRESIZE +static int last_used; +#endif +static LPDIRECTDRAWSURFACE g_lpddsOverlay = NULL; +static LPDIRECTDRAWSURFACE g_lpddsPrimary = NULL; +static int g_overlay_init_ok=0; +typedef enum { + UYVY, + YUY2 +} fourcc_enum; +static fourcc_enum g_overlay_fourcc=UYVY; +static int g_saved_desktop_values=0; + +static char g_saved_desktop_wallpaper[256]; +static char g_saved_reg_bkgnd_color[64]; +static DWORD g_saved_bkgnd_color; + +extern void Wnd_GoWindowed(HWND hwnd); + +#define INIT_DIRECTDRAW_STRUCT(x) (ZeroMemory(&x, sizeof(x)), x.dwSize=sizeof(x)) +DDPIXELFORMAT g_ddpfOverlayFormats[] = +{ {sizeof(DDPIXELFORMAT), DDPF_FOURCC,MAKEFOURCC('U','Y','V','Y'),0,0,0,0,0}, // UYVY + {sizeof(DDPIXELFORMAT), DDPF_FOURCC,MAKEFOURCC('Y','U','Y','2'),0,0,0,0,0}}; // YUY2 + +#define NUM_OVERLAY_FORMATS (sizeof(g_ddpfOverlayFormats) / sizeof(g_ddpfOverlayFormats[0])) + +static HWND hwndOverlayWnd; + +static LRESULT CALLBACK FSOverlayWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static unsigned int start_t; + + if ( + + (((message == WM_KEYDOWN && (wParam == VK_ESCAPE || wParam == VK_RETURN)) || + message == WM_LBUTTONUP) && GetTickCount()-start_t > 1000) + + || + + (cfg_cancelfs_on_deactivate && ((message == WM_NCACTIVATE && !wParam) || + message == WM_KILLFOCUS)) + ) + { + DestroyWindow(hwnd); + Wnd_GoWindowed(g_hwnd); + return 0; + } + switch(message) + { + case WM_CREATE: + start_t=GetTickCount(); + return 0; + case WM_SETCURSOR: + SetCursor(NULL); + return TRUE; + case WM_DESTROY: + hwndOverlayWnd=0; + return 0; + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc=BeginPaint(hwnd,&ps); + RECT r; + GetClientRect(hwnd,&r); + int rv=0xff&(cfg_bkgnd_render_color>>16), gv=0xff&(cfg_bkgnd_render_color>>8), bv=0xff&cfg_bkgnd_render_color; + HBRUSH b=CreateSolidBrush(RGB(rv,gv,bv)); + SelectObject(ps.hdc, b); + Rectangle(ps.hdc, r.left, r.top, r.right, r.bottom); + DeleteObject(b); + EndPaint(hwnd,&ps); + } + return 0; + case WM_KEYDOWN: + return SendMessage(g_hwnd, message, wParam, lParam); + } + return DefWindowProc(hwnd, message, wParam, lParam); +} + +static void DD_CreateFullscreenOverlayWindow() +{ + static int inited=0; + if(!inited) + { + WNDCLASSW wc={0,}; + wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; + wc.lpfnWndProc = FSOverlayWndProc; + wc.hInstance = g_hInstance; + wc.hbrBackground = NULL; + wc.lpszClassName = L"avsfsoverlaywnd"; + wc.hCursor=NULL; + if(!RegisterClassW(&wc)) return; + inited=1; + } + hwndOverlayWnd=CreateWindowExW(WS_EX_TOPMOST|WS_EX_TOOLWINDOW,L"avsfsoverlaywnd",L"",WS_VISIBLE|WS_POPUP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),NULL,NULL,g_hInstance,0); +} + +static void DD_RestoreBkgndSettings() +{ + if (g_saved_desktop_values) + { + int e=COLOR_DESKTOP; + unsigned long c=g_saved_bkgnd_color; + SetSysColors(1, &e, &c); // FUCKING MESSAGE PUMP AND SETSYSCOLORS + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, g_saved_desktop_wallpaper, NULL); + g_saved_desktop_values=0; + } +} + +void DD_CreateSurfaces(int w, int h, int fsh, int fs, int fsbpp, int flip, int dbl, int fsovl) // fsh is the height to use (not screen res) +{ + int resize_h=8, resize_w=8; +#ifdef RESIZE_ONRESIZE + int fb_save[64*65+1]; + int fb_save_use=0; +#endif + EnterCriticalSection(&g_cs); + nodraw=0; + if (g_lpDD) + { + extern int config_reuseonresize; +#ifdef RESIZE_ONRESIZE + HRESULT han; + int ll=!!last_used; + DDSURFACEDESC d={sizeof(d),}; + if (config_reuseonresize && g_w && g_h && g_lpRenderSurf[ll] && + (han = g_lpRenderSurf[ll]->Lock(NULL,&d,DDLOCK_WAIT,NULL)) == DD_OK) + { + if (d.lpSurface) + { + int x,y; + int dxpos=(g_w<<16)/64; + int ypos=0; + int dypos=(g_h<<16)/64; + int *pp=((int *)d.lpSurface); + + if (g_fs && g_fs_height < g_h) // adjust to use partial screen when + { + int fsy=g_h/2-g_fs_height/2; + dypos=(g_fs_height<<16)/64; + pp+=fsy * g_w; + } + + for (y = 0; y < 64; y++) + { + int *p=pp + g_w * (ypos>>16); + int xpos=0; + for (x = 0; x < 64; x ++) + { + fb_save[(y<<6)+x]=p[xpos>>16]; + xpos+=dxpos; + } + ypos+=dypos; + } + memset(fb_save+64*64,0,sizeof(int)*65); + fb_save_use=1; + } + g_lpRenderSurf[ll]->Unlock(d.lpSurface); + } +#endif + + if (g_lpPrimSurf) + { + g_lpPrimSurf->Release(); + g_lpPrimSurfBack=g_lpPrimSurf=NULL; + } + if (g_lpRenderSurf[0]) g_lpRenderSurf[0]->Release(); + if (g_lpRenderSurf[1]) g_lpRenderSurf[1]->Release(); + g_lpRenderSurf[0]=0; + g_lpRenderSurf[1]=0; + if (g_lpddsOverlay) g_lpddsOverlay->Release(); + if (g_lpddsPrimary) g_lpddsPrimary->Release(); + g_lpddsOverlay=g_lpddsPrimary=NULL; + g_lpDD->Release(); + g_lpDD=NULL; + } + + if (DirectDrawCreate(NULL,&g_lpDD,NULL) != DD_OK) + { + g_lpDD=NULL; + MessageBox(g_hwnd,WASABI_API_LNGSTRING(IDS_ERROR_CREATING_DDRAW_OBJECT),"DDraw",0); + LeaveCriticalSection(&g_cs); + return; + } + if (fs && !fsovl) + { + g_fs_w=w; + g_fs_h=h; + g_fs_height=fsh>>dbl; + g_fs_flip=flip; + resize_w=w>>dbl; + resize_h=h>>dbl; + if (g_lpDD->SetCooperativeLevel(g_hwnd,DDSCL_NOWINDOWCHANGES|DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) != DD_OK) + { + fs=0; + } + else + { + if (g_lpDD->SetDisplayMode(w,h,fsbpp) != DD_OK) + { + fs=0; + } + else + { + DDSURFACEDESC DDsd={sizeof(DDsd),}; + DDsd.dwFlags = DDSD_CAPS; + DDsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + if (g_fs_flip&1) + { + DDsd.ddsCaps.dwCaps |= DDSCAPS_COMPLEX|DDSCAPS_FLIP; + DDsd.dwFlags|=DDSD_BACKBUFFERCOUNT; + DDsd.dwBackBufferCount = 1; + } + if (g_lpDD->CreateSurface(&DDsd, &g_lpPrimSurf, NULL) != DD_OK) + { + fs=0; + } + else + { + DDBLTFX ddbfx={sizeof(ddbfx),}; + g_lpPrimSurf->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + if (g_fs_flip&1) + { + DDSCAPS ddscaps; + ddscaps.dwCaps = DDSCAPS_BACKBUFFER; + if (g_lpPrimSurf->GetAttachedSurface(&ddscaps, &g_lpPrimSurfBack) != DD_OK) + { + g_lpPrimSurf->Release(); + fs=0; + } + else g_lpPrimSurfBack->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + } + else + g_lpPrimSurfBack=g_lpPrimSurf; + } + } + } + SetForegroundWindow(g_hwnd); + } else { + g_lpDD->SetCooperativeLevel(g_hwnd,DDSCL_NOWINDOWCHANGES|DDSCL_NORMAL); + resize_w=(((w>>dbl)+3)&~3); + g_noshoww=resize_w-(w>>dbl); + resize_h=h>>dbl; + } + g_fs=fs; + + int wh; + for (wh = 0; wh < 2; wh ++) + { + DDSURFACEDESC DDsd={sizeof(DDsd),}; + DDsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PITCH|DDSD_PIXELFORMAT; + DDsd.dwWidth=resize_w; + DDsd.dwHeight=resize_h; + DDsd.lPitch=resize_w*sizeof(int); + DDsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY; + DDsd.ddpfPixelFormat.dwSize = sizeof(DDsd.ddpfPixelFormat); + DDsd.ddpfPixelFormat.dwFlags=DDPF_RGB; + DDsd.ddpfPixelFormat.dwRGBBitCount = 32; + DDsd.ddpfPixelFormat.dwRBitMask=0xff0000; + DDsd.ddpfPixelFormat.dwGBitMask=0x00ff00; + DDsd.ddpfPixelFormat.dwBBitMask=0x0000ff; + if (g_lpDD->CreateSurface(&DDsd, &g_lpRenderSurf[wh], NULL) != DD_OK) + { + if (wh) + { + g_lpRenderSurf[0]->Release(); + g_lpRenderSurf[0]=0; + } + g_lpRenderSurf[wh]=0; + LeaveCriticalSection(&g_cs); + return; + } + +#ifdef RESIZE_ONRESIZE + DDSURFACEDESC d={sizeof(d),}; + HRESULT han; + if (fb_save_use && g_lpRenderSurf[wh] && + (han = g_lpRenderSurf[wh]->Lock(NULL,&d,DDLOCK_WAIT,NULL)) == DD_OK) + { + if (d.lpSurface) + { + int x,y; + int dxpos=(64<<16)/resize_w; + int ypos=0; + int *p=(int *)d.lpSurface; + int h=resize_h; + + if (fs && (fsh>>dbl) < resize_h) + { + int fsy=resize_h/2-(((fsh>>dbl)/2)); + p+=fsy * resize_w; + h -= fsy*2; + } + int dypos=(64<<16)/h; + + for (y = 0; y < h; y ++) + { + int xpos=0; + for (x = 0; x < resize_w; x ++) + { + *p++ = BLEND4_16((unsigned int *)fb_save + ((ypos>>10)&~63) + (xpos>>16),64,xpos,ypos); + xpos+=dxpos; + } + ypos+=dypos; + } +#ifndef NO_MMX + __asm emms; +#endif + } + g_lpRenderSurf[wh]->Unlock(d.lpSurface); + } +#endif + } + g_w=resize_w; + g_h=resize_h; + g_dsh=g_h<<dbl; + g_dsw=g_w<<dbl; + g_bpp=fs?fsbpp:32; + g_windowed_dsize=dbl; + + g_overlay_init_ok=0; + if(!(cfg_bkgnd_render&1)) DD_RestoreBkgndSettings(); + if((cfg_bkgnd_render&1) || (g_fs && fsovl)) { + // init overlay stuff + DDSURFACEDESC ddsdOverlay; + HRESULT ddrval; + int i; + + // It's currently not possible to query for pixel formats supported by the + // overlay hardware (though GetFourCCCodes() usually provides a partial + // list). Instead you need to call CreateSurface() to try a variety of + // formats till one works. + INIT_DIRECTDRAW_STRUCT(ddsdOverlay); + ddsdOverlay.ddsCaps.dwCaps=DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY; + ddsdOverlay.dwFlags= DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH; + ddsdOverlay.dwWidth=resize_w; + ddsdOverlay.dwHeight=resize_h; + ddsdOverlay.lPitch=resize_w*sizeof(int); + ddsdOverlay.dwBackBufferCount=0; + + // Try to create an overlay surface using one of the pixel formats in our + // global list. + i=0; + do + { + ddsdOverlay.ddpfPixelFormat=g_ddpfOverlayFormats[i]; + // Try to create the overlay surface + ddrval = g_lpDD->CreateSurface(&ddsdOverlay, &g_lpddsOverlay, NULL); + } while( FAILED(ddrval) && (++i < NUM_OVERLAY_FORMATS) ); + + if(!FAILED(ddrval)) + { + g_overlay_fourcc=(fourcc_enum)i; + + HRESULT ddrval; + DDSURFACEDESC ddsd; + INIT_DIRECTDRAW_STRUCT(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + ddrval = g_lpDD->CreateSurface(&ddsd, &g_lpddsPrimary, NULL ); + + RECT rs, rd; + DDOVERLAYFX ovfx; + DDCAPS capsDrv; + unsigned int uDestSizeAlign, uSrcSizeAlign; + DWORD dwUpdateFlags; + + INIT_DIRECTDRAW_STRUCT(capsDrv); + ddrval = g_lpDD->GetCaps(&capsDrv, NULL); + + uDestSizeAlign = capsDrv.dwAlignSizeDest; + uSrcSizeAlign = capsDrv.dwAlignSizeSrc; + + dwUpdateFlags = DDOVER_SHOW | DDOVER_DDFX | DDOVER_KEYDESTOVERRIDE; + + DEVMODE d; + d.dmSize=sizeof(d); + d.dmDriverExtra=0; + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &d); + + int rv=0xff&(cfg_bkgnd_render_color>>16), gv=0xff&(cfg_bkgnd_render_color>>8), bv=0xff&cfg_bkgnd_render_color; + + if(!fsovl) + { + if (cfg_bkgnd_render&2) + { + if (!g_saved_desktop_values) + { + HKEY key; + g_saved_desktop_wallpaper[0]=0; + g_saved_reg_bkgnd_color[0]=0; + + // get wallpaper + if(RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\Desktop",&key)==ERROR_SUCCESS) + { + unsigned long s=sizeof(g_saved_desktop_wallpaper),vt; + RegQueryValueEx(key,"Wallpaper", 0, &vt, (unsigned char *)g_saved_desktop_wallpaper, &s); + } + + // get registry bkgnd color + if(RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\Colors",&key)==ERROR_SUCCESS) + { + unsigned long s=sizeof(g_saved_reg_bkgnd_color),vt; + RegQueryValueEx(key,"Background", 0, &vt, (unsigned char *)g_saved_reg_bkgnd_color, &s); + } + + g_saved_bkgnd_color=GetSysColor(COLOR_DESKTOP); + g_saved_desktop_values=1; + } + int e=COLOR_DESKTOP; + unsigned long c=RGB(rv,gv,bv); + SetSysColors(1, &e, &c); + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "", NULL); + + // rewrite registry settings right now so we don't fuck the user desktop if avs crashes + { + HKEY key; + if(RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\Desktop",&key)==ERROR_SUCCESS) + RegSetValueEx(key,"Wallpaper", 0, REG_SZ, (unsigned char *)g_saved_desktop_wallpaper, strlen(g_saved_desktop_wallpaper)+1); + if(RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\Colors",&key)==ERROR_SUCCESS) + RegSetValueEx(key,"Background", 0, REG_SZ, (unsigned char *)g_saved_reg_bkgnd_color, strlen(g_saved_reg_bkgnd_color)+1); + } + } + else DD_RestoreBkgndSettings(); + } + + INIT_DIRECTDRAW_STRUCT(ovfx); + switch(d.dmBitsPerPel) + { + case 16: + ovfx.dckDestColorkey.dwColorSpaceLowValue=((rv>>3) << 11) | ((gv>>2) << 5) | (bv>>3); + break; + case 15: + ovfx.dckDestColorkey.dwColorSpaceLowValue=((rv>>3) << 10) | ((gv>>3) << 5) | (bv>>3); + break; + case 24: case 32: + ovfx.dckDestColorkey.dwColorSpaceLowValue=(rv << 16) | (gv << 8) | bv; + break; + } + ovfx.dckDestColorkey.dwColorSpaceHighValue=ovfx.dckDestColorkey.dwColorSpaceLowValue; + + rs.left=0; rs.top=0; + rs.right = resize_w; + rs.bottom = resize_h; + if (capsDrv.dwCaps & DDCAPS_ALIGNSIZESRC && uSrcSizeAlign) + rs.right -= rs.right % uSrcSizeAlign; + rd.left=0; rd.top=0; + rd.right=GetSystemMetrics(SM_CXSCREEN); rd.bottom=GetSystemMetrics(SM_CYSCREEN); + if (capsDrv.dwCaps & DDCAPS_ALIGNSIZEDEST && uDestSizeAlign) + rd.right = (int)((rd.right+uDestSizeAlign-1)/uDestSizeAlign)*uDestSizeAlign; + // Make the call to UpdateOverlay() which actually displays the overlay on + // the screen. + ddrval = g_lpddsOverlay->UpdateOverlay(&rs, g_lpddsPrimary, &rd, dwUpdateFlags, &ovfx); + if(!FAILED(ddrval)) g_overlay_init_ok=1; + } + } + + if(g_fs && fsovl) + { + g_fs_height=fsh>>dbl; + DD_CreateFullscreenOverlayWindow(); + } + + LeaveCriticalSection(&g_cs); +} + +#ifndef NO_MMX +bool CopyRGBSurfaceToYUVSurfaceMMX( + LPDDSURFACEDESC pddsd1, + LPDDSURFACEDESC pddsd2, + fourcc_enum eOverlayFormat) +{ + if (pddsd1->dwWidth != pddsd2->dwWidth) + return false; + if (pddsd1->dwHeight != pddsd2->dwHeight) + return false; + + DWORD w = pddsd1->dwWidth; + DWORD h = pddsd1->dwHeight; + LONG pitch1 = pddsd1->lPitch; + LONG pitch2 = pddsd2->lPitch; + unsigned __int32 *pPixels1 = (unsigned __int32 *)pddsd1->lpSurface; + unsigned __int32 *pPixels2 = (unsigned __int32 *)pddsd2->lpSurface; + signed __int16 cm1[4]; + signed __int16 cm2[4]; + signed __int16 cm3[4]; + signed __int16 cm4[4]; + int loops_per_scanline = w/2; + int extra_bytes_per_scanline_src = pitch1 - w*4; + int extra_bytes_per_scanline_dest = pitch2 - w*2; + + if (eOverlayFormat == UYVY) // U Y V Y + { + // swap 0<->1, and 2<->3 + cm1[1] = 77/2; cm1[0] = -38/2; cm1[3] = 77/2; cm1[2] = 110/2; + cm2[1] = 150/2; cm2[0] = -74/2; cm2[3] = 150/2; cm2[2] = -92/2; + cm3[1] = 29/2; cm3[0] = 112/2; cm3[3] = 29/2; cm3[2] = -18/2; + cm4[1] = 0; cm4[0] = 32768/2; cm4[3] = 0; cm4[2] = 32768/2; + } + else // Y U Y 2 + { + // (laptop) + cm1[0] = 77/2; cm1[1] = -38/2; cm1[2] = 77/2; cm1[3] = 110/2; + cm2[0] = 150/2; cm2[1] = -74/2; cm2[2] = 150/2; cm2[3] = -92/2; + cm3[0] = 29/2; cm3[1] = 112/2; cm3[2] = 29/2; cm3[3] = -18/2; + cm4[0] = 0; cm4[1] = 32768/2; cm4[2] = 0; cm4[3] = 32768/2; + } + + __asm + { + mov edx, h + + mov esi, pPixels1 + mov edi, pPixels2 + sub edi, 4 // pre-subtract + movq mm4, cm4 + movq mm5, cm1 + movq mm6, cm2 + movq mm7, cm3 + + ALIGN 8 + yuvscanlineloop: + + mov ecx, loops_per_scanline + + ALIGN 8 + yuvloop: + + /* + // prefetch + test ecx, 0x000001ff + jnz PROCESS_PIXEL_MMX32 // every 256th pixel do some prefetches + + mov ebx, 2*256 // need to prefetch 256*6 bytes + ALIGN 8 + LOAD_ESI_ARRAY_MMX32: + mov eax, [ebx+esi] + mov eax, [ebx+esi+32] + sub ebx, 64 + jnz LOAD_ESI_ARRAY_MMX32 + + ALIGN 8 + PROCESS_PIXEL_MMX32: + */ + + // read in 2 pixels + movq mm0, qword ptr [esi] // -- b1 g1 r1 -- b2 g2 r2 + movq mm1, qword ptr [esi] // -- b1 g1 r1 -- b2 g2 r2 + movq mm2, qword ptr [esi] // -- b1 g1 r1 -- b2 g2 r2 + + // quick reference: + // punpcklbw mm7, mm7 // abcdefgh -> eeffgghh + // punpcklbw mm7, mm0 // abcdefgh -> 0e0f0g0h (if mm0 is zero) + // packuswb mm7, mm7 // 0a0b0g0r -> abgrabgr ? + + // step 1: get to this state: + // mm0: r1 r1 r2 r2 + // mm1: g1 g1 g2 g2 + // mm2: b1 b1 b2 b2 + // mm3: junk + // mm4: 0 32k 0 32k + // mm5: c1r1 c1r2 c2r1 c2r2 + // mm6: c1g1 c1g2 c2g1 c2g2 + // mm7: c1b1 c1b2 c2b1 c2b2 + + // NOTE: the shifts of 8, 16, and 24 below are + // correct (vs. 0-8-16) but might be in + // backwards order! + + pslld mm0, 8 + pslld mm1, 16 + pslld mm2, 24 + psrld mm0, 24 // 00 00 00 r1 00 00 00 r2 + psrld mm1, 24 // 00 00 00 g1 00 00 00 g2 + psrld mm2, 24 // 00 00 00 b1 00 00 00 b2 + + movq mm3, mm0 + pslld mm0, 16 + por mm0, mm3 // 00 r1 00 r1 00 r2 00 r2 + + movq mm3, mm1 + pslld mm1, 16 + por mm1, mm3 // 00 g1 00 g1 00 g2 00 g2 + + movq mm3, mm2 + pslld mm2, 16 + por mm2, mm3 // 00 b1 00 b1 00 b2 00 b2 + + // step 2: multiply to get to this state: + // mm0: r1*c1r1 r1*c1r2 r2*c2r1 r2*c2r2 + // mm1: g1*c1g1 g1*c1g2 g2*c2g1 g2*c2g2 + // mm2: b1*c1b1 b1*c1b2 b2*c2b1 b2*c2b2 + // mm4: 0 32k 0 32k + pmullw mm0, mm5 + add edi, 4 + pmullw mm1, mm6 + add esi, 8 + pmullw mm2, mm7 + + // step 3: add to get to this state: + // mm0: d1*256 d2*256 d3*256 d4*256 + paddsw mm0, mm4 + paddsw mm0, mm1 + paddsw mm0, mm2 + + psrlw mm0, 7 + packuswb mm0, mm0 // bytes: abgrabgr + movd dword ptr [edi], mm0 // store + + loop yuvloop + + // scanline complete + add esi, extra_bytes_per_scanline_src + add edi, extra_bytes_per_scanline_dest + + dec edx + jnz yuvscanlineloop + + emms + } + + return true; +} +#else +bool CopyRGBSurfaceToYUVSurface( + LPDDSURFACEDESC pddsd1, + LPDDSURFACEDESC pddsd2, + fourcc_enum eOverlayFormat) +{ + if (pddsd1->dwWidth != pddsd2->dwWidth) + return false; + if (pddsd1->dwHeight != pddsd2->dwHeight) + return false; + + DWORD w = pddsd1->dwWidth; + DWORD h = pddsd1->dwHeight; + LONG pitch1 = pddsd1->lPitch; + LONG pitch2 = pddsd2->lPitch; + unsigned __int32 *pPixels1 = (unsigned __int32 *)pddsd1->lpSurface; + unsigned __int32 *pPixels2 = (unsigned __int32 *)pddsd2->lpSurface; + unsigned __int32 color1; + LONG offset1 = 0; + LONG offset2 = 0; + unsigned int R, G, B, i1, i2, i3, i4; + BYTE yuv[4]; + + if (eOverlayFormat == UYVY) // U Y V Y + { + i1 = 1; + i2 = 0; + i3 = 3; + i4 = 2; + } + else // Y U Y 2 + { + i1 = 0; + i2 = 1; + i3 = 2; + i4 = 3; + } + + // Go through the image 2 pixels at a time and convert to YUV + for (unsigned int y=0; y<h; y++) + { + offset1 = y*pitch1/4; + offset2 = y*pitch2/4; + + for (unsigned int x=0; x<w; x+=2) + { + color1 = pPixels1[offset1++]; + B = (color1) & 0xFF; + G = (color1 >> 8) & 0xFF; + R = (color1 >> 16) & 0xFF; + yuv[i1] = (77*R + 150*G + 29*B) >> 8; + yuv[i2] = (32768 - 38*R - 74*G + 112*B) >> 8; + + color1 = pPixels1[offset1++]; + B = (color1) & 0xFF; + G = (color1 >> 8) & 0xFF; + R = (color1 >> 16) & 0xFF; + yuv[i3] = (77*R + 150*G + 29*B) >> 8; + yuv[i4] = (32768 + 110*R - 92*G - 18*B) >> 8; + + pPixels2[offset2++] = *((unsigned __int32 *)yuv); + } + } + return true; +} +#endif + +int DDraw_Init() +{ + InitializeCriticalSection(&g_cs); + return 0; + +} +void DDraw_Quit(void) +{ + if (g_lpDD) + { + if (g_lpPrimSurf) + { + g_lpPrimSurf->Release(); + g_lpPrimSurfBack=g_lpPrimSurf=NULL; + } + if (g_lpRenderSurf[0]) g_lpRenderSurf[0]->Release(); + if (g_lpRenderSurf[1]) g_lpRenderSurf[1]->Release(); + g_lpRenderSurf[0]=0; + g_lpRenderSurf[1]=0; + if (g_lpddsOverlay) g_lpddsOverlay->Release(); + if (g_lpddsPrimary) g_lpddsPrimary->Release(); + g_lpddsOverlay=g_lpddsPrimary=NULL; + g_lpDD->Release(); + g_lpDD=NULL; + DD_RestoreBkgndSettings(); + } + DeleteCriticalSection(&g_cs); +} + + +void DDraw_BeginResize(void) +{ + if (!g_fs) nodraw=1; +} +void DDraw_Resize(int w, int h, int dsize) +{ + if (!g_fs) DD_CreateSurfaces(w, h, 0, 0, 0, 0, !!dsize, 0); +} + +static void *g_lpsurf[2]; + +static DDSURFACEDESC d={sizeof(d),}; +static DDSURFACEDESC d2={sizeof(d),}; + +void DDraw_Enter(int *w, int *h, int **fb1, int **fb2) +{ + HRESULT han; + if (nodraw) + { + *fb1=*fb2=0; + return; + } + EnterCriticalSection(&g_cs); + *w=g_w; + *h=g_h; + if (!g_lpDD || !g_lpRenderSurf[0] || !g_lpRenderSurf[1]) + { + *fb1=*fb2=0; + LeaveCriticalSection(&g_cs); + return; + } + if ((han = g_lpRenderSurf[0]->Lock(NULL,&d,DDLOCK_WAIT,NULL)) != DD_OK) + { + *fb1=*fb2=0; + LeaveCriticalSection(&g_cs); + return; + } + if ((han = g_lpRenderSurf[1]->Lock(NULL,&d2,DDLOCK_WAIT,NULL)) != DD_OK) + { + g_lpRenderSurf[0]->Unlock(d.lpSurface); + *fb1=*fb2=0; + LeaveCriticalSection(&g_cs); + return; + } + *fb1=(int*)(g_lpsurf[0]=d.lpSurface); + *fb2=(int*)(g_lpsurf[1]=d2.lpSurface); + + if (g_fs && g_fs_height!=g_h)// && !cfg_fs_use_overlay) + { + int y=g_h/2-((g_fs_height/2)); + *h-=y*2; + *fb1 += y*g_w; + *fb2 += y*g_w; + } +} + +static unsigned int draw_title_time; +static char last_title[1024]; + +extern HWND hwnd_WinampParent; + +static void do_gettitle() +{ + if (draw_title_p < 1 && --draw_title_p < -7) + { + char this_title[2048]={0,}; + char *p; + if (IsWindow(hwnd_WinampParent)) + { + DWORD id; + if (!SendMessageTimeout( hwnd_WinampParent,WM_GETTEXT,(WPARAM)sizeof(this_title),(LPARAM)this_title,SMTO_BLOCK,50,&id) || !id) return; + } + p = this_title+strlen(this_title); + while (p >= this_title) + { + char buf[9]; + memcpy(buf,p,8); + buf[8]=0; + if (!lstrcmpi(buf,"- Winamp")) break; + p--; + } + if (p >= this_title) p--; + while (p >= this_title && *p == ' ') p--; + *++p=0; + if (lstrcmpi(this_title,last_title)) + { + strcpy(last_title,this_title); + draw_title_p=1; + draw_title_time=GetTickCount()+1000; + } + else draw_title_p=0; + } + if (draw_title_p == 2) + { + draw_title_p=1; + draw_title_time=GetTickCount()+1000; + } +} + + +char statustext[256]; +DWORD statustext_life; +int statustext_len; + +void DDraw_SetStatusText(char *text, int life) +{ + strcpy(statustext,text); + statustext_len=life?life:2000; + statustext_life=1; + +} + + + +#ifndef NO_X86ASM +void homemadeBlitFrom32bpp(DDSURFACEDESC *out, void *in, int w, int h, int sy, int ey) +{ + int mh=min(h,(int)out->dwHeight); + if (sy < 0) sy=0; + if (ey > mh) ey=mh; + if (out->ddpfPixelFormat.dwRGBBitCount == 15) + { + int y; + int mw; + mw=min(w,out->lPitch/2); + unsigned int *inptr=(unsigned int *)in + w*sy; + for (y = sy; y < ey; y ++) + { + unsigned char *optr = (unsigned char *)out->lpSurface + (y * out->lPitch); + __asm + { + mov edi, optr + mov esi, inptr + mov ecx, mw + mov ebx, 00000000111110001111100011111000b + shr ecx, 1 + conv15_loop: + mov eax,[esi] + + mov edx,[esi+4] + + and eax, ebx + and edx, ebx + + // 00000000RRRRR000GGGGG000BBBBB000 + shr ah,3 // 00000000RRRRR000000GGGGGBBBBB000 + shr dh,3 + + shr ax,3 // 00000000RRRRR000000000GGGGGBBBBB + shr dx,3 + + // ----------------HHHHHHHHLLLLLLLL + ror eax,10// GGGGGBBBBB00000000RRRRR000000000 + ror edx,10 + + shr ah,1 + shr dh,1 + + mov al,ah + mov dl,dh + + rol eax,10 + + rol edx,10 + + shl edx, 16 + + and eax, 0x0000ffff + add esi,8 + + or eax, edx + + mov [edi], eax + + add edi, 4 + dec ecx + jnz conv15_loop + } + inptr += w; + } + + } + else if (out->ddpfPixelFormat.dwRGBBitCount == 16) + { + int y; + int mw; + mw=min(w,out->lPitch/2); + unsigned int *inptr=(unsigned int *)in + w*sy; + for (y = sy; y < ey; y ++) + { + unsigned char *optr = (unsigned char *)out->lpSurface + (y * out->lPitch); + __asm + { + mov edi, optr + mov esi, inptr + mov ecx, mw + mov ebx, 00000000111110001111110011111000b + shr ecx, 1 + conv16_loop: + mov eax,[esi] + + mov edx,[esi+4] + + and eax, ebx + and edx, ebx + + // RRRRR000GGGGGG00BBBBB000 + + shr ah,2 // RRRRR00000GGGGGGBBBBB000 + shr dh,2 + + shr ax,3 // RRRRR00000000GGGGGGBBBBB + shr dx,3 + + ror eax,8 // GGGBBBBBRRRRR00000000GGG + ror edx,8 + + add al,ah // GGGBBBBBRRRRR000RRRRRGGG + add dl,dh + + rol eax,8 // RRRRR000RRRRRGGGGGGBBBBB + + rol edx,8 + + shl edx, 16 + + and eax, 0x0000ffff + add esi,8 + + or eax, edx + + mov [edi], eax + + add edi, 4 + dec ecx + jnz conv16_loop + } + inptr += w; + } + + } + else if (out->ddpfPixelFormat.dwRGBBitCount == 24) + { // very unoptimized + int y,x; + int mw; + unsigned int *inptr=(unsigned int *)in+sy; + mw=min(w,out->lPitch/3); + for (y = sy; y < ey; y ++) + { + unsigned char *optr = (unsigned char *)out->lpSurface + (y * out->lPitch); + x=mw/2; + while (x--) + { + int a=inptr[0]; + int b=inptr[1]; + optr[0]=(unsigned char) a; + optr[3]=(unsigned char) b; + optr[1]=(unsigned char) (a>>8); + optr[4]=(unsigned char) (b>>8); + optr[2]=(unsigned char) (a>>16); + optr[5]=(unsigned char) (b>>16); + + optr+=6; + inptr+=2; + } + inptr += (w-mw); + } + } + else + { + unsigned char *outptr; + unsigned int *inptr; + int mw=min(w*4,out->lPitch); + int y; + inptr=(unsigned int*)in + (sy*w); + outptr=(unsigned char *)out->lpSurface + (sy*out->lPitch); + for (y = sy; y < ey; y ++) + { + memcpy(outptr,inptr,mw); + inptr+=w; + outptr+=out->lPitch; + } + } +} +#endif + +static int unlocksurfaces() +{ + int a=0; + if (g_lpRenderSurf[0] && g_lpRenderSurf[0]->Unlock(g_lpsurf[0]) != DD_OK) a=1; + if (g_lpRenderSurf[1] && g_lpRenderSurf[1]->Unlock(g_lpsurf[1]) != DD_OK) a=1; + return a; +} + +void DDraw_Exit(int which) +{ + if (!g_lpRenderSurf[0] || !g_lpRenderSurf[1]) + { + unlocksurfaces(); + goto endfunc; + } +#ifdef RESIZE_ONRESIZE + last_used=which; +#endif + + if (g_fs && !cfg_fs_use_overlay) + { + int fsy=g_h/2-((g_fs_height/2)); + RECT r={0,0,g_w,g_h}; + if (g_bpp != 32) // non-32bpp mode + { + if (fsy>0 && ((cfg_fs_fps&1) || (statustext_life&&!(cfg_fs_fps&8)))) // clear portions of backbuffer if necessary + { + DDBLTFX ddbfx={sizeof(ddbfx),}; + int ty=min(fsy,16); + RECT r2={0,0,g_w,ty}; + g_lpPrimSurfBack->Blt(&r2,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + r2.top=g_h-ty; + r2.bottom=g_h-1; + g_lpPrimSurfBack->Blt(&r2,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + } +#ifndef NO_X86ASM + if (!(g_fs_flip&8) && !g_windowed_dsize) // homemade bltshit + { + DDSURFACEDESC d={sizeof(d),}; + HRESULT han; + han = g_lpPrimSurfBack->Lock(NULL,&d,DDLOCK_WAIT,NULL); + if (han == DDERR_SURFACELOST) + { + DDBLTFX ddbfx={sizeof(ddbfx),}; + g_lpPrimSurfBack->Restore(); + g_lpPrimSurfBack->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + han = g_lpPrimSurfBack->Lock(NULL,&d,DDLOCK_WAIT,NULL); + } + if (han != DD_OK) goto slow_fs_non32bpp; + + homemadeBlitFrom32bpp(&d,g_lpsurf[which],g_w,g_h,fsy,g_h-fsy); + + int a=0; + if (g_lpPrimSurfBack->Unlock(d.lpSurface) != DD_OK ) a=1; + if (unlocksurfaces()||a) + { + goto endfunc; + } + } + else // slow (stretchblt) +#endif + { + HDC in, out; +#ifndef NO_X86ASM +slow_fs_non32bpp: +#endif + if (unlocksurfaces() || g_lpPrimSurfBack->GetDC(&out) != DD_OK) + { + goto endfunc; + } + if (g_lpRenderSurf[which]->GetDC(&in) != DD_OK) + { + g_lpPrimSurfBack->ReleaseDC(out); + goto endfunc; + } + if (g_windowed_dsize) StretchBlt(out,0,fsy*2,g_dsw,g_dsh-fsy*4,in,0,fsy,g_w,g_h-fsy*2,SRCCOPY); + else BitBlt(out,0,fsy,g_w,g_h-fsy*2,in,0,fsy,SRCCOPY); + g_lpRenderSurf[which]->ReleaseDC(in); + g_lpPrimSurfBack->ReleaseDC(out); + } + } + else // 32bpp - always just use Blt() - will scale if necessary (yay Blt!) + { + //RECT or={0,g_go_fs_h/2-g_go_fs_height/2,g_go_fs_w,g_go_fs_h/2+g_go_fs_height/2}; + //RECT ir={0,g_h/2-g_go_fs_height/2,g_w,g_h/2+g_go_fs_height/2}; + if (unlocksurfaces()) + { + goto endfunc; + } + if (g_lpPrimSurfBack->Blt(NULL,g_lpRenderSurf[which],&r,DDBLT_WAIT,NULL) == DDERR_SURFACELOST) + { + DDBLTFX ddbfx={sizeof(ddbfx),}; + if (g_fs_flip&1) + { + g_lpPrimSurfBack->Restore(); + g_lpPrimSurfBack->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + } + g_lpPrimSurf->Restore(); + g_lpPrimSurf->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&ddbfx); + goto endfunc; + } + } + do_gettitle(); + if ((cfg_fs_fps&1) || (draw_title_p>0&&!(cfg_fs_fps&16)) || (statustext_life&&!(cfg_fs_fps&8))) + { + HDC out; + if (g_lpPrimSurfBack->GetDC(&out) == DD_OK) + { + char str[2048]; + SetBkMode(out,TRANSPARENT); + if (cfg_fs_fps&1) + { + RECT r={2,2,g_fs_w,g_fs_h}; + wsprintf(str,"%d.%d",g_dlg_fps/10,g_dlg_fps%10); + SetTextColor(out,RGB(0,0,0)); + DrawText(out,str,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOCLIP|DT_NOPREFIX); + r.left=r.top=0; + SetTextColor(out,RGB(255,255,255)); + DrawText(out,str,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOCLIP|DT_NOPREFIX); + } + if (statustext_life&&!(cfg_fs_fps&8)) + { + if (statustext_life==1) statustext_life=GetTickCount()+statustext_len; + RECT r={0,0,g_fs_w,g_fs_h}; + if (GetTickCount() > statustext_life) + { + if (statustext_life==2) statustext_life=0; + else statustext_life=2; + } + else + { + SetTextColor(out,RGB(0,0,0)); + DrawText(out,statustext,-1,&r,DT_BOTTOM|DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX); + SetTextColor(out,RGB(255,255,255)); + r.right-=2; + r.bottom-=2; + DrawText(out,statustext,-1,&r,DT_BOTTOM|DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX); + } + } + if (draw_title_p>0&&!(cfg_fs_fps&16)) + { + RECT r={4,4,g_fs_w,g_fs_h}; + SetTextColor(out,RGB(0,0,0)); + DrawText(out,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + r.left=r.top=0; + SetTextColor(out,RGB(255,255,255)); + DrawText(out,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + } + g_lpPrimSurfBack->ReleaseDC(out); + } + if (draw_title_p>0 && draw_title_time < GetTickCount() && !(cfg_fs_fps&16)) + { + if (g_lpRenderSurf[which]->GetDC(&out) == DD_OK) + { + RECT r={4,4,g_w,g_h}; + SetBkMode(out,TRANSPARENT); + SetTextColor(out,RGB(0,0,0)); + DrawText(out,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + r.left=r.top=0; + SetTextColor(out,RGB(255,255,255)); + DrawText(out,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + g_lpRenderSurf[which]->ReleaseDC(out); + } + draw_title_p=0; + } + } + if (g_fs_flip&1) g_lpPrimSurf->Flip(NULL, DDFLIP_WAIT); + else if (!(g_fs_flip&2)) g_lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN,0); + } + else + { + if(g_overlay_init_ok) + { + LPDDSURFACEDESC pd=(which==0?&d:&d2); + DDSURFACEDESC dd={sizeof(dd),}; + if (g_fs) if (!(cfg_fs_flip&2)) g_lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN,0); + + if (g_lpddsOverlay->Lock(NULL,&dd,DDLOCK_WAIT,NULL) != DD_OK) + { + g_overlay_init_ok=0; + goto endfunc; + } +#ifndef NO_MMX + CopyRGBSurfaceToYUVSurfaceMMX(pd,&dd,g_overlay_fourcc); +#else + CopyRGBSurfaceToYUVSurface(pd,&dd,g_overlay_fourcc); +#endif + g_lpddsOverlay->Unlock(&dd); + if (g_fs) + { + unlocksurfaces(); + goto endfunc; + } + } + + HDC in1, out, in2=NULL; + if (unlocksurfaces() || g_lpRenderSurf[which]->GetDC(&in1) != DD_OK) + { + goto endfunc; + } + do_gettitle(); + if (draw_title_p>0&&!(cfg_fs_fps&4) && draw_title_time < GetTickCount()) + { + RECT r={4,4,g_w,g_h}; + SetBkMode(in1,TRANSPARENT); + SetTextColor(in1,RGB(0,0,0)); + DrawText(in1,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + r.left=r.top=0; + SetTextColor(in1,RGB(255,255,255)); + DrawText(in1,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + draw_title_p=0; + } + if ((draw_title_p > 0&&!(cfg_fs_fps&4)) || (statustext_life&&!(cfg_fs_fps&2))) + { + // draw perframe + RECT r={4,4,g_w,g_h}; + if (g_lpRenderSurf[which^1]->GetDC(&in2) != DD_OK) + { + in2=NULL; + goto abort_thingy; + } + BitBlt(in2,0,0,g_w,g_h,in1,0,0,SRCCOPY); + SetBkMode(in2,TRANSPARENT); + if (draw_title_p > 0&&!(cfg_fs_fps&4)) + { + SetTextColor(in2,RGB(0,0,0)); + DrawText(in2,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + r.left=r.top=0; + SetTextColor(in2,RGB(255,255,255)); + DrawText(in2,last_title,-1,&r,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_NOPREFIX); + } + if (statustext_life&&!(cfg_fs_fps&2)) + { + if (statustext_life==1) statustext_life=GetTickCount()+statustext_len; + if (GetTickCount() > statustext_life) statustext_life=0; + SetTextColor(in2,RGB(0,0,0)); + DrawText(in2,statustext,-1,&r,DT_BOTTOM|DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX); + r.right-=2; + r.bottom-=2; + SetTextColor(in2,RGB(255,255,255)); + DrawText(in2,statustext,-1,&r,DT_BOTTOM|DT_RIGHT|DT_SINGLELINE|DT_NOPREFIX); + } + } +abort_thingy: + if (!(cfg_fs_flip&4)) g_lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN,0); + out=GetDC(g_hwnd); + if (out) + { + if (!g_windowed_dsize) + { +#ifndef WA2_EMBED + BitBlt(out,inWharf?0:7,inWharf?0:15,g_w-g_noshoww,g_h,in2?in2:in1,0,0,SRCCOPY); +#else + BitBlt(out,0,0,g_w-g_noshoww,g_h,in2?in2:in1,0,0,SRCCOPY); +#endif + } + else + { +#ifndef WA2_EMBED + StretchBlt(out,inWharf?0:7,inWharf?0:15,g_dsw,g_dsh,in2?in2:in1,0,0,g_w,g_h,SRCCOPY); +#else + StretchBlt(out,0,0,g_dsw,g_dsh,in2?in2:in1,0,0,g_w,g_h,SRCCOPY); +#endif + } + ReleaseDC(g_hwnd,out); + } + g_lpRenderSurf[which]->ReleaseDC(in1); + if (in2) + g_lpRenderSurf[which^1]->ReleaseDC(in2); + } +endfunc: + LeaveCriticalSection(&g_cs); +} + + +void DDraw_SetFullScreen(int fs, int w, int h, int dbl, int bpp) +{ + if (!fs) DD_CreateSurfaces(w, h, 0, 0, 0, 0, !!dbl, 0); + else + { + DD_CreateSurfaces(w, h, (min(max(1,cfg_fs_height),100)*h)/100, 1, bpp, cfg_fs_flip, !!dbl, cfg_fs_use_overlay); + } +} + +int DDraw_IsFullScreen(void) +{ + return g_fs; +} + +HRESULT WINAPI _cb( + LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) +{ + HWND h=(HWND)lpContext; + if ((lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_RGB) && + (lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==32 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==24 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==16 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==15)) + { + char s[256]; + wsprintf(s,"%dx%d@%dBPP",lpDDSurfaceDesc->dwWidth,lpDDSurfaceDesc->dwHeight,lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount); + SendMessage(h,CB_ADDSTRING,0,(long)s); + } + + return DDENUMRET_OK; +} + + +void DDraw_EnumDispModes(HWND hwnd) +{ + if (g_lpDD) + g_lpDD->EnumDisplayModes(0,NULL,hwnd,_cb); +} + +static int g_st; + +HRESULT WINAPI _cb2( + LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) +{ + DWORD *x=(DWORD *)lpContext; + if (x[0]==lpDDSurfaceDesc->dwWidth && + x[1]==lpDDSurfaceDesc->dwHeight && + x[2]==lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount) + { + g_st=1; + return DDENUMRET_CANCEL; + } + + return DDENUMRET_OK; +} + +int DDraw_IsMode(int w, int h, int bpp) +{ + int x[3]={w,h,bpp}; + if (!x[0] || !x[1] || !x[2]) return 0; + if (!g_lpDD) return 0; + g_st=0; + g_lpDD->EnumDisplayModes(0,NULL,(LPVOID)x,_cb2); + return g_st; +} + +HRESULT WINAPI _cb3( + LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) +{ + if ((lpDDSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_RGB) && + (lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==32 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==24 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==16 || + lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount==15)) + { + int *(*x)=(int **)lpContext; + if (lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount > (DWORD)x[2][0] || + lpDDSurfaceDesc->dwWidth < (DWORD)x[0][0] || + lpDDSurfaceDesc->dwHeight < (DWORD)x[1][0]) + { + x[0][0]=lpDDSurfaceDesc->dwWidth; + x[1][0]=lpDDSurfaceDesc->dwHeight; + x[2][0]=lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount; + } + } + + return DDENUMRET_OK; +} + + +int DDraw_PickMode(int *w, int *h, int *bpp) +{ + int *(x[3])={w,h,bpp}; + *w=0; + *h=0; + *bpp=0; + // return if mode found that is suitable + g_lpDD->EnumDisplayModes(0,NULL,(LPVOID)x,_cb3); + return *w && *h && *bpp; +} + +double DDraw_translatePoint(POINT p, int isY) +{ + double v=0.0; + if(g_fs && g_overlay_init_ok && hwndOverlayWnd && IsWindow(hwndOverlayWnd)) + { + RECT r; + ScreenToClient(hwndOverlayWnd,&p); + GetClientRect(hwndOverlayWnd,&r); + if (isY) + { + if (r.bottom>0) + v=p.y/(double)(r.bottom*0.5) - 1.0; + } + else + { + if (r.right>0) + v=p.x/(double)(r.right*0.5) - 1.0; + } + } + else + { + ScreenToClient(g_hwnd,&p); + + if (isY) + { + if (g_dsh>0) + v=p.y/(double)(g_dsh*0.5) - 1.0; + } + else + { + if (g_dsw>0) + v=p.x/(double)(g_dsw*0.5) - 1.0; + } + } + //if (v > 1.0) v=1.0; + //if (v < -1.0) v=-1.0; + return v; +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/draw.h b/Src/Plugins/Visualization/vis_avs/draw.h new file mode 100644 index 00000000..3c42cf77 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/draw.h @@ -0,0 +1,42 @@ +/* + 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. + +*/ +int DDraw_Init(); +void DDraw_Quit(void); +void DDraw_Resize(int w, int h, int dsize); +void DDraw_BeginResize(void); +void DDraw_Enter(int *w, int *h, int **fb1, int **fb2); +void DDraw_Exit(int which); +void DDraw_SetFullScreen(int fs, int w, int h, int dbl, int bps); +int DDraw_IsFullScreen(void); +void DDraw_EnumDispModes(HWND); +double DDraw_translatePoint(POINT p, int isY); + +void DDraw_SetStatusText(char *text, int life=0); +int DDraw_IsMode(int w, int h, int bpp);
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/dyn_dist.bin b/Src/Plugins/Visualization/vis_avs/dyn_dist.bin new file mode 100644 index 00000000..3bb05a44 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/dyn_dist.bin @@ -0,0 +1,12 @@ +The dynamic distance modifier allows you to dynamically (once per frame) +change the source pixels for each ring of pixels out from the center. +In the 'pixel' code section, 'd' represents the distance in pixels +the current ring is from the center, and code can modify it to +change the distance from the center where the source pixels for +that ring would be read. This is a terrible explanation, and if +you want to make a better one send it to me. + +Examples: +Zoom in: 'd=d*0.9' +Zoom out: 'd=d*1.1' +Back and forth: pixel='d=d*(1.0+0.1*cos(t));', frame='t=t+0.1'
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/dyn_move.bin b/Src/Plugins/Visualization/vis_avs/dyn_move.bin new file mode 100644 index 00000000..f75356a7 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/dyn_move.bin @@ -0,0 +1 @@ +Dynamic movement help goes here (send me some :) )
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/dyn_shift.bin b/Src/Plugins/Visualization/vis_avs/dyn_shift.bin new file mode 100644 index 00000000..30712dca --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/dyn_shift.bin @@ -0,0 +1,7 @@ +Better Dynamic shift help goes here (send me some :) + +Variables: + x,y = amount to shift (in pixels - set these) + w,h = width, height (in pixels) + b = isBeat + alpha = alpha value (0.0-1.0) for blend
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/effect_l.bin b/Src/Plugins/Visualization/vis_avs/effect_l.bin new file mode 100644 index 00000000..2541bcff --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/effect_l.bin @@ -0,0 +1,6 @@ +Read/write 'enabled' to get/set whether the effect list is enabled for this frame +Read/write 'beat' to get/set whether there is currently a beat +Read/write 'clear' to get/set whether to clear the framebuffer +If the input blend is set to adjustable, 'alphain' can be set from 0.0-1.0 +If the output blend is set to adjustable, 'alphaout' can be set from 0.0-1.0 +'w' and 'h' are set with the current width and height of the frame
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/evallib/BISON.EXE b/Src/Plugins/Visualization/vis_avs/evallib/BISON.EXE Binary files differnew file mode 100644 index 00000000..1a00d0ab --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/BISON.EXE diff --git a/Src/Plugins/Visualization/vis_avs/evallib/CAL_TAB.C b/Src/Plugins/Visualization/vis_avs/evallib/CAL_TAB.C new file mode 100644 index 00000000..83345693 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/CAL_TAB.C @@ -0,0 +1,576 @@ +#include <windows.h> +#include <stdio.h> +#include "Compiler.h" +#include "eval.h" + +#define VALUE 258 +#define IDENTIFIER 259 +#define FUNCTION1 260 +#define FUNCTION2 261 +#define FUNCTION3 262 +#define UMINUS 263 +#define UPLUS 264 +#define YYSTYPE int + +int yyerror(char *); +int yylex(char **exp); + +extern int result; + +typedef struct +{ + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; +} yyltype; + +#define YYLTYPE yyltype + +#define YYFINAL 51 +#define YYFLAG -32768 +#define YYNTBASE 21 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 26) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 14, 9, 2, 18, + 19, 12, 10, 20, 11, 2, 13, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 15, 16 +}; + + +static const short yyr1[] = { 0, + 21, 21, 22, 23, 23, 23, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 25, 25, 25 +}; + +static const short yyr2[] = { 0, + 1, 3, 1, 1, 1, 3, 1, 3, 3, 3, + 3, 3, 3, 3, 2, 2, 1, 4, 6, 8 +}; + +static const short yydefact[] = { 0, + 3, 4, 0, 0, 0, 0, 0, 0, 5, 7, + 1, 17, 0, 0, 0, 0, 4, 16, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, + 0, 6, 14, 13, 11, 12, 8, 9, 10, 18, + 0, 0, 0, 0, 19, 0, 0, 20, 0, 0, + 0 +}; + +static const short yydefgoto[] = { 49, + 9, 10, 11, 12 +}; + +static const short yypact[] = { 19, +-32768, -11, -7, -5, -4, 38, 38, 38,-32768,-32768, + 136,-32768, 38, 38, 38, 38,-32768,-32768,-32768, 88, + 38, 38, 38, 38, 38, 38, 38, 136, 100, 49, + 62,-32768, 41, 54, -9, -9,-32768,-32768,-32768,-32768, + 38, 38, 112, 75,-32768, 38, 124,-32768, 12, 27, +-32768 +}; + +static const short yypgoto[] = {-32768, +-32768,-32768, -6,-32768 +}; + + +#define YYLAST 150 + + +static const short yytable[] = { 18, + 19, 20, 25, 26, 27, 13, 28, 29, 30, 31, + 14, 50, 15, 16, 33, 34, 35, 36, 37, 38, + 39, 1, 2, 3, 4, 5, 51, 0, 6, 7, + 0, 0, 0, 0, 43, 44, 8, 0, 0, 47, + 1, 17, 3, 4, 5, 0, 0, 6, 7, 22, + 23, 24, 25, 26, 27, 8, 21, 22, 23, 24, + 25, 26, 27, 23, 24, 25, 26, 27, 41, 21, + 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, + 0, 42, 21, 22, 23, 24, 25, 26, 27, 0, + 0, 0, 0, 0, 46, 21, 22, 23, 24, 25, + 26, 27, 0, 0, 0, 0, 32, 21, 22, 23, + 24, 25, 26, 27, 0, 0, 0, 0, 40, 21, + 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, + 45, 21, 22, 23, 24, 25, 26, 27, 0, 0, + 0, 0, 48, 21, 22, 23, 24, 25, 26, 27 +}; + +static const short yycheck[] = { 6, + 7, 8, 12, 13, 14, 17, 13, 14, 15, 16, + 18, 0, 18, 18, 21, 22, 23, 24, 25, 26, + 27, 3, 4, 5, 6, 7, 0, -1, 10, 11, + -1, -1, -1, -1, 41, 42, 18, -1, -1, 46, + 3, 4, 5, 6, 7, -1, -1, 10, 11, 9, + 10, 11, 12, 13, 14, 18, 8, 9, 10, 11, + 12, 13, 14, 10, 11, 12, 13, 14, 20, 8, + 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, + -1, 20, 8, 9, 10, 11, 12, 13, 14, -1, + -1, -1, -1, -1, 20, 8, 9, 10, 11, 12, + 13, 14, -1, -1, -1, -1, 19, 8, 9, 10, + 11, 12, 13, 14, -1, -1, -1, -1, 19, 8, + 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, + 19, 8, 9, 10, 11, 12, 13, 14, -1, -1, + -1, -1, 19, 8, 9, 10, 11, 12, 13, 14 +}; +#define YYPURE 1 + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYIMPURE +#define YYLEX yylex(&exp) +#endif + +#ifndef YYPURE +#define YYLEX yylex(&yylval)//, &yylloc) MY MODIF! +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYIMPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + + +int yynerrs; /* number of parse errors so far */ +#endif /* YYIMPURE */ + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#define YYINITDEPTH 5000 +#define YYMAXDEPTH 5000 + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +#define __yy_bcopy(from,to,count) memcpy(to,from,(count)>0?(count):0) + +//#ln 131 "bison.simple" +int yyparse(char *exp) +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + + int yystacksize = YYINITDEPTH; + +#ifndef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + + yylval = 0; + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. */ + + yyssp = yyss - 1; + yyvsp = yyvs; + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + + if (yystacksize >= YYMAXDEPTH) + { + yyerror("internal error: parser stack overflow"); + return 2; + } + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; + + + if (yyssp >= yyss + yystacksize - 1) YYABORT; + } + + +// yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +// yyStackSize = yyssp - (yyss - 1); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + + } + else + { + yychar1 = YYTRANSLATE(yychar); + + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + + + switch (yyn) { + +case 1: +//#ln 32 "cal.y" +{ yyval = yyvsp[0]; result = yyvsp[0]; ; + break;} +case 2: +//#ln 34 "cal.y" +{ { + int i = (int)setVar((int)yyvsp[-2], 0); + int v; + + if (i < 0) v=createCompiledValue(0, NULL); + else if (i < EVAL_MAX_VARS) v= createCompiledValue(0, &(varTable[i].value)); + else if (i < EVAL_MAX_VARS+100) v= createCompiledValue(0, globalregs+i-EVAL_MAX_VARS); + else v=createCompiledValue(0, NULL); + + yyval = createCompiledFunction2(MATH_SIMPLE, FN_ASSIGN, v, (int)yyvsp[0]); + result = yyval; + } + ; + break;} +case 3: +//#ln 50 "cal.y" +{ yyval = yyvsp[0] ; + break;} +case 4: +//#ln 55 "cal.y" +{ yyval = getVar((int)yyvsp[0]);; + break;} +case 5: +//#ln 57 "cal.y" +{ yyval = yyvsp[0];; + break;} +case 6: +//#ln 59 "cal.y" +{ yyval = yyvsp[-1];; + break;} +case 7: +//#ln 64 "cal.y" +{ yyval = yyvsp[0]; ; + break;} +case 8: +//#ln 66 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_MULTIPLY, yyvsp[-2], yyvsp[0]); + break;} +case 9: +//#ln 72 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_DIVIDE, yyvsp[-2], yyvsp[0]); + break;} +case 10: +//#ln 78 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_MODULO, yyvsp[-2], yyvsp[0]); + break;} +case 11: +//#ln 84 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_ADD, yyvsp[-2], yyvsp[0]); + break;} +case 12: +//#ln 90 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_SUB, yyvsp[-2], yyvsp[0]); + break;} +case 13: +//#ln 96 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_AND, yyvsp[-2], yyvsp[0]); + break;} +case 14: +//#ln 102 "cal.y" +{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_OR, yyvsp[-2], yyvsp[0]); + break;} +case 15: +//#ln 108 "cal.y" +{ yyval = createCompiledFunction1(MATH_SIMPLE, FN_UMINUS, yyvsp[0]); + break;} +case 16: +//#ln 114 "cal.y" +{ yyval = createCompiledFunction1(MATH_SIMPLE, FN_UPLUS, yyvsp[0]); + break;} +case 17: +//#ln 120 "cal.y" +{ yyval = yyvsp[0]; + break;} +case 18: +//#ln 125 "cal.y" +{ yyval = createCompiledFunction1(MATH_FN, (int)yyvsp[-3], yyvsp[-1]); + break;} +case 19: +//#ln 131 "cal.y" +{ yyval = createCompiledFunction2(MATH_FN, (int)yyvsp[-5], yyvsp[-3], yyvsp[-1]); + break;} +case 20: +//#ln 137 "cal.y" +{ yyval = createCompiledFunction3(MATH_FN, (int)yyvsp[-7], yyvsp[-5], yyvsp[-3], yyvsp[-1]); + break;} +} + /* the action file gets copied in in place of this dollarsign */ +//#ln 362 "bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; + + *++yyvsp = yyval; + + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; +#error this should not compile + msg = (char *) xmalloc(size + 15); + strcpy(msg, "syntax error"); + + if (count < 5) + { + count = 0; + for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("syntax error"); + } + +//yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) YYABORT; + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; + + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + yystate = yyn; + goto yynewstate; +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/Compiler.c b/Src/Plugins/Visualization/vis_avs/evallib/Compiler.c new file mode 100644 index 00000000..56d3a067 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/Compiler.c @@ -0,0 +1,747 @@ +#include <windows.h> +#include <stdio.h> +#include <math.h> +#include "Compiler.h" +#include "eval.h" + +// defining this allows code to run in different threads at the same time +// it tends however, to be slower. We leave this OFF for AVS, since most of our shit runs in one thread +// anyhow. +//#define NSEEL_REENTRANT_EXECUTION + +#ifdef NSEEL_REENTRANT_EXECUTION +#include <malloc.h> +#endif +#define NSEEL_USE_CRITICAL_SECTION g_eval_cs + +// note that compiling can only happen in one thread at a time, always. + + + + +int g_evallib_stats[5]; // source bytes, static code bytes, call code bytes, data bytes, segments + +#ifdef NSEEL_USE_CRITICAL_SECTION +CRITICAL_SECTION NSEEL_USE_CRITICAL_SECTION; +#endif + + +#define LLB_DSIZE (65536-64) +typedef struct _llBlock { + struct _llBlock *next; + int sizeused; + char block[LLB_DSIZE]; +} llBlock; + +typedef struct _startPtr { + struct _startPtr *next; + void *startptr; +} startPtr; + +typedef struct { + int workTablePtr_size; + + llBlock *blocks; + void *code; + int code_stats[4]; +} codeHandleType; + +static llBlock *blocks_head = NULL; +static llBlock *tmpblocks_head = NULL; // used only during compile + +#define NSEEL_MAX_TEMPSPACE_ENTRIES 8192 + +static int g_evallib_computTableTop; // make it abort on potential overflow =) + +static int l_stats[4]; // source bytes, static code bytes, call code bytes, data bytes + +static void *__newBlock(llBlock **start,int size); + +#define newTmpBlock(x) __newBlock(&tmpblocks_head,x) +#define newBlock(x) __newBlock(&blocks_head,x) + +static void freeBlocks(llBlock *start); + +char *g_evallib_visdata; + +#define DECL_ASMFUNC(x) \ + void _asm_##x##(void); \ + void _asm_##x##_end(void); \ + + DECL_ASMFUNC(sin) + DECL_ASMFUNC(cos) + DECL_ASMFUNC(tan) + DECL_ASMFUNC(asin) + DECL_ASMFUNC(acos) + DECL_ASMFUNC(atan) + DECL_ASMFUNC(atan2) + DECL_ASMFUNC(sqr) + DECL_ASMFUNC(sqrt) + DECL_ASMFUNC(pow) + DECL_ASMFUNC(exp) + DECL_ASMFUNC(log) + DECL_ASMFUNC(log10) + DECL_ASMFUNC(abs) + DECL_ASMFUNC(min) + DECL_ASMFUNC(min) + DECL_ASMFUNC(max) + DECL_ASMFUNC(sig) + DECL_ASMFUNC(sign) + DECL_ASMFUNC(rand) + DECL_ASMFUNC(band) + DECL_ASMFUNC(bor) + DECL_ASMFUNC(bnot) + DECL_ASMFUNC(if) + DECL_ASMFUNC(equal) + DECL_ASMFUNC(below) + DECL_ASMFUNC(above) + DECL_ASMFUNC(assign) + DECL_ASMFUNC(add) + DECL_ASMFUNC(sub) + DECL_ASMFUNC(mul) + DECL_ASMFUNC(div) + DECL_ASMFUNC(mod) + DECL_ASMFUNC(or) + DECL_ASMFUNC(and) + DECL_ASMFUNC(uplus) + DECL_ASMFUNC(uminus) + DECL_ASMFUNC(floor) + DECL_ASMFUNC(ceil) + DECL_ASMFUNC(invsqrt) + DECL_ASMFUNC(exec2) + + DECL_ASMFUNC(getosc) + DECL_ASMFUNC(getspec) + DECL_ASMFUNC(gettime) + DECL_ASMFUNC(getmouse) + DECL_ASMFUNC(setmousepos) + + +static functionType fnTable1[36] = { + { "if", _asm_if,_asm_if_end, 3 }, + { "sin", _asm_sin,_asm_sin_end, 1 }, + { "cos", _asm_cos,_asm_cos_end, 1 }, + { "tan", _asm_tan,_asm_tan_end, 1 }, + { "asin", _asm_asin,_asm_asin_end, 1 }, + { "acos", _asm_acos,_asm_acos_end, 1 }, + { "atan", _asm_atan,_asm_atan_end, 1 }, + { "atan2", _asm_atan2,_asm_atan2_end, 2 }, + { "sqr", _asm_sqr,_asm_sqr_end, 1 }, + { "sqrt", _asm_sqrt,_asm_sqrt_end, 1 }, + { "pow", _asm_pow,_asm_pow_end, 2 }, + { "exp", _asm_exp,_asm_exp_end, 1 }, + { "log", _asm_log,_asm_log_end, 1 }, + { "log10", _asm_log10,_asm_log10_end, 1 }, + { "abs", _asm_abs,_asm_abs_end, 1 }, + { "min", _asm_min,_asm_min_end, 2 }, + { "max", _asm_max,_asm_max_end, 2 }, + { "sigmoid",_asm_sig,_asm_sig_end, 2 } , + { "sign", _asm_sign,_asm_sign_end, 1 } , + { "rand", _asm_rand,_asm_rand_end, 1 } , + { "band", _asm_band,_asm_band_end, 2 } , + { "bor", _asm_bor,_asm_bor_end, 2 } , + { "bnot", _asm_bnot,_asm_bnot_end, 1 } , + { "equal", _asm_equal,_asm_equal_end, 2 }, + { "below", _asm_below,_asm_below_end, 2 }, + { "above", _asm_above,_asm_above_end, 2 }, + { "floor", _asm_floor,_asm_floor_end, 1 }, + { "ceil", _asm_ceil,_asm_ceil_end, 1 }, + { "invsqrt", _asm_invsqrt,_asm_invsqrt_end, 1 }, + { "assign",_asm_assign,_asm_assign_end,2}, + { "exec2",_asm_exec2,_asm_exec2_end,2}, + // these will be seperated since they are AVS specific + { "getosc", _asm_getosc,_asm_getosc_end,3 }, + { "getspec",_asm_getspec,_asm_getspec_end,3 }, + { "gettime", _asm_gettime,_asm_gettime_end,1}, + { "getkbmouse",_asm_getmouse,_asm_getmouse_end,1}, + { "setmousepos",_asm_setmousepos,_asm_setmousepos_end,2}, + }; + + +functionType *getFunctionFromTable(int idx) +{ + // todo: add API for adding functions to a seperate table :) + if (idx<0 || idx>=sizeof(fnTable1)/sizeof(fnTable1[0])) return 0; + return fnTable1+idx; +} + +//--------------------------------------------------------------------------------------------------------------- +static void *realAddress(void *fn, void *fn_e, int *size) +{ +#ifdef _DEBUG + // Debug Mode + *siiiize=0; // fucko, need to figure this out +char *ptr = (char *)fn; +return ptr + (*(int *)(ptr+1))+5; +#else + // Release Mode + *size = (int)fn_e - (int) fn; + return fn; +#endif +} + +//--------------------------------------------------------------------------------------------------------------- +static void freeBlocks(llBlock *start) +{ + while (start) + { + llBlock *llB = start->next; + GlobalFree(start); + start=llB; + } +} + +//--------------------------------------------------------------------------------------------------------------- +static void *__newBlock(llBlock **start, int size) +{ + llBlock *llb; + int alloc_size; + if (*start && (LLB_DSIZE - (*start)->sizeused) >= size) + { + void *t=(*start)->block+(*start)->sizeused; + (*start)->sizeused+=size; + return t; + } + + alloc_size=sizeof(llBlock); + if ((int)size > LLB_DSIZE) alloc_size += size - LLB_DSIZE; + llb = (llBlock *)VirtualAlloc(NULL, alloc_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + // benski> CUT: llb = (llBlock *)GlobalAlloc(GMEM_FIXED,alloc_size); // grab bigger block if absolutely necessary (heh) + llb->sizeused=size; + llb->next = *start; + *start = llb; + return llb->block; +} + + +#define X86_MOV_EAX_DIRECTVALUE 0xB8 +#define X86_MOV_ESI_DIRECTVALUE 0xBE +#define X86_MOV_ESI_DIRECTMEMVALUE 0x358B +#define X86_PUSH_EAX 0x50 +#define X86_POP_EBX 0x5B +#define X86_POP_ECX 0x59 +#define X86_MOV_ESI_EDI 0xF78B + +#define X86_PUSH_ESI 0x56 +#define X86_POP_ESI 0x5E + +#define X86_RET 0xC3 + + +//--------------------------------------------------------------------------------------------------------------- +static int *findFBlock(char *p) +{ + while (*(int *)p != 0xFFFFFFFF) p++; + return (int*)p; +} + + +//--------------------------------------------------------------------------------------------------------------- +int createCompiledValue(double value, double *addrValue) +{ + unsigned char *block; + double *dupValue; + + block=(unsigned char *)newTmpBlock(4+5); + + if (addrValue == NULL) + { + l_stats[3]+=sizeof(double); + *(dupValue = (double *)newBlock(sizeof(double))) = value; + } + else + dupValue = addrValue; + + ((int*)block)[0]=5; + block[4]=X86_MOV_EAX_DIRECTVALUE; // mov eax, <value> + *(int *)(block+5) = (int)dupValue; + + return ((int)(block)); + +} + +//--------------------------------------------------------------------------------------------------------------- +int getFunctionAddress(int fntype, int fn, int *size) +{ + switch (fntype) + { + case MATH_SIMPLE: + switch (fn) + { + case FN_ASSIGN: + return (int)realAddress(_asm_assign,_asm_assign_end,size); + case FN_ADD: + return (int)realAddress(_asm_add,_asm_add_end,size); + case FN_SUB: + return (int)realAddress(_asm_sub,_asm_sub_end,size); + case FN_MULTIPLY: + return (int)realAddress(_asm_mul,_asm_mul_end,size); + case FN_DIVIDE: + return (int)realAddress(_asm_div,_asm_div_end,size); + case FN_MODULO: + return (int)realAddress(_asm_mod,_asm_mod_end,size); + case FN_AND: + return (int)realAddress(_asm_and,_asm_and_end,size); + case FN_OR: + return (int)realAddress(_asm_or,_asm_or_end,size); + case FN_UPLUS: + return (int)realAddress(_asm_uplus,_asm_uplus_end,size); + case FN_UMINUS: + return (int)realAddress(_asm_uminus,_asm_uminus_end,size); + } + case MATH_FN: + { + functionType *p=getFunctionFromTable(fn); + if (!p) + { + if (size) *size=0; + return 0; + } + return (int)realAddress(p->afunc,p->func_e,size); + } + } + return 0; +} + + +//--------------------------------------------------------------------------------------------------------------- +int createCompiledFunction3(int fntype, int fn, int code1, int code2, int code3) +{ + int sizes1=((int *)code1)[0]; + int sizes2=((int *)code2)[0]; + int sizes3=((int *)code3)[0]; + + if (fntype == MATH_FN && fn == 0) // special case: IF + { + void *func3; + int size; + int *ptr; + char *block; + + unsigned char *newblock2,*newblock3; + + newblock2=newBlock(sizes2+1); + memcpy(newblock2,(char*)code2+4,sizes2); + newblock2[sizes2]=X86_RET; + + newblock3=newBlock(sizes3+1); + memcpy(newblock3,(char*)code3+4,sizes3); + newblock3[sizes3]=X86_RET; + + l_stats[2]+=sizes2+sizes3+2; + + func3 = realAddress(_asm_if,_asm_if_end,&size); + + block=(char *)newTmpBlock(4+sizes1+size); + ((int*)block)[0]=sizes1+size; + memcpy(block+4,(char*)code1+4,sizes1); + ptr=(int *)(block+4+sizes1); + memcpy(ptr,func3,size); + + ptr=findFBlock((char*)ptr); *ptr++=(int)newblock2; + ptr=findFBlock((char*)ptr); *ptr=(int)newblock3; + + return (int)block; + + } + else + { + int size2; + unsigned char *block; + unsigned char *outp; + + int myfunc; + + myfunc = getFunctionAddress(fntype, fn, &size2); + + block=(unsigned char *)newTmpBlock(4+size2+sizes1+sizes2+sizes3+4); + + ((int*)block)[0]=4+size2+sizes1+sizes2+sizes3; + outp=block+4; + memcpy(outp,(char*)code1+4,sizes1); + outp+=sizes1; + *outp++ = X86_PUSH_EAX; + memcpy(outp,(char*)code2+4,sizes2); + outp+=sizes2; + *outp++ = X86_PUSH_EAX; + memcpy(outp,(char*)code3+4,sizes3); + outp+=sizes3; + *outp++ = X86_POP_EBX; + *outp++ = X86_POP_ECX; + + memcpy(block+4+4+sizes1+sizes2+sizes3,(void*)myfunc,size2); + g_evallib_computTableTop++; + + return ((int)(block)); + } +} + +//--------------------------------------------------------------------------------------------------------------- +int createCompiledFunction2(int fntype, int fn, int code1, int code2) +{ + int size2; + unsigned char *block; + unsigned char *outp; + + int myfunc; + int sizes1=((int *)code1)[0]; + int sizes2=((int *)code2)[0]; + + myfunc = getFunctionAddress(fntype, fn, &size2); + + block=(unsigned char *)newTmpBlock(2+size2+sizes1+sizes2+4); + + ((int*)block)[0]=2+size2+sizes1+sizes2; + outp=block+4; + memcpy(outp,(char*)code1+4,sizes1); + outp+=sizes1; + *outp++ = X86_PUSH_EAX; + memcpy(outp,(char*)code2+4,sizes2); + outp+=sizes2; + *outp++ = X86_POP_EBX; + + memcpy(block+4+2+sizes1+sizes2,(void*)myfunc,size2); + + g_evallib_computTableTop++; + + return ((int)(block)); + +} + + +//--------------------------------------------------------------------------------------------------------------- +int createCompiledFunction1(int fntype, int fn, int code) +{ + int size,size2; + char *block; + int myfunc; + void *func1; + + size =((int *)code)[0]; + func1 = (void *)(code+4); + + myfunc = getFunctionAddress(fntype, fn, &size2); + + block=(char *)newTmpBlock(4+size+size2); + ((int*)block)[0]=size+size2; + + memcpy(block+4, func1, size); + memcpy(block+size+4,(void*)myfunc,size2); + + g_evallib_computTableTop++; + + return ((int)(block)); +} + +static char *preprocessCode(char *expression) +{ + int len=0; + int alloc_len=strlen(expression)+1+64; + char *buf=(char *)malloc(alloc_len); + + while (*expression) + { + if (len > alloc_len-32) + { + alloc_len = len+128; + buf=(char*)realloc(buf,alloc_len); + } + + if (expression[0] == '/') + { + if (expression[1] == '/') + { + expression+=2; + while (expression[0] && expression[0] != '\r' && expression[0] != '\n') expression++; + } + else if (expression[1] == '*') + { + expression+=2; + while (expression[0] && (expression[0] != '*' || expression[1] != '/')) expression++; + if (expression[0]) expression+=2; // at this point we KNOW expression[0]=* and expression[1]=/ + } + else + { + char c=buf[len++]=*expression++; + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') l_stats[0]++; + } + } + else if (expression[0] == '$') + { + if (toupper(expression[1]) == 'P' && toupper(expression[2]) == 'I') + { + static char *str="3.141592653589793"; + expression+=3; + memcpy(buf+len,str,17); + len+=17; //strlen(str); + l_stats[0]+=17; + } + else if (toupper(expression[1]) == 'E') + { + static char *str="2.71828183"; + expression+=2; + memcpy(buf+len,str,10); + len+=10; //strlen(str); + l_stats[0]+=10; + } + if (toupper(expression[1]) == 'P' && toupper(expression[2]) == 'H' && toupper(expression[3]) == 'I') + { + static char *str="1.61803399"; + expression+=4; + memcpy(buf+len,str,10); + len+=10; //strlen(str); + l_stats[0]+=10; + } + else + { + char c = buf[len++]=*expression++; + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') l_stats[0]++; + } + } + else + { + char c=*expression++; + if (c == '\r' || c == '\n' || c == '\t') c=' '; + buf[len++]=c; + if (c != ' ') l_stats[0]++; + } + } + buf[len]=0; + + return buf; +} + +int g_log_errors; + +static void movestringover(char *str, int amount) +{ + char tmp[1024+8]; + + int l=(int)strlen(str); + l=min(1024-amount-1,l); + + memcpy(tmp,str,l+1); + + while (l >= 0 && tmp[l]!='\n') l--; + l++; + + tmp[l]=0;//ensure we null terminate + + memcpy(str+amount,tmp,l+1); +} + +//------------------------------------------------------------------------------ +int compileCode(char *_expression) +{ + char *expression,*expression_start; + int computable_size=0; + codeHandleType *handle; + startPtr *scode=NULL; + startPtr *startpts=NULL; + + if (!_expression || !*_expression) return 0; + if (!varTable) return 0; + + #ifdef NSEEL_USE_CRITICAL_SECTION + EnterCriticalSection(& NSEEL_USE_CRITICAL_SECTION); + #endif + + blocks_head=0; + tmpblocks_head=0; + memset(l_stats,0,sizeof(l_stats)); + + handle = (codeHandleType*)newBlock(sizeof(codeHandleType)); + + if (!handle) + { + #ifdef NSEEL_USE_CRITICAL_SECTION + LeaveCriticalSection(& NSEEL_USE_CRITICAL_SECTION); + #endif + return 0; + } + + memset(handle,0,sizeof(codeHandleType)); + + expression_start=expression=preprocessCode(_expression); + + while (*expression) + { + startPtr *tmp; + char *expr; + colCount=0; + + // single out segment + while (*expression == ';' || *expression == ' ') expression++; + if (!*expression) break; + expr=expression; + while (*expression && *expression != ';') expression++; + if (*expression) *expression++ = 0; + + // parse + tmp=(startPtr*) newTmpBlock(sizeof(startPtr)); + if (!tmp) break; + g_evallib_computTableTop=0; + tmp->startptr=compileExpression(expr); + if (computable_size < g_evallib_computTableTop) + { + computable_size=g_evallib_computTableTop; + } + + if (g_evallib_computTableTop > NSEEL_MAX_TEMPSPACE_ENTRIES-32) + { + tmp->startptr=0; // overflow in this mode + } + + if (!tmp->startptr) + { + if (g_log_errors) + { + int l=strlen(expr); + if (l > 512) l=512; + movestringover(last_error_string,l+2); + memcpy(last_error_string,expr,l); + last_error_string[l]='\r'; + last_error_string[l+1]='\n'; + } + + scode=NULL; + break; + } + tmp->next=NULL; + if (!scode) scode=startpts=tmp; + else + { + scode->next=tmp; + scode=tmp; + } + } + + // check to see if failed on the first startingCode + if (!scode) + { + freeBlocks(blocks_head); // free blocks + handle=NULL; // return NULL (after resetting blocks_head) + } + else + { + // now we build one big code segment out of our list of them, inserting a mov esi, computable before each item + unsigned char *writeptr; + int size=1; // for ret at end :) + startPtr *p; + p=startpts; + while (p) + { + size+=2; // mov esi, edi + size+=*(int *)p->startptr; + p=p->next; + } + handle->code = newBlock(size); + if (handle->code) + { + writeptr=(unsigned char *)handle->code; + p=startpts; + while (p) + { + int thissize=*(int *)p->startptr; + *(unsigned short *)writeptr= X86_MOV_ESI_EDI; + writeptr+=2; + memcpy(writeptr,(char*)p->startptr + 4,thissize); + writeptr += thissize; + + p=p->next; + } + *writeptr=X86_RET; // ret + l_stats[1]=size; + } + handle->blocks = blocks_head; + handle->workTablePtr_size=(computable_size+4) * sizeof(double); + } + freeBlocks(tmpblocks_head); // free blocks + tmpblocks_head=0; + + blocks_head=0; + + if (handle) + { + memcpy(handle->code_stats,l_stats,sizeof(l_stats)); + g_evallib_stats[0]+=l_stats[0]; + g_evallib_stats[1]+=l_stats[1]; + g_evallib_stats[2]+=l_stats[2]; + g_evallib_stats[3]+=l_stats[3]; + g_evallib_stats[4]++; + } + memset(l_stats,0,sizeof(l_stats)); + + #ifdef NSEEL_USE_CRITICAL_SECTION + LeaveCriticalSection(& NSEEL_USE_CRITICAL_SECTION); + #endif + + free(expression_start); + + return (int)handle; +} + +//------------------------------------------------------------------------------ +void executeCode(int handle, char visdata[2][2][576]) +{ +#ifdef NSEEL_REENTRANT_EXECUTION + int baseptr; +#else + static double _tab[NSEEL_MAX_TEMPSPACE_ENTRIES]; + int baseptr = (int) _tab; +#endif + codeHandleType *h = (codeHandleType *)handle; + if (!h || !h->code) return; +#ifdef NSEEL_USE_CRITICAL_SECTION + EnterCriticalSection(& NSEEL_USE_CRITICAL_SECTION); +#endif + g_evallib_visdata=(char*)visdata; +#ifdef NSEEL_REENTRANT_EXECUTION + baseptr = (int) alloca(h->workTablePtr_size); + if (!baseptr) return; +#endif + { + int startPoint=(int)h->code; + __asm + { + mov ebx, baseptr + mov eax, startPoint + pushad // Lets cover our ass + mov edi, ebx + call eax + popad + } + } + g_evallib_visdata=NULL; + #ifdef NSEEL_USE_CRITICAL_SECTION + LeaveCriticalSection(& NSEEL_USE_CRITICAL_SECTION); + #endif +} + +//------------------------------------------------------------------------------ +void freeCode(int handle) +{ + codeHandleType *h = (codeHandleType *)handle; + if (h != NULL) + { + g_evallib_stats[0]-=h->code_stats[0]; + g_evallib_stats[1]-=h->code_stats[1]; + g_evallib_stats[2]-=h->code_stats[2]; + g_evallib_stats[3]-=h->code_stats[3]; + g_evallib_stats[4]--; + freeBlocks(h->blocks); + } +} + + +//------------------------------------------------------------------------------ +void resetVars(varType *vars) +{ +#ifdef NSEEL_USE_CRITICAL_SECTION + if (vars) EnterCriticalSection(& NSEEL_USE_CRITICAL_SECTION); +#endif + varTable=vars; +#ifdef NSEEL_USE_CRITICAL_SECTION + if (!vars) LeaveCriticalSection(& NSEEL_USE_CRITICAL_SECTION); +#endif +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/Compiler.h b/Src/Plugins/Visualization/vis_avs/evallib/Compiler.h new file mode 100644 index 00000000..2a41d7fd --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/Compiler.h @@ -0,0 +1,47 @@ +#ifndef __COMPILER_H +#define __COMPILER_H + +#define FN_ASSIGN 0 +#define FN_MULTIPLY 1 +#define FN_DIVIDE 2 +#define FN_MODULO 3 +#define FN_ADD 4 +#define FN_SUB 5 +#define FN_AND 6 +#define FN_OR 7 +#define FN_UMINUS 8 +#define FN_UPLUS 9 + +#define MATH_SIMPLE 0 +#define MATH_FN 1 + +#ifdef __cplusplus +extern "C" { +#endif + + +int compileCode(char *exp); +void executeCode(int handle, char visdata[2][2][576]); +void freeCode(int handle); + + + +typedef struct { + char *name; + void *afunc; + void *func_e; + int nParams; + } functionType; + +extern functionType *getFunctionFromTable(int idx); + +int createCompiledValue(double value, double *addrValue); +int createCompiledFunction1(int fntype, int fn, int code); +int createCompiledFunction2(int fntype, int fn, int code1, int code2); +int createCompiledFunction3(int fntype, int fn, int code1, int code2, int code3); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Src/Plugins/Visualization/vis_avs/evallib/GETTOK.C b/Src/Plugins/Visualization/vis_avs/evallib/GETTOK.C new file mode 100644 index 00000000..69428de2 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/GETTOK.C @@ -0,0 +1,6 @@ +/* + * Bob Denny 28-Aug-82 Remove reference to stdio.h + * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C + */ + +#include <lex.h> diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LEX.EXE b/Src/Plugins/Visualization/vis_avs/evallib/LEX.EXE Binary files differnew file mode 100644 index 00000000..9686a99d --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LEX.EXE diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LEX.H b/Src/Plugins/Visualization/vis_avs/evallib/LEX.H new file mode 100644 index 00000000..2a6af32b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LEX.H @@ -0,0 +1,53 @@ +/* + * Bob Denny 28-Aug-82 Remove reference to FILE *lexin to + * eliminate dependency on standard I/O library. Only + * lexgetc() used it, and it's there now. + * Add EOF definition for standalone uses. + * Corrected comment for llnxtmax. + * + * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C. Removed + * equivalence of yylval and lexval since + * a multi-typed parser wants yylval to be + * typed to be the union of the types (YYSTYPE). + */ + +/* + * lex library header file -- accessed through + * #include <lex.h> + */ + +#include <stdio.h> + +/* + * Description of scanning tables. The entries at the front of + * the struct must remain in place for the assembler routines to find. + */ +struct lextab { + int llendst; /* Last state number */ + char *lldefault; /* Default state table */ + char *llnext; /* Next state table */ + char *llcheck; /* Check table */ + int *llbase; /* Base table */ + int llnxtmax; /* Last in next table */ + int (*llmove)(); /* Move between states */ + char *llfinal; /* Final state descriptions */ + int (*llactr)(); /* Action routine */ + int *lllook; /* Look ahead vector if != NULL */ + char *llign; /* Ignore char vec if != NULL */ + char *llbrk; /* Break char vec if != NULL */ + char *llill; /* Illegal char vec if != NULL */ +}; + +#define NBPW 16 +#define LEXERR 256 +#define LEXSKIP (-1) +#define EOF (-1) +//#define NULL (0) +#define LEXECHO(fp) {lexecho((fp));} + +#define lextext llbuf +#define lexlast llend + +extern FILE *lexin; +extern llstin(); + diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LEXGET.C b/Src/Plugins/Visualization/vis_avs/evallib/LEXGET.C new file mode 100644 index 00000000..26b70418 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LEXGET.C @@ -0,0 +1,20 @@ +/* + * lexget.c + * + * Bob Denny 28-Aug-82 Move stdio dependencies to lexerr(), lexget(), + * lexech() and mapch(). This is one of 4 modules + * in lexlib which depend upon the standard I/O package. + * + * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C. + */ + +#include <stdio.h> +#include <lex.h> +extern char expression[4096]; +extern int pos; +lexgetc() +{ +char c = expression[pos]; +if (c) pos++; + return( c != 0 ? c : -1); +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LEXSWI.C b/Src/Plugins/Visualization/vis_avs/evallib/LEXSWI.C new file mode 100644 index 00000000..a4c042b8 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LEXSWI.C @@ -0,0 +1,23 @@ +/* + * lexswitch -- switch lex tables + */ + +/* + * Bob Denny 28-Aug-82 Remove reference to stdio.h + * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C + */ + +#include <lex.h> + +extern struct lextab *_tabp; + +struct lextab * +lexswitch(lp) +struct lextab *lp; +{ + register struct lextab *olp; + + olp = _tabp; + _tabp = lp; + return(olp); +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LEXTAB.C b/Src/Plugins/Visualization/vis_avs/evallib/LEXTAB.C new file mode 100644 index 00000000..247272ba --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LEXTAB.C @@ -0,0 +1,260 @@ +/* + * Created by IBM PC LEX from file "scan.l" + * - for use with standard I/O + */ + +#include <stdio.h> +#include <lex.h> +#define LL16BIT int + +int _lmovb(struct lextab *lp, int c, int st) +{ + int base; + + while ((base = lp->llbase[st]+c) > lp->llnxtmax || + (lp->llcheck[base] & 0377) != st) { + + if (st != lp->llendst) { + base = lp->lldefault[st] & 0377; + st = base; + } + else + return(-1); + } + return(lp->llnext[base]&0377); +} + +int lexval; +char lbuf[]; + +#define YYSTYPE int +#include "cal_tab.h" +int c; + +extern YYSTYPE yylval; +int translate(int type); +void count(void); +void setLastVar(void); +int lookup(int *typeOfObject); + + +#define INTCONST 1 +#define DBLCONST 2 +#define HEXCONST 3 +#define VARIABLE 4 +#define OTHER 5 + +int _Alextab(__na__) +{ + if (__na__ >= 0 && __na__ <= 19) count(); + switch (__na__) + { + case 0: yylval = translate(HEXCONST); return VALUE; + case 1: yylval = translate(INTCONST); return VALUE; + case 2: yylval = translate(INTCONST); return VALUE; + case 3: yylval = translate(DBLCONST); return VALUE; + case 4: + case 5: setLastVar(); yylval = lookup(&__na__); return __na__; + case 6: return '+'; + case 7: return '-'; + case 8: return '*'; + case 9: return '/'; + case 10: return '%'; + case 11: return '&'; + case 12: return '|'; + case 13: return '('; + case 14: return ')'; + case 15: return '='; + case 16: return ','; + case 17: return ';'; + } + return (LEXSKIP); +} + + +char _Flextab[] = + { + 1, 18, 17, 16, 15, 14, 13, 12, + 11, 10, 9, 8, 7, 6, 4, 5, + 5, 4, 4, 3, 3, 3, 3, 4, + 0, 4, 5, 0, 5, 4, 1, 3, + 0, 2, -1, 1, -1, + }; + + +char _Nlextab[] = + { + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 1, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 1, 36, 36, 36, 36, 9, 8, 36, + 6, 5, 11, 13, 3, 12, 19, 10, + 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 36, 2, 36, 4, 36, 36, + 36, 29, 29, 29, 29, 29, 29, 18, + 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 36, 36, 36, 36, 18, + 36, 29, 29, 29, 29, 29, 23, 18, + 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 14, 18, + 18, 18, 18, 36, 7, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 36, + 36, 36, 36, 36, 36, 36, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 36, 36, 36, 36, 17, 36, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 36, 36, 36, 36, 36, 36, + 36, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 36, 36, 36, 36, 16, + 36, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 36, + 20, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 36, 36, 36, 36, 36, + 36, 36, 25, 25, 25, 25, 25, 25, + 36, 24, 36, 36, 36, 36, 36, 36, + 20, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 25, 25, 25, 25, 25, 25, + 36, 24, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 36, 36, 36, 36, + 36, 36, 36, 28, 28, 28, 28, 28, + 28, 36, 27, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 28, 28, 28, 28, 28, + 28, 31, 27, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 36, 36, 36, + 36, 36, 36, 36, 34, 34, 34, 33, + 34, 34, 36, 32, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 34, 34, 34, 33, + 34, 34, 36, 32, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 36, 36, + 36, 36, 36, 36, 36, 34, 34, 34, + 34, 34, 34, 36, 32, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 34, 34, 34, + 34, 34, 34, 36, 32, + }; + +char _Clextab[] = + { + -1, -1, -1, -1, -1, -1, -1, -1, + -1, 0, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, 0, 0, -1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -1, 0, -1, 0, -1, -1, + -1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1, -1, -1, -1, 0, + -1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1, 0, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, -1, + -1, -1, -1, -1, -1, -1, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + -1, -1, -1, -1, 14, -1, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, -1, -1, -1, -1, -1, -1, + -1, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, -1, -1, -1, -1, 15, + -1, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, -1, + 19, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, -1, -1, -1, -1, -1, + -1, -1, 23, 23, 23, 23, 23, 23, + -1, 23, -1, -1, -1, -1, -1, -1, + 19, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 23, 23, 23, 23, 23, 23, + -1, 23, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, -1, -1, -1, -1, + -1, -1, -1, 26, 26, 26, 26, 26, + 26, -1, 26, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 26, 26, 26, 26, + 26, 30, 26, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, -1, -1, -1, + -1, -1, -1, -1, 30, 30, 30, 30, + 30, 30, -1, 30, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 30, 30, 30, 30, + 30, 30, -1, 30, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, -1, -1, + -1, -1, -1, -1, -1, 33, 33, 33, + 33, 33, 33, -1, 33, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 33, 33, 33, + 33, 33, 33, -1, 33, + }; + +char _Dlextab[] = + { + 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, + 15, 14, 14, 36, 36, 20, 19, 14, + 14, 23, 15, 15, 26, 23, 36, 19, + 36, 36, 33, 30, + }; + +int _Blextab[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 77, 152, + 0, 0, 0, 227, 237, 0, 0, 249, + 0, 0, 306, 0, 0, 0, 363, 0, + 0, 420, 0, 0, 0, + }; + +struct lextab lextab = { + 36, + _Dlextab, + _Nlextab, + _Clextab, + _Blextab, + 524, + _lmovb, + _Flextab, + _Alextab, + + NULL, + 0, + 0, + 0, + }; + + diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LLSAVE.C b/Src/Plugins/Visualization/vis_avs/evallib/LLSAVE.C new file mode 100644 index 00000000..23c5e472 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LLSAVE.C @@ -0,0 +1,6 @@ +/* + * This is linked from lexlib to resolve a global in yylex which + * will be undefined if the user grammar has not defined any rules + * with right-context (look-ahead) + */ +char *llsave[1]; /* Look ahead buffer */ diff --git a/Src/Plugins/Visualization/vis_avs/evallib/LMOVB.C b/Src/Plugins/Visualization/vis_avs/evallib/LMOVB.C new file mode 100644 index 00000000..ef3a0039 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/LMOVB.C @@ -0,0 +1,29 @@ +/* + * Bob Denny 28-Aug-82 Remove reference to stdio.h + * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C + */ + +#include <lex.h> + +_lmovb(lp, c, st) +register int c, st; +register struct lextab *lp; +{ + int base; + + while ((base = lp->llbase[st]+c) > lp->llnxtmax || + (lp->llcheck[base] & 0377) != st) { + + if (st != lp->llendst) { +/* + * This miscompiled on Decus C many years ago: + * st = lp->lldefault[st] & 0377; + */ + base = lp->lldefault[st] & 0377; + st = base; + } + else + return(-1); + } + return(lp->llnext[base]&0377); +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/Scan.l b/Src/Plugins/Visualization/vis_avs/evallib/Scan.l new file mode 100644 index 00000000..25134332 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/Scan.l @@ -0,0 +1,54 @@ +%{ +#define YYSTYPE double +#include "cal_tab.h" +int c; + +extern YYSTYPE yylval; +double translate(int type); +void count(void); +void setLastVar(void); +int lookup(int *typeOfObject); +struct lextab *lexswitch(struct lextab *lp); + + +#define INTCONST 1 +#define DBLCONST 2 +#define HEXCONST 3 +#define VARIABLE 4 +#define OTHER 5 + +%} + +digit = [0-9]; +letter = [a-zA-Z_]; +hex = [a-fA-F0-9]; +/* -- */ +space = [\40]; +/*number = (digit* | "-" digit*);*/ +number = digit*; +exp = [Ee] number; +doubl = number "." (digit* | digit* exp); + +%% +hex hex* [hH] { count(); yylval = translate(HEXCONST); return VALUE; } +digit* { count(); yylval = translate(INTCONST); return VALUE; } +digit digit* [Dd] { count(); yylval = translate(INTCONST); return VALUE; } +doubl { count(); yylval = translate(DBLCONST); return VALUE; } +letter* { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }} +letter (letter|digit)* { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }} +'+' { count(); return '+'; } +'-' { count(); return '-'; } +'*' { count(); return '*'; } +'/' { count(); return '/'; } +'%' { count(); return '%'; } +'&' { count(); return '&'; } +'|' { count(); return '|'; } +'(' { count(); return '('; } +')' { count(); return ')'; } +'=' { count(); return '='; } +',' { count(); return ','; } +';' { count(); return ';'; } +[ \t\v\f] { count(); } +. { count(); } + +%% diff --git a/Src/Plugins/Visualization/vis_avs/evallib/YYLEX.C b/Src/Plugins/Visualization/vis_avs/evallib/YYLEX.C new file mode 100644 index 00000000..1b63f0c0 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/YYLEX.C @@ -0,0 +1,143 @@ +#include <lex.h> + +#define ERROR 256 /* yacc's value */ + +static int llset(void); +static int llinp(char **exp); +static int lexgetc(char **exp) +{ + char c= **exp; + if (c) (*exp)++; + return( c != 0 ? c : -1); +} +static int tst__b(register int c, char tab[]) +{ + return (tab[(c >> 3) & 037] & (1 << (c & 07)) ); +} + +static char *llsave[16]; /* Look ahead buffer */ +static char llbuf[100]; /* work buffer */ +static char *llp1 = &llbuf[0]; /* pointer to next avail. in token */ +static char *llp2 = &llbuf[0]; /* pointer to end of lookahead */ +static char *llend = &llbuf[0]; /* pointer to end of token */ +static char *llebuf = &llbuf[sizeof llbuf]; +static int lleof; +static int yyline = 0; +extern struct lextab lextab; + +int gettoken(char *lltb, int lltbsiz) +{ + register char *lp, *tp, *ep; + + tp = lltb; + ep = tp+lltbsiz-1; + for (lp = llbuf; lp < llend && tp < ep;) + *tp++ = *lp++; + *tp = 0; + return(tp-lltb); +} + + +int yylex(char **exp) +{ + register int c, st; + int final, l, llk, i; + register struct lextab *lp; + char *cp; + + while (1) + { + llk = 0; + if (llset()) return(0); + st = 0; + final = -1; + lp = &lextab; + + do { + if (lp->lllook && (l = lp->lllook[st])) { + for (c=0; c<NBPW; c++) + if (l&(1<<c)) + llsave[c] = llp1; + llk++; + } + if ((i = lp->llfinal[st]) != -1) { + final = i; + llend = llp1; + } + if ((c = llinp(exp)) < 0) + break; + if ((cp = lp->llbrk) && llk==0 && tst__b(c, cp)) { + llp1--; + break; + } + } while ((st = (*lp->llmove)(lp, c, st)) != -1); + + + if (llp2 < llp1) + llp2 = llp1; + if (final == -1) { + llend = llp1; + if (st == 0 && c < 0) + return(0); + if ((cp = lp->llill) && tst__b(c, cp)) { + continue; + } + return(ERROR); + } + if (c = (final >> 11) & 037) + llend = llsave[c-1]; + if ((c = (*lp->llactr)(final&03777)) >= 0) + return(c); + } +} + +void llinit(viud) +{ + llp1 = llp2 = llend = llbuf; + llebuf = llbuf + sizeof(llbuf); + lleof = yyline = 0; +} + + +static int llinp(char **exp) +{ + register c; + register struct lextab *lp; + register char *cp; + + lp = &lextab; + cp = lp->llign; /* Ignore class */ + for (;;) { + /* + * Get the next character from the save buffer (if possible) + * If the save buffer's empty, then return EOF or the next + * input character. Ignore the character if it's in the + * ignore class. + */ + c = (llp1 < llp2) ? *llp1 & 0377 : (lleof) ? EOF : lexgetc(exp); + if (c >= 0) { /* Got a character? */ + if (cp && tst__b(c, cp)) + continue; /* Ignore it */ + if (llp1 >= llebuf) { /* No, is there room? */ + return -1; + } + *llp1++ = c; /* Store in token buff */ + } else + lleof = 1; /* Set EOF signal */ + return(c); + } +} + +static int llset(void) +/* + * Return TRUE if EOF and nothing was moved in the look-ahead buffer + */ +{ + register char *lp1, *lp2; + + for (lp1 = llbuf, lp2 = llend; lp2 < llp2;) + *lp1++ = *lp2++; + llend = llp1 = llbuf; + llp2 = lp1; + return(lleof && lp1 == llbuf); +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.HAI b/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.HAI new file mode 100644 index 00000000..999b5559 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.HAI @@ -0,0 +1,334 @@ + +extern int timeclock; + + +int yyerror; /* Yyerror and yycost are set by guards. */ +int yycost; /* If yyerror is set to a nonzero value by a */ + /* guard, the reduction with which the guard */ + /* is associated is not performed, and the */ + /* error recovery mechanism is invoked. */ + /* Yycost indicates the cost of performing */ + /* the reduction given the attributes of the */ + /* symbols. */ + + +/* YYMAXDEPTH indicates the size of the parser's state and value */ +/* stacks. */ + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 500 +#endif + +/* YYMAXRULES must be at least as large as the number of rules that */ +/* could be placed in the rule queue. That number could be determined */ +/* from the grammar and the size of the stack, but, as yet, it is not. */ + +#ifndef YYMAXRULES +#define YYMAXRULES 100 +#endif + +#ifndef YYMAXBACKUP +#define YYMAXBACKUP 100 +#endif + + +short yyss[YYMAXDEPTH]; /* the state stack */ +YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */ +YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */ +short yyrq[YYMAXRULES]; /* the rule queue */ +int yychar; /* the lookahead symbol */ + +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +YYSTYPE yytval; /* the semantic value for the state */ + /* at the top of the state stack. */ + +YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ + +YYLTYPE yytloc; /* location data for the state at the */ + /* top of the state stack */ + + +int yynunlexed; +short yyunchar[YYMAXBACKUP]; +YYSTYPE yyunval[YYMAXBACKUP]; +YYLTYPE yyunloc[YYMAXBACKUP]; + +short *yygssp; /* a pointer to the top of the state */ + /* stack; only set during error */ + /* recovery. */ + +YYSTYPE *yygvsp; /* a pointer to the top of the value */ + /* stack; only set during error */ + /* recovery. */ + +YYLTYPE *yyglsp; /* a pointer to the top of the */ + /* location stack; only set during */ + /* error recovery. */ + + +/* Yyget is an interface between the parser and the lexical analyzer. */ +/* It is costly to provide such an interface, but it avoids requiring */ +/* the lexical analyzer to be able to back up the scan. */ + +yyget() +{ + if (yynunlexed > 0) + { + yynunlexed--; + yychar = yyunchar[yynunlexed]; + yylval = yyunval[yynunlexed]; + yylloc = yyunloc[yynunlexed]; + } + else if (yychar <= 0) + yychar = 0; + else + { + yychar = yylex(); + if (yychar < 0) + yychar = 0; + else yychar = YYTRANSLATE(yychar); + } +} + + + +yyunlex(chr, val, loc) +int chr; +YYSTYPE val; +YYLTYPE loc; +{ + yyunchar[yynunlexed] = chr; + yyunval[yynunlexed] = val; + yyunloc[yynunlexed] = loc; + yynunlexed++; +} + + + +yyrestore(first, last) +register short *first; +register short *last; +{ + register short *ssp; + register short *rp; + register int symbol; + register int state; + register int tvalsaved; + + ssp = yygssp; + yyunlex(yychar, yylval, yylloc); + + tvalsaved = 0; + while (first != last) + { + symbol = yystos[*ssp]; + if (symbol < YYNTBASE) + { + yyunlex(symbol, yytval, yytloc); + tvalsaved = 1; + ssp--; + } + + ssp--; + + if (first == yyrq) + first = yyrq + YYMAXRULES; + + first--; + + for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++) + { + if (symbol < YYNTBASE) + state = yytable[yypact[*ssp] + symbol]; + else + { + state = yypgoto[symbol - YYNTBASE] + *ssp; + + if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp) + state = yytable[state]; + else + state = yydefgoto[symbol - YYNTBASE]; + } + + *++ssp = state; + } + } + + if ( ! tvalsaved && ssp > yyss) + { + yyunlex(yystos[*ssp], yytval, yytloc); + ssp--; + } + + yygssp = ssp; +} + + + +int +yyparse() +{ + register int yystate; + register int yyn; + register short *yyssp; + register short *yyrq0; + register short *yyptr; + register YYSTYPE *yyvsp; + + int yylen; + YYLTYPE *yylsp; + short *yyrq1; + short *yyrq2; + + yystate = 0; + yyssp = yyss - 1; + yyvsp = yyvs - 1; + yylsp = yyls - 1; + yyrq0 = yyrq; + yyrq1 = yyrq0; + yyrq2 = yyrq0; + + yychar = yylex(); + if (yychar < 0) + yychar = 0; + else yychar = YYTRANSLATE(yychar); + +yynewstate: + + if (yyssp >= yyss + YYMAXDEPTH - 1) + { + yyabort("Parser Stack Overflow"); + YYABORT; + } + + *++yyssp = yystate; + +yyresume: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + yyn += yychar; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar) + goto yydefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + yystate = yyn; + + yyptr = yyrq2; + while (yyptr != yyrq1) + { + yyn = *yyptr++; + yylen = yyr2[yyn]; + yyvsp -= yylen; + yylsp -= yylen; + + yyguard(yyn, yyvsp, yylsp); + if (yyerror) + goto yysemerr; + + yyaction(yyn, yyvsp, yylsp); + *++yyvsp = yyval; + + yylsp++; + if (yylen == 0) + { + yylsp->timestamp = timeclock; + yylsp->first_line = yytloc.first_line; + yylsp->first_column = yytloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } + + if (yyptr == yyrq + YYMAXRULES) + yyptr = yyrq; + } + + if (yystate == YYFINAL) + YYACCEPT; + + yyrq2 = yyptr; + yyrq1 = yyrq0; + + *++yyvsp = yytval; + *++yylsp = yytloc; + yytval = yylval; + yytloc = yylloc; + yyget(); + + goto yynewstate; + +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +yyreduce: + + *yyrq0++ = yyn; + + if (yyrq0 == yyrq + YYMAXRULES) + yyrq0 = yyrq; + + if (yyrq0 == yyrq2) + { + yyabort("Parser Rule Queue Overflow"); + YYABORT; + } + + yyssp -= yyr2[yyn]; + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yysemerr: + *--yyptr = yyn; + yyrq2 = yyptr; + yyvsp += yyr2[yyn]; + +yyerrlab: + + yygssp = yyssp; + yygvsp = yyvsp; + yyglsp = yylsp; + yyrestore(yyrq0, yyrq2); + yyrecover(); + yystate = *yygssp; + yyssp = yygssp; + yyvsp = yygvsp; + yyrq0 = yyrq; + yyrq1 = yyrq0; + yyrq2 = yyrq0; + goto yyresume; +} + +$ diff --git a/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.SIM b/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.SIM new file mode 100644 index 00000000..e318ee36 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/bison/BISON.SIM @@ -0,0 +1,577 @@ +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +//#ln 3 "bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* Not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) +#include <alloca.h> +#endif /* Sparc. */ +#endif /* Not GNU C. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("Syntax error, cannot back up!"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYIMPURE +#define YYLEX yylex() +#endif + +#ifndef YYPURE +#define YYLEX yylex(&yylval)//, &yylloc) MY MODIF! +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYIMPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* YYIMPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_bcopy (from, to, count) + char *from; + char *to; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +//#ln 131 "bison.simple" +int +yyparse() +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + +#define YYPOPSTACK (yyvsp--, yysp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yysp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifndef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ + yyoverflow("internal error: parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), +#ifdef YYLSP_NEEDED + &yyls1, size * sizeof (*yylsp), +#endif + &yystacksize); + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("internal error: parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "entering state %d\n", yystate); +#endif + + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "reading a token: "); +#endif + yyStackSize = yyssp - (yyss - 1); + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "next token is %d (%s)\n", yychar, yytname[yychar1]); +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + if (yylen == 1) + fprintf (stderr, "reducing 1 value via rule %d (line %d), ", + yyn, yyrline[yyn]); + else + fprintf (stderr, "reducing %d values via rule %d (line %d), ", + yylen, yyn, yyrline[yyn]); + } +#endif + +$ /* the action file gets copied in in place of this dollarsign */ +//#ln 362 "bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) xmalloc(size + 15); + strcpy(msg, "syntax error"); + + if (count < 5) + { + count = 0; + for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("syntax error"); + } + +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} diff --git a/Src/Plugins/Visualization/vis_avs/evallib/cal.y b/Src/Plugins/Visualization/vis_avs/evallib/cal.y new file mode 100644 index 00000000..3844ac03 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/cal.y @@ -0,0 +1,155 @@ + + %{ + #define YYSTYPE double + #include <malloc.h> + #include <memory.h> + #include "Compiler.h" + #include "eval.h" + + yyerror(char *); + yylex(); + + extern int yyStackSize; + extern double result; + + int regs[26]; + int base; + + %} + + %token VALUE IDENTIFIER FUNCTION1 FUNCTION2 FUNCTION3 + + %left '|' + %left '&' + %left '+' '-' + %left '*' '/' '%' + %left UMINUS /*supplies precedence for unary minus */ + %left UPLUS /*supplies precedence for unary plus */ + + %% /*beginning of rules section */ + + stat : math_expr + { $$ = $1; result = $1; } + | IDENTIFIER '=' math_expr + { if (parseType == PARSE_EVAL) + { + setVar((int)$1, $3); + $$ = $3; + result = $3; + } + else + { + double i = setVar((int)$1, 0); + double v = createCompiledValue(0, &(varTable[(int)i].value)); + $$ = createCompiledFunction2(MATH_SIMPLE, FN_ASSIGN, v, $3); + result = $$; + } + } + ; + + value : VALUE { $$ = $1 } + + + primary_expr + : IDENTIFIER + { $$ = getVar((int)$1);} + | value + { $$ = $1;} + | '(' math_expr ')' + { $$ = $2;} + ; + + math_expr + : primary_expr + { $$ = $1; } + | math_expr '*' math_expr + { if (parseType == PARSE_EVAL) + $$ = $1 * $3; + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_MULTIPLY, $1, $3); + } + | math_expr '/' math_expr + { if (parseType == PARSE_EVAL) + $$ = $1 / $3; + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_DIVIDE, $1, $3); + } + | math_expr '%' math_expr + { if (parseType == PARSE_EVAL) + $$ = (double)((int)$1 % (int)$3); + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_MODULO, $1, $3); + } + | math_expr '+' math_expr + { if (parseType == PARSE_EVAL) + $$ = $1 + $3; + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_ADD, $1, $3); + } + | math_expr '-' math_expr + { if (parseType == PARSE_EVAL) + $$ = $1 - $3; + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_SUB, $1, $3); + } + | math_expr '&' math_expr + { if (parseType == PARSE_EVAL) + $$ = (double)((int)$1 & (int)$3); + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_AND, $1, $3); + } + | math_expr '|' math_expr + { if (parseType == PARSE_EVAL) + $$ = (double)((int)$1 | (int)$3); + else + $$ = createCompiledFunction2(MATH_SIMPLE, FN_OR, $1, $3); + } + | '-' math_expr %prec UMINUS + { if (parseType == PARSE_EVAL) + $$ = -$2; + else + $$ = createCompiledFunction1(MATH_SIMPLE, FN_UMINUS, $2); + } + | '+' math_expr %prec UPLUS + { if (parseType == PARSE_EVAL) + $$ = +$2; + else + $$ = createCompiledFunction1(MATH_SIMPLE, FN_UPLUS, $2); + } + | fonction + { $$ = $1; } + ; + + fonction + : FUNCTION1 '(' math_expr ')' + { if (parseType == PARSE_EVAL) + $$ = calcFunction1((int)$1, $3); + else + $$ = createCompiledFunction1(MATH_FN, (int)$1, $3); + } + | FUNCTION2 '(' math_expr ',' math_expr ')' + { if (parseType == PARSE_EVAL) + $$ = calcFunction2((int)$1, $3, $5); + else + $$ = createCompiledFunction2(MATH_FN, (int)$1, $3, $5); + } + | FUNCTION3 '(' math_expr ',' math_expr ',' math_expr ')' + { if (parseType == PARSE_EVAL) + $$ = calcFunction3((int)$1, $3, $5, $7); + else + $$ = createCompiledFunction3(MATH_FN, (int)$1, $3, $5, $7); + } + ; + + + + %% + main() + { + return(yyparse()); + } + + yywrap() + { + return(1); + } diff --git a/Src/Plugins/Visualization/vis_avs/evallib/cal_tab.h b/Src/Plugins/Visualization/vis_avs/evallib/cal_tab.h new file mode 100644 index 00000000..ecf31d93 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/cal_tab.h @@ -0,0 +1,13 @@ +#ifndef YYSTYPE +#define YYSTYPE int +#endif +#define VALUE 258 +#define IDENTIFIER 259 +#define FUNCTION1 260 +#define FUNCTION2 261 +#define FUNCTION3 262 +#define UMINUS 263 +#define UPLUS 264 + + +extern YYSTYPE yylval; diff --git a/Src/Plugins/Visualization/vis_avs/evallib/cfunc.c b/Src/Plugins/Visualization/vis_avs/evallib/cfunc.c new file mode 100644 index 00000000..f311aaad --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/cfunc.c @@ -0,0 +1,901 @@ +#include <windows.h> +#include <stdio.h> +#include <math.h> +#include "Compiler.h" +#include "eval.h" + + +// these are used by our assembly code +static float g_cmpaddtab[2]={0.0,1.0}; +static float g_signs[2]={1.0,-1.0}; +static double g_closefact = 0.00001; +static float g_half=0.5; +static float negativezeropointfive=-0.5f; +static float onepointfive=1.5f; + + + +/// functions called by built code +#define SHITCALL __fastcall + +#define isnonzero(x) (fabs(x) > g_closefact) + +//--------------------------------------------------------------------------------------------------------------- +static double SHITCALL _rand(double *x) +{ + if (*x < 1.0) *x=1.0; + return (double)(rand()%(int)max(*x,1.0)); +} + +//--------------------------------------------------------------------------------------------------------------- +static double SHITCALL _band(double *var, double *var2) +{ + return isnonzero(*var) && isnonzero(*var2) ? 1 : 0; +} + +//--------------------------------------------------------------------------------------------------------------- +static double SHITCALL _bor(double *var, double *var2) +{ + return isnonzero(*var) || isnonzero(*var2) ? 1 : 0; +} + +//--------------------------------------------------------------------------------------------------------------- +static double SHITCALL _sig(double *x, double *constraint) +{ + double t = (1+exp(-*x * (*constraint))); + return isnonzero(t) ? 1.0/t : 0; +} + +extern char *g_evallib_visdata; + +static double SHITCALL getvis(unsigned char *visdata, int bc, int bw, int ch, int xorv) +{ + int x; + int accum=0; + if (ch && ch != 1 && ch != 2) return 0.0; + + if (bw < 1) bw=1; + bc-=bw/2; + if (bc < 0) + { + bw+=bc; + bc=0; + } + if (bc > 575) bc=575; + if (bc+bw > 576) bw=576-bc; + + + if (!ch) + { + for (x = 0; x < bw; x ++) + { + accum+=(visdata[bc]^xorv)-xorv; + accum+=(visdata[bc+576]^xorv)-xorv; + bc++; + } + return (double)accum / ((double)bw*255.0); + } + else + { + if (ch == 2) visdata+=576; + for (x = 0; x < bw; x ++) accum+=(visdata[bc++]^xorv)-xorv; + return (double)accum / ((double)bw*127.5); + } +} + +static double SHITCALL getspec_(double *band, double *bandw, double *chan) +{ + if (!g_evallib_visdata) return 0.0; + return getvis((unsigned char *)g_evallib_visdata,(int)(*band*576.0),(int)(*bandw*576.0),(int)(*chan+0.5),0)*0.5; +} + +static double SHITCALL getosc_(double *band, double *bandw, double *chan) +{ + if (!g_evallib_visdata) return 0.0; + return getvis((unsigned char *)g_evallib_visdata+576*2,(int)(*band*576.0),(int)(*bandw*576.0),(int)(*chan+0.5),128); +} + +static double SHITCALL gettime_(double *sc) +{ + int ispos; + if ((ispos=(*sc > -1.001 && *sc < -0.999)) || (*sc > -2.001 && *sc < -1.999)) + { + int pos=0; + + extern HWND hwnd_WinampParent; + if (IsWindow(hwnd_WinampParent)) + { + if (!SendMessageTimeout( hwnd_WinampParent, WM_USER,(WPARAM)!ispos,(LPARAM)105,SMTO_BLOCK,50,(LPDWORD)&pos)) pos=0; + } + if (!ispos) return (double)pos; + return pos / 1000.0; + } + + return GetTickCount()/1000.0 - *sc; +} + +static double SHITCALL setmousepos_(double *x, double *y) +{ + //fucko: implement me + return 0.0; +} + +static double SHITCALL getmouse_(double *which) +{ + int w=(int)(*which+0.5); + + if (w > 5) + return (GetAsyncKeyState(w)&0x8000)?1.0:0.0; + + if (w == 1 || w == 2) + { + double DDraw_translatePoint(POINT p, int isY); + POINT p; + GetCursorPos(&p); + return DDraw_translatePoint(p,w==2); + } + if (w == 3) return (GetAsyncKeyState(MK_LBUTTON)&0x8000)?1.0:0.0; + if (w == 4) return (GetAsyncKeyState(MK_RBUTTON)&0x8000)?1.0:0.0; + if (w == 5) return (GetAsyncKeyState(MK_MBUTTON)&0x8000)?1.0:0.0; + return 0.0; +} +// end functions called by inline code + +// these make room on the stack for local variables, but do not need to +// worry about trashing ebp, since none of our code uses ebp and there's +// a pushad+popad surrounding the call + +#if 0 // dont seem to need to do this +#define CF_PUSHREGS __asm { push esi } __asm { push edi } +#define CF_POPREGS __asm { pop edi } __asm { pop esi } +#else +#define CF_PUSHREGS +#define CF_POPREGS +#endif + +#define FUNC1_ENTER \ + double *parm_a, *__nextBlock; \ + __asm { mov ebp, esp } \ + __asm { sub esp, __LOCAL_SIZE } \ + __asm { mov dword ptr parm_a, eax } \ + __asm { mov __nextBlock, esi } \ + CF_PUSHREGS + +#define FUNC2_ENTER \ + double *parm_a,*parm_b,*__nextBlock; \ + __asm { mov ebp, esp } \ + __asm { sub esp, __LOCAL_SIZE } \ + __asm { mov dword ptr parm_a, eax } \ + __asm { mov dword ptr parm_b, ebx } \ + __asm { mov __nextBlock, esi } \ + CF_PUSHREGS + +#define FUNC3_ENTER \ + double *parm_a,*parm_b,*parm_c,*__nextBlock; \ + __asm { mov ebp, esp } \ + __asm { sub esp, __LOCAL_SIZE } \ + __asm { mov dword ptr parm_a, eax } \ + __asm { mov dword ptr parm_b, ebx } \ + __asm { mov dword ptr parm_c, ecx } \ + __asm { mov __nextBlock, esi } \ + CF_PUSHREGS + +#define FUNC_LEAVE \ + __asm { mov eax, esi } \ + __asm { add esi, 8 } \ + __asm { mov esp, ebp } \ + CF_POPREGS + + +static double (*__asin)(double) = &asin; +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_asin(void) +{ + FUNC1_ENTER + + *__nextBlock = __asin(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_asin_end(void) {} + +static double (*__acos)(double) = &acos; +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_acos(void) +{ + FUNC1_ENTER + + *__nextBlock = __acos(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_acos_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (*__atan)(double) = &atan; +__declspec ( naked ) void _asm_atan(void) +{ + FUNC1_ENTER + + *__nextBlock = __atan(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_atan_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (*__atan2)(double,double) = &atan2; +__declspec ( naked ) void _asm_atan2(void) +{ + FUNC2_ENTER + + *__nextBlock = __atan2(*parm_b, *parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_atan2_end(void) {} + + +//--------------------------------------------------------------------------------------------------------------- +static double (SHITCALL * __sig)(double *,double *) = &_sig; +__declspec ( naked ) void _asm_sig(void) +{ + FUNC2_ENTER + + *__nextBlock = __sig(parm_b, parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_sig_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (SHITCALL *__rand)(double *) = &_rand; +__declspec ( naked ) void _asm_rand(void) +{ + FUNC1_ENTER + + *__nextBlock = __rand(parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_rand_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (SHITCALL *__band)(double *,double *) = &_band; +__declspec ( naked ) void _asm_band(void) +{ + FUNC2_ENTER + + *__nextBlock = __band(parm_b, parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_band_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double ( SHITCALL *__bor)(double *,double *) = &_bor; +__declspec ( naked ) void _asm_bor(void) +{ + FUNC2_ENTER + + *__nextBlock = __bor(parm_b, parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_bor_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (* __pow)(double,double) = &pow; +__declspec ( naked ) void _asm_pow(void) +{ + FUNC2_ENTER + + *__nextBlock = __pow(*parm_b, *parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_pow_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (*__exp)(double) = &exp; +__declspec ( naked ) void _asm_exp(void) +{ + FUNC1_ENTER + + *__nextBlock = __exp(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_exp_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +static double (*__floor)(double) = &floor; +__declspec ( naked ) void _asm_floor(void) +{ + FUNC1_ENTER + + *__nextBlock = __floor(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_floor_end(void) {} + + +//--------------------------------------------------------------------------------------------------------------- +static double (*__ceil)(double) = &ceil; +__declspec ( naked ) void _asm_ceil(void) +{ + FUNC1_ENTER + + *__nextBlock = __ceil(*parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_ceil_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- + + + +static double (SHITCALL *__getosc)(double *,double *,double *) = &getosc_; +__declspec ( naked ) void _asm_getosc(void) +{ + FUNC3_ENTER + + *__nextBlock = __getosc(parm_c,parm_b,parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_getosc_end(void) {} + + +static double (SHITCALL *__getspec)(double *,double *,double *) = &getspec_; +__declspec ( naked ) void _asm_getspec(void) +{ + FUNC3_ENTER + + *__nextBlock = __getspec(parm_c,parm_b,parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_getspec_end(void) {} + +static double (SHITCALL *__gettime)(double *) = &gettime_; +__declspec ( naked ) void _asm_gettime(void) +{ + FUNC1_ENTER + + *__nextBlock = __gettime(parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_gettime_end(void) {} + +// do nothing, eh +__declspec ( naked ) void _asm_exec2(void) +{ +} +__declspec ( naked ) void _asm_exec2_end(void) { } + + +static double (SHITCALL *__getmouse)(double *) = &getmouse_; +__declspec ( naked ) void _asm_getmouse(void) +{ + FUNC1_ENTER + + *__nextBlock = __getmouse(parm_a); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_getmouse_end(void) {} + + +static double (SHITCALL *__setmousepos)(double *,double *) = &setmousepos_; +__declspec ( naked ) void _asm_setmousepos(void) +{ + FUNC2_ENTER + + *__nextBlock = __setmousepos(parm_a,parm_b); + + FUNC_LEAVE +} +__declspec ( naked ) void _asm_setmousepos_end(void) {} + + + +__declspec ( naked ) void _asm_invsqrt(void) +{ + __asm + { + fld qword ptr [eax] + + mov edx, 0x5f3759df + fst dword ptr [esi] + // floating point stack has input, as does [eax] + fmul dword ptr [negativezeropointfive] + mov ecx, [esi] + sar ecx, 1 + sub edx, ecx + mov [esi], edx + + // st(0) = input, [eax] has x + fmul dword ptr [esi] + + fmul dword ptr [esi] + + fadd dword ptr [onepointfive] + + fmul dword ptr [esi] + mov eax, esi + + fstp qword ptr [esi] + + add esi, 8 + } +} +__declspec ( naked ) void _asm_invsqrt_end(void) {} + + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_sin(void) +{ + __asm + { + fld qword ptr [eax] + fsin + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_sin_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_cos(void) +{ + __asm + { + fld qword ptr [eax] + fcos + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_cos_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_tan(void) +{ + __asm + { + fld qword ptr [eax] + fsincos + fdiv + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_tan_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_sqr(void) +{ + __asm + { + fld qword ptr [eax] + fmul st(0), st(0) + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_sqr_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_sqrt(void) +{ + __asm + { + fld qword ptr [eax] + fabs + fsqrt + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_sqrt_end(void) {} + + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_log(void) +{ + __asm + { + fld1 + fldl2e + fdiv + fld qword ptr [eax] + mov eax, esi + fyl2x + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_log_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_log10(void) +{ + __asm + { + fld1 + fldl2t + fdiv + fld qword ptr [eax] + mov eax, esi + fyl2x + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_log10_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_abs(void) +{ + __asm + { + fld qword ptr [eax] + fabs + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_abs_end(void) {} + + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_assign(void) +{ + __asm + { + fld qword ptr [eax] + fstp qword ptr [ebx] + } +} +__declspec ( naked ) void _asm_assign_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_add(void) +{ + __asm + { + fld qword ptr [eax] + fadd qword ptr [ebx] + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_add_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_sub(void) +{ + __asm + { + fld qword ptr [ebx] + fsub qword ptr [eax] + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_sub_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_mul(void) +{ + __asm + { + fld qword ptr [ebx] + fmul qword ptr [eax] + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_mul_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_div(void) +{ + __asm + { + fld qword ptr [ebx] + fdiv qword ptr [eax] + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + } +} +__declspec ( naked ) void _asm_div_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_mod(void) +{ + __asm + { + fld qword ptr [ebx] + + fld qword ptr [eax] + fsub dword ptr [g_cmpaddtab+4] + fabs + fadd qword ptr [eax] + fadd dword ptr [g_cmpaddtab+4] + + fmul dword ptr [g_half] + + fistp dword ptr [esi] + fistp dword ptr [esi+4] + mov eax, [esi+4] + xor edx, edx + div dword ptr [esi] + mov [esi], edx + fild dword ptr [esi] + mov eax, esi + fstp qword ptr [esi] + add esi, 8 + + } +} +__declspec ( naked ) void _asm_mod_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_or(void) +{ + __asm + { + fld qword ptr [ebx] + fld qword ptr [eax] + fistp qword ptr [esi] + fistp qword ptr [esi+8] + mov ebx, [esi+8] + or [esi], ebx + mov ebx, [esi+12] + or [esi+4], ebx + fild qword ptr [esi] + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_or_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_and(void) +{ + __asm + { + fld qword ptr [ebx] + fld qword ptr [eax] + + fistp qword ptr [esi] + fistp qword ptr [esi+8] + mov ebx, [esi+8] + and [esi], ebx + mov ebx, [esi+12] + and [esi+4], ebx + fild qword ptr [esi] + fstp qword ptr [esi] + + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_and_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_uplus(void) // this is the same as doing nothing, it seems +{ +#if 0 + __asm + { + mov ebx, nextBlock + mov ecx, [eax] + mov [ebx], ecx + mov ecx, [eax+4] + mov [ebx+4], ecx + mov eax, ebx + add ebx, 8 + mov nextBlock, ebx + } +#endif +} +__declspec ( naked ) void _asm_uplus_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_uminus(void) +{ + __asm + { + mov ecx, [eax] + mov ebx, [eax+4] + xor ebx, 0x80000000 + mov [esi], ecx + mov [esi+4], ebx + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_uminus_end(void) {} + + + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_sign(void) +{ + __asm + { + mov ecx, [eax+4] + + shr ecx, 31 + + fld dword ptr [g_signs+ecx*4] + + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_sign_end(void) {} + + + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_bnot(void) +{ + __asm + { + fld qword ptr [eax] + fabs + fcomp qword ptr [g_closefact] + fstsw ax + shr eax, 6 + and eax, (1<<2) + fld dword ptr [g_cmpaddtab+eax] + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_bnot_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_if(void) +{ + __asm + { + fld qword ptr [eax] + fabs + fcomp qword ptr [g_closefact] + fstsw ax + + shr eax, 6 + + mov dword ptr [esi], 0FFFFFFFFh + mov dword ptr [esi+4], 0FFFFFFFFh + + and eax, (1<<2) + + mov eax, [esi+eax] + + call eax // call the proper function + + // at this point, the return value will be in eax, as desired + } +} +__declspec ( naked ) void _asm_if_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_equal(void) +{ + __asm + { + fld qword ptr [eax] + fsub qword ptr [ebx] + fabs + fcomp qword ptr [g_closefact] + fstsw ax + shr eax, 6 + and eax, (1<<2) + fld dword ptr [g_cmpaddtab+eax] + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_equal_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_below(void) +{ + __asm + { + fld qword ptr [ebx] + fcomp qword ptr [eax] + fstsw ax + shr eax, 6 + and eax, (1<<2) + fld dword ptr [g_cmpaddtab+eax] + + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_below_end(void) {} + +//--------------------------------------------------------------------------------------------------------------- +__declspec ( naked ) void _asm_above(void) +{ + __asm + { + fld qword ptr [eax] + fcomp qword ptr [ebx] + fstsw ax + shr eax, 6 + and eax, (1<<2) + fld dword ptr [g_cmpaddtab+eax] + + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_above_end(void) {} + + +__declspec ( naked ) void _asm_min(void) +{ + __asm + { + fld qword ptr [eax] + fld qword ptr [ebx] + fld st(1) + fsub st(0), st(1) + fabs // stack contains fabs(1-2),1,2 + fchs + fadd + fadd + fmul dword ptr [g_half] + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_min_end(void) {} + +__declspec ( naked ) void _asm_max(void) +{ + __asm + { + fld qword ptr [eax] + fld qword ptr [ebx] + fld st(1) + fsub st(0), st(1) + fabs // stack contains fabs(1-2),1,2 + fadd + fadd + fmul dword ptr [g_half] + fstp qword ptr [esi] + mov eax, esi + add esi, 8 + } +} +__declspec ( naked ) void _asm_max_end(void) {} + diff --git a/Src/Plugins/Visualization/vis_avs/evallib/eval.c b/Src/Plugins/Visualization/vis_avs/evallib/eval.c new file mode 100644 index 00000000..44e45881 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/eval.c @@ -0,0 +1,238 @@ +#include <windows.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> +#include <math.h> +#include "cal_tab.h" +#include "compiler.h" +#include "eval.h" + +#define INTCONST 1 +#define DBLCONST 2 +#define HEXCONST 3 +#define VARIABLE 4 +#define OTHER 5 + +int yyparse(char *exp); +void llinit(void); +int gettoken(char *lltb, int lltbsiz); +char yytext[256]=""; +char lastVar[256]=""; +int *errPtr; +int result; +int colCount=0; + +varType *varTable; + +char last_error_string[1024]; +double globalregs[100]; + +//------------------------------------------------------------------------------ +void *compileExpression(char *exp) +{ + int errv=0; + errPtr=&errv; + llinit(); + if (!yyparse(exp) && !*errPtr) + { + return (void*)result; + } + return 0; +} + +//------------------------------------------------------------------------------ +void setLastVar(void) +{ + gettoken(lastVar, sizeof lastVar); +} + +//------------------------------------------------------------------------------ +int setVar(int varNum, double value) +{ + int i=varNum; + if (varNum < 0) + { + char *var=lastVar; + if (!_strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4])) + { + int x=atoi(var+3); + if (x < 0 || x > 99) x=0; + i=EVAL_MAX_VARS+x; + } + else + { + for (i=0;i<EVAL_MAX_VARS;i++) + { + if (!varTable[i].name[0] || !_strnicmp(varTable[i].name,lastVar,sizeof(varTable[i].name))) + break; + } + if (i==EVAL_MAX_VARS) return -1; + } + } + + if (i < 0 || i >= EVAL_MAX_VARS+100) + { + return -1; + } + + if (i >= EVAL_MAX_VARS && i < EVAL_MAX_VARS+100) + { + globalregs[i - EVAL_MAX_VARS]=value; + } + else if (!varTable[i].name[0]) + { + strncpy(varTable[i].name,lastVar,sizeof(varTable[i].name)); + varTable[i].value = value; + } + + return i; +} + +//------------------------------------------------------------------------------ +int getVar(int varNum) +{ + if (varNum >= EVAL_MAX_VARS && varNum < EVAL_MAX_VARS+100) + return createCompiledValue(0, globalregs + (varNum - EVAL_MAX_VARS)); + + if (varNum >= 0 && varNum < EVAL_MAX_VARS) + return createCompiledValue(0, &(varTable[varNum].value)); + + return createCompiledValue(0, NULL); +} + +#if 0 +//------------------------------------------------------------------------------ +double *getVarPtr(char *var) +{ + int i; + + if (!_strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4])) + { + int x=atoi(var+3); + if (x < 0 || x > 99) x=0; + return globalregs + x; + } + + for (i=0;i<EVAL_MAX_VARS;i++) + if (!_strnicmp(varTable[i].name, yytext,sizeof(varTable[i].name))) + return &(varTable[i].value); + return NULL; +} +#endif + +//------------------------------------------------------------------------------ +double *registerVar(char *var) +{ + int i; + if (!_strnicmp(var,"reg",3) && strlen(var) == 5 && isdigit(var[3]) && isdigit(var[4])) + { + int x=atoi(var+3); + if (x < 0 || x > 99) x=0; + return globalregs + x; + } + + for (i=0;i<EVAL_MAX_VARS;i++) + if (!varTable[i].name[0] || + !_strnicmp(varTable[i].name,var,sizeof(varTable[i].name))) + break; + if (i==EVAL_MAX_VARS) return NULL; + + if (!varTable[i].name[0]) + { + strncpy(varTable[i].name,var,sizeof(varTable[i].name)); + varTable[i].value = 0.0; + } + return &(varTable[i].value); +} + +//------------------------------------------------------------------------------ +int translate(int type) +{ + int v; + int n; + *yytext = 0; + gettoken(yytext, sizeof yytext); + + switch (type) + { + case INTCONST: return createCompiledValue((double)atoi(yytext), NULL); + case DBLCONST: return createCompiledValue((double)atof(yytext), NULL); + case HEXCONST: + v=0; + n=0; + while (1) + { + int a=yytext[n++]; + if (a >= '0' && a <= '9') v+=a-'0'; + else if (a >= 'A' && a <= 'F') v+=10+a-'A'; + else if (a >= 'a' && a <= 'f') v+=10+a-'a'; + else break; + v<<=4; + } + return createCompiledValue((double)v, NULL); + } + return 0; +} + +//------------------------------------------------------------------------------ +int objectId(int nParams) +{ + switch (nParams) + { + case 1: return FUNCTION1; + case 2: return FUNCTION2; + case 3: return FUNCTION3; + } + return IDENTIFIER; +} + +//------------------------------------------------------------------------------ +int lookup(int *typeOfObject) +{ + int i; + gettoken(yytext, sizeof yytext); + + if (!_strnicmp(yytext,"reg",3) && strlen(yytext) == 5 && isdigit(yytext[3]) && isdigit(yytext[4]) && (i=atoi(yytext+3))>=0 && i<100) + { + *typeOfObject=IDENTIFIER; + return i+EVAL_MAX_VARS; + } + + for (i=0;i<EVAL_MAX_VARS;i++) + if (!_strnicmp(varTable[i].name, yytext,sizeof(varTable[i].name))) + { + *typeOfObject = IDENTIFIER; + return i; + } + + for (i=0;getFunctionFromTable(i);i++) + { + functionType *f=getFunctionFromTable(i); + if (!strcmpi(f->name, yytext)) + { + *typeOfObject = objectId(f->nParams); + return i; + } + } + *typeOfObject = IDENTIFIER; + setLastVar(); + i = setVar(-1, 0); + return i; +} + + + +//--------------------------------------------------------------------------- +void count(void) +{ + gettoken(yytext, sizeof yytext); + colCount+=strlen(yytext); +} + +//--------------------------------------------------------------------------- +int yyerror(char *txt) +{ + *errPtr = colCount; + return 0; +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/evallib/eval.h b/Src/Plugins/Visualization/vis_avs/evallib/eval.h new file mode 100644 index 00000000..cf42fd08 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/eval.h @@ -0,0 +1,41 @@ +#ifndef __EVAL_H +#define __EVAL_H + +#ifdef __cplusplus +extern "C" { +#endif + + // stuff that apps will want to use +#define EVAL_MAX_VARS 256 +typedef struct +{ + char name[8]; + double value; +} varType; + +extern double globalregs[100]; +extern char last_error_string[1024]; + +void resetVars(varType *vars); +double *getVarPtr(char *varName); +double *registerVar(char *varName); + + +// other shat + +extern varType *varTable; +extern int *errPtr; +extern int colCount; +extern int result; + +int setVar(int varNum, double value); +int getVar(int varNum); +void *compileExpression(char *txt); + + + +#ifdef __cplusplus +} +#endif + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/evallib/makel.bat b/Src/Plugins/Visualization/vis_avs/evallib/makel.bat new file mode 100644 index 00000000..63ee3079 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/makel.bat @@ -0,0 +1 @@ +lex -i scan.l diff --git a/Src/Plugins/Visualization/vis_avs/evallib/makey.bat b/Src/Plugins/Visualization/vis_avs/evallib/makey.bat new file mode 100644 index 00000000..3cf40833 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/makey.bat @@ -0,0 +1,2 @@ +bison -d cal.y + diff --git a/Src/Plugins/Visualization/vis_avs/evallib/new_eval_stuff.zip b/Src/Plugins/Visualization/vis_avs/evallib/new_eval_stuff.zip Binary files differnew file mode 100644 index 00000000..70f3b441 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/new_eval_stuff.zip diff --git a/Src/Plugins/Visualization/vis_avs/evallib/readme.txt b/Src/Plugins/Visualization/vis_avs/evallib/readme.txt new file mode 100644 index 00000000..f13fb8ee --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/evallib/readme.txt @@ -0,0 +1,84 @@ +
+ Expression evaluation library v1.0 - by lone
+ --------------------------------------------
+
+
+ How to use
+ ~~~~~~~~~~
+
+
+ ¦ resetVars
+ -----------
+
+ void resetVars(void);
+
+ Resets the variables table. It is necessary to call it prior to evaluate your first
+ expression or variables contents may be random instead of zero
+
+
+ ¦ evaluate
+ ----------
+
+ double evaluate(char *expression, int *col);
+
+ Evaluates an expression and returns the result.
+ If a syntax error was encountered during the parsing of the expression, then col will
+ be non-null and col-1 will be the index of the char which triggered the error.
+
+
+ Limitations
+ ~~~~~~~~~~~
+
+ ¦ you can set only up to 1024 variables.
+ ¦ only decimal and hexadecimal bases available
+ ¦ operators are limited to :
+ + - / * % & |
+ ¦ functions are limited to :
+ sin, cos, tan,
+ asin, acos, atan,
+ atan2, sqr, sqrt,
+ pow, exp, log, log10
+
+
+ Some examples
+ ~~~~~~~~~~~~~
+
+ - assignments :
+
+ pi=3.1415927
+ a=atan2(cos(pi/4),2)
+
+ - direct evaluations :
+
+ cos(pi/4)
+ sin(45)
+
+ - base notations :
+
+ 3bh (this is 0x3B)
+ 17d (this is 17)
+ 17dh (this is 0x17D)
+
+
+ Adding new functions
+ ~~~~~~~~~~~~~~~~~~~~
+
+ The file EVAL.C contains the functions table (fnTable). Just add an entry with the name,
+ the number of parameters, and a pointer to the function body. Implement the body and
+ you're done. If your function ahs more than 2 parameters, you'll need to extend the grammar
+ description file (CAL.Y) to add the FUNCTION3 (and eventually subsequent) token(s) and
+ parsing informations.
+
+ SCAN.L & CAL.Y
+ ~~~~~~~~~~~~~~
+
+ SCAN.L contains description for the lexical analyzer generator (LEX). Use makel.bat to rebuild
+ LEXTAB.C
+ CAL.Y contains the LALR formal grammar description for the parser generator (BISON). Use makey.bat
+ to rebuild CAL_TAB.C
+
+
+ Compiling
+ ~~~~~~~~~
+
+ Just include all source files to your project, and include EVAL.H into your main source code.
diff --git a/Src/Plugins/Visualization/vis_avs/ff_ipc.h b/Src/Plugins/Visualization/vis_avs/ff_ipc.h new file mode 100644 index 00000000..9fe335d0 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/ff_ipc.h @@ -0,0 +1,104 @@ +/* + 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. + +*/ +#ifndef _FF_IPC_H +#define _FF_IPC_H + +// ----------------------------------------------------------------------------------------------------- +// ----- IPC_FF_GETSKINCOLOR : Ask for a skin color -- the color is filtered for the current theme ----- +// ----------------------------------------------------------------------------------------------------- + +#define IPC_FF_GETSKINCOLOR IPC_FF_FIRST + 1 // data = ff_skincolor struct with .colorname, fills in .color + +typedef struct { + char colorname[256]; + COLORREF color; +} ff_skincolor; + +// List of default colors as of june 30, 2003. see freeform/xml/wasabi/xml/system-colors.xml for latest/complete list + +// Trees + #define SKINCOLOR_TREE_ITEMTEXT "wasabi.tree.text" + #define SKINCOLOR_TREE_SELITEMBKG "wasabi.tree.selected" + #define SKINCOLOR_TREE_HILITEDROP "wasabi.tree.hiliteddrop" + +// Lists + #define SKINCOLOR_LIST_ITEMTEXT "wasabi.list.text" + #define SKINCOLOR_LIST_SELITEMBKG "wasabi.list.item.selected" + #define SKINCOLOR_LIST_FOCUSITEMBKG "wasabi.list.item.focused" + #define SKINCOLOR_LIST_COLUMNBKG "wasabi.list.column.background" + #define SKINCOLOR_LIST_COLUMNTEXT "wasabi.list.column.text" + #define SKINCOLOR_LIST_SELITEMTEXT "wasabi.list.item.selected.fg" + #define SKINCOLOR_LIST_COLUMNSEPARATOR "wasabi.list.column.separator" + +// Buttons + #define SKINCOLOR_BUTTON_TEXT "wasabi.button.text" + #define SKINCOLOR_BUTTON_HILITETEXT "wasabi.button.hiliteText" + #define SKINCOLOR_BUTTON_DIMMEDTEXT "wasabi.button.dimmedText" + + +// ---------------------------------------------------------------------------------------- +// ----- IPC_FF_GENSKINBITMAP: Ask gen_ff to create a bitmap of various skin elements ----- +// ---------------------------------------------------------------------------------------- + +// NOTE: You should free the hbitmap eventually using DeleteObject + +#define IPC_FF_GENSKINBITMAP IPC_FF_FIRST + 2 // data = ff_skinbitmap with bitmap .id .w .h and .state, fills in .bitmap + +typedef struct { + int id; // see below + int w, h; + int state; // id specific, see below + HBITMAP bitmap; +} ff_skinbitmap; + +// Bitmap IDs : + +#define SKINBITMAP_BUTTON 0 // Generate a button bitmap. states are as follows : + + #define BUTTONSTATE_NORMAL 0 + #define BUTTONSTATE_PUSHED 1 + +#define SKINBITMAP_SCROLLBARUPBUTTON 1 // Generate a scrollbar up button bitmap. states are button states +#define SKINBITMAP_SCROLLBARDOWNBUTTON 2 // Generate a scrollbar down button bitmap. states are button states +#define SKINBITMAP_SCROLLBARLEFTBUTTON 3 // Generate a scrollbar left button bitmap. states are button states +#define SKINBITMAP_SCROLLBARRIGHTBUTTON 4 // Generate a scrollbar right button bitmap. states are button states +#define SKINBITMAP_SCROLLBARVBUTTON 5 // Generate a scrollbar vertical button bitmap. states are button states +#define SKINBITMAP_SCROLLBARHBUTTON 6 // Generate a scrollbar vertical button bitmap. states are button states + +// ----------------------------------------------------------------------------------------------- +// ----- IPC_FF_ONCOLORTHEMECHANGED: CALLBACK - sent when the skin's color theme has changed ----- +// ----------------------------------------------------------------------------------------------- + +#define IPC_FF_ONCOLORTHEMECHANGED IPC_FF_FIRST + 3 // data = name of the new color theme (const char *) +#define IPC_FF_ISMAINWND IPC_FF_FIRST + 4 // data = hwnd, returns 1 if hwnd is main window or any of its windowshade +#define IPC_FF_GETCONTENTWND IPC_FF_FIRST + 5 // data = HWND, returns the wa2 window that is embedded in the window's container (ie if hwnd is the pledit windowshade hwnd, it returns the wa2 pledit hwnd). if no content is found (ie, the window has nothing embedded) it returns the parameter you gave it +#define IPC_FF_NOTIFYHOTKEY IPC_FF_FIRST + 6 // data = const char * to hotkey description + +#endif diff --git a/Src/Plugins/Visualization/vis_avs/help_1.bin b/Src/Plugins/Visualization/vis_avs/help_1.bin new file mode 100644 index 00000000..f69742a2 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/help_1.bin @@ -0,0 +1,32 @@ +Many AVS effects allow you to write simple expressions to control +visualization. Here is a brief summary of how to write AVS code. + +Many aspects of AVS code are similar to C (including comments). + +You can create new variables just by using them, and you can read +and write predefined variables (of which each effect has its own) +to interact with the effect. Note that variables are all floating +point numbers (no strings), and the maximum length of a variable's +name is 8 characters (anything longer will be ignored. + +So, to create a variable, you can simply use it, for example: + x = 5; + +You can also use a variety of operators and math functions to +modify variables, see the Operators and Functions tabs above. + +Code can include C and C++ style comments: + // using the doubleslash comments until the end of the line + /* using the classic C comments + comment a block of text */ + +You can combine operators and functions into expressions, such +as: + x = 5 * cos(y) / 32.0; // this does some leetness right here + +You can use multiple expressions by seperating them with one or +more semicolons, for example: + x = x * 17.0; x = x / 5; y = pow(x,3.0); + +It is worth noting that extra whitespace (spaces, newlines) is +ignored, so if you need to space things out for clarity, you can.
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/help_2.bin b/Src/Plugins/Visualization/vis_avs/help_2.bin new file mode 100644 index 00000000..307b2693 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/help_2.bin @@ -0,0 +1,32 @@ +The following operators are available: += + assigns a value to a variable. + example: var=5; + ++ + adds two values, returns the sum. + example: var=5+var2; + +- + subtracts two values, returns the difference. + example: var=5-var2; + +* + multiplies two values, returns the product. + example: var=5*var2; + +/ + divides two values, returns the quotient. + example: var=5/var2; + +% + converts two values to integer, performs division, returns remainder + example: var=var2%5; + +| + converts two values to integer, returns bitwise OR of both values + example: var=var2|31; + +& + converts two values to integer, returns bitwise AND of both values + example: var=var2&31;
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/help_3.bin b/Src/Plugins/Visualization/vis_avs/help_3.bin new file mode 100644 index 00000000..a936f31a --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/help_3.bin @@ -0,0 +1,133 @@ +Functions available from code: +abs(value) + = returns the absolute value of 'value' + +sin(value) + = returns the sine of the radian angle 'value' + +cos(value) + = returns the cosine of the radian angle 'value' + +tan(value) + = returns the tangent of the radian angle 'value' + +asin(value) + = returns the arcsine (in radians) of 'value' + +acos(value) + = returns the arccosine (in radians) of 'value' + +atan(value) + = returns the arctangent (in radians) of 'value' + +atan2(value,value2) + = returns the arctangent (in radians) of 'value'/'value2' + +sqr(value) + = returns the square of 'value' + +sqrt(value) + = returns the square root of 'value' + +invsqrt(value) + = returns the reciprocal of the square root of 'value' (1/sqrt(value)) + (uses a fast approximation, may not always = 1/sqrt(value) :) + +pow(value,value2) + = returns 'value' to the power of 'value2' + +exp(value) + = returns e to the power of 'value' + +log(value) + = returns the log in base e of 'value' + +log10(value) + = returns the log in base 10 of 'value' + +floor(value) + = returns the largest integer less than or equal to 'value' + +ceil(value) + = returns the smallest integer greater than or equal to 'value' + + "sign(value) + = returns the sign of 'value' (-1.0 or 1.0, or 0.0 or -0.0 for 0.0 or -0.0) + + "min(value,value2) + = returns the smallest of 'value' and 'value2' + + "max(var,var2) + = returns the greatest of 'value' and 'value2' + + "sigmoid(value,value2) + = returns sigmoid function value of x='value' ('value2'=constraint) + + "rand(value) + = returns a random integer between 0 and 'value' + + "band(value,value2) + = returns a boolean AND of 'value' and 'value2' + + "bor(value,value2) + = returns a boolean OR of 'value' and 'value2' + + "bnot(value) + = returns a boolean NOT of 'value' + + "if(condition,valtrue,valfalse) + = returns 'valtrue' if 'condition' is nonzero, returns 'valfalse' otherwise. + new in AVS 2.8+: only one of valtrue/valfalse is evaluated, depending on condition + + "assign(dest, source) + = if 'dest' is a variable, assigns the value of 'source' to it. returns the value of 'source'. + a little trick: assign(if(v,a,b),1.0); is like if V is true, a=1.0, otherwise b=1.0. :) + + "exec2(parm1, parm2) + = evaluates parm1, then parm2, and returns the value of parm2. + + "equal(value,value2) + = returns 1.0 if 'value' is equal to 'value2', otherwise returns 0.0 + + "above(value,value2) + = returns 1.0 if 'value' is greater than 'value2', otherwise returns 0.0 + + "below(value,value2) + = returns 1.0 if 'value' is less than 'value2', otherwise returns 0.0 + + "getosc(band,width,channel) + = returns waveform data centered at 'band', (0..1), sampled 'width' (0..1) wide. + 'channel' can be: 0=center, 1=left, 2=right. return value is (-1..1) + + "getspec(band,width,channel) + = returns spectrum data centered at 'band', (0..1), sampled 'width' (0..1) wide. + 'channel' can be: 0=center, 1=left, 2=right. return value is (0..1) + +gettime(start_time) + = returns time in seconds since start_time (start_time can be 0 for time since boot) + (start_time can be -1.0 for current play time in seconds + (start_time can be -2.0 for current play length in seconds + +getkbmouse(which_parm) + = returns information about the location and state of the keyboard or mouse + which_parm = 1: mouse X position (-1..1 is onscreen) + which_parm = 2: mouse Y position (-1..1 is onscreen) + which_parm = 3: mouse left button state (0 up, 1 down) + which_parm = 4: mouse right button state (0 up, 1 down) + which_parm = 5: mouse middle button state (0 up, 1 down) + which_parm > 5: (GetAsyncKeyState(which_parm)&0x8000)?1:0 + +megabuf(index) + = can be used to get or set an item from the 1 million item temp buffer + to get, use: val=megabuf(index); + to set, use: assign(megabuf(index),val); + +gmegabuf(index) + = can be used to get or set an item from the global 1 million item buffer + to get, use: val=gmegabuf(index); + to set, use: assign(gmegabuf(index),val); + +loop(count, statement) + = executes <statement> <count> times. count is evaluated once and clamped + to 0..4096. best used with exec2() and exec3() and assign(). Note that + the return value of loop() is undefined and should not be used.
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/help_4.bin b/Src/Plugins/Visualization/vis_avs/help_4.bin new file mode 100644 index 00000000..1f5888bf --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/help_4.bin @@ -0,0 +1,6 @@ +Constants + '$PI' can be used in place of '3.14159' + '$E' can be used in place of '2.71828' + '$PHI' can be used in place of '1.618033' + Numbers can be specified as integers or as floating point + (i.e. '5' or '5.0' or '5.00001')
\ No newline at end of file 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 diff --git a/Src/Plugins/Visualization/vis_avs/linedraw.cpp b/Src/Plugins/Visualization/vis_avs/linedraw.cpp new file mode 100644 index 00000000..f6ec9de3 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/linedraw.cpp @@ -0,0 +1,261 @@ +/* + 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. + +*/ +#include <windows.h> +#include "r_defs.h" +#include <math.h> + +#define SWAP(x,y,temp) ( temp ) = ( x ); ( x ) = ( y ); ( y ) = ( temp ) +#define ABS(x) (( x ) < 0 ? - ( x ) : ( x )) + +void line(int *fb, int x1,int y1,int x2,int y2, int width, int height, int color, int lw) +{ + int dy = ABS(y2-y1); + int dx = ABS(x2-x1); + +#ifdef LASER + lw=1; + #define BLEND_LINE(fb,color) (*(fb)=BLEND(*(fb),(color))) +#else + if (lw<1) lw=1; + else if (lw>255)lw=255; +#endif + + int lw2=lw/2; + if (!dx) // optimize vertical draw + { + x1-=lw2; + if (x1+lw >= 0 && x1 < width) + { + int d=max(min(y1,y2),0); + int ye=min(max(y1,y2),height-1); + if (x1<0) + { + lw+=x1; + x1=0; + } + if (x1+lw >= width) lw=width-x1; + fb += d*width+x1; + width-=lw; + if (lw>0) while (d++ < ye) + { + int x=lw; + while (x--) { BLEND_LINE(fb, color); fb++; } + fb+=width; + } + } + return; + } + if (y1==y2) // optimize horizontal draw. + { + y1-=lw2; + if (y1+lw >= 0 && y1 < height) + { + int d=max(min(x1,x2),0); + int xe=min(max(x1,x2),width-1); + if (y1<0) + { + lw+=y1; + + + y1=0; + } + if (y1+lw >= height) lw=height-y1; + fb+=y1*width+d; + width-=xe-d; + int y=lw; + while (y--) + { + int lt=d; + while (lt++<xe) { BLEND_LINE(fb,color); fb++; } + fb+=width; + } + } + return; + } + + if (dy <= dx) // x major, low slope + { + // first things first for better line drawing, let's see if we can't get the + // width calculated right. + // lw is the width in pixels. if dy = 0, then lw=lw. if dy=dx, then: + /* + + + __________ C=30d + |\ + | \ lw + | \_____ A=90d + ? | / + | / pc2 + |/ ____ B = 60d + + tan(C) = sin(C)/cos(C) = (dy / dx) + cos(C) = lw / ? + + sin(C)/(lw / ? ) = (dy / dx) + sin(C) * ? / lw = (dy/dx) + sin(C) * ? = lw * dy/dx; + ? = lw * dy/dx / sin(C) + + + cos(C) = lw / ? === ? = lw / cos(C) + tan(C) = dy / dx; + + C = atan2(dy,dx); + ? = lw / cos(C) + + */ + +#if 0// lame + if (lw>1 && (GetAsyncKeyState(VK_SHIFT)&0x8000)){ + double d=atan2((double)dy,(double)dx); + lw = (int) (lw / cos(d)); + if (lw<1)lw=1; + } +#endif + + + if (x2 < x1) + { + int temp; + SWAP(x1,x2,temp); + SWAP(y1,y2,temp); + } + + int yincr = y2>y1?1:-1; + int offsincr= y2>y1?width:-width; + y1-=lw2; + int offs = y1 * width + x1; + int d = dy + dy - dx; + int Eincr = dy + dy; + int NEincr = d - dx; + if (x2 >= 0 && x1 < width) + { + if (x1<0) + { + int v; + v=yincr * -x1; + if (dx) v= (v * dy)/dx; + + y1 += v; + offs += v*width - x1; + x1=0; + } + + if (x2 > width) x2=width; + while (x1<x2) + { + int yp=y1; + int ype=y1+lw; + int *newfb=fb+offs; + if (yp < 0) + { + newfb-=yp*width; + yp=0; + } + if (ype>height) ype=height; + while (yp++ < ype) + { + BLEND_LINE(newfb,color); + newfb+=width; + } + if (d < 0) d += Eincr; + else + { + d += NEincr; + y1 += yincr; + offs += offsincr; + } + offs++; + x1++; + } + } + } + else + { +#if 0//lame + if (lw>1 && (GetAsyncKeyState(VK_SHIFT)&0x8000)){ + double d=atan2((double)dx,(double)dy); + lw = (int) (lw / cos(d)); + if (lw<1)lw=1; + } +#endif + if (y2 < y1) + { + int temp; + SWAP(x1,x2,temp); + SWAP(y1,y2,temp); + } + + int yincr=(x2>x1)?1:-1; + int d = dx + dx - dy; + int Eincr = dx + dx; + int NEincr = d - dy; + x1-=lw2; + int offs = y1 * width + x1; + if (y2 >= 0 && y1 < height) + { + if (y1<0) + { + int v; + v=yincr * -y1; + if (dy) v= (v * dx)/dy; + + x1 += v; + offs += v - y1*width; + y1=0; + } + if (y2 > height) y2 = height; + while (y1 < y2) + { + int xp=x1; + int xpe=x1+lw; + int *newfb=fb+offs; + if (xp<0) + { + newfb-=xp; + xp=0; + } + if (xpe > width) xpe=width; + while (xp++ < xpe) { BLEND_LINE(newfb, color); newfb++; } + + if (d < 0) d += Eincr; + else + { + d += NEincr; + x1 += yincr; + offs += yincr; + } + offs += width; + y1++; + } + } + } +} diff --git a/Src/Plugins/Visualization/vis_avs/main.cpp b/Src/Plugins/Visualization/vis_avs/main.cpp new file mode 100644 index 00000000..05b16d5c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/main.cpp @@ -0,0 +1,604 @@ +/* + 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. + +*/ +#include <windows.h> +#include <math.h> +#include <process.h> +#include "draw.h" +#include "wnd.h" +#include "r_defs.h" +#include "render.h" +#include "vis.h" +#include "cfgwnd.h" +#include "resource.h" +#include "bpm.h" +#include "api.h" +#include "../winamp/wa_ipc.h" +#include "../Agave/Language/api_language.h" +#include <api/service/waServiceFactory.h> + +#include <stdio.h> + +#ifdef REAPLAY_PLUGIN +#include "../../jmde/reaper_plugin.h" +const char *(*get_ini_file)(); +int (*vuGetVisData)(char *vdata, int size); +#endif + +#define PLUGIN_VERSION "v2.93" + +#include "avs_eelif.h" + +extern void GetClientRect_adj(HWND hwnd, RECT *r); + +static unsigned char g_logtab[256]; +HINSTANCE g_hInstance; + +/* char *verstr= +#ifndef LASER +"Advanced Visualization Studio" +#else +"AVS/Laser" +#endif +" v2.92" +; +*/ + +static unsigned int WINAPI RenderThread(LPVOID a); + +static void config(struct winampVisModule *this_mod); +static int init(struct winampVisModule *this_mod); +static int render(struct winampVisModule *this_mod); +static void quit(struct winampVisModule *this_mod); + +HANDLE g_hThread; +volatile int g_ThreadQuit; + +static CRITICAL_SECTION g_cs; + +static unsigned char g_visdata[2][2][576]; +static int g_visdata_pstat; + +/* wasabi based services for localisation support */ +api_service *WASABI_API_SVC = 0; +api_language *WASABI_API_LNG = 0; +HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0; +static char module1[128]; + +static winampVisModule *getModule(int which); +static winampVisHeader hdr = { VIS_HDRVER, 0, getModule }; + +// use this to get our own HINSTACE since overriding DllMain(..) causes instant crashes (should see why) + +static HINSTANCE GetMyInstance() +{ + MEMORY_BASIC_INFORMATION mbi = {0}; + if(VirtualQuery(GetMyInstance, &mbi, sizeof(mbi))) + return (HINSTANCE)mbi.AllocationBase; + return NULL; +} + +extern "C" { + __declspec( dllexport ) winampVisHeader* winampVisGetHeader(HWND hwndParent) + { + if(!WASABI_API_LNG_HINST) + { + // loader so that we can get the localisation service api for use + WASABI_API_SVC = (api_service*)SendMessage(hwndParent, WM_WA_IPC, 0, IPC_GET_API_SERVICE); + if (WASABI_API_SVC == (api_service*)1) WASABI_API_SVC = NULL; + + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(languageApiGUID); + if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface()); + + // need to have this initialised before we try to do anything with localisation features + WASABI_API_START_LANG(GetMyInstance(),VisAVSLangGUID); + } + + #ifndef LASER + static char szDescription[256]; + wsprintfA(szDescription,"%s " PLUGIN_VERSION,WASABI_API_LNGSTRING_BUF(IDS_AVS,module1,128)); + hdr.description = szDescription; + #else + hdr.description = "AVS/Laser "PLUGIN_VERSION; + #endif + + return &hdr; + } +} + +static winampVisModule *getModule(int which) +{ + static winampVisModule mod = + { +#ifdef LASER + "Advanced Visualization Studio/Laser", +#else + module1, +#endif + NULL, // hwndParent + NULL, // hDllInstance + 0, // sRate + 0, // nCh + 1000/70, // latencyMS + 1000/70,// delayMS + 2, // spectrumNch + 2, // waveformNch + { 0, }, // spectrumData + { 0, }, // waveformData + config, + init, + render, + quit + }; + if (which==0) return &mod; + return 0; +} + +void about(HWND hwndParent) + + { + static int about_here = 0; + char aboutbuf[1024] = {0}, aboutTitle[48] = {0}; + if (about_here) + { + SetActiveWindow(FindWindow("#32770",WASABI_API_LNGSTRING_BUF(IDS_ABOUT_AVS,aboutTitle,48))); + return; + } + about_here = 1; + wsprintf(aboutbuf,WASABI_API_LNGSTRING(IDS_ABOUT_STRING),hdr.description); + MessageBox(hwndParent,aboutbuf,WASABI_API_LNGSTRING_BUF(IDS_ABOUT_AVS,aboutTitle,48),0); + about_here = 0; +} + +HWND GetDialogBoxParent(HWND winamp) +{ + HWND parent = (HWND)SendMessage(winamp, WM_WA_IPC, 0, IPC_GETDIALOGBOXPARENT); + if (!parent || parent == (HWND)1) + return winamp; + return parent; + +/* +BOOL CALLBACK aboutProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg,IDC_VERSTR,verstr); + + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: case IDCANCEL: + EndDialog(hwndDlg,0); + return 0; + } + return 0; + } + return 0; +*/ + +} + +static void config(struct winampVisModule *this_mod) +{ + if (!g_hwnd || !IsWindow(g_hwnd)) + { + about(GetDialogBoxParent(this_mod->hwndParent)); +// DialogBox(this_mod->hDllInstance,MAKEINTRESOURCE(IDD_DIALOG2),this_mod->hwndParent,aboutProc); + } + else + { + SendMessage(g_hwnd,WM_USER+33,0,0); + } +} + +CRITICAL_SECTION g_render_cs; +static int g_is_beat; +char g_path[1024]; + +int beat_peak1,beat_peak2, beat_cnt,beat_peak1_peak; + +void main_setRenderThreadPriority() +{ + int prios[]={ + GetThreadPriority(GetCurrentThread()), + THREAD_PRIORITY_IDLE, + THREAD_PRIORITY_LOWEST, + THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_HIGHEST, + }; + SetThreadPriority(g_hThread,prios[cfg_render_prio]); +} + +extern void previous_preset(HWND hwnd); +extern void next_preset(HWND hwnd); +extern void random_preset(HWND hwnd); + +#if 0//syntax highlighting +HINSTANCE hRich; +#endif + +static int init(struct winampVisModule *this_mod) +{ + DWORD id; + FILETIME ft; +#if 0//syntax highlighting + if (!hRich) hRich=LoadLibrary("RICHED32.dll"); +#endif + GetSystemTimeAsFileTime(&ft); + srand(ft.dwLowDateTime|ft.dwHighDateTime^GetCurrentThreadId()); + g_hInstance=this_mod->hDllInstance; + GetModuleFileName(g_hInstance,g_path,MAX_PATH); + char *p=g_path+strlen(g_path); + while (p > g_path && *p != '\\') p--; + *p = 0; + +#ifdef WA2_EMBED + if (SendMessage(this_mod->hwndParent,WM_USER,0,0) < 0x2900) + { + char title[16]; + MessageBox(this_mod->hwndParent,WASABI_API_LNGSTRING(IDS_REQUIRES_2_9_PLUS), + WASABI_API_LNGSTRING_BUF(IDS_AVS_ERROR,title,16),MB_OK|MB_ICONSTOP); + return 1; + } +#endif + +#ifndef NO_MMX + extern int is_mmx(void); + if (!is_mmx()) + { + char title[16]; + MessageBox(this_mod->hwndParent,WASABI_API_LNGSTRING(IDS_NO_MMX_SUPPORT), + WASABI_API_LNGSTRING_BUF(IDS_AVS_ERROR,title,16),MB_OK|MB_ICONSTOP); + return 1; + } +#endif + +#ifdef LASER + strcat(g_path,"\\avs_laser"); +#else + strcat(g_path,"\\avs"); +#endif + CreateDirectory(g_path,NULL); + + InitializeCriticalSection(&g_cs); + InitializeCriticalSection(&g_render_cs); + g_ThreadQuit=0; + g_visdata_pstat=1; + + AVS_EEL_IF_init(); + + if (Wnd_Init(this_mod)) return 1; + + { + int x; + for (x = 0; x < 256; x ++) + { + double a=log((double)x*60.0/255.0 + 1.0)/log(60.0); + int t=(int)(a*255.0); + if (t<0)t=0; + if (t>255)t=255; + g_logtab[x]=(unsigned char )t; + } + } + + initBpm(); + + Render_Init(g_hInstance); + + CfgWnd_Create(this_mod); + + g_hThread=(HANDLE)_beginthreadex(NULL,0,RenderThread,0,0,(unsigned int *)&id); + main_setRenderThreadPriority(); + SetForegroundWindow(g_hwnd); + SetFocus(g_hwnd); + + return 0; +} + +static int render(struct winampVisModule *this_mod) +{ + int x,avs_beat=0,b; + if (g_ThreadQuit) return 1; + EnterCriticalSection(&g_cs); + if (g_ThreadQuit) + { + LeaveCriticalSection(&g_cs); + return 1; + } + if (g_visdata_pstat) + for (x = 0; x< 576*2; x ++) + g_visdata[0][0][x]=g_logtab[(unsigned char)this_mod->spectrumData[0][x]]; + else + { + for (x = 0; x < 576*2; x ++) + { + int t=g_logtab[(unsigned char)this_mod->spectrumData[0][x]]; + if (g_visdata[0][0][x] < t) + g_visdata[0][0][x] = t; + } + } + memcpy(&g_visdata[1][0][0],this_mod->waveformData,576*2); + { + int lt[2]={0,0}; + int x; + int ch; + for (ch = 0; ch < 2; ch ++) + { + unsigned char *f=(unsigned char*)&this_mod->waveformData[ch][0]; + for (x = 0; x < 576; x ++) + { + int r= *f++^128; + r-=128; + if (r<0)r=-r; + lt[ch]+=r; + } + } + lt[0]=max(lt[0],lt[1]); + + beat_peak1=(beat_peak1*125+beat_peak2*3)/128; + + beat_cnt++; + + if (lt[0] >= (beat_peak1*34)/32 && lt[0] > (576*16)) + { + if (beat_cnt>0) + { + beat_cnt=0; + avs_beat=1; + } + beat_peak1=(lt[0]+beat_peak1_peak)/2; + beat_peak1_peak=lt[0]; + } + else if (lt[0] > beat_peak2) + { + beat_peak2=lt[0]; + } + else beat_peak2=(beat_peak2*14)/16; + + } + b=refineBeat(avs_beat); + if (b) g_is_beat=1; + g_visdata_pstat=0; + LeaveCriticalSection(&g_cs); + return 0; +} + +static void quit(struct winampVisModule *this_mod) +{ +#define DS(x) + //MessageBox(this_mod->hwndParent,x,"AVS Debug",MB_OK) + if (g_hThread) + { + DS("Waitin for thread to quit\n"); + g_ThreadQuit=1; + if (WaitForSingleObject(g_hThread,10000) != WAIT_OBJECT_0) + { + DS("Terminated thread (BAD!)\n"); + //MessageBox(NULL,"error waiting for thread to quit","a",MB_TASKMODAL); + TerminateThread(g_hThread,0); + } + DS("Thread done... calling ddraw_quit\n"); + DDraw_Quit(); + + DS("Calling cfgwnd_destroy\n"); + CfgWnd_Destroy(); + DS("Calling render_quit\n"); + Render_Quit(this_mod->hDllInstance); + + DS("Calling wnd_quit\n"); + Wnd_Quit(); + + DS("closing thread handle\n"); + CloseHandle(g_hThread); + g_hThread=NULL; + + DS("calling eel quit\n"); + AVS_EEL_IF_quit(); + + DS("cleaning up critsections\n"); + DeleteCriticalSection(&g_cs); + DeleteCriticalSection(&g_render_cs); + + DS("smp_cleanupthreads\n"); + C_RenderListClass::smp_cleanupthreads(); + } +#undef DS +#if 0//syntax highlighting + if (hRich) FreeLibrary(hRich); + hRich=0; +#endif +} + +#define FPS_NF 64 + +static unsigned int WINAPI RenderThread(LPVOID a) +{ + int framedata[FPS_NF]={0,}; + int framedata_pos=0; + int s=0; + char vis_data[2][2][576]; + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + srand(ft.dwLowDateTime|ft.dwHighDateTime^GetCurrentThreadId()); + while (!g_ThreadQuit) + { + int w,h,*fb=NULL, *fb2=NULL,beat=0; + +#ifdef REAPLAY_PLUGIN + if(!IsWindowVisible(g_hwnd)) + { + Sleep(1); + continue; + } + + char visdata[576*2*2]; + int ret = vuGetVisData(visdata, sizeof(visdata)); + if (!ret) + { + memset(&vis_data[0][0][0],0,576*2*2); + beat=0; + } + else + { + int x; + unsigned char *v=(unsigned char *)visdata; + for (x = 0; x < 576*2; x ++) + vis_data[0][0][x]=g_logtab[*v++]; + for (x = 0; x < 576*2; x ++) + ((unsigned char *)vis_data[1][0])[x]=*v++; + + v=(unsigned char *)visdata+1152; + { + int lt[2]={0,0}; + int ch; + for (ch = 0; ch < 2; ch ++) + { + for (x = 0; x < 576; x ++) + { + int r=*v++^128; + r-=128; + if (r<0)r=-r; + lt[ch]+=r; + } + } + lt[0]=max(lt[0],lt[1]); + + beat_peak1=(beat_peak1*125+beat_peak2*3)/128; + beat_cnt++; + + if (lt[0] >= (beat_peak1*34)/32 && lt[0] > (576*16)) + { + if (beat_cnt>0) + { + beat_cnt=0; + beat=1; + } + beat_peak1=(lt[0]+beat_peak1_peak)/2; + beat_peak1_peak=lt[0]; + } + else if (lt[0] > beat_peak2) + { + beat_peak2=lt[0]; + } + else beat_peak2=(beat_peak2*14)/16; + + } +// EnterCriticalSection(&g_title_cs); + beat=refineBeat(beat); +// LeaveCriticalSection(&g_title_cs); + } +#else + EnterCriticalSection(&g_cs); + memcpy(&vis_data[0][0][0],&g_visdata[0][0][0],576*2*2); + g_visdata_pstat=1; + beat=g_is_beat; + g_is_beat=0; + LeaveCriticalSection(&g_cs); +#endif + + if (!g_ThreadQuit) + { + if (IsWindow(g_hwnd)&&!g_in_destroy) DDraw_Enter(&w,&h,&fb,&fb2); + else break; + if (fb&&fb2) + { + extern int g_dlg_w, g_dlg_h, g_dlg_fps; +#ifdef LASER + g_laser_linelist->ClearLineList(); +#endif + + EnterCriticalSection(&g_render_cs); + int t=g_render_transition->render(vis_data,beat,s?fb2:fb,s?fb:fb2,w,h); + LeaveCriticalSection(&g_render_cs); + if (t&1) s^=1; + +#ifdef LASER + s=0; + memset(fb,0,w*h*sizeof(int)); + LineDrawList(g_laser_linelist,fb,w,h); +#endif + if (IsWindow(g_hwnd)) DDraw_Exit(s); + + int lastt=framedata[framedata_pos]; + int thist=GetTickCount(); + framedata[framedata_pos]=thist; + g_dlg_w=w; + g_dlg_h=h; + if (lastt) + { + g_dlg_fps=MulDiv(sizeof(framedata)/sizeof(framedata[0]),10000,thist-lastt); + } + framedata_pos++; + if (framedata_pos >= sizeof(framedata)/sizeof(framedata[0])) framedata_pos=0; + + } + int fs=DDraw_IsFullScreen(); + int sv=(fs?(cfg_speed>>8):cfg_speed)&0xff; + Sleep(min(max(sv,1),100)); + } + } + _endthreadex(0); + return 0; +} + +#ifdef REAPLAY_PLUGIN +static winampVisModule dummyMod; +extern "C" +{ + + REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t *rec) + { + g_hInstance=hInstance; + if (rec) + { + if (rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc) + return 0; + + *((void **)&get_ini_file) = rec->GetFunc("get_ini_file"); + *((void **)&vuGetVisData) = rec->GetFunc("vuGetVisData"); + if (!get_ini_file || !vuGetVisData) + return 0; + + dummyMod.hwndParent=rec->hwnd_main; + dummyMod.hDllInstance=g_hInstance; + init(&dummyMod); + + return 1; + } + else + { + quit(&dummyMod); + return 0; + } + } + +}; +#endif diff --git a/Src/Plugins/Visualization/vis_avs/matrix.cpp b/Src/Plugins/Visualization/vis_avs/matrix.cpp new file mode 100644 index 00000000..8b567f2a --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/matrix.cpp @@ -0,0 +1,74 @@ +/* + 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. + +*/ +#include <windows.h> +#include <math.h> +#include "r_defs.h" + +void matrixRotate(float matrix[], char m, float Deg) { + char m1, m2; + float c,s; + Deg *= 3.141592653589f / 180.0f; + memset(matrix,0,sizeof(float)*16); + matrix[((m-1)<<2)+m-1] = matrix[15] = 1.0f; + m1 = (m % 3); + m2 = ((m1+1) % 3); + c = (float)cos(Deg); s = (float)sin(Deg); + matrix[(m1<<2)+m1]=c; matrix[(m1<<2)+m2]=s; + matrix[(m2<<2)+m2]=c; matrix[(m2<<2)+m1]=-s; +} + +void matrixTranslate(float m[], float x, float y, float z) { + memset(m,0,sizeof(float)*16); + m[0] = m[4+1] = m[8+2] = m[12+3] = 1.0f; + m[0+3] = x; m[4+3] = y; m[8+3] = z; +} + +void matrixMultiply(float *dest, float src[]) { + float temp[16]; + int i; + memcpy(temp,dest,sizeof(float)*16); + for (i = 0; i < 16; i += 4) { + *dest++ = src[i+0]*temp[(0<<2)+0]+src[i+1]*temp[(1<<2)+0]+ + src[i+2]*temp[(2<<2)+0]+src[i+3]*temp[(3<<2)+0]; + *dest++ = src[i+0]*temp[(0<<2)+1]+src[i+1]*temp[(1<<2)+1]+ + src[i+2]*temp[(2<<2)+1]+src[i+3]*temp[(3<<2)+1]; + *dest++ = src[i+0]*temp[(0<<2)+2]+src[i+1]*temp[(1<<2)+2]+ + src[i+2]*temp[(2<<2)+2]+src[i+3]*temp[(3<<2)+2]; + *dest++ = src[i+0]*temp[(0<<2)+3]+src[i+1]*temp[(1<<2)+3]+ + src[i+2]*temp[(2<<2)+3]+src[i+3]*temp[(3<<2)+3]; + } +} + +void matrixApply(float *m, float x, float y, float z, + float *outx, float *outy, float *outz) { + *outx = x*m[0] + y*m[1] + z*m[2] + m[3]; + *outy = x*m[4] + y*m[5] + z*m[6] + m[7]; + *outz = x*m[8] + y*m[9] + z*m[10] + m[11]; +} diff --git a/Src/Plugins/Visualization/vis_avs/movement.bin b/Src/Plugins/Visualization/vis_avs/movement.bin new file mode 100644 index 00000000..d68ca743 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/movement.bin @@ -0,0 +1,5 @@ +Movement help goes here (send me some :) ) + +To use the custom table, modify r,d,x or y. +Rect coords: x,y are in (-1..1) . Otherwise: d is (0..1) and r is (0..2PI). +You can also access 'sw' and 'sh' for screen dimensions in pixels (might be useful)
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/peices.bmp b/Src/Plugins/Visualization/vis_avs/peices.bmp Binary files differnew file mode 100644 index 00000000..ddb7609f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/peices.bmp diff --git a/Src/Plugins/Visualization/vis_avs/r_avi.cpp b/Src/Plugins/Visualization/vis_avs/r_avi.cpp new file mode 100644 index 00000000..fd52ff32 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_avi.cpp @@ -0,0 +1,383 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + + +#define MOD_NAME "Render / AVI" +#define C_THISCLASS C_AVIClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + void reinit(int, int); + void loadAvi(char *name); + void closeAvi(void); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_AVI,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + char ascName[MAX_PATH]; + int lastWidth, lastHeight; + HDRAWDIB hDrawDib; + PAVISTREAM PAVIVideo; + PGETFRAME PgetFrame; + HBITMAP hRetBitmap; + HBITMAP hOldBitmap; + HDC hDesktopDC; + HDC hBitmapDC; + LPBITMAPINFOHEADER lpFrame; + BITMAPINFO bi; + int blend, blendavg, adapt, persist; + int loaded, rendering; + int lFrameIndex; + int length; + unsigned int speed; + unsigned int lastspeed; + int *old_image,old_image_w,old_image_h; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + AVIFileInit ( ) ; + hDrawDib = DrawDibOpen ( ) ; + lastWidth=0; + lastHeight=0; + lFrameIndex=0; + loaded=0; + rendering=0; + length=0; + blend=0; + adapt=0; + blendavg=1; + persist=6; + enabled=1; + speed=0; + lastspeed=0; + old_image=NULL; old_image_h=0; old_image_w=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + closeAvi(); + SelectObject (hBitmapDC, hOldBitmap); + DeleteDC (hBitmapDC); + ReleaseDC (NULL, hDesktopDC); + AVIFileExit ( ); + DrawDibClose (hDrawDib); + if(old_image) { + GlobalFree(old_image); + old_image=NULL; + old_image_h=old_image_w=0; + } +} + +void C_THISCLASS::loadAvi(char *name) +{ + char pathfile[MAX_PATH]; + + if (loaded) closeAvi(); + + wsprintf(pathfile,"%s\\%s",g_path, name); + + if (AVIStreamOpenFromFile ((PAVISTREAM FAR *) &PAVIVideo, pathfile, streamtypeVIDEO, 0, OF_READ | OF_SHARE_EXCLUSIVE, NULL) != 0) + { + // MessageBox(NULL, "An error occured while trying to open a file. Effect is disabled", "Warning", 0); + return; + } + PgetFrame = AVIStreamGetFrameOpen (PAVIVideo, NULL); + length = AVIStreamLength(PAVIVideo); + lFrameIndex = 0; + + lpFrame = (LPBITMAPINFOHEADER) AVIStreamGetFrame (PgetFrame, 0); + + reinit(lastWidth, lastHeight); + + loaded=1; +} + +void C_THISCLASS::closeAvi(void) +{ +if (loaded) + { + while (rendering); + loaded=0; + AVIStreamGetFrameClose (PgetFrame); + AVIStreamRelease (PAVIVideo); + } +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + char *p=ascName; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + while (data[pos] && len-pos > 0 && p-ascName < sizeof(ascName)-1) *p++=data[pos++]; + *p=0; pos++; + if (len-pos >= 4) { adapt=GET_INT(); pos+=4; } + if (len-pos >= 4) { persist=GET_INT(); pos+=4; } + if (len-pos >= 4) { speed=GET_INT(); pos+=4; } + + if (*ascName) + loadAvi(ascName); +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + strcpy((char *)data+pos, ascName); + pos+=strlen(ascName)+1; + PUT_INT(adapt); pos+=4; + PUT_INT(persist); pos+=4; + PUT_INT(speed); pos+=4; + return pos; +} + + +void C_THISCLASS::reinit(int w, int h) +{ +if (lastWidth || lastHeight) + { + SelectObject (hBitmapDC, hOldBitmap); + DeleteDC (hBitmapDC); + ReleaseDC (NULL, hDesktopDC); + } + + hDesktopDC = GetDC (NULL); + hRetBitmap = CreateCompatibleBitmap (hDesktopDC, w, h); + hBitmapDC = CreateCompatibleDC (hDesktopDC); + hOldBitmap = (HBITMAP) SelectObject (hBitmapDC, hRetBitmap); + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bi.bmiHeader.biWidth = w; + bi.bmiHeader.biHeight = h; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = 0; + bi.bmiHeader.biXPelsPerMeter = 0; + bi.bmiHeader.biYPelsPerMeter = 0; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int *p,*d; + int i,j; + static int persistCount=0; + + if (!enabled || !loaded) return 0; + + if(h!=old_image_h||w!=old_image_w) { + if(old_image) + GlobalFree(old_image); + old_image=(int *)GlobalAlloc(GMEM_FIXED,sizeof(int)*w*h); + old_image_h=h; old_image_w=w; + } + + if((lastspeed+speed)>GetTickCount()) { + memcpy(fbout,old_image,sizeof(int)*w*h); + } else { + lastspeed=GetTickCount(); + + rendering=1; + + if (lastWidth != w || lastHeight != h) + { + lastWidth = w; + lastHeight = h; + reinit(w, h); + } + if (isBeat&0x80000000) return 0; + + if (!length) return 0; + + lFrameIndex %= length; + lpFrame = (LPBITMAPINFOHEADER) AVIStreamGetFrame (PgetFrame, lFrameIndex++); + DrawDibDraw (hDrawDib, hBitmapDC, 0, 0, lastWidth, lastHeight, lpFrame, + NULL, 0, 0, (int) lpFrame ->biWidth, (int) lpFrame ->biHeight, 0); + GetDIBits(hBitmapDC, hRetBitmap, 0, h, (void *)fbout, &bi, DIB_RGB_COLORS); + rendering=0; + memcpy(old_image,fbout,sizeof(int)*w*h); + } + + if (isBeat) + persistCount=persist; + else + if (persistCount>0) persistCount--; + + p = fbout; + d = framebuffer+w*(h-1); + if (blend || (adapt && (isBeat || persistCount))) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + *d=BLEND(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + if (blendavg || adapt) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + *d=BLEND_AVG(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + for (i=0;i<h;i++) + { + memcpy(d, p, w*4); + p+=w; + d-=w; + } + + return 0; +} + + +// configuration dialog stuff + +static void EnableWindows(HWND hwndDlg) +{ + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST),g_ConfigThis->adapt); + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST_TITLE),g_ConfigThis->adapt); +} + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_SETRANGE, TRUE, MAKELONG(0, 32)); + SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_SETPOS, TRUE, g_ConfigThis->persist); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETTICFREQ, 50, 0); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(0, 1000)); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, g_ConfigThis->speed); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (g_ConfigThis->adapt) CheckDlgButton(hwndDlg,IDC_ADAPT,BST_CHECKED); + if (!g_ConfigThis->adapt && !g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + EnableWindows(hwndDlg); + loadComboBox(GetDlgItem(hwndDlg,OBJ_COMBO),"*.AVI",g_ConfigThis->ascName); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_PERSIST) + g_ConfigThis->persist = SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_SPEED) + g_ConfigThis->speed = SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0); + } + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_ADAPT) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->adapt=IsDlgButtonChecked(hwndDlg,IDC_ADAPT)?1:0; + EnableWindows(hwndDlg); + } + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == OBJ_COMBO) // handle clicks to combo box + { + int sel = SendDlgItemMessage(hwndDlg, OBJ_COMBO, CB_GETCURSEL, 0, 0); + if (sel != -1) + { + SendDlgItemMessage(hwndDlg, OBJ_COMBO, CB_GETLBTEXT, sel, (LPARAM)g_ConfigThis->ascName); + if (*(g_ConfigThis->ascName)) + g_ConfigThis->loadAvi(g_ConfigThis->ascName); + } + } + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_AVI,hwndParent,g_DlgProc); +} +// export stuff + +C_RBASE *R_AVI(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else//!LASER +C_RBASE *R_AVI(char *desc) { return NULL; } +#endif diff --git a/Src/Plugins/Visualization/vis_avs/r_blit.cpp b/Src/Plugins/Visualization/vis_avs/r_blit.cpp new file mode 100644 index 00000000..901df213 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_blit.cpp @@ -0,0 +1,557 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +// highly optimized on 10/10/00 JF. MMX. + +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +#define C_THISCLASS C_BlitClass +#define MOD_NAME "Trans / Blitter Feedback" + +static const unsigned int revn[2]={0xff00ff,0xff00ff};//{0x1000100,0x1000100}; <<- this is actually more correct, but we're going for consistency vs. the non-mmx ver-jf +static const int zero=0; + + + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BLITTER_FEEDBACK,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int scale, scale2, blend,beatch; + int fpos; + int subpixel; + + + int blitter_normal(int *framebuffer, int *fbout, int w, int h, int f_val); + int blitter_out(int *framebuffer, int *fbout, int w, int h, int f_val); +}; + + +#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; + if (len-pos >= 4) { scale=GET_INT(); pos+=4; } + if (len-pos >= 4) { scale2=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatch=GET_INT(); pos+=4; } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + else subpixel=0; + + fpos=scale; + +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(scale); pos+=4; + PUT_INT(scale2); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(beatch); pos+=4; + PUT_INT(subpixel); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + scale=30; + scale2=30; + blend=0; + fpos=scale; + beatch=0; + subpixel=1; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::blitter_out(int *framebuffer, int *fbout, int w, int h, int f_val) +{ + const int adj=7; + int ds_x = ((f_val+(1<<adj)-32)<<(16-adj)); + int x_len=((w<<16)/ds_x)&~3; + int y_len=(h<<16)/ds_x; + + if (x_len >= w || y_len >= h) return 0; + + + int start_x=(w-x_len)/2; + int start_y=(h-y_len)/2; + int s_y=32768; + + int *dest=(int *)framebuffer+start_y*w + start_x; + int *src=(int *)fbout+start_y*w + start_x; + int y; + + fbout += start_y*w; + for (y = 0; y < y_len; y ++) + { + int s_x=32768; + unsigned int *src = ((unsigned int *) framebuffer)+(s_y>>16)*w; + unsigned int *old_dest=((unsigned int *)fbout) + start_x; + s_y+=ds_x; + if (!blend) + { + int x=x_len/4; + while (x--) + { + old_dest[0]=src[s_x>>16]; + s_x += ds_x; + old_dest[1]=src[s_x>>16]; + s_x += ds_x; + old_dest[2]=src[s_x>>16]; + s_x += ds_x; + old_dest[3]=src[s_x>>16]; + s_x += ds_x; + old_dest+=4; + } + } + else + { + unsigned int *s2=(unsigned int *)framebuffer+((y+start_y)*w)+start_x; + int x=x_len/4; + while (x--) + { + old_dest[0]=BLEND_AVG(s2[0],src[s_x>>16]); + s_x += ds_x; + old_dest[1]=BLEND_AVG(s2[1],src[s_x>>16]); + s_x += ds_x; + old_dest[2]=BLEND_AVG(s2[2],src[s_x>>16]); + s_x += ds_x; + old_dest[3]=BLEND_AVG(s2[3],src[s_x>>16]); + s2+=4; + old_dest+=4; + s_x += ds_x; + } + } + fbout += w; + } + for (y = 0; y < y_len; y ++) + { + memcpy(dest,src,x_len*sizeof(int)); + dest+=w; + src+=w; + } + + return 0; +} + + + +int C_THISCLASS::blitter_normal(int *framebuffer, int *fbout, int w, int h, int f_val) +{ + int ds_x = ((f_val+32)<<16)/64; + int isx=(((w<<16)-((ds_x*w)))/2); + int s_y=(((h<<16)-((ds_x*h)))/2); + + if (subpixel) + { + int y; + for (y = 0; y < h; y ++) + { + int s_x=isx; + unsigned int *src = ((unsigned int *) framebuffer)+(s_y>>16)*w; + int ypart=(s_y>>8)&0xff; + s_y+=ds_x; +#ifdef NO_MMX + { + ypart=(ypart*255)>>8; + int x=w/4; + while (x--) + { + fbout[0]=BLEND4(src+(s_x>>16),w,(s_x>>8)&0xff,ypart); + s_x += ds_x; + fbout[1]=BLEND4(src+(s_x>>16),w,(s_x>>8)&0xff,ypart); + s_x += ds_x; + fbout[2]=BLEND4(src+(s_x>>16),w,(s_x>>8)&0xff,ypart); + s_x += ds_x; + fbout[3]=BLEND4(src+(s_x>>16),w,(s_x>>8)&0xff,ypart); + s_x += ds_x; + fbout+=4; + } + } +#else + { + __int64 mem5,mem7; + __asm + { + mov edi, fbout + mov esi, w + + movd mm7, ypart + punpcklwd mm7,mm7 + + movq mm5, revn + punpckldq mm7,mm7 + + psubw mm5, mm7 + mov ecx, esi + + movq mem5,mm5 + movq mem7,mm7 + + shr ecx, 1 + mov edx, s_x + + align 16 + mmx_scale_loop1: + + mov ebx, edx + mov eax, edx + + shr eax, 14 + add edx, ds_x + + shr ebx, 8 + and eax, ~3 + + add eax, src + and ebx, 0xff + + movd mm6, ebx + // + + movq mm4, revn + punpcklwd mm6,mm6 + + movd mm0, [eax] + punpckldq mm6,mm6 + + movd mm1, [eax+4] + psubw mm4, mm6 + + movd mm2, [eax+esi*4] + punpcklbw mm0, [zero] + + movd mm3, [eax+esi*4+4] + pmullw mm0, mm4 // mm0 used in divide for 3 cycles + + punpcklbw mm1, [zero] + mov eax, edx + + pmullw mm1, mm6 // mm1 used in divide for 3 cycles + punpcklbw mm2, [zero] + + pmullw mm2, mm4 // mm2 used in divide for 3 cycles + punpcklbw mm3, [zero] + + pmullw mm3, mm6 // mm3 used in divide for 3 cycles + shr eax, 14 + + mov ebx, edx + and eax, ~3 + + paddw mm0, mm1 + shr ebx, 8 + + psrlw mm0, 8 + add eax, src + + paddw mm2, mm3 + and ebx, 0xff + + pmullw mm0, mem5 + psrlw mm2, 8 + + pmullw mm2, mem7 + add edx, ds_x + + + movd mm6, ebx + // + + movq mm4, revn + punpcklwd mm6,mm6 + + + movd mm1, [eax+4] + // + + movd mm7, [eax+esi*4] + paddw mm0, mm2 + + movd mm5, [eax] + psrlw mm0, 8 + + movd mm3, [eax+esi*4+4] + packuswb mm0, mm0 + + movd [edi], mm0 + punpckldq mm6,mm6 + + //poop + + punpcklbw mm5, [zero] + psubw mm4, mm6 + + punpcklbw mm1, [zero] + pmullw mm5, mm4 + + punpcklbw mm7, [zero] + pmullw mm1, mm6 + + punpcklbw mm3, [zero] + pmullw mm7, mm4 + + //cycle + //cycle + + paddw mm5, mm1 + // + + pmullw mm3, mm6 + psrlw mm5, 8 + + pmullw mm5, mem5 + add edi, 8 + + // cycle + // cycle + + paddw mm7, mm3 + // + + psrlw mm7, 8 + // + + pmullw mm7, mem7 + dec ecx + + // cycle + // cycle + // cycle + + paddw mm5, mm7 + + psrlw mm5, 8 + + packuswb mm5, mm5 + + movd [edi-4], mm5 + + + jnz mmx_scale_loop1 + mov fbout, edi + } + } // end mmx + __asm emms; +#endif + if (blend) // reblend this scanline with the original + { + fbout-=w; + int x=w/4; + unsigned int *s2=(unsigned int *)framebuffer+y*w; + while (x--) + { + fbout[0]=BLEND_AVG(fbout[0],s2[0]); + fbout[1]=BLEND_AVG(fbout[1],s2[1]); + fbout[2]=BLEND_AVG(fbout[2],s2[2]); + fbout[3]=BLEND_AVG(fbout[3],s2[3]); + fbout+=4; + s2+=4; + } + } + } // end subpixel y loop + } + else // !subpixel + { + int y; + for (y = 0; y < h; y ++) + { + int s_x=isx; + unsigned int *src = ((unsigned int *) framebuffer)+(s_y>>16)*w; + int ypart=(s_y>>8)&0xff; + s_y+=ds_x; + if (!blend) + { + int x=w/4; + while (x--) + { + fbout[0]=src[s_x>>16]; + s_x += ds_x; + fbout[1]=src[s_x>>16]; + s_x += ds_x; + fbout[2]=src[s_x>>16]; + s_x += ds_x; + fbout[3]=src[s_x>>16]; + s_x += ds_x; + fbout+=4; + } + } + else + { + unsigned int *s2=(unsigned int *)framebuffer+(y*w); + int x=w/4; + while (x--) + { + fbout[0]=BLEND_AVG(s2[0],src[s_x>>16]); + s_x += ds_x; + fbout[1]=BLEND_AVG(s2[1],src[s_x>>16]); + s_x += ds_x; + fbout[2]=BLEND_AVG(s2[2],src[s_x>>16]); + s_x += ds_x; + fbout[3]=BLEND_AVG(s2[3],src[s_x>>16]); + s2+=4; + fbout+=4; + s_x += ds_x; + } + } + } + } + return 1; +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + int f_val; + unsigned int *dest=(unsigned int *) fbout; + + if (isBeat && beatch) + { + fpos=scale2; + } + + if (scale < scale2) + { + f_val=(fpos > scale? fpos:scale); + fpos -= 3; + } + else + { + f_val=(fpos < scale? fpos :scale); + fpos+=3; + } + + if (f_val<0) f_val=0; + + if (f_val < 32) return blitter_normal(framebuffer,fbout,w,h,f_val); + if (f_val > 32) return blitter_out(framebuffer,fbout,w,h,f_val); + return 0; +} + +C_RBASE *R_BlitterFB(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,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,256); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->scale); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,256); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->scale2); + if (g_this->blend==1) CheckDlgButton(hwndDlg,IDC_BLEND,BST_CHECKED); + if (g_this->subpixel) CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (g_this->beatch==1) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_BLEND: + if (IsDlgButtonChecked(hwndDlg,IDC_BLEND)) + { + g_this->blend=1; + } + else g_this->blend=0; + break; + case IDC_CHECK1: + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK1)) + g_this->beatch=1; + else g_this->beatch=0; + break; + case IDC_CHECK2: + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK2)) + { + g_this->subpixel=1; + } + else g_this->subpixel=0; + break; + } + 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->scale=t; + g_this->fpos=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->scale2=t; + g_this->fpos=t; + } + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BLT,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_BlitterFB(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_blur.cpp b/Src/Plugins/Visualization/vis_avs/r_blur.cpp new file mode 100644 index 00000000..77645dc9 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_blur.cpp @@ -0,0 +1,883 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 + +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + +#define C_THISCLASS C_BlurClass +#define MOD_NAME "Trans / Blur" + +static const int zero=0; + +class C_THISCLASS : public C_RBASE2 { + 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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BLUR,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + + int enabled; + + int roundmode; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { roundmode=GET_INT(); pos+=4; } + else roundmode=0; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(roundmode); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + roundmode=0; + enabled=1; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +#define MASK_SH1 (~(((1<<7)|(1<<15)|(1<<23))<<1)) +#define MASK_SH2 (~(((3<<6)|(3<<14)|(3<<22))<<2)) +#define MASK_SH3 (~(((7<<5)|(7<<13)|(7<<21))<<3)) +#define MASK_SH4 (~(((15<<4)|(15<<12)|(15<<20))<<4)) +static unsigned int mmx_mask1[2]={MASK_SH1,MASK_SH1}; +static unsigned int mmx_mask2[2]={MASK_SH2,MASK_SH2}; +static unsigned int mmx_mask3[2]={MASK_SH3,MASK_SH3}; +static unsigned int mmx_mask4[2]={MASK_SH4,MASK_SH4}; + +#define DIV_2(x) ((( x ) & MASK_SH1)>>1) +#define DIV_4(x) ((( x ) & MASK_SH2)>>2) +#define DIV_8(x) ((( x ) & MASK_SH3)>>3) +#define DIV_16(x) ((( x ) & MASK_SH4)>>4) + + +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return; + + timingEnter(0); + + unsigned int *f = (unsigned int *) framebuffer; + unsigned int *of = (unsigned int *) fbout; + + if (max_threads < 1) max_threads=1; + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + int skip_pix=start_l*w; + + f += skip_pix; + of+= skip_pix; + + int at_top=0, at_bottom=0; + + if (!this_thread) at_top=1; + if (this_thread >= max_threads - 1) at_bottom=1; + + if (enabled == 2) + { + // top line + if (at_top) + { + unsigned int *f2=f+w; + int x; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x03030303; adj_tl2 = 0x04040404; } + // top left + *of++=DIV_2(f[0])+DIV_4(f[0])+DIV_8(f[1])+DIV_8(f2[0]) + adj_tl; f++; f2++; + // top center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_8(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + adj_tl2; + of[1]=DIV_2(f[1]) + DIV_8(f[1]) + DIV_8(f[2]) + DIV_8(f[0]) + DIV_8(f2[1]) + adj_tl2; + of[2]=DIV_2(f[2]) + DIV_8(f[2]) + DIV_8(f[3]) + DIV_8(f[1]) + DIV_8(f2[2]) + adj_tl2; + of[3]=DIV_2(f[3]) + DIV_8(f[3]) + DIV_8(f[4]) + DIV_8(f[2]) + DIV_8(f2[3]) + adj_tl2; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_2(f[0]) + DIV_8(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + adj_tl2; + f++; + f2++; + } + // top right + *of++=DIV_2(f[0])+DIV_4(f[0]) + DIV_8(f[-1])+DIV_8(f2[0]) + adj_tl; f++; f2++; + } + + + // middle block + { + int y=outh-at_top-at_bottom; + unsigned int adj_tl1=0,adj_tl2=0; + unsigned __int64 adj2=0; + if (roundmode) { adj_tl1=0x04040404; adj_tl2=0x05050505; adj2=0x0505050505050505i64; } + while (y--) + { + int x; + unsigned int *f2=f+w; + unsigned int *f3=f-w; + + // left edge + *of++=DIV_2(f[0])+DIV_8(f[0])+DIV_8(f[1])+DIV_8(f2[0])+DIV_8(f3[0])+adj_tl1; f++; f2++; f3++; + + // middle of line +#ifdef NO_MMX + x=(w-2)/4; + if (roundmode) + { + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_4(f[0]) + DIV_16(f[1]) + DIV_16(f[-1]) + DIV_16(f2[0]) + DIV_16(f3[0]) + 0x05050505; + of[1]=DIV_2(f[1]) + DIV_4(f[1]) + DIV_16(f[2]) + DIV_16(f[0]) + DIV_16(f2[1]) + DIV_16(f3[1]) + 0x05050505; + of[2]=DIV_2(f[2]) + DIV_4(f[2]) + DIV_16(f[3]) + DIV_16(f[1]) + DIV_16(f2[2]) + DIV_16(f3[2]) + 0x05050505; + of[3]=DIV_2(f[3]) + DIV_4(f[3]) + DIV_16(f[4]) + DIV_16(f[2]) + DIV_16(f2[3]) + DIV_16(f3[3]) + 0x05050505; + f+=4; + f2+=4; + f3+=4; + of+=4; + } + } + else + { + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_4(f[0]) + DIV_16(f[1]) + DIV_16(f[-1]) + DIV_16(f2[0]) + DIV_16(f3[0]); + of[1]=DIV_2(f[1]) + DIV_4(f[1]) + DIV_16(f[2]) + DIV_16(f[0]) + DIV_16(f2[1]) + DIV_16(f3[1]); + of[2]=DIV_2(f[2]) + DIV_4(f[2]) + DIV_16(f[3]) + DIV_16(f[1]) + DIV_16(f2[2]) + DIV_16(f3[2]); + of[3]=DIV_2(f[3]) + DIV_4(f[3]) + DIV_16(f[4]) + DIV_16(f[2]) + DIV_16(f2[3]) + DIV_16(f3[3]); + f+=4; + f2+=4; + f3+=4; + of+=4; + } + } +#else + { + __asm + { + mov ecx, w + mov edx, ecx + mov ebx, edx + neg ebx + mov esi, f + mov edi, of + sub ecx, 2 + shr ecx, 2 + movq mm1, [esi-4] + align 16 +mmx_light_blur_loop: + movq mm0, [esi] + + movq mm2, [esi+4] + pand mm0, mmx_mask1 + + movq mm5, mm2 + psrl mm0, 1 + + movq mm7, [esi+8] + movq mm4, mm0 + + pand mm1, mmx_mask4 + pand mm4, mmx_mask1 + + movq mm3, [esi+edx*4] + psrl mm4, 1 + + paddb mm0, mm4 + pand mm2, mmx_mask4 + + movq mm4, [esi+ebx*4] + pand mm3, mmx_mask4 + + pand mm4, mmx_mask4 + + psrl mm1, 4 + pand mm7, mmx_mask1 + + movq mm6, [esi+12] + + psrl mm2, 4 + add esi, 16 + + psrl mm3, 4 + + paddb mm0, mm1 + psrl mm4, 4 + + movq mm1, mm6 + psrl mm7, 1 + + paddb mm2, mm3 + paddb mm0, mm4 + + movq mm3, [esi+edx*4-8] + paddb mm0, mm2 + + movq mm4, [esi+ebx*4-8] + paddb mm0, [adj2] + + pand mm6, mmx_mask4 + + movq [edi],mm0 + pand mm5, mmx_mask4 + + movq mm0, mm7 + pand mm3, mmx_mask4 + + psrl mm6, 4 + pand mm0, mmx_mask1 + + pand mm4, mmx_mask4 + psrl mm5, 4 + + psrl mm0, 1 + paddb mm7, mm6 + + paddb mm7, mm0 + add edi, 16 + + psrl mm3, 4 + + psrl mm4, 4 + paddb mm5, mm3 + + paddb mm7, mm4 + dec ecx + + paddb mm7, mm5 + paddb mm7, [adj2] + + movq [edi-8],mm7 + + jnz mmx_light_blur_loop + mov of, edi + mov f, esi + }; + f2=f+w; // update these bitches + f3=f-w; + } +#endif + x=(w-2)&3; + while (x--) + { + *of++=DIV_2(f[0]) + DIV_4(f[0]) + DIV_16(f[1]) + DIV_16(f[-1]) + DIV_16(f2[0]) + DIV_16(f3[0]) + adj_tl2; + f++; + f2++; + f3++; + } + + // right block + *of++=DIV_2(f[0])+DIV_8(f[0])+DIV_8(f[-1])+DIV_8(f2[0])+DIV_8(f3[0])+adj_tl1; f++; + } + } + // bottom block + if (at_bottom) + { + unsigned int *f2=f-w; + int x; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x03030303; adj_tl2 = 0x04040404; } + // bottom left + *of++=DIV_2(f[0])+DIV_4(f[0])+DIV_8(f[1])+DIV_8(f2[0]) + adj_tl; f++; f2++; + // bottom center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_8(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + adj_tl2; + of[1]=DIV_2(f[1]) + DIV_8(f[1]) + DIV_8(f[2]) + DIV_8(f[0]) + DIV_8(f2[1]) + adj_tl2; + of[2]=DIV_2(f[2]) + DIV_8(f[2]) + DIV_8(f[3]) + DIV_8(f[1]) + DIV_8(f2[2])+adj_tl2; + of[3]=DIV_2(f[3]) + DIV_8(f[3]) + DIV_8(f[4]) + DIV_8(f[2]) + DIV_8(f2[3])+adj_tl2; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_2(f[0]) + DIV_8(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0])+adj_tl2; + f++; + f2++; + } + // bottom right + *of++=DIV_2(f[0])+DIV_4(f[0]) + DIV_8(f[-1])+DIV_8(f2[0])+adj_tl; f++; f2++; + } + } + else if (enabled == 3) // more blur + { + // top line + if (at_top) { + unsigned int *f2=f+w; + int x; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x02020202; adj_tl2 = 0x01010101; } + // top left + *of++=DIV_2(f[1])+DIV_2(f2[0]) + adj_tl2; f++; f2++; + // top center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_2(f2[0]) + adj_tl; + of[1]=DIV_4(f[2]) + DIV_4(f[0]) + DIV_2(f2[1]) +adj_tl; + of[2]=DIV_4(f[3]) + DIV_4(f[1]) + DIV_2(f2[2]) + adj_tl; + of[3]=DIV_4(f[4]) + DIV_4(f[2]) + DIV_2(f2[3]) + adj_tl; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_2(f2[0])+adj_tl; + f++; + f2++; + } + // top right + *of++=DIV_2(f[-1])+DIV_2(f2[0])+adj_tl2; f++; f2++; + } + + + // middle block + { + int y=outh-at_top-at_bottom; + int adj_tl1=0,adj_tl2=0; + unsigned __int64 adj2=0; + if (roundmode) { adj_tl1=0x02020202; adj_tl2=0x03030303; adj2=0x0303030303030303i64; } + + while (y--) + { + int x; + unsigned int *f2=f+w; + unsigned int *f3=f-w; + + // left edge + *of++=DIV_2(f[1])+DIV_4(f2[0])+DIV_4(f3[0]) + adj_tl1; f++; f2++; f3++; + + // middle of line +#ifdef NO_MMX + x=(w-2)/4; + if (roundmode) + { + while (x--) + { + of[0]=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + DIV_4(f3[0]) + 0x03030303; + of[1]=DIV_4(f[2]) + DIV_4(f[0]) + DIV_4(f2[1]) + DIV_4(f3[1]) + 0x03030303; + of[2]=DIV_4(f[3]) + DIV_4(f[1]) + DIV_4(f2[2]) + DIV_4(f3[2]) + 0x03030303; + of[3]=DIV_4(f[4]) + DIV_4(f[2]) + DIV_4(f2[3]) + DIV_4(f3[3]) + 0x03030303; + f+=4; f2+=4; f3+=4; of+=4; + } + } + else + { + while (x--) + { + of[0]=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + DIV_4(f3[0]); + of[1]=DIV_4(f[2]) + DIV_4(f[0]) + DIV_4(f2[1]) + DIV_4(f3[1]); + of[2]=DIV_4(f[3]) + DIV_4(f[1]) + DIV_4(f2[2]) + DIV_4(f3[2]); + of[3]=DIV_4(f[4]) + DIV_4(f[2]) + DIV_4(f2[3]) + DIV_4(f3[3]); + f+=4; f2+=4; f3+=4; of+=4; + } + } +#else + { + __asm + { + mov ecx, w + mov edx, ecx + mov ebx, edx + neg ebx + mov esi, f + mov edi, of + sub ecx, 2 + shr ecx, 2 + movq mm1, [esi-4] + align 16 +mmx_heavy_blur_loop: + movq mm2, [esi+4] + pxor mm0, mm0 + + movq mm5, mm2 + pxor mm7, mm7 + + movq mm3, [esi+edx*4] + pand mm1, mmx_mask2 + + movq mm4, [esi+ebx*4] + pand mm2, mmx_mask2 + + pand mm3, mmx_mask2 + pand mm4, mmx_mask2 + + psrl mm1, 2 + + movq mm6, [esi+12] + psrl mm2, 2 + + psrl mm3, 2 + + paddb mm0, mm1 + psrl mm4, 2 + + movq mm1, mm6 + + paddb mm2, mm3 + paddb mm0, mm4 + + movq mm3, [esi+edx*4+8] + paddb mm0, mm2 + + movq mm4, [esi+ebx*4+8] + paddb mm0, [adj2] + + pand mm6, mmx_mask2 + + movq [edi],mm0 + pand mm5, mmx_mask2 + + pand mm3, mmx_mask2 + add esi, 16 + + psrl mm6, 2 + pand mm4, mmx_mask2 + + psrl mm5, 2 + paddb mm7, mm6 + + psrl mm3, 2 + add edi, 16 + + psrl mm4, 2 + paddb mm5, mm3 + + paddb mm7, mm4 + + paddb mm7, mm5 + paddb mm7, [adj2] + + movq [edi-8],mm7 + + dec ecx + jnz mmx_heavy_blur_loop + mov of, edi + mov f, esi + }; + f2=f+w; // update these bitches + f3=f-w; + } +#endif + x=(w-2)&3; + while (x--) + { + *of++=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + DIV_4(f3[0]) + adj_tl2; + f++; + f2++; + f3++; + } + + // right block + *of++=DIV_2(f[-1])+DIV_4(f2[0])+DIV_4(f3[0]) + adj_tl1; f++; + } + } + + // bottom block + if (at_bottom) + { + unsigned int *f2=f-w; + int x; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x02020202; adj_tl2 = 0x01010101; } + // bottom left + *of++=DIV_2(f[1])+DIV_2(f2[0]) + adj_tl2; f++; f2++; + // bottom center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_2(f2[0])+adj_tl; + of[1]=DIV_4(f[2]) + DIV_4(f[0]) + DIV_2(f2[1])+adj_tl; + of[2]=DIV_4(f[3]) + DIV_4(f[1]) + DIV_2(f2[2])+adj_tl; + of[3]=DIV_4(f[4]) + DIV_4(f[2]) + DIV_2(f2[3])+adj_tl; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_4(f[1]) + DIV_4(f[-1]) + DIV_2(f2[0])+adj_tl; + f++; + f2++; + } + // bottom right + *of++=DIV_2(f[-1])+DIV_2(f2[0])+adj_tl2; f++; f2++; + } + } + else + { + // top line + if (at_top) + { + unsigned int *f2=f+w; + int x; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x02020202; adj_tl2 = 0x03030303; } + // top left + *of++=DIV_2(f[0])+DIV_4(f[1])+DIV_4(f2[0]) + adj_tl; f++; f2++; + // top center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_4(f[0]) + DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + adj_tl2; + of[1]=DIV_4(f[1]) + DIV_4(f[2]) + DIV_4(f[0]) + DIV_4(f2[1]) + adj_tl2; + of[2]=DIV_4(f[2]) + DIV_4(f[3]) + DIV_4(f[1]) + DIV_4(f2[2]) + adj_tl2; + of[3]=DIV_4(f[3]) + DIV_4(f[4]) + DIV_4(f[2]) + DIV_4(f2[3]) + adj_tl2; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_4(f[0]) + DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + adj_tl2; + f++; + f2++; + } + // top right + *of++=DIV_2(f[0])+DIV_4(f[-1])+DIV_4(f2[0]) + adj_tl; f++; f2++; + } + + + // middle block + { + int y=outh-at_top-at_bottom; + int adj_tl1=0,adj_tl2=0; + unsigned __int64 adj2=0; + if (roundmode) { adj_tl1=0x03030303; adj_tl2=0x04040404; adj2=0x0404040404040404i64; } + while (y--) + { + int x; + unsigned int *f2=f+w; + unsigned int *f3=f-w; + + // left edge + *of++=DIV_4(f[0])+DIV_4(f[1])+DIV_4(f2[0])+DIV_4(f3[0])+adj_tl1; f++; f2++; f3++; + + // middle of line +#ifdef NO_MMX + x=(w-2)/4; + if (roundmode) + { + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + DIV_8(f3[0]) + 0x04040404; + of[1]=DIV_2(f[1]) + DIV_8(f[2]) + DIV_8(f[0]) + DIV_8(f2[1]) + DIV_8(f3[1]) + 0x04040404; + of[2]=DIV_2(f[2]) + DIV_8(f[3]) + DIV_8(f[1]) + DIV_8(f2[2]) + DIV_8(f3[2]) + 0x04040404; + of[3]=DIV_2(f[3]) + DIV_8(f[4]) + DIV_8(f[2]) + DIV_8(f2[3]) + DIV_8(f3[3]) + 0x04040404; + f+=4; f2+=4; f3+=4; of+=4; + } + } + else + { + while (x--) + { + of[0]=DIV_2(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + DIV_8(f3[0]); + of[1]=DIV_2(f[1]) + DIV_8(f[2]) + DIV_8(f[0]) + DIV_8(f2[1]) + DIV_8(f3[1]); + of[2]=DIV_2(f[2]) + DIV_8(f[3]) + DIV_8(f[1]) + DIV_8(f2[2]) + DIV_8(f3[2]); + of[3]=DIV_2(f[3]) + DIV_8(f[4]) + DIV_8(f[2]) + DIV_8(f2[3]) + DIV_8(f3[3]); + f+=4; f2+=4; f3+=4; of+=4; + } + } +#else + { + __asm + { + mov ecx, w + mov edx, ecx + mov ebx, edx + neg ebx + mov esi, f + mov edi, of + sub ecx, 2 + shr ecx, 2 + movq mm1, [esi-4] + align 16 +mmx_normal_blur_loop: + movq mm0, [esi] + + movq mm2, [esi+4] + pand mm0, mmx_mask1 + + movq mm5, mm2 + + movq mm7, [esi+8] + pand mm1, mmx_mask3 + + movq mm3, [esi+edx*4] + pand mm2, mmx_mask3 + + movq mm4, [esi+ebx*4] + pand mm3, mmx_mask3 + + psrl mm0, 1 + pand mm4, mmx_mask3 + + psrl mm1, 3 + pand mm7, mmx_mask1 + + movq mm6, [esi+12] + psrl mm2, 3 + + add esi, 16 + psrl mm3, 3 + + paddb mm0, mm1 + psrl mm4, 3 + + movq mm1, mm6 + + paddb mm2, mm3 + paddb mm0, mm4 + + movq mm3, [esi+edx*4-8] + paddb mm0, mm2 + + movq mm4, [esi+ebx*4-8] + paddb mm0, [adj2] + + pand mm6, mmx_mask3 + + movq [edi],mm0 + pand mm5, mmx_mask3 + + psrl mm7, 1 + pand mm3, mmx_mask3 + + psrl mm6, 3 + pand mm4, mmx_mask3 + + psrl mm5, 3 + paddb mm7, mm6 + + add edi, 16 + psrl mm3, 3 + + psrl mm4, 3 + paddb mm5, mm3 + + paddb mm7, mm4 + dec ecx + + paddb mm7, mm5 + paddb mm7, [adj2] + + movq [edi-8],mm7 + + jnz mmx_normal_blur_loop + mov of, edi + mov f, esi + }; + f2=f+w; // update these bitches + f3=f-w; + } +#endif + x=(w-2)&3; + while (x--) + { + *of++=DIV_2(f[0]) + DIV_8(f[1]) + DIV_8(f[-1]) + DIV_8(f2[0]) + DIV_8(f3[0]) + adj_tl2; + f++; + f2++; + f3++; + } + + // right block + *of++=DIV_4(f[0])+DIV_4(f[-1])+DIV_4(f2[0])+DIV_4(f3[0]) + adj_tl1; f++; + } + } + + // bottom block + if (at_bottom) + { + unsigned int *f2=f-w; + int adj_tl=0, adj_tl2=0; + if (roundmode) { adj_tl = 0x02020202; adj_tl2 = 0x03030303; } + int x; + // bottom left + *of++=DIV_2(f[0])+DIV_4(f[1])+DIV_4(f2[0]) + adj_tl; f++; f2++; + // bottom center + x=(w-2)/4; + while (x--) + { + of[0]=DIV_4(f[0]) + DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + adj_tl2; + of[1]=DIV_4(f[1]) + DIV_4(f[2]) + DIV_4(f[0]) + DIV_4(f2[1]) + adj_tl2; + of[2]=DIV_4(f[2]) + DIV_4(f[3]) + DIV_4(f[1]) + DIV_4(f2[2]) + adj_tl2; + of[3]=DIV_4(f[3]) + DIV_4(f[4]) + DIV_4(f[2]) + DIV_4(f2[3]) + adj_tl2; + f+=4; + f2+=4; + of+=4; + } + x=(w-2)&3; + while (x--) + { + *of++=DIV_4(f[0]) + DIV_4(f[1]) + DIV_4(f[-1]) + DIV_4(f2[0]) + adj_tl2; + f++; + f2++; + } + // bottom right + *of++=DIV_2(f[0])+DIV_4(f[-1])+DIV_4(f2[0]) + adj_tl; f++; f2++; + } + } + +#ifndef NO_MMX + __asm emms; +#endif + + timingLeave(0); +} + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return 0; + return max_threads; +} + + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return !!enabled; +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + + +C_RBASE *R_Blur(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + if (g_this->enabled==2) CheckDlgButton(hwndDlg,IDC_RADIO3,BST_CHECKED); + else if (g_this->enabled==3) CheckDlgButton(hwndDlg,IDC_RADIO4,BST_CHECKED); + else if (g_this->enabled) CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + if (g_this->roundmode==0) CheckDlgButton(hwndDlg,IDC_ROUNDDOWN,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_ROUNDUP,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_RADIO1) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) + g_this->enabled=0; + if (LOWORD(wParam) == IDC_RADIO2) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO2)) + g_this->enabled=1; + if (LOWORD(wParam) == IDC_RADIO3) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO3)) + g_this->enabled=2; + if (LOWORD(wParam) == IDC_RADIO4) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO4)) + g_this->enabled=3; + if (LOWORD(wParam) == IDC_ROUNDUP) + if (IsDlgButtonChecked(hwndDlg,IDC_ROUNDUP)) + g_this->roundmode=1; + if (LOWORD(wParam) == IDC_ROUNDDOWN) + if (IsDlgButtonChecked(hwndDlg,IDC_ROUNDDOWN)) + g_this->roundmode=0; + return 0; + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BLUR,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_Blur(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_bpm.cpp b/Src/Plugins/Visualization/vis_avs/r_bpm.cpp new file mode 100644 index 00000000..9ed19d16 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_bpm.cpp @@ -0,0 +1,285 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include <stdio.h> +#include <math.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#define MOD_NAME "Misc / Custom BPM" +#define C_THISCLASS C_BpmClass + +#define SET_BEAT 0x10000000 +#define CLR_BEAT 0x20000000 + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_MISC_CUSTOM_BPM,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + void SliderStep(int Ctl, int *slide); + int enabled; + int arbitrary, skip, invert; // Type of action, adapt = detect beat + int arbVal, skipVal; // Values of arbitrary beat and beat skip + DWORD arbLastTC; // Last tick count used for arbitrary beat + int skipCount; // Beat counter used by beat skipper + int inInc, outInc; // +1/-1, Used by the nifty beatsynced sliders + int inSlide, outSlide; // Positions of sliders + int oldInSlide, oldOutSlide; // Used by timer to detect changes in sliders + int skipfirst; + int count; + }; + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + skipfirst=0; + inSlide=0; + outSlide=0; + oldInSlide=0; + oldOutSlide=0; + enabled = 1; + arbLastTC = GetTickCount(); + arbitrary=1; + arbVal = 500; + skipVal = 1; + skipCount = 0; + skip=0; + invert=0; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { arbitrary=GET_INT(); pos+=4; } + if (len-pos >= 4) { skip=GET_INT(); pos+=4; } + if (len-pos >= 4) { invert=GET_INT(); pos+=4; } + if (len-pos >= 4) { arbVal=GET_INT(); pos+=4; } + if (len-pos >= 4) { skipVal=GET_INT(); pos+=4; } + if (len-pos >= 4) { skipfirst=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(arbitrary); pos+=4; + PUT_INT(skip); pos+=4; + PUT_INT(invert); pos+=4; + PUT_INT(arbVal); pos+=4; + PUT_INT(skipVal); pos+=4; + PUT_INT(skipfirst); pos+=4; + return pos; +} + + + +void C_THISCLASS::SliderStep(int Ctl, int *slide) +{ +*slide += Ctl == IDC_IN ? inInc : outInc; +if (!*slide || *slide == 8) (Ctl == IDC_IN ? inInc : outInc) *= -1; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return 0; + if (isBeat&0x80000000) return 0; + + if (isBeat) // Show the beat received from AVS + { + SliderStep(IDC_IN, &inSlide); + count++; + } + + if (skipfirst != 0 && count <= skipfirst) + return isBeat ? CLR_BEAT : 0; + + if (arbitrary) + { + DWORD TCNow = GetTickCount(); + if (TCNow > arbLastTC + arbVal) + { + arbLastTC = TCNow; + SliderStep(IDC_OUT, &outSlide); + return SET_BEAT; + } + return CLR_BEAT; + } + + if (skip) + { + if (isBeat && ++skipCount >= skipVal+1) + { + skipCount = 0; + SliderStep(IDC_OUT, &outSlide); + return SET_BEAT; + } + return CLR_BEAT; + } + + if (invert) + { + if (isBeat) + return CLR_BEAT; + else + { + SliderStep(IDC_OUT, &outSlide); + return SET_BEAT; + } + } +return 0; +} + +// configuration dialog stuff + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + { + char txt[40], beat[16], beats[16]; + g_ConfigThis->inInc = 1; + g_ConfigThis->outInc = 1; + g_ConfigThis->inSlide = 0; + g_ConfigThis->outSlide = 0; + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->arbitrary) CheckDlgButton(hwndDlg,IDC_ARBITRARY,BST_CHECKED); + if (g_ConfigThis->skip) CheckDlgButton(hwndDlg,IDC_SKIP,BST_CHECKED); + if (g_ConfigThis->invert) CheckDlgButton(hwndDlg,IDC_INVERT,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_ARBVAL, TBM_SETTICFREQ, 100, 0); + SendDlgItemMessage(hwndDlg, IDC_SKIPVAL, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_ARBVAL, TBM_SETRANGE, TRUE, MAKELONG(200, 10000)); + SendDlgItemMessage(hwndDlg, IDC_SKIPVAL, TBM_SETRANGE, TRUE, MAKELONG(1, 16)); + SendDlgItemMessage(hwndDlg, IDC_ARBVAL, TBM_SETPOS, TRUE, g_ConfigThis->arbVal); + SendDlgItemMessage(hwndDlg, IDC_SKIPVAL, TBM_SETPOS, TRUE, g_ConfigThis->skipVal); + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETRANGE, TRUE, MAKELONG(0, 8)); + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETRANGE, TRUE, MAKELONG(0, 8)); + SendDlgItemMessage(hwndDlg, IDC_SKIPFIRST, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_SKIPFIRST, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_SKIPFIRST, TBM_SETPOS, TRUE, g_ConfigThis->skipfirst); + wsprintf(txt, "%d bpm", 60000 / g_ConfigThis->arbVal); + SetDlgItemText(hwndDlg, IDC_ARBTXT, txt); + WASABI_API_LNGSTRING_BUF(IDS_BEAT,beat,16); + WASABI_API_LNGSTRING_BUF(IDS_BEATS,beats,16); + wsprintf(txt, "%d %s", g_ConfigThis->skipVal, g_ConfigThis->skipVal > 1 ? beats : beat); + SetDlgItemText(hwndDlg, IDC_SKIPTXT, txt); + wsprintf(txt, "%d %s", g_ConfigThis->skipfirst, g_ConfigThis->skipfirst > 1 ? beats : beat); + SetDlgItemText(hwndDlg, IDC_SKIPFIRSTTXT, txt); + SetTimer(hwndDlg, 0, 50, NULL); + } + return 1; + case WM_TIMER: + { + if (g_ConfigThis->oldInSlide != g_ConfigThis->inSlide) { + SendDlgItemMessage(hwndDlg, IDC_IN, TBM_SETPOS, TRUE, g_ConfigThis->inSlide); g_ConfigThis->oldInSlide=g_ConfigThis->inSlide; } + if (g_ConfigThis->oldOutSlide != g_ConfigThis->outSlide) { + SendDlgItemMessage(hwndDlg, IDC_OUT, TBM_SETPOS, TRUE, g_ConfigThis->outSlide); g_ConfigThis->oldOutSlide=g_ConfigThis->outSlide; } + } + return 0; + case WM_NOTIFY: + { + char txt[40], beat[16], beats[16]; + if (LOWORD(wParam) == IDC_ARBVAL) + g_ConfigThis->arbVal = SendDlgItemMessage(hwndDlg, IDC_ARBVAL, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_SKIPVAL) + g_ConfigThis->skipVal = SendDlgItemMessage(hwndDlg, IDC_SKIPVAL, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_SKIPFIRST) + g_ConfigThis->skipfirst = SendDlgItemMessage(hwndDlg, IDC_SKIPFIRST, TBM_GETPOS, 0, 0); + wsprintf(txt, "%d bpm", 60000 / g_ConfigThis->arbVal); + SetDlgItemText(hwndDlg, IDC_ARBTXT, txt); + WASABI_API_LNGSTRING_BUF(IDS_BEAT,beat,16); + WASABI_API_LNGSTRING_BUF(IDS_BEATS,beats,16); + wsprintf(txt, "%d %s", g_ConfigThis->skipVal, g_ConfigThis->skipVal > 1 ? beats : beat); + SetDlgItemText(hwndDlg, IDC_SKIPTXT, txt); + wsprintf(txt, "%d %s", g_ConfigThis->skipfirst, g_ConfigThis->skipfirst > 1 ? beats : beat); + SetDlgItemText(hwndDlg, IDC_SKIPFIRSTTXT, txt); + return 0; + } + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ARBITRARY) || + (LOWORD(wParam) == IDC_SKIP) || + (LOWORD(wParam) == IDC_INVERT)) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->arbitrary=IsDlgButtonChecked(hwndDlg,IDC_ARBITRARY)?1:0; + g_ConfigThis->skip=IsDlgButtonChecked(hwndDlg,IDC_SKIP)?1:0; + g_ConfigThis->invert=IsDlgButtonChecked(hwndDlg,IDC_INVERT)?1:0; + } + return 0; + case WM_DESTROY: + KillTimer(hwndDlg, 0); + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BPM,hwndParent,g_DlgProc); +} + +C_RBASE *R_Bpm(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} diff --git a/Src/Plugins/Visualization/vis_avs/r_bright.cpp b/Src/Plugins/Visualization/vis_avs/r_bright.cpp new file mode 100644 index 00000000..bb224add --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_bright.cpp @@ -0,0 +1,506 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include <math.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +#define MOD_NAME "Trans / Brightness" +#define C_THISCLASS C_BrightnessClass + +class C_THISCLASS : public C_RBASE2 { + 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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BRIGHTNESS,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + + int enabled; + int redp, greenp, bluep; + int blend, blendavg; + int dissoc; + int color; + int exclude; + int distance; + int tabs_needinit; + int green_tab[256]; + int red_tab[256]; + int blue_tab[256]; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + tabs_needinit=1; + redp=0; + bluep=0; + greenp=0; + blend=0; + blendavg=1; + enabled=1; + color=0; + exclude=0; + distance = 16; + dissoc=0; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { redp=GET_INT(); pos+=4; } + if (len-pos >= 4) { greenp=GET_INT(); pos+=4; } + if (len-pos >= 4) { bluep=GET_INT(); pos+=4; } + if (len-pos >= 4) { dissoc=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { exclude=GET_INT(); pos+=4; } + if (len-pos >= 4) { distance=GET_INT(); pos+=4; } + tabs_needinit=1; +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(redp); pos+=4; + PUT_INT(greenp); pos+=4; + PUT_INT(bluep); pos+=4; + PUT_INT(dissoc); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(exclude); pos+=4; + PUT_INT(distance); pos+=4; + return pos; +} + +static __inline int iabs(int v) +{ +return (v<0) ? -v : v; +} + +static __inline int inRange(int color, int ref, int distance) +{ +if (iabs((color & 0xFF) - (ref & 0xFF)) > distance) return 0; +if (iabs(((color) & 0xFF00) - ((ref) & 0xFF00)) > (distance<<8)) return 0; +if (iabs(((color) & 0xFF0000) - ((ref) & 0xFF0000)) > (distance<<16)) return 0; +return 1; +} + +static void mmx_brighten_block(int *p, int rm, int gm, int bm, int l) +{ + int poo[2]= + { + (bm>>8)|((gm>>8)<<16), + rm>>8 + }; + __asm + { + mov eax, p + mov ecx, l + movq mm1, [poo] + align 16 +mmx_brightblock_loop: + pxor mm0, mm0 + punpcklbw mm0, [eax] + + pmulhw mm0, mm1 + packuswb mm0, mm0 + + movd [eax], mm0 + + add eax, 4 + + dec ecx + jnz mmx_brightblock_loop + emms + }; +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int rm=(int)((1+(redp < 0 ? 1 : 16)*((float)redp/4096))*65536.0); + int gm=(int)((1+(greenp < 0 ? 1 : 16)*((float)greenp/4096))*65536.0); + int bm=(int)((1+(bluep < 0 ? 1 : 16)*((float)bluep/4096))*65536.0); + + if (!enabled) return 0; + if (tabs_needinit) + { + int n; + for (n = 0; n < 256; n ++) + { + red_tab[n] = (n*rm)&0xffff0000; + if (red_tab[n]>0xff0000) red_tab[n]=0xff0000; + if (red_tab[n]<0) red_tab[n]=0; + green_tab[n] = ((n*gm)>>8)&0xffff00; + if (green_tab[n]>0xff00) green_tab[n]=0xff00; + if (green_tab[n]<0) green_tab[n]=0; + blue_tab[n] = ((n*bm)>>16)&0xffff; + if (blue_tab[n]>0xff) blue_tab[n]=0xff; + if (blue_tab[n]<0) blue_tab[n]=0; + } + tabs_needinit=0; + } + if (isBeat&0x80000000) return 0; + + return max_threads; +} + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return 0; +} + + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled || (isBeat&0x80000000)) return; + + if (max_threads < 1) max_threads=1; + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + int l=w*outh; + + int *p = framebuffer + start_l * w; + if (blend) + { + if (!exclude) + { + while (l--) + { + int pix=*p; + *p++ = BLEND(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]); + } + } + else + { + while (l--) + { + int pix=*p; + if (!inRange(pix,color,distance)) + { + *p = BLEND(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]); + } + p++; + } + } + } + else if (blendavg) + { + if (!exclude) + { + while (l--) + { + int pix=*p; + *p++ = BLEND_AVG(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]); + } + } + else + { + while (l--) + { + int pix=*p; + if (!inRange(pix,color,distance)) + { + *p = BLEND_AVG(pix, red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]); + } + p++; + } + } + } + else + { + if (!exclude) + { +#if 1 // def NO_MMX + while (l--) + { + int pix=*p; + *p++ = red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]; + } +#else + mmx_brighten_block(p,rm,gm,bm,l); +#endif + } + else + { + while (l--) + { + int pix=*p; + if (!inRange(pix,color,distance)) + { + *p = red_tab[(pix>>16)&0xff] | green_tab[(pix>>8)&0xff] | blue_tab[pix&0xff]; + } + p++; + } + } + } +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETRANGEMIN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETRANGEMIN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETRANGEMIN, TRUE, 0); + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETRANGEMAX, TRUE, 8192); + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETRANGEMAX, TRUE, 8192); + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETRANGEMAX, TRUE, 8192); + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETTICFREQ, 256, 0); + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETTICFREQ, 256, 0); + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETTICFREQ, 256, 0); + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096); + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096); + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETPOS, TRUE, g_ConfigThis->distance); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETTICFREQ, 16, 0); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->exclude) CheckDlgButton(hwndDlg,IDC_EXCLUDE,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (g_ConfigThis->dissoc) CheckDlgButton(hwndDlg,IDC_DISSOC,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_DISTANCE) + { + g_ConfigThis->distance = SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_GETPOS, 0, 0); + } + if (LOWORD(wParam) == IDC_RED) + { + g_ConfigThis->redp = SendDlgItemMessage(hwndDlg, IDC_RED, TBM_GETPOS, 0, 0)-4096; + rred: + g_ConfigThis->tabs_needinit=1; + if (!g_ConfigThis->dissoc) + { + g_ConfigThis->greenp = g_ConfigThis->redp; + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096); + g_ConfigThis->bluep = g_ConfigThis->redp; + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096); + } + } + if (LOWORD(wParam) == IDC_GREEN) + { + g_ConfigThis->greenp = SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_GETPOS, 0, 0)-4096; + rgreen: + g_ConfigThis->tabs_needinit=1; + if (!g_ConfigThis->dissoc) + { + g_ConfigThis->redp = g_ConfigThis->greenp; + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096); + g_ConfigThis->bluep = g_ConfigThis->greenp; + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096); + } + } + if (LOWORD(wParam) == IDC_BLUE) + { + g_ConfigThis->bluep = SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_GETPOS, 0, 0)-4096; + rblue: + g_ConfigThis->tabs_needinit=1; + if (!g_ConfigThis->dissoc) + { + g_ConfigThis->redp = g_ConfigThis->bluep; + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096); + g_ConfigThis->greenp = g_ConfigThis->bluep; + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096); + } + } + return 0; + } + case WM_COMMAND: + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + if (LOWORD(wParam) == IDC_BRED) + { + g_ConfigThis->redp = 0; + SendDlgItemMessage(hwndDlg, IDC_RED, TBM_SETPOS, TRUE, g_ConfigThis->redp+4096); + goto rred; // gotos are so sweet ;) + } + if (LOWORD(wParam) == IDC_BGREEN) + { + g_ConfigThis->greenp = 0; + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096); + goto rgreen; + } + if (LOWORD(wParam) == IDC_BBLUE) + { + g_ConfigThis->bluep = 0; + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096); + goto rblue; + } + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_EXCLUDE) || + (LOWORD(wParam) == IDC_DISSOC) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->exclude=IsDlgButtonChecked(hwndDlg,IDC_EXCLUDE)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->dissoc=IsDlgButtonChecked(hwndDlg,IDC_DISSOC)?1:0; + if (!g_ConfigThis->dissoc) + { + g_ConfigThis->greenp = g_ConfigThis->redp; + SendDlgItemMessage(hwndDlg, IDC_GREEN, TBM_SETPOS, TRUE, g_ConfigThis->greenp+4096); + g_ConfigThis->bluep = g_ConfigThis->redp; + SendDlgItemMessage(hwndDlg, IDC_BLUE, TBM_SETPOS, TRUE, g_ConfigThis->bluep+4096); + } + } + return 0; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BRIGHTNESS,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Brightness(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +#else +C_RBASE *R_Brightness(char *desc) { return NULL; } +#endif diff --git a/Src/Plugins/Visualization/vis_avs/r_bspin.cpp b/Src/Plugins/Visualization/vis_avs/r_bspin.cpp new file mode 100644 index 00000000..dac61a1b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_bspin.cpp @@ -0,0 +1,315 @@ +/* + 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. + +*/ +// alphachannel safe (sets alpha to 0 on rendered portions) 11/21/99 + +#include <windows.h> +#include <math.h> +#include "r_defs.h" + +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_BSpinClass +#define MOD_NAME "Render / Bass Spin" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_BASS_SPIN,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + void my_triangle(int *fb, int points[6], int width, int height, int color); + int enabled; + int colors[2]; + int mode; + + + int last_a; + int lx[2][2],ly[2][2]; + double r_v[2]; + double v[2]; + double dir[2]; +}; + + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { colors[0]=GET_INT(); pos+=4; } + if (len-pos >= 4) { colors[1]=GET_INT(); pos+=4; } + if (len-pos >= 4) { mode=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(colors[0]); pos+=4; + PUT_INT(colors[1]); pos+=4; + PUT_INT(mode); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + last_a=0; + enabled=3; + colors[0]=RGB(255,255,255); + colors[1]=RGB(255,255,255); + memset(lx,0,sizeof(lx)); + memset(ly,0,sizeof(ly)); + memset(v,0,sizeof(v)); + r_v[0]=3.14159; + r_v[1]=0.0; + dir[0]=-1.0; + dir[1]=1.0; + mode=1; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int y,x; + if (isBeat&0x80000000) return 0; + for (y = 0; y < 2; y ++) + { + if (!(enabled&(1<<y))) continue; + unsigned char *fa_data=(unsigned char *)visdata[0][y]; + int xp,yp; + int ss=min(h/2,(w*3)/8); + double s=(double)ss; + int c_x = (!y?w/2-ss/2:w/2+ss/2); + int a=0,d=0; + int nc=1; + int oc6 = colors[y]; + for (x = 0; x < 44; x ++) + { + d+=fa_data[x]; + } + + a=(d*512)/(last_a+30*256); + + last_a=d; + + if (a > 255) a =255; + v[y] = 0.7*(max(a-104,12)/96.0) + 0.3*v[y]; + r_v[y] += 3.14159/6.0 * v[y] * dir[y]; + + s *= a*1.0/256.0f; + yp=(int)(sin(r_v[y])*s); + xp=(int)(cos(r_v[y])*s); + if (mode==0) + { + if (lx[0][y] || ly[0][y]) line(framebuffer,lx[0][y],ly[0][y],xp+c_x,yp+h/2,w,h,oc6,(g_line_blend_mode&0xff0000)>>16); + lx[0][y]=xp+c_x; + ly[0][y]=yp+h/2; + line(framebuffer,c_x,h/2,c_x+xp,h/2+yp,w,h,oc6,(g_line_blend_mode&0xff0000)>>16); + if (lx[1][y] || ly[1][y]) line(framebuffer,lx[1][y],ly[1][y],c_x-xp,h/2-yp,w,h,oc6,(g_line_blend_mode&0xff0000)>>16); + lx[1][y]=c_x-xp; + ly[1][y]=h/2-yp; + line(framebuffer,c_x,h/2,c_x-xp,h/2-yp,w,h,oc6,(g_line_blend_mode&0xff0000)>>16); + } + else if (mode==1) + { + if (lx[0][y] || ly[0][y]) + { + int points[6] = { c_x,h/2, lx[0][y], ly[0][y], xp+c_x,yp+h/2 }; + my_triangle(framebuffer,points,w,h,oc6); + } + lx[0][y]=xp+c_x; + ly[0][y]=yp+h/2; + if (lx[1][y] || ly[1][y]) + { + int points[6] = { c_x,h/2, lx[1][y], ly[1][y], c_x-xp,h/2-yp }; + my_triangle(framebuffer,points,w,h,oc6); + } + lx[1][y]=c_x-xp; + ly[1][y]=h/2-yp; + } + } + return 0; +} + +C_RBASE *R_BSpin(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; + switch (di->CtlID) + { + case IDC_LC: + GR_DrawColoredButton(di,g_this->colors[0]); + break; + case IDC_RC: + GR_DrawColoredButton(di,g_this->colors[1]); + break; + } + } + return 0; + case WM_INITDIALOG: + if (g_this->enabled&1) CheckDlgButton(hwndDlg,IDC_LEFT,BST_CHECKED); + if (g_this->enabled&2) CheckDlgButton(hwndDlg,IDC_RIGHT,BST_CHECKED); + if (g_this->mode==0) CheckDlgButton(hwndDlg,IDC_LINES,BST_CHECKED); + if (g_this->mode==1) CheckDlgButton(hwndDlg,IDC_TRI,BST_CHECKED); + + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_LINES: + g_this->mode=IsDlgButtonChecked(hwndDlg,IDC_LINES)?0:1; + return 0; + case IDC_TRI: + g_this->mode=IsDlgButtonChecked(hwndDlg,IDC_TRI)?1:0; + return 0; + case IDC_LEFT: + g_this->enabled&=~1; + g_this->enabled|=IsDlgButtonChecked(hwndDlg,IDC_LEFT)?1:0; + return 0; + case IDC_RIGHT: + g_this->enabled&=~2; + g_this->enabled|=IsDlgButtonChecked(hwndDlg,IDC_RIGHT)?2:0; + return 0; + case IDC_LC: + if (!a) a=&g_this->colors[0]; + case IDC_RC: + if (!a) a=&g_this->colors[1]; + GR_SelectColor(hwndDlg,a); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + return 0; + + + } + + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BSPIN,hwndParent,g_DlgProc); +} + + + +#define F16(x) ((x)<<16) + +void C_THISCLASS::my_triangle(int *fb, int points[6], int width, int height, int color) +{ + int ymax; + int p; + int y; + int dx1,dx2; + int x1,x2; + for (y = 0; y < 2; y ++) + { + if (points[1] > points[3]) + { + p=points[2]; points[2]=points[0]; points[0]=p; + p=points[3]; points[3]=points[1]; points[1]=p; + } + if (points[3] > points[5]) + { + p=points[4]; points[4]=points[2]; points[2]=p; + p=points[5]; points[5]=points[3]; points[3]=p; + } + } + + x1=x2=F16(points[0]); + if (points[1] < points[3]) + { + dx1 = F16(points[2]-points[0])/(points[3]-points[1]); + } else dx1=0; + + if (points[1] < points[5]) + dx2 = F16(points[4]-points[0])/(points[5]-points[1]); + else dx2=0; + + fb += points[1]*width; + ymax = min(points[5],height); + for (y = points[1]; y < ymax; y ++) + { + if (y == points[3]) + { + if (y == points[5]) return; + x1=F16(points[2]); + dx1=F16(points[4]-points[2])/(points[5]-points[3]); + } + if (y >= 0) { + int x,xl; + x=(min(x1,x2)-32768)>>16; + xl=((max(x1,x2)+32768)>>16)-x; + if (xl < 0) xl=-xl; + if (!xl) xl++; + { + int *t=fb+x; + if (x < 0) { t-=x; xl-=x; } + if (x+xl >= width) xl=width-x; + if (xl>0) while (xl--) BLEND_LINE(t++,color); + } + } + fb += width; + x1+=dx1; + x2+=dx2; + } + +} + +#else +C_RBASE *R_BSpin(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_bump.cpp b/Src/Plugins/Visualization/vis_avs/r_bump.cpp new file mode 100644 index 00000000..5d0e5fdd --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_bump.cpp @@ -0,0 +1,562 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include <stdio.h> +#include "resource.h" +#include "r_defs.h" +#include "r_stack.h" +#include "avs_eelif.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Bump" +#define C_THISCLASS C_BumpClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + float GET_FLOAT(unsigned char *data, int pos); + void PUT_FLOAT(float f, unsigned char *data, int pos); + void InitializeStars(int Start); + void CreateStar(int A); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_BUMP,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int __inline depthof(int c, int i); + int enabled; + int depth; + int depth2; + int onbeat; + int durFrames; + int thisDepth; + int blend; + int blendavg; + int nF; + NSEEL_CODEHANDLE codeHandle; + NSEEL_CODEHANDLE codeHandleBeat; + NSEEL_CODEHANDLE codeHandleInit; + double *var_x; + double *var_y; + double *var_isBeat; + double *var_isLongBeat; + double *var_bi; + RString code1,code2,code3; + int need_recompile; + int showlight; + int initted; + int invert; + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + int oldstyle; + int buffern; + CRITICAL_SECTION rcs; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ + freeCode(codeHandle); + freeCode(codeHandleBeat); + freeCode(codeHandleInit); + DeleteCriticalSection(&rcs); + AVS_EEL_QUITINST(); +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + AVS_EEL_INITINST(); + InitializeCriticalSection(&rcs); + buffern=0; + oldstyle=0; + invert=0; + enabled=1; + onbeat = 0; + durFrames = 15; + depth=30; + depth2=100; + nF=0; + showlight=0; + thisDepth=depth; + blend = 0; + blendavg = 0; + code1.assign("x=0.5+cos(t)*0.3;\r\ny=0.5+sin(t)*0.3;\r\nt=t+0.1;"); + code2.assign(""); + code3.assign("t=0;"); + codeHandle=0; + codeHandleBeat=0; + codeHandleInit=0; + var_bi=0; + initted=0; + + need_recompile=1; +} + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { durFrames=GET_INT(); pos+=4; } + if (len-pos >= 4) { depth=GET_INT(); pos+=4; } + if (len-pos >= 4) { depth2=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + load_string(code1,data,pos,len); + load_string(code2,data,pos,len); + load_string(code3,data,pos,len); + if (len-pos >= 4) { showlight=GET_INT(); pos+=4; } + if (len-pos >= 4) { invert=GET_INT(); pos+=4; } + if (len-pos >= 4) { oldstyle=GET_INT(); pos+=4; } else oldstyle=1; + if (len-pos >= 4) { buffern=GET_INT(); pos+=4; } + thisDepth=depth; + nF=0; + + need_recompile=1; +} + +#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 + + +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_INT(durFrames); pos+=4; + PUT_INT(depth); pos+=4; + PUT_INT(depth2); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + save_string(data, pos, code1); + save_string(data, pos, code2); + save_string(data, pos, code3); + PUT_INT(showlight); pos+=4; + PUT_INT(invert); pos+=4; + PUT_INT(oldstyle); pos+=4; + PUT_INT(buffern); pos+=4; + return pos; +} + +int __inline C_THISCLASS::depthof(int c, int i) +{ +int r= max(max((c & 0xFF), ((c & 0xFF00)>>8)), (c & 0xFF0000)>>16); +return i ? 255 - r : r; +} + +static int __inline setdepth(int l, int c) +{ +int r; +r=min((c&0xFF)+l, 254); +r|=min(((c&0xFF00))+(l<<8),254<<8); +r|=min(((c&0xFF0000))+(l<<16),254<<16); +return r; +} + +static int __inline setdepth0(int c) +{ +int r; +r=min((c&0xFF), 254); +r|=min(((c&0xFF00)),254<<8); +r|=min(((c&0xFF0000)),254<<16); +return r; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. +#define abs(x) (( x ) >= 0 ? ( x ) : - ( x )) + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int cx,cy; + int curbuf; + + if (!enabled) return 0; + + if (need_recompile) + { + EnterCriticalSection(&rcs); + if (!var_bi || g_reset_vars_on_recompile) + { + clearVars(); + var_x = registerVar("x"); + var_y = registerVar("y"); + var_isBeat = registerVar("isbeat"); + var_isLongBeat = registerVar("islbeat"); + var_bi = registerVar("bi"); + *var_bi = 1.0; + initted=0; + } + + need_recompile=0; + + freeCode(codeHandle); + freeCode(codeHandleBeat); + freeCode(codeHandleInit); + codeHandle = compileCode(code1.get()); + codeHandleBeat = compileCode(code2.get()); + codeHandleInit = compileCode(code3.get()); + + LeaveCriticalSection(&rcs); + } + if (isBeat&0x80000000) return 0; + + int *depthbuffer = !buffern ? framebuffer : (int *)getGlobalBuffer(w,h,buffern-1,0); + if (!depthbuffer) return 0; + + curbuf = (depthbuffer==framebuffer); + + if (!initted) + { + executeCode(codeHandleInit,visdata); + initted=1; + } + + executeCode(codeHandle,visdata); + if (isBeat) executeCode(codeHandleBeat,visdata); + + if (isBeat) + *var_isBeat=-1; + else + *var_isBeat=1; + if (nF) + *var_isLongBeat=-1; + else + *var_isLongBeat=1; + + if (onbeat && isBeat) + { + thisDepth=depth2; + nF = durFrames; + } + else if (!nF) thisDepth = depth; + + memset(fbout, 0, w*h*4); // previous effects may have left fbout in a mess + + if (oldstyle) + { + cx = (int)(*var_x/100.0*w); + cy = (int)(*var_y/100.0*h); + } + else + { + cx = (int)(*var_x*w); + cy = (int)(*var_y*h); + } + cx = max(0, min(w, cx)); + cy = max(0, min(h, cy)); + if (showlight) fbout[cx+cy*w]=0xFFFFFF; + + if (var_bi) + { + *var_bi = min(max(*var_bi, 0), 1); + thisDepth = (int)(thisDepth * *var_bi); + } + + int thisDepth_scaled=(thisDepth<<8)/100; + depthbuffer += w+1; + framebuffer += w+1; + fbout += w+1; + + int ly=1-cy; + int i=h-2; + while (i--) + { + int j=w-2; + int lx=1-cx; + if (blend) + { + while (j--) + { + int m1,p1,mw,pw; + m1=depthbuffer[-1]; + p1=depthbuffer[1]; + mw=depthbuffer[-w]; + pw=depthbuffer[w]; + if (!curbuf || (curbuf && (m1||p1||mw||pw))) + { + int coul1,coul2; + coul1=depthof(p1, invert)-depthof(m1, invert)-lx; + coul2=depthof(pw, invert)-depthof(mw, invert)-ly; + coul1=127-abs(coul1); + coul2=127-abs(coul2); + if (coul1<=0||coul2<=0) + coul1=setdepth0(framebuffer[0]); + else + coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]); + fbout[0]=BLEND(framebuffer[0], coul1); + } + depthbuffer++; + framebuffer++; + fbout++; + lx++; + } + } + else if (blendavg) + { + while (j--) + { + int m1,p1,mw,pw; + m1=depthbuffer[-1]; + p1=depthbuffer[1]; + mw=depthbuffer[-w]; + pw=depthbuffer[w]; + if (!curbuf || (curbuf && (m1||p1||mw||pw))) + { + int coul1,coul2; + coul1=depthof(p1, invert)-depthof(m1, invert)-lx; + coul2=depthof(pw, invert)-depthof(mw, invert)-ly; + coul1=127-abs(coul1); + coul2=127-abs(coul2); + if (coul1<=0||coul2<=0) + coul1=setdepth0(framebuffer[0]); + else + coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]); + fbout[0]=BLEND_AVG(framebuffer[0], coul1); + } + depthbuffer++; + framebuffer++; + fbout++; + lx++; + } + } + else + { + while (j--) + { + int m1,p1,mw,pw; + m1=depthbuffer[-1]; + p1=depthbuffer[1]; + mw=depthbuffer[-w]; + pw=depthbuffer[w]; + if (!curbuf || (curbuf && (m1||p1||mw||pw))) + { + int coul1,coul2; + coul1=depthof(p1, invert)-depthof(m1, invert)-lx; + coul2=depthof(pw, invert)-depthof(mw, invert)-ly; + coul1=127-abs(coul1); + coul2=127-abs(coul2); + if (coul1<=0||coul2<=0) + coul1=setdepth0(framebuffer[0]); + else + coul1=setdepth((coul1*coul2*thisDepth_scaled)>>(8+6), framebuffer[0]); + fbout[0]=coul1; + } + depthbuffer++; + framebuffer++; + fbout++; + lx++; + } + } + depthbuffer+=2; + framebuffer+=2; + fbout+=2; + ly++; + } + + if (nF) + { + nF--; + if (nF) + { + int a = abs(depth - depth2) / durFrames; + thisDepth += a * (depth2 > depth ? -1 : 1); + } + } + + return 1; +} + +// configuration dialog stuff +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg, IDC_CODE1, g_ConfigThis->code1.get()); + SetDlgItemText(hwndDlg, IDC_CODE2, g_ConfigThis->code2.get()); + SetDlgItemText(hwndDlg, IDC_CODE3, g_ConfigThis->code3.get()); + SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_SETPOS, TRUE, g_ConfigThis->depth); + SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_SETPOS, TRUE, g_ConfigThis->depth2); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETPOS, TRUE, g_ConfigThis->durFrames); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->invert) CheckDlgButton(hwndDlg,IDC_INVERTDEPTH,BST_CHECKED); + if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_ONBEAT,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (g_ConfigThis->showlight) CheckDlgButton(hwndDlg,IDC_DOT,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_CURRENT)); + { + int i=0; + char txt[64]; + for (i=0;i<NBUF;i++) + { + wsprintf(txt, WASABI_API_LNGSTRING(IDS_BUFFER_X), i+1); + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)txt); + } + } + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_SETCURSEL, (WPARAM) g_ConfigThis->buffern, 0); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_DEPTH) + g_ConfigThis->depth = SendDlgItemMessage(hwndDlg, IDC_DEPTH, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_DEPTH2) + g_ConfigThis->depth2 = SendDlgItemMessage(hwndDlg, IDC_DEPTH2, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_BEATDUR) + g_ConfigThis->durFrames = SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_GETPOS, 0, 0); + } + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_HELPBTN) + { +/* char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_BUMP_LIGHT_POSITION,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_BUMP_LIGHT_POSITION),4095-titlelen); +*/ + char *text="Bump Light Position\0" + "How to use the custom light position evaluator:\r\n" + " * Init code will be executed each time the window size is changed\r\n" + " or when the effect loads\r\n" + " * Frame code is executed before rendering a new frame\r\n" + " * Beat code is executed when a beat is detected\r\n" + "\r\n" + "Predefined variables:\r\n" + " x : Light x position, ranges from 0 (left) to 1 (right) (0.5 = center)\r\n" + " y : Light y position, ranges from 0 (top) to 1 (bottom) (0.5 = center)\r\n" + " isBeat : 1 if no beat, -1 if beat (weird, but old)\r\n" + " isLBeat: same as isBeat but persists according to 'shorter/longer' settings\r\n" + " (usable only with OnBeat checked)\r\n" + " bi: Bump intensity, ranges from 0 (flat) to 1 (max specified bump, default)\r\n" + " You may also use temporary variables accross code segments\r\n" + "\r\n" + "Some examples:\r\n" + " Circular move\r\n" + " Init : t=0\r\n" + " Frame: x=0.5+cos(t)*0.3; y=0.5+sin(t)*0.3; t=t+0.1;\r\n" + " Nice motion:\r\n" + " Init : t=0;u=0\r\n" + " Frame: x=0.5+cos(t)*0.3; y=0.5+cos(u)*0.3; t=t+0.1; u=u+0.012;\r\n" + ; + compilerfunctionlist(hwndDlg,text); + return 0; + } + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ONBEAT) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_DOT) || + (LOWORD(wParam) == IDC_INVERTDEPTH) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->showlight=IsDlgButtonChecked(hwndDlg,IDC_DOT)?1:0; + g_ConfigThis->invert=IsDlgButtonChecked(hwndDlg,IDC_INVERTDEPTH)?1:0; + } + if (LOWORD(wParam) == IDC_CODE1 && HIWORD(wParam) == EN_CHANGE) + { + EnterCriticalSection(&g_ConfigThis->rcs); + g_ConfigThis->code1.get_from_dlgitem(hwndDlg,IDC_CODE1); + g_ConfigThis->need_recompile=1; + LeaveCriticalSection(&g_ConfigThis->rcs); + } + if (LOWORD(wParam) == IDC_CODE2 && HIWORD(wParam) == EN_CHANGE) + { + EnterCriticalSection(&g_ConfigThis->rcs); + g_ConfigThis->code2.get_from_dlgitem(hwndDlg,IDC_CODE2); + g_ConfigThis->need_recompile=1; + LeaveCriticalSection(&g_ConfigThis->rcs); + } + if (LOWORD(wParam) == IDC_CODE3 && HIWORD(wParam) == EN_CHANGE) + { + EnterCriticalSection(&g_ConfigThis->rcs); + g_ConfigThis->code3.get_from_dlgitem(hwndDlg,IDC_CODE3); + g_ConfigThis->need_recompile=1; + g_ConfigThis->initted=0; + LeaveCriticalSection(&g_ConfigThis->rcs); + } + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMBO1) // handle clicks to combo box + g_ConfigThis->buffern = SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0); + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_BUMP,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Bump(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Bump(char *desc) { return NULL; } +#endif diff --git a/Src/Plugins/Visualization/vis_avs/r_chanshift.cpp b/Src/Plugins/Visualization/vis_avs/r_chanshift.cpp new file mode 100644 index 00000000..7bf60ea4 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_chanshift.cpp @@ -0,0 +1,362 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include <time.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +// this will be the directory and APE name displayed in the AVS Editor +#define MOD_NAME "Trans / Channel Shift" + +#define C_THISCLASS C_ChannelShiftClass + + +typedef struct { + int mode; + int onbeat; +} apeconfig; + +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); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + apeconfig config; + + HWND hwndDlg; +}; + +// global configuration dialog pointer +static C_THISCLASS *g_ConfigThis; +static HINSTANCE g_hDllInstance; + + +// this is where we deal with the configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int ids[] = { IDC_RBG, IDC_BRG, IDC_BGR, IDC_GBR, IDC_GRB, IDC_RGB }; + switch (uMsg) + { + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED) { + for (int i=0;i<sizeof(ids)/sizeof(ids[0]);i++) + if (IsDlgButtonChecked(hwndDlg, ids[i])) + g_ConfigThis->config.mode = ids[i]; + g_ConfigThis->config.onbeat = IsDlgButtonChecked(hwndDlg, IDC_ONBEAT) ? 1 : 0; + } + return 1; + + + case WM_INITDIALOG: + g_ConfigThis->hwndDlg = hwndDlg; + + CheckDlgButton(hwndDlg, g_ConfigThis->config.mode, 1); + if (g_ConfigThis->config.onbeat) + CheckDlgButton(hwndDlg, IDC_ONBEAT, 1); + + return 1; + + case WM_DESTROY: + KillTimer(hwndDlg, 1); + return 1; + } + return 0; +} + +// set up default configuration +C_THISCLASS::C_THISCLASS() +{ + memset(&config, 0, sizeof(apeconfig)); + config.mode = IDC_RBG; + config.onbeat = 1; +} + +// virtual destructor +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + + int c; + int modes[] = { IDC_RGB, IDC_RBG, IDC_GBR, IDC_GRB, IDC_BRG, IDC_BGR }; + + if (isBeat && config.onbeat) { + config.mode = modes[rand() % 6]; + } + + c = w*h; + + switch (config.mode) { + default: + case IDC_RGB: + return 0; + case IDC_RBG: + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp1: + sub ecx, 4; + + mov eax, dword ptr [ebx+ecx*4]; + xchg ah, al; + mov [ebx+ecx*4], eax; + + mov eax, dword ptr [ebx+ecx*4+4]; + xchg ah, al; + mov [ebx+ecx*4+4], eax; + + mov eax, dword ptr [ebx+ecx*4+8]; + xchg ah, al; + mov [ebx+ecx*4+8], eax; + + mov eax, dword ptr [ebx+ecx*4+12]; + xchg ah, al; + mov [ebx+ecx*4+12], eax; + + test ecx, ecx; + jnz lp1; + } + break; + + case IDC_BRG: + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp2: + sub ecx, 4; + + mov eax, dword ptr [ebx+ecx*4]; + mov dl, al; + shr eax, 8; + bswap eax; + mov ah, dl; + bswap eax; + mov [ebx+ecx*4], eax; + + mov eax, dword ptr [ebx+ecx*4+4]; + mov dl, al; + shr eax, 8; + bswap eax; + mov ah, dl; + bswap eax; + mov [ebx+ecx*4+4], eax; + + mov eax, dword ptr [ebx+ecx*4+8]; + mov dl, al; + shr eax, 8; + bswap eax; + mov ah, dl; + bswap eax; + mov [ebx+ecx*4+8], eax; + + mov eax, dword ptr [ebx+ecx*4+12]; + mov dl, al; + shr eax, 8; + bswap eax; + mov ah, dl; + bswap eax; + mov [ebx+ecx*4+12], eax; + + test ecx, ecx; + jnz lp2; + } + break; + + case IDC_BGR: + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp3: + sub ecx, 4; + + mov eax, dword ptr [ebx+ecx*4]; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4], eax; + + mov eax, dword ptr [ebx+ecx*4+4]; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+4], eax; + + mov eax, dword ptr [ebx+ecx*4+8]; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+8], eax; + + mov eax, dword ptr [ebx+ecx*4+12]; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+12], eax; + + test ecx, ecx; + jnz lp3; + } + break; + + case IDC_GBR: + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp4: + sub ecx, 4; + + mov eax, dword ptr [ebx+ecx*4]; + mov edx, eax; + bswap edx; + shl eax, 8; + mov al, dh; + mov [ebx+ecx*4], eax; + + mov eax, dword ptr [ebx+ecx*4+4]; + mov edx, eax; + bswap edx; + shl eax, 8; + mov al, dh; + mov [ebx+ecx*4+4], eax; + + mov eax, dword ptr [ebx+ecx*4+8]; + mov edx, eax; + bswap edx; + shl eax, 8; + mov al, dh; + mov [ebx+ecx*4+8], eax; + + mov eax, dword ptr [ebx+ecx*4+12]; + mov edx, eax; + bswap edx; + shl eax, 8; + mov al, dh; + mov [ebx+ecx*4+12], eax; + + test ecx, ecx; + jnz lp4; + } + break; + + case IDC_GRB: + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp5: + sub ecx, 4; + + mov eax, dword ptr [ebx+ecx*4]; + shl eax, 8; + bswap eax; + xchg ah, al; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4], eax; + + mov eax, dword ptr [ebx+ecx*4+4]; + shl eax, 8; + bswap eax; + xchg ah, al; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+4], eax; + + mov eax, dword ptr [ebx+ecx*4+8]; + shl eax, 8; + bswap eax; + xchg ah, al; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+8], eax; + + mov eax, dword ptr [ebx+ecx*4+12]; + shl eax, 8; + bswap eax; + xchg ah, al; + bswap eax; + shr eax, 8; + mov [ebx+ecx*4+12], eax; + + test ecx, ecx; + jnz lp5; + } + break; + } + return 0; +} + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_CHANSHIFT, hwndParent, (DLGPROC)g_DlgProc); +} + + +char *C_THISCLASS::get_desc(void) +{ + static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_CHANNEL_SHIFT,desc,128):desc); +} + +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + srand((unsigned int)time(0)); + if (len <= sizeof(apeconfig)) + memcpy(&this->config, data, len); +} + + +int C_THISCLASS::save_config(unsigned char *data) +{ + memcpy(data, &this->config, sizeof(apeconfig)); + return sizeof(apeconfig); +} + +C_RBASE *R_ChannelShift(char *desc) +{ + if (desc) { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_THISCLASS(); +} + + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_clear.cpp b/Src/Plugins/Visualization/vis_avs/r_clear.cpp new file mode 100644 index 00000000..21021b6b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_clear.cpp @@ -0,0 +1,231 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Render / Clear screen" +#define C_THISCLASS C_ClearClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_CLEAR_SCREEN,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + int onlyfirst; + int color; + int fcounter; + int blend, blendavg; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + color = 0; + onlyfirst = 0; + fcounter=0; + blend = 0; + blendavg = 0; + enabled=1; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { onlyfirst=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(onlyfirst); pos+=4; + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int i=w*h; + int *p=framebuffer; + + if (!enabled) return 0; + if (onlyfirst && fcounter) return 0; + if (isBeat&0x80000000) return 0; + + fcounter++; + + if (blend==2) while (i--) BLEND_LINE(p++,color); + else if (blend) while (i--) *p++=BLEND(*p,color); + else if (blendavg) while (i--) *p++=BLEND_AVG(*p,color); + else while (i--) *p++=color; + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->onlyfirst) CheckDlgButton(hwndDlg,IDC_CLEARFIRSTFRAME,BST_CHECKED); + if (g_ConfigThis->blend==1) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + else if (g_ConfigThis->blend==2) CheckDlgButton(hwndDlg,IDC_DEFRENDBLEND,BST_CHECKED); + else if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={(COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) || + (LOWORD(wParam) == IDC_DEFRENDBLEND)) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + if (!g_ConfigThis->blend) + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_DEFRENDBLEND)?2:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + } + if (LOWORD(wParam) == IDC_CLEARFIRSTFRAME) + { + g_ConfigThis->onlyfirst=IsDlgButtonChecked(hwndDlg,IDC_CLEARFIRSTFRAME)?1:0; + if (g_ConfigThis->onlyfirst) g_ConfigThis->fcounter=0; + } + + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_CLEAR,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Clear(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Clear(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_colorfade.cpp b/Src/Plugins/Visualization/vis_avs/r_colorfade.cpp new file mode 100644 index 00000000..021a6cd1 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_colorfade.cpp @@ -0,0 +1,357 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_ColorFadeClass +#define MOD_NAME "Trans / Colorfade" + +class C_THISCLASS : public C_RBASE2 { + 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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_COLORFADE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + static int ft[4][3]; + + + int enabled; + int faders[3]; + int beatfaders[3]; + int faderpos[3]; + unsigned char c_tab[512][512]; + unsigned char clip[256+40+40]; +}; +int C_THISCLASS::ft[4][3]; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { faders[0]=GET_INT(); pos+=4; } + if (len-pos >= 4) { faders[1]=GET_INT(); pos+=4; } + if (len-pos >= 4) { faders[2]=GET_INT(); pos+=4; } + memcpy(beatfaders,faders,3*sizeof(int)); + if (len-pos >= 4) { beatfaders[0]=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatfaders[1]=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatfaders[2]=GET_INT(); pos+=4; } + memcpy(faderpos,faders,3*sizeof(int)); +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(faders[0]); pos+=4; + PUT_INT(faders[1]); pos+=4; + PUT_INT(faders[2]); pos+=4; + PUT_INT(beatfaders[0]); pos+=4; + PUT_INT(beatfaders[1]); pos+=4; + PUT_INT(beatfaders[2]); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + int x,y; + enabled=1; + faders[0]=8; + faders[1]=faders[2]=-8; + memcpy(beatfaders,faders,3*sizeof(int)); + memcpy(faderpos,faders,3*sizeof(int)); + for (x = 0; x < 512; x ++) + { + for (y = 0; y < 512; y ++) + { + int xp=x-255; + int yp=y-255; + if (xp > 0 /* g-b > 0, or g > b */ && xp > -yp /* g-b > r-b, or g > r */ ) c_tab[x][y]=0; + else if (yp < 0 /* b-r < 0 or r > b */ && xp < -yp /* g-b < r-b, or g < r */ ) c_tab[x][y]=1; + else if (xp < 0 && yp > 0) c_tab[x][y]=2; + else c_tab[x][y]=3; + } + } + for (x = 0; x < 256+40+40; x ++) + clip[x]=min(max(x-40,0),255); +} + +C_THISCLASS::~C_THISCLASS() +{ +} +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled || (isBeat&0x80000000)) return 0; + + if (faderpos[0] < faders[0]) faderpos[0]++; + if (faderpos[1] < faders[2]) faderpos[1]++; + if (faderpos[2] < faders[1]) faderpos[2]++; + if (faderpos[0] > faders[0]) faderpos[0]--; + if (faderpos[1] > faders[2]) faderpos[1]--; + if (faderpos[2] > faders[1]) faderpos[2]--; + + if (!(enabled&4)) + { + faderpos[0]=faders[0]; + faderpos[1]=faders[1]; + faderpos[2]=faders[2]; + } + else if (isBeat && (enabled&2)) + { + faderpos[0]=(rand()%32)-6; + faderpos[1]=(rand()%64)-32; + if (faderpos[1] < 0 && faderpos[1] > -16) faderpos[1]=-32; + if (faderpos[1] >= 0 && faderpos[1] < 16) faderpos[1]=32; + faderpos[2]=(rand()%32)-6; + } + else if (isBeat) + { + faderpos[0]=beatfaders[0]; + faderpos[1]=beatfaders[1]; + faderpos[2]=beatfaders[2]; + } + + { + int fs1,fs2,fs3; + fs1=faderpos[0]; + fs2=faderpos[1]; + fs3=faderpos[2]; + + ft[0][0]=fs3; + ft[0][1]=fs2; + ft[0][2]=fs1; + + ft[1][0]=fs2; + ft[1][1]=fs1; + ft[1][2]=fs3; + + ft[2][0]=fs1; + ft[2][1]=fs3; + ft[2][2]=fs2; + + ft[3][0]=fs3; + ft[3][1]=fs3; + ft[3][2]=fs3; + } + + return max_threads; +} + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return 0; +} + + +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return; + + if (max_threads < 1) max_threads=1; + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + unsigned char *q=(unsigned char *)(framebuffer + start_l*w); + + unsigned char *ctab_ptr=(unsigned char *)c_tab[0]+255+(255<<9); + unsigned char *clip_ptr=(unsigned char *)clip+40; + + int x=w*outh; + + if (enabled) + { + int lx=x&1; + x>>=1; + while (x--) + { + int r=q[0]; + int g=q[1]; + int b=q[2]; + int r2=q[4]; + int g2=q[5]; + int b2=q[6]; + int i=((g-b)<<9) + b - r; + int i2=((g2-b2)<<9) + b2 - r2; + int p=ctab_ptr[i]; + int p2=ctab_ptr[i2]; + + q[0]=clip_ptr[r+ft[p][0]]; + q[1]=clip_ptr[g+ft[p][1]]; + q[2]=clip_ptr[b+ft[p][2]]; + q[4]=clip_ptr[r2+ft[p2][0]]; + q[5]=clip_ptr[g2+ft[p2][1]]; + q[6]=clip_ptr[b2+ft[p2][2]]; + q+=8; + } + if (lx) + { + int r=q[0]; + int g=q[1]; + int b=q[2]; + int i=((g-b)<<9) + b - r; + int p=ctab_ptr[i]; + q[0]=clip_ptr[r+ft[p][0]]; + q[1]=clip_ptr[g+ft[p][1]]; + q[2]=clip_ptr[b+ft[p][2]]; + } + } +} + +C_RBASE *R_ColorFade(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->faders[0]+32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->faders[1]+32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER3,TBM_SETPOS,1,g_this->faders[2]+32); + + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER4,TBM_SETPOS,1,g_this->beatfaders[0]+32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETPOS,1,g_this->beatfaders[1]+32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETPOS,1,g_this->beatfaders[2]+32); + + if (g_this->enabled&1) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->enabled&2) CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (g_this->enabled&4) CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CHECK1: + case IDC_CHECK2: + case IDC_CHECK3: + g_this->enabled=(IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0)| + (IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?2:0)| + (IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?4:0); + return 0; + + } + 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->faders[0]=t-32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->faders[1]=t-32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER3)) + { + g_this->faders[2]=t-32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER4)) + { + g_this->beatfaders[0]=t-32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER5)) + { + g_this->beatfaders[1]=t-32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER6)) + { + g_this->beatfaders[2]=t-32; + } + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_COLORFADE,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_ColorFade(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_colorreduction.cpp b/Src/Plugins/Visualization/vis_avs/r_colorreduction.cpp new file mode 100644 index 00000000..2d4fa7a4 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_colorreduction.cpp @@ -0,0 +1,193 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +// this will be the directory and APE name displayed in the AVS Editor +#define MOD_NAME "Trans / Color Reduction" +#define C_THISCLASS C_ColorReduction + +typedef struct { + char fname[MAX_PATH]; + int levels; +} apeconfig; + +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); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + apeconfig config; + + HWND hwndDlg; +}; + +// global configuration dialog pointer +static C_THISCLASS *g_ConfigThis; +static HINSTANCE g_hDllInstance; + + +// this is where we deal with the configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_HSCROLL: + { + if (LOWORD(wParam) == TB_ENDTRACK) + g_ConfigThis->config.levels = SendMessage(GetDlgItem(hwndDlg, IDC_LEVELS), TBM_GETPOS, 0, 0); + { + char buf[4]; + int a,b; + a = 8-g_ConfigThis->config.levels; + b = 0x100; + while (a--) b>>=1; + wsprintf(buf, "%d", b); + SetDlgItemText(hwndDlg, IDC_LEVELTEXT, buf); + } + } + return 1; + + case WM_INITDIALOG: + g_ConfigThis->hwndDlg = hwndDlg; + + SendMessage(GetDlgItem(hwndDlg, IDC_LEVELS), TBM_SETRANGE, TRUE, MAKELONG(1, 8)); + SendMessage(GetDlgItem(hwndDlg, IDC_LEVELS), TBM_SETPOS, TRUE, g_ConfigThis->config.levels); + SetFocus(GetDlgItem(hwndDlg, IDC_LEVELS)); + { + char buf[4]; + int a,b; + a = 8-g_ConfigThis->config.levels; + b = 0x100; + while (a--) b>>=1; + wsprintf(buf, "%d", b); + SetDlgItemText(hwndDlg, IDC_LEVELTEXT, buf); + } + return 1; + + case WM_DESTROY: + KillTimer(hwndDlg, 1); + return 1; + } + return 0; +} + +// set up default configuration +C_THISCLASS::C_THISCLASS() +{ + memset(&config, 0, sizeof(apeconfig)); + config.levels = 7; +} + +// virtual destructor +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + + int a,b,c; + a = 8-config.levels; + b = 0xFF; + while (a--) b=(b<<1)&0xFF; + b |= (b<<16) | (b<<8); + c = w*h; + __asm { + mov ebx, framebuffer; + mov ecx, c; + mov edx, b; + lp: + sub ecx, 4; + test ecx, ecx; + jz end; + and dword ptr [ebx+ecx*4], edx; + and dword ptr [ebx+ecx*4+4], edx; + and dword ptr [ebx+ecx*4+8], edx; + and dword ptr [ebx+ecx*4+12], edx; + jmp lp; + end: + } + return 0; +} + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_COLORREDUCTION, hwndParent, (DLGPROC)g_DlgProc); +} + + +char *C_THISCLASS::get_desc(void) +{ + static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_COLOR_REDUCTION,desc,128):desc); +} + +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + if (len == sizeof(apeconfig)) + memcpy(&this->config, data, len); + else + memset(&this->config, 0, sizeof(apeconfig)); +} + + +int C_THISCLASS::save_config(unsigned char *data) +{ + memcpy(data, &this->config, sizeof(apeconfig)); + return sizeof(apeconfig); +} + +C_RBASE *R_ColorReduction(char *desc) +{ + if (desc) { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_THISCLASS(); +} + + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_colorreplace.cpp b/Src/Plugins/Visualization/vis_avs/r_colorreplace.cpp new file mode 100644 index 00000000..adf4d775 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_colorreplace.cpp @@ -0,0 +1,159 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#define C_THISCLASS C_ContrastEnhanceClass +#define MOD_NAME "Trans / Color Clip" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_COLOR_CLIP,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int enabled; + int color_clip; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color_clip=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color_clip); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + enabled=1; + color_clip=RGB(32,32,32); +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + unsigned int *f = (unsigned int *) framebuffer; + int fs_r,fs_g,fs_b; + int x=w*h; + if (!enabled) return 0; + + fs_b=(color_clip>>16)&255; + fs_g=(color_clip>>8)&255; + fs_r=(color_clip)&255; + + while (x--) + { + int r=f[0]&255; + int g=(f[0]>>8)&255; + int b=(f[0]>>16)&255; + int a=(f[0]&0xff000000); + if (r <= fs_r && g <= fs_g && b <= fs_b) + f[0]=a|fs_r|(fs_g<<8)|(fs_b<<16); + f++; + } + return 0; +} + +C_RBASE *R_ContrastEnhance(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) +{ + switch (uMsg) + { + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + switch (di->CtlID) + { + case IDC_LC: + GR_DrawColoredButton(di,g_this->color_clip); + break; + } + } + return 0; + case WM_INITDIALOG: + if (g_this->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CHECK1: + g_this->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + return 0; + case IDC_LC: + GR_SelectColor(hwndDlg,&g_this->color_clip); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + return 0; + + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_CONTRASTENHANCE,hwndParent,g_DlgProc); +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_comment.cpp b/Src/Plugins/Visualization/vis_avs/r_comment.cpp new file mode 100644 index 00000000..be4c8fba --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_comment.cpp @@ -0,0 +1,116 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#define C_THISCLASS C_CommentClass +#define MOD_NAME "Misc / Comment" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_MISC_COMMENT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + RString msgdata; +}; + +#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; + load_string(msgdata,data,pos,len); +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + save_string(data,pos,msgdata); + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + msgdata.assign(""); +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + return 0; +} + +C_RBASE *R_Comment(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg,IDC_EDIT1,g_this->msgdata.get()); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_EDIT1 && HIWORD(wParam) == EN_CHANGE) + { + g_this->msgdata.get_from_dlgitem(hwndDlg,IDC_EDIT1); + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_COMMENT,hwndParent,g_DlgProc); +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_contrast.cpp b/Src/Plugins/Visualization/vis_avs/r_contrast.cpp new file mode 100644 index 00000000..bf7395f4 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_contrast.cpp @@ -0,0 +1,226 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_ContrastEnhanceClass +#define MOD_NAME "Trans / Color Clip" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_COLOR_CLIP,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int enabled; + int color_clip,color_clip_out,color_dist; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color_clip=GET_INT(); pos+=4; } + if (len-pos >= 4) { color_clip_out=GET_INT(); pos+=4; } + else color_clip_out=color_clip; + if (len-pos >= 4) { color_dist=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color_clip); pos+=4; + PUT_INT(color_clip_out); pos+=4; + PUT_INT(color_dist); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + enabled=1; + color_clip=RGB(32,32,32); + color_clip_out=RGB(32,32,32); + color_dist=10; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return 0; + if (isBeat&0x80000000) return 0; + + int *f = framebuffer; + int fs_r,fs_g,fs_b; + int x=w*h; + int l=color_dist*2; + + + l=l*l; + + fs_b=(color_clip&0xff0000); + fs_g=(color_clip&0xff00); + fs_r=(color_clip&0xff); + + if (enabled==1) while (x--) + { + int a=f[0]; + if ((a&0xff) <= fs_r && (a&0xff00) <= fs_g && (a&0xff0000) <= fs_b) + f[0]=(a&0xff000000)|color_clip_out; + f++; + } + else if (enabled==2) while (x--) + { + int a=f[0]; + if ((a&0xff) >= fs_r && (a&0xff00) >= fs_g && (a&0xff0000) >= fs_b) + f[0]=(a&0xff000000)|color_clip_out; + f++; + } + else + { + fs_b>>=16; + fs_g>>=8; + while (x--) + { + int a=f[0]; + int r=a&255; + int g=(a>>8)&255; + int b=(a>>16)&255; + r-=fs_r; g-=fs_g; b-=fs_b; + if (r*r+g*g+b*b <= l) f[0]=(a&0xff000000)|color_clip_out; + f++; + } + } + return 0; +} + +C_RBASE *R_ContrastEnhance(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) +{ + switch (uMsg) + { + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + switch (di->CtlID) + { + case IDC_LC: + GR_DrawColoredButton(di,g_this->color_clip); + break; + case IDC_LC2: + GR_DrawColoredButton(di,g_this->color_clip_out); + break; + } + } + return 0; + case WM_INITDIALOG: + if (g_this->enabled==0) CheckDlgButton(hwndDlg,IDC_OFF,BST_CHECKED); + else if (g_this->enabled==1) CheckDlgButton(hwndDlg,IDC_BELOW,BST_CHECKED); + else if (g_this->enabled==2) CheckDlgButton(hwndDlg,IDC_ABOVE,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_NEAR,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETPOS, TRUE, g_this->color_dist); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETTICFREQ, 4, 0); + return 1; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_DISTANCE) + g_this->color_dist = SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_GETPOS, 0, 0); + return 0; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_OFF: + case IDC_BELOW: + case IDC_ABOVE: + case IDC_NEAR: + if (IsDlgButtonChecked(hwndDlg,IDC_OFF)) + g_this->enabled=0; + else if (IsDlgButtonChecked(hwndDlg,IDC_BELOW)) + g_this->enabled=1; + else if (IsDlgButtonChecked(hwndDlg,IDC_ABOVE)) + g_this->enabled=2; + else + g_this->enabled=3; + return 0; + case IDC_LC: + GR_SelectColor(hwndDlg,&g_this->color_clip); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + return 0; + case IDC_LC2: + GR_SelectColor(hwndDlg,&g_this->color_clip_out); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + return 0; + case IDC_BUTTON1: + g_this->color_clip_out=g_this->color_clip; + InvalidateRect(GetDlgItem(hwndDlg,IDC_LC2),NULL,FALSE); + return 0; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_CONTRASTENHANCE,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_ContrastEnhance(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_dcolormod.cpp b/Src/Plugins/Visualization/vis_avs/r_dcolormod.cpp new file mode 100644 index 00000000..640f7e8c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_dcolormod.cpp @@ -0,0 +1,359 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" +#include "resource.h" +#include "avs_eelif.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_DColorModClass +#define MOD_NAME "Trans / Color Modifier" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_COLOR_MODIFIER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + RString effect_exp[4]; + + int m_recompute; + + int m_tab_valid; + unsigned char m_tab[768]; + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_r, *var_g, *var_b, *var_beat; + int inited; + NSEEL_CODEHANDLE codehandle[4]; + int need_recompile; + 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; + 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); + } + } + if (len-pos >= 4) { m_recompute=GET_INT(); pos+=4; } + +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + 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]); + PUT_INT(m_recompute); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + AVS_EEL_INITINST(); + InitializeCriticalSection(&rcs); + need_recompile=1; + m_recompute=1; + memset(codehandle,0,sizeof(codehandle)); + effect_exp[0].assign(""); + effect_exp[1].assign(""); + effect_exp[2].assign(""); + effect_exp[3].assign(""); + + var_beat=0; + m_tab_valid=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=0; + } + AVS_EEL_QUITINST(); + + DeleteCriticalSection(&rcs); +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (need_recompile) + { + EnterCriticalSection(&rcs); + if (!var_beat || g_reset_vars_on_recompile) + { + clearVars(); + var_r = registerVar("red"); + var_g = registerVar("green"); + var_b = registerVar("blue"); + var_beat = registerVar("beat"); + inited=0; + } + need_recompile=0; + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + LeaveCriticalSection(&rcs); + } + if (isBeat&0x80000000) return 0; + + *var_beat=isBeat?1.0:0.0; + + if (codehandle[3] && !inited) { executeCode(codehandle[3],visdata); inited=1; } + executeCode(codehandle[1],visdata); + + if (isBeat) executeCode(codehandle[2],visdata); + + if (m_recompute || !m_tab_valid) + { + int x; + unsigned char *t=m_tab; + for (x = 0; x < 256; x ++) + { + *var_r=*var_b=*var_g=x/255.0; + executeCode(codehandle[0],visdata); + int r=(int) (*var_r*255.0 + 0.5); + int g=(int) (*var_g*255.0 + 0.5); + int b=(int) (*var_b*255.0 + 0.5); + if (r < 0) r=0; + else if (r > 255)r=255; + if (g < 0) g=0; + else if (g > 255)g=255; + if (b < 0) b=0; + else if (b > 255)b=255; + t[512]=r; + t[256]=g; + t[0]=b; + t++; + } + m_tab_valid=1; + } + + unsigned char *fb=(unsigned char *)framebuffer; + int l=w*h; + while (l--) + { + fb[0]=m_tab[fb[0]]; + fb[1]=m_tab[(int)fb[1]+256]; + fb[2]=m_tab[(int)fb[2]+512]; + fb+=4; + } + + + return 0; +} + +C_RBASE *R_DColorMod(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +typedef struct +{ + char *name; + char *init; + char *point; + char *frame; + char *beat; + int recompute; +} presetType; + +static presetType presets[]= +{ + // Name, Init, Level, Frame, Beat, Recalc + {"4x Red Brightness, 2x Green, 1x Blue","","red=4*red; green=2*green;","","",0}, + {"Solarization","","red=(min(1,red*2)-red)*2;\r\ngreen=red; blue=red;","","",0}, + {"Double Solarization","","red=(min(1,red*2)-red)*2;\r\nred=(min(1,red*2)-red)*2;\r\ngreen=red; blue=red;","","",0}, + {"Inverse Solarization (Soft)","","red=abs(red - .5) * 1.5;\r\ngreen=red; blue=red;","","",0}, + {"Big Brightness on Beat","scale=1.0","red=red*scale;\r\ngreen=red; blue=red;","scale=0.07 + (scale*0.93)","scale=16",1}, + {"Big Brightness on Beat (Interpolative)","c = 200; f = 0;","red = red * t;\r\ngreen=red;blue=red;","f = f + 1;\r\nt = (1.025 - (f / c)) * 5;","c = f;f = 0;",1}, + {"Pulsing Brightness (Beat Interpolative)","c = 200; f = 0;","red = red * st;\r\ngreen=red;blue=red;","f = f + 1;\r\nt = (f * 2 * $PI) / c;\r\nst = sin(t) + 1;","c = f;f = 0;",1}, + {"Rolling Solarization (Beat Interpolative)","c = 200; f = 0;","red=(min(1,red*st)-red)*st;\r\nred=(min(1,red*2)-red)*2;\r\ngreen=red; blue=red;","f = f + 1;\r\nt = (f * 2 * $PI) / c;\r\nst = ( sin(t) * .75 ) + 2;","c = f;f = 0;",1}, + {"Rolling Tone (Beat Interpolative)","c = 200; f = 0;","red = red * st;\r\ngreen = green * ct;\r\nblue = (blue * 4 * ti) - red - green;","f = f + 1;\r\nt = (f * 2 * $PI) / c;\r\nti = (f / c);\r\nst = sin(t) + 1.5;\r\nct = cos(t) + 1.5;","c = f;f = 0;",1}, + {"Random Inverse Tone (Switch on Beat)","","dd = red * 1.5;\r\nred = pow(dd, dr);\r\ngreen = pow(dd, dg);\r\nblue = pow(dd, db);","","token = rand(99) % 3;\r\ndr = if (equal(token, 0), -1, 1);\r\ndg = if (equal(token, 1), -1, 1);\r\ndb = if (equal(token, 2), -1, 1);",1}, + }; + + +static C_THISCLASS *g_this; +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + static int isstart; + 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()); + if (g_this->m_recompute) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + + isstart=0; + + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { +/* char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_COLOR_MODIFIER,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_COLOR_MODIFIER),4095-titlelen); +*/ + char *text="Color Modifier\0" + "The color modifier allows you to modify the intensity of each color\r\n" + "channel with respect to itself. For example, you could reverse the red\r\n" + "channel, double the green channel, or half the blue channel.\r\n" + "\r\n" + "The code in the 'level' section should adjust the variables\r\n" + "'red', 'green', and 'blue', whose value represent the channel\r\n" + "intensity (0..1).\r\n" + "Code in the 'frame' or 'level' sections can also use the variable\r\n" + "'beat' to detect if it is currently a beat.\r\n" + "\r\n" + "Try loading an example via the 'Load Example' button for examples." + + ; + compilerfunctionlist(hwndDlg,text); + } + + if (LOWORD(wParam)==IDC_CHECK1) + { + g_this->m_recompute=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + + if (LOWORD(wParam) == IDC_BUTTON4) + { + RECT r; + HMENU hMenu; + MENUITEMINFO i={sizeof(i),}; + hMenu=CreatePopupMenu(); + int x; + for (x = 0; x < sizeof(presets)/sizeof(presets[0]); x ++) + { + i.fMask=MIIM_TYPE|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.wID = x+16; + i.dwTypeData=presets[x].name; + i.cch=strlen(presets[x].name); + InsertMenuItem(hMenu,x,TRUE,&i); + } + GetWindowRect(GetDlgItem(hwndDlg,IDC_BUTTON4),&r); + x=TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,r.right,r.top,0,hwndDlg,NULL); + if (x >= 16 && x < 16+sizeof(presets)/sizeof(presets[0])) + { + isstart=1; + SetDlgItemText(hwndDlg,IDC_EDIT1,presets[x-16].point); + SetDlgItemText(hwndDlg,IDC_EDIT2,presets[x-16].frame); + SetDlgItemText(hwndDlg,IDC_EDIT3,presets[x-16].beat); + SetDlgItemText(hwndDlg,IDC_EDIT4,presets[x-16].init); + g_this->m_recompute=presets[x-16].recompute; + CheckDlgButton(hwndDlg,IDC_CHECK1,g_this->m_recompute?BST_CHECKED:0); + isstart=0; + + SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_EDIT4,EN_CHANGE),0); + } + DestroyMenu(hMenu); + } + if (!isstart && HIWORD(wParam) == EN_CHANGE) + { + if (LOWORD(wParam) == IDC_EDIT1||LOWORD(wParam) == IDC_EDIT2||LOWORD(wParam) == IDC_EDIT3||LOWORD(wParam) == IDC_EDIT4) + { + 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->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT4) g_this->inited = 0; + g_this->m_tab_valid=0; + 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_COLORMOD,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_DColorMod(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_ddm.cpp b/Src/Plugins/Visualization/vis_avs/r_ddm.cpp new file mode 100644 index 00000000..21db977c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_ddm.cpp @@ -0,0 +1,492 @@ +/* + 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 M_PI 3.14159265358979323846 + +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" +#include "resource.h" +#include "avs_eelif.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_PulseClass +#define MOD_NAME "Trans / Dynamic Distance Modifier" + + +// Integer Square Root function + +// Uses factoring to find square root +// A 256 entry table used to work out the square root of the 7 or 8 most +// significant bits. A power of 2 used to approximate the rest. +// Based on an 80386 Assembly implementation by Arne Steinarson + +static unsigned const char sq_table[]= +{0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, 64, 65, +67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, 90, 91, 93, 94, +96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, +114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, +128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, +142, 143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, +154, 155, 155, 156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, +165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, +176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 183, 184, 185, +185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 193, 194, +195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, 202, 203, 203, +204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211, 212, +212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, +221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, +229, 229, 230, 230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, +236, 237, 237, 238, 238, 239, 240, 240, 241, 241, 242, 242, 243, 243, +244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 249, 249, 250, 250, +251, 251, 252, 252, 253, 253, 254, 254, 255}; + +static __inline unsigned long isqrt(unsigned long n) +{ + if (n >= 0x10000) + if (n >= 0x1000000) + if (n >= 0x10000000) + if (n >= 0x40000000) return(sq_table[n >> 24] << 8); + else return(sq_table[n >> 22] << 7); + else + if (n >= 0x4000000) return(sq_table[n >> 20] << 6); + else return(sq_table[n >> 18] << 5); + else + if (n >= 0x100000) + if (n >= 0x400000) return(sq_table[n >> 16] << 4); + else return(sq_table[n >> 14] << 3); + else + if (n >= 0x40000) return(sq_table[n >> 12] << 2); + else return(sq_table[n >> 10] << 1); + + else + if (n >= 0x100) + if (n >= 0x1000) + if (n >= 0x4000) return(sq_table[n >> 8]); + else return(sq_table[n >> 6] >> 1); + else + if (n >= 0x400) return(sq_table[n >> 4] >> 2); + else return(sq_table[n >> 2] >> 3); + else + if (n >= 0x10) + if (n >= 0x40) return(sq_table[n] >> 4); + else return(sq_table[n << 2] << 5); + else + if (n >= 0x4) return(sq_table[n >> 4] << 6); + else return(sq_table[n >> 6] << 7); + +} + + + + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_DYNAMIC_DISTANCE_MODIFIER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + RString effect_exp[4]; + int blend; + + int m_wt; + int m_lastw,m_lasth; + int *m_wmul; + int *m_tab; + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_d, *var_b; + double max_d; + int inited; + NSEEL_CODEHANDLE codehandle[4]; + int need_recompile; + int subpixel; + 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; + 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[513]; + if (len-pos >= 256*2) + { + memcpy(buf,data+pos,256*2); + pos+=256*2; + buf[512]=0; + effect_exp[1].assign(buf+256); + buf[256]=0; + effect_exp[0].assign(buf); + } + if (len-pos >= 256*2) + { + memcpy(buf,data+pos,256*2); + pos+=256*2; + buf[512]=0; + effect_exp[3].assign(buf+256); + buf[256]=0; + effect_exp[2].assign(buf); + } + } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + 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]); + PUT_INT(blend); pos+=4; + PUT_INT(subpixel); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + AVS_EEL_INITINST(); + InitializeCriticalSection(&rcs); + need_recompile=1; + memset(codehandle,0,sizeof(codehandle)); + m_lasth=m_lastw=0; + m_wmul=0; + m_tab=0; + m_wt=0; + effect_exp[0].assign("d=d-sigmoid((t-50)/100,2)"); + effect_exp[3].assign("u=1;t=0"); + effect_exp[1].assign("t=t+u;t=min(100,t);t=max(0,t);u=if(equal(t,100),-1,u);u=if(equal(t,0),1,u)"); + effect_exp[2].assign(""); + + blend=0; + subpixel=0; + + var_b=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=0; + } + if (m_wmul) GlobalFree(m_wmul); + if (m_tab) GlobalFree(m_tab); + AVS_EEL_QUITINST(); + + m_tab=0; + m_wmul=0; + DeleteCriticalSection(&rcs); +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int *fbin=framebuffer; + if (m_lasth != h || m_lastw != w || !m_tab || !m_wmul) + { + int y; + m_lastw=w; // jf 121100 - added (oops) + m_lasth=h; + max_d=sqrt((w*w+h*h)/4.0); + if (m_wmul) GlobalFree(m_wmul); + m_wmul=(int*)GlobalAlloc(GMEM_FIXED,sizeof(int)*h); + for (y = 0; y < h; y ++) m_wmul[y]=y*w; + if (m_tab) GlobalFree(m_tab); + m_tab=0; + } + int imax_d=(int)(max_d + 32.9); + + if (imax_d < 33) imax_d=33; + + if (!m_tab) + m_tab=(int*)GlobalAlloc(GMEM_FIXED,sizeof(int)*imax_d); + + int x; + + //pow(sin(d),dpos)*1.7 + if (need_recompile) + { + EnterCriticalSection(&rcs); + if (!var_b || g_reset_vars_on_recompile) + { + clearVars(); + var_d = registerVar("d"); + var_b = registerVar("b"); + inited=0; + } + need_recompile=0; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + LeaveCriticalSection(&rcs); + } + if (isBeat&0x80000000) return 0; + + *var_b=isBeat?1.0:0.0; + + if (codehandle[3] && !inited) { executeCode(codehandle[3],visdata); inited=1; } + executeCode(codehandle[1],visdata); + if (isBeat) executeCode(codehandle[2],visdata); + if (codehandle[0]) + { + for (x = 0; x < imax_d-32; x ++) + { + *var_d=x/(max_d-1); + executeCode(codehandle[0],visdata); + m_tab[x]=(int) (*var_d*256.0*max_d/(x+1)); + } + for (; x < imax_d; x ++) + { + m_tab[x]=m_tab[x-1]; + } + } + else for (x = 0; x < imax_d; x ++) m_tab[x]=0; + + m_wt++; + m_wt&=63; + + { + int w2=w/2; + int h2=h/2; + int y; + for (y = 0; y < h; y ++) + { + int ty=y-h2; + int x2=w2*w2+w2+ty*ty+256; + int dx2=-2*w2; + int yysc=ty; + int xxsc=-w2; + int x=w; + if (subpixel) + { + if (blend) + while (x--) + { + int qd=m_tab[isqrt(x2)]; + int ow,oh; + int xpart,ypart; + x2+=dx2; + dx2+=2; + xpart=(qd*xxsc+128); + ypart=(qd*yysc+128); + ow = w2 + (xpart>>8); + oh = h2 + (ypart>>8); + xpart&=0xff; + ypart&=0xff; + xxsc++; + + if (ow < 0) ow=0; + else if (ow >= w-1) ow=w-2; + if (oh < 0) oh=0; + else if (oh >= h-1) oh=h-2; + + *fbout++=BLEND_AVG(BLEND4((unsigned int *)framebuffer+ow+m_wmul[oh],w,xpart,ypart),*fbin++); + } + else + while (x--) + { + int qd=m_tab[isqrt(x2)]; + int ow,oh; + int xpart,ypart; + x2+=dx2; + dx2+=2; + xpart=(qd*xxsc+128); + ypart=(qd*yysc+128); + ow = w2 + (xpart>>8); + oh = h2 + (ypart>>8); + xpart&=0xff; + ypart&=0xff; + xxsc++; + + if (ow < 0) ow=0; + else if (ow >= w-1) ow=w-2; + if (oh < 0) oh=0; + else if (oh >= h-1) oh=h-2; + + *fbout++=BLEND4((unsigned int *)framebuffer+ow+m_wmul[oh],w,xpart,ypart); + } + } + else + { + if (blend) + while (x--) + { + int qd=m_tab[isqrt(x2)]; + int ow,oh; + x2+=dx2; + dx2+=2; + ow = w2 + ((qd*xxsc+128)>>8); + xxsc++; + oh = h2 + ((qd*yysc+128)>>8); + + if (ow < 0) ow=0; + else if (ow >= w) ow=w-1; + if (oh < 0) oh=0; + else if (oh >= h) oh=h-1; + + *fbout++=BLEND_AVG(framebuffer[ow+m_wmul[oh]],*fbin++); + } + else + while (x--) + { + int qd=m_tab[isqrt(x2)]; + int ow,oh; + x2+=dx2; + dx2+=2; + ow = w2 + ((qd*xxsc+128)>>8); + xxsc++; + oh = h2 + ((qd*yysc+128)>>8); + + if (ow < 0) ow=0; + else if (ow >= w) ow=w-1; + if (oh < 0) oh=0; + else if (oh >= h) oh=h-1; + + *fbout++=framebuffer[ow+m_wmul[oh]]; + } + } + } + } +#ifndef NO_MMX + if (subpixel) __asm emms; +#endif + return 1; +} + +C_RBASE *R_DDM(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; + 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->blend) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->subpixel) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { +/* char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_DYNAMIC_DISTANCE_MODIFIER,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_DYNAMIC_DISTANCE_MODIFIER),4095-titlelen); +*/ + char *text="Dynamic Distance Modifier\0" + "The dynamic distance modifier allows you to dynamically (once per frame)\r\n" + "change the source pixels for each ring of pixels out from the center.\r\n" + "In the 'pixel' code section, 'd' represents the distance in pixels\r\n" + "the current ring is from the center, and code can modify it to\r\n" + "change the distance from the center where the source pixels for\r\n" + "that ring would be read. This is a terrible explanation, and if\r\n" + "you want to make a better one send it to me. \r\n" + "\r\n" + "Examples:\r\n" + "Zoom in: 'd=d*0.9'\r\n" + "Zoom out: 'd=d*1.1'\r\n" + "Back and forth: pixel='d=d*(1.0+0.1*cos(t));', frame='t=t+0.1'\r\n" + ; + compilerfunctionlist(hwndDlg,text); + } + + if (LOWORD(wParam)==IDC_CHECK1) + { + g_this->blend=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + if (LOWORD(wParam)==IDC_CHECK2) + { + g_this->subpixel=IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?1:0; + } + if (!isstart && (LOWORD(wParam) == IDC_EDIT1||LOWORD(wParam) == IDC_EDIT2||LOWORD(wParam) == IDC_EDIT3||LOWORD(wParam) == IDC_EDIT4) && HIWORD(wParam) == EN_CHANGE) + { + 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->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT4) g_this->inited = 0; + 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_DDM,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_DDM(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_defs.h b/Src/Plugins/Visualization/vis_avs/r_defs.h new file mode 100644 index 00000000..19f0fc30 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_defs.h @@ -0,0 +1,739 @@ +/* + 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. + +*/ +#ifndef _R_DEFS_H_ +#define _R_DEFS_H_ + +// base class declaration, compatibility class +class RString; + +class C_RBASE { + public: + C_RBASE() { } + virtual ~C_RBASE() { }; + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h)=0; // returns 1 if fbout has dest + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent){return 0;}; + virtual char *get_desc()=0; + virtual void load_config(unsigned char *data, int len) { } + virtual int save_config(unsigned char *data) { return 0; } + + void load_string(RString &s,unsigned char *data, int &pos, int len); + void save_string(unsigned char *data, int &pos, RString &text); + +}; + +class C_RBASE2 : public C_RBASE { + public: + C_RBASE2() { } + virtual ~C_RBASE2() { }; + + int getRenderVer2() { return 2; } + + + virtual int smp_getflags() { return 0; } // return 1 to enable smp support + + // returns # of threads you desire, <= max_threads, or 0 to not do anything + // default should return max_threads if you are flexible + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; } + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { }; + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) { return 0; }; // return value is that of render() for fbstuff etc + +}; + + +// defined in main.cpp, render.cpp +extern char g_path[]; +extern unsigned char g_blendtable[256][256]; + +extern int g_reset_vars_on_recompile; + +// use this function to get a global buffer, and the last flag says whether or not to +// allocate it if it's not valid... +#define NBUF 8 +void *getGlobalBuffer(int w, int h, int n, int do_alloc); + + +// implemented in util.cpp +char* GetTextResource(UINT id); +void GR_SelectColor(HWND hwnd, int *a); +void GR_DrawColoredButton(DRAWITEMSTRUCT *di, COLORREF color); +void loadComboBox(HWND dlg, char *ext, char *selectedName); +void compilerfunctionlist(HWND hwndDlg, char *localinfo=NULL); + +// matrix.cpp +void matrixRotate(float matrix[], char m, float Deg); +void matrixTranslate(float m[], float x, float y, float z); +void matrixMultiply(float *dest, float src[]); +void matrixApply(float *m, float x, float y, float z, float *outx, float *outy, float *outz); + +// linedraw.cpp +extern int g_line_blend_mode; +void line(int *fb, int x1,int y1,int x2,int y2, int width, int height, int color, int lw); + + +// inlines +static unsigned int __inline BLEND(unsigned int a, unsigned int b) +{ + register unsigned int r,t; + r=(a&0xff)+(b&0xff); + t=min(r,0xff); + r=(a&0xff00)+(b&0xff00); + t|=min(r,0xff00); + r=(a&0xff0000)+(b&0xff0000); + t|=min(r,0xff0000); + r=(a&0xff000000)+(b&0xff000000); + return t|min(r,0xff000000); +} + +#if 1 +#define FASTMAX(x,y) max(x,y) +// (x-(((x-y)>>(32-1))&(x-y))) // hmm not faster :( +#define FASTMIN(x,y) min(x,y) +//(x+(((y-x)>>(32-1))&(y-x))) +#else +#pragma warning( push, 1 ) + +static __inline int FASTMAX(int x, int y) +{ + __asm + { + mov ecx, [x] + mov eax, [y] + sub ecx, eax + cmc + and ecx, edx + add eax, ecx + } +} +static __inline int FASTMIN(int x, int y) +{ + __asm + { + mov ecx, [x] + mov eax, [y] + sub ecx, eax + sbb edx, edx + and ecx, edx + add eax, ecx + } +} +#pragma warning( pop ) + +#endif + +static unsigned int __inline BLEND_MAX(unsigned int a, unsigned int b) +{ + register unsigned int t; + int _a=a&0xff; + int _b=b&0xff; + t=FASTMAX(_a,_b); + _a=a&0xff00; _b=b&0xff00; + t|=FASTMAX(_a,_b); + _a=a&0xff0000; _b=b&0xff0000; + t|=FASTMAX(_a,_b); + return t; +} + +static unsigned int __inline BLEND_MIN(unsigned int a, unsigned int b) +{ +#if 1 + register unsigned int t; + int _a=a&0xff; + int _b=b&0xff; + t=FASTMIN(_a,_b); + _a=a&0xff00; _b=b&0xff00; + t|=FASTMIN(_a,_b); + _a=a&0xff0000; _b=b&0xff0000; + t|=FASTMIN(_a,_b); + return t; +#else + __asm + { + mov ecx, [a] + mov eax, [b] + + and ecx, 0xff + and eax, 0xff + + mov esi, [a] + mov ebx, [b] + + sub ecx, eax + sbb edx, edx + + and esi, 0xff00 + and ebx, 0xff00 + + and ecx, edx + sub esi, ebx + + sbb edx, edx + add eax, ecx + + and esi, edx + mov ecx, [a] + + add ebx, esi + and ecx, 0xff0000 + + mov esi, [b] + or eax, ebx + + and esi, 0xff0000 + + sub ecx, esi + sbb edx, edx + + and ecx, edx + add esi, ecx + + or eax, esi + } +#endif +} + +#ifdef FASTMAX +#undef FASTMAX +#undef FASTMIN +#endif + + +static unsigned int __inline BLEND_AVG(unsigned int a, unsigned int b) +{ + return ((a>>1)&~((1<<7)|(1<<15)|(1<<23)))+((b>>1)&~((1<<7)|(1<<15)|(1<<23))); +} + + +static unsigned int __inline BLEND_SUB(unsigned int a, unsigned int b) +{ + register int r,t; + r=(a&0xff)-(b&0xff); + t=max(r,0); + r=(a&0xff00)-(b&0xff00); + t|=max(r,0); + r=(a&0xff0000)-(b&0xff0000); + t|=max(r,0); + r=(a&0xff000000)-(b&0xff000000); + return t|max(r,0); +} + +#ifdef NO_MMX +#define BLEND_ADJ BLEND_ADJ_NOMMX +#endif + +static unsigned int __inline BLEND_ADJ_NOMMX(unsigned int a, unsigned int b, int v) +{ + register int t; + t=g_blendtable[a&0xFF][v]+g_blendtable[b&0xFF][0xFF-v]; + t|=(g_blendtable[(a&0xFF00)>>8][v]+g_blendtable[(b&0xFF00)>>8][0xFF-v])<<8; + t|=(g_blendtable[(a&0xFF0000)>>16][v]+g_blendtable[(b&0xFF0000)>>16][0xFF-v])<<16; + return t; +} + +static unsigned int __inline BLEND_MUL(unsigned int a, unsigned int b) +{ + register int t; + t=g_blendtable[a&0xFF][b&0xFF]; + t|=g_blendtable[(a&0xFF00)>>8][(b&0xFF00)>>8]<<8; + t|=g_blendtable[(a&0xFF0000)>>16][(b&0xFF0000)>>16]<<16; + return t; +} + +static __inline void BLEND_LINE(int *fb, int color) +{ + register int bm=g_line_blend_mode&0xff; + switch (g_line_blend_mode&0xff) + { + case 1: *fb=BLEND(*fb,color); break; + case 2: *fb=BLEND_MAX(*fb,color); break; + case 3: *fb=BLEND_AVG(*fb,color); break; + case 4: *fb=BLEND_SUB(*fb,color); break; + case 5: *fb=BLEND_SUB(color,*fb); break; + case 6: *fb=BLEND_MUL(*fb,color); break; + case 7: *fb=BLEND_ADJ_NOMMX(*fb,color,(g_line_blend_mode>>8)&0xff); break; + case 8: *fb=*fb^color; break; + case 9: *fb=BLEND_MIN(*fb,color); break; + default: *fb=color; break; + } +} +extern unsigned int const mmx_blend4_revn[2]; +extern int const mmx_blend4_zero; +extern int const mmx_blendadj_mask[2]; +// NOTE. WHEN USING THIS FUNCTION, BE SURE TO DO 'if (g_mmx_available) __asm emms;' before calling +// any fpu code, or before returning. +#pragma warning( push, 1 ) + +#ifndef NO_MMX +static unsigned int __inline BLEND_ADJ(unsigned int a, unsigned int b, int v) +{ + __asm + { + movd mm3, [v] // VVVVVVVV + + movd mm0, [a] + packuswb mm3, mm3 // 0000HHVV + + movd mm1, [b] + punpcklwd mm3, mm3 // HHVVHHVV + + movq mm4, [mmx_blend4_revn] + punpckldq mm3, mm3 // HHVVHHVV HHVVHHVV + + punpcklbw mm0, [mmx_blend4_zero] + pand mm3, [mmx_blendadj_mask] + + punpcklbw mm1, [mmx_blend4_zero] + psubw mm4, mm3 + + pmullw mm0, mm3 + pmullw mm1, mm4 + + paddw mm0, mm1 + + psrlw mm0, 8 + + packuswb mm0, mm0 + + movd eax, mm0 + } +} +#endif + + +static __inline unsigned int BLEND4(unsigned int *p1, unsigned int w, int xp, int yp) +{ +#ifdef NO_MMX + register int t; + unsigned char a1,a2,a3,a4; + a1=g_blendtable[255-xp][255-yp]; + a2=g_blendtable[xp][255-yp]; + a3=g_blendtable[255-xp][yp]; + a4=g_blendtable[xp][yp]; + t=g_blendtable[p1[0]&0xff][a1]+g_blendtable[p1[1]&0xff][a2]+g_blendtable[p1[w]&0xff][a3]+g_blendtable[p1[w+1]&0xff][a4]; + t|=(g_blendtable[(p1[0]>>8)&0xff][a1]+g_blendtable[(p1[1]>>8)&0xff][a2]+g_blendtable[(p1[w]>>8)&0xff][a3]+g_blendtable[(p1[w+1]>>8)&0xff][a4])<<8; + t|=(g_blendtable[(p1[0]>>16)&0xff][a1]+g_blendtable[(p1[1]>>16)&0xff][a2]+g_blendtable[(p1[w]>>16)&0xff][a3]+g_blendtable[(p1[w+1]>>16)&0xff][a4])<<16; + return t; +#else + __asm + { + movd mm6, xp + mov eax, p1 + + movd mm7, yp + mov esi, w + + movq mm4, mmx_blend4_revn + punpcklwd mm6,mm6 + + movq mm5, mmx_blend4_revn + punpcklwd mm7,mm7 + + movd mm0, [eax] + punpckldq mm6,mm6 + + movd mm1, [eax+4] + punpckldq mm7,mm7 + + movd mm2, [eax+esi*4] + punpcklbw mm0, [mmx_blend4_zero] + + movd mm3, [eax+esi*4+4] + psubw mm4, mm6 + + punpcklbw mm1, [mmx_blend4_zero] + pmullw mm0, mm4 + + punpcklbw mm2, [mmx_blend4_zero] + pmullw mm1, mm6 + + punpcklbw mm3, [mmx_blend4_zero] + psubw mm5, mm7 + + pmullw mm2, mm4 + pmullw mm3, mm6 + + paddw mm0, mm1 + // stall (mm0) + + psrlw mm0, 8 + // stall (waiting for mm3/mm2) + + paddw mm2, mm3 + pmullw mm0, mm5 + + psrlw mm2, 8 + // stall (mm2) + + pmullw mm2, mm7 + // stall + + // stall (mm2) + + paddw mm0, mm2 + // stall + + psrlw mm0, 8 + // stall + + packuswb mm0, mm0 + // stall + + movd eax, mm0 + } +#endif +} + + +static __inline unsigned int BLEND4_16(unsigned int *p1, unsigned int w, int xp, int yp) +{ +#ifdef NO_MMX + register int t; + unsigned char a1,a2,a3,a4; + xp=(xp>>8)&0xff; + yp=(yp>>8)&0xff; + a1=g_blendtable[255-xp][255-yp]; + a2=g_blendtable[xp][255-yp]; + a3=g_blendtable[255-xp][yp]; + a4=g_blendtable[xp][yp]; + t=g_blendtable[p1[0]&0xff][a1]+g_blendtable[p1[1]&0xff][a2]+g_blendtable[p1[w]&0xff][a3]+g_blendtable[p1[w+1]&0xff][a4]; + t|=(g_blendtable[(p1[0]>>8)&0xff][a1]+g_blendtable[(p1[1]>>8)&0xff][a2]+g_blendtable[(p1[w]>>8)&0xff][a3]+g_blendtable[(p1[w+1]>>8)&0xff][a4])<<8; + t|=(g_blendtable[(p1[0]>>16)&0xff][a1]+g_blendtable[(p1[1]>>16)&0xff][a2]+g_blendtable[(p1[w]>>16)&0xff][a3]+g_blendtable[(p1[w+1]>>16)&0xff][a4])<<16; + return t; +#else + __asm + { + movd mm6, xp + mov eax, p1 + + movd mm7, yp + mov esi, w + + movq mm4, mmx_blend4_revn + psrlw mm6, 8 + + movq mm5, mmx_blend4_revn + psrlw mm7, 8 + + movd mm0, [eax] + punpcklwd mm6,mm6 + + movd mm1, [eax+4] + punpcklwd mm7,mm7 + + movd mm2, [eax+esi*4] + punpckldq mm6,mm6 + + movd mm3, [eax+esi*4+4] + punpckldq mm7,mm7 + + punpcklbw mm0, [mmx_blend4_zero] + psubw mm4, mm6 + + punpcklbw mm1, [mmx_blend4_zero] + pmullw mm0, mm4 + + punpcklbw mm2, [mmx_blend4_zero] + pmullw mm1, mm6 + + punpcklbw mm3, [mmx_blend4_zero] + psubw mm5, mm7 + + pmullw mm2, mm4 + pmullw mm3, mm6 + + paddw mm0, mm1 + // stall (mm0) + + psrlw mm0, 8 + // stall (waiting for mm3/mm2) + + paddw mm2, mm3 + pmullw mm0, mm5 + + psrlw mm2, 8 + // stall (mm2) + + pmullw mm2, mm7 + // stall + + // stall (mm2) + + paddw mm0, mm2 + // stall + + psrlw mm0, 8 + // stall + + packuswb mm0, mm0 + // stall + + movd eax, mm0 + } +#endif +} + + +#pragma warning( pop ) + + +static __inline void mmx_avgblend_block(int *output, int *input, int l) +{ +#ifdef NO_MMX + while (l--) + { + *output=BLEND_AVG(*input++,*output); + output++; + } +#else + static int mask[2]= + { + ~((1<<7)|(1<<15)|(1<<23)), + ~((1<<7)|(1<<15)|(1<<23)) + }; + __asm + { + mov eax, input + mov edi, output + mov ecx, l + shr ecx, 2 + align 16 +mmx_avgblend_loop: + movq mm0, [eax] + movq mm1, [edi] + psrlq mm0, 1 + movq mm2, [eax+8] + psrlq mm1, 1 + movq mm3, [edi+8] + psrlq mm2, 1 + pand mm0, [mask] + psrlq mm3, 1 + pand mm1, [mask] + pand mm2, [mask] + paddusb mm0, mm1 + pand mm3, [mask] + add eax, 16 + paddusb mm2, mm3 + + movq [edi], mm0 + movq [edi+8], mm2 + + add edi, 16 + + dec ecx + jnz mmx_avgblend_loop + emms + }; +#endif +} + + +static __inline void mmx_addblend_block(int *output, int *input, int l) +{ +#ifdef NO_MMX + while (l--) + { + *output=BLEND(*input++,*output); + output++; + } +#else + __asm + { + mov eax, input + mov edi, output + mov ecx, l + shr ecx, 2 + align 16 +mmx_addblend_loop: + movq mm0, [eax] + movq mm1, [edi] + movq mm2, [eax+8] + movq mm3, [edi+8] + paddusb mm0, mm1 + paddusb mm2, mm3 + add eax, 16 + + movq [edi], mm0 + movq [edi+8], mm2 + + add edi, 16 + + dec ecx + jnz mmx_addblend_loop + emms + }; +#endif +} + +static __inline void mmx_mulblend_block(int *output, int *input, int l) +{ +#ifdef NO_MMX + while (l--) + { + *output=BLEND_MUL(*input++,*output); + output++; + } +#else + __asm + { + mov eax, input + mov edi, output + mov ecx, l + shr ecx, 1 + align 16 +mmx_mulblend_loop: + movd mm0, [eax] + movd mm1, [edi] + movd mm2, [eax+4] + punpcklbw mm0, [mmx_blend4_zero] + movd mm3, [edi+4] + punpcklbw mm1, [mmx_blend4_zero] + punpcklbw mm2, [mmx_blend4_zero] + pmullw mm0, mm1 + punpcklbw mm3, [mmx_blend4_zero] + psrlw mm0, 8 + pmullw mm2, mm3 + packuswb mm0, mm0 + psrlw mm2, 8 + packuswb mm2, mm2 + add eax, 8 + + movd [edi], mm0 + movd [edi+4], mm2 + + add edi, 8 + + dec ecx + jnz mmx_mulblend_loop + emms + }; +#endif +} + +static void __inline mmx_adjblend_block(int *o, int *in1, int *in2, int len, int v) +{ +#ifdef NO_MMX + while (len--) + { + *o++=BLEND_ADJ(*in1++,*in2++,inblendval); + } +#else + __asm + { + movd mm3, [v] // VVVVVVVV + mov ecx, len + + packuswb mm3, mm3 // 0000HHVV + mov edx, o + + punpcklwd mm3, mm3 // HHVVHHVV + mov esi, in1 + + movq mm4, [mmx_blend4_revn] + punpckldq mm3, mm3 // HHVVHHVV HHVVHHVV + + pand mm3, [mmx_blendadj_mask] + mov edi, in2 + + shr ecx, 1 + psubw mm4, mm3 + + align 16 +_mmx_adjblend_loop: + + movd mm0, [esi] + + movd mm1, [edi] + punpcklbw mm0, [mmx_blend4_zero] + + movd mm6, [esi+4] + punpcklbw mm1, [mmx_blend4_zero] + + movd mm7, [edi+4] + punpcklbw mm6, [mmx_blend4_zero] + + pmullw mm0, mm3 + punpcklbw mm7, [mmx_blend4_zero] + + pmullw mm1, mm4 + pmullw mm6, mm3 + + pmullw mm7, mm4 + paddw mm0, mm1 + + paddw mm6, mm7 + add edi, 8 + + psrlw mm0, 8 + add esi, 8 + + psrlw mm6, 8 + packuswb mm0, mm0 + + packuswb mm6, mm6 + movd [edx], mm0 + + movd [edx+4], mm6 + add edx, 8 + dec ecx + jnz _mmx_adjblend_loop + + emms + }; +#endif +} + + + +class RString +{ + public: + RString() { m_str=0; m_size=0; } + ~RString() { if (m_str) GlobalFree(m_str); }; + void resize(int size) { m_size=size; if (m_str) GlobalFree(m_str); m_str=0; if (size) m_str=(char*)GlobalAlloc(GPTR,size); } + char *get() { return m_str; } + int getsize() { if (!m_str) return 0; return m_size; } + void assign(char *s) { resize(strlen(s)+1); strcpy(m_str,s); } + void get_from_dlgitem(HWND hwnd, int dlgItem) + { + int l=SendDlgItemMessage(hwnd,dlgItem,WM_GETTEXTLENGTH,0,0); + if ( l < 256) l=256; + resize(l+1+256); + GetDlgItemText(hwnd,dlgItem, m_str, l+1); + m_str[l]=0; + } + private: + char *m_str; + int m_size; +}; + +void doAVSEvalHighLight(HWND hwndDlg, UINT sub, char *data); + +#include "laser/laserline.h" + +#endif diff --git a/Src/Plugins/Visualization/vis_avs/r_dmove.cpp b/Src/Plugins/Visualization/vis_avs/r_dmove.cpp new file mode 100644 index 00000000..34ce6481 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_dmove.cpp @@ -0,0 +1,780 @@ +/* + 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 M_PI 3.14159265358979323846 + +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" +#include "resource.h" +#include "avs_eelif.h" +#include "r_list.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + + +#if 0 +static void __docheck(int xp, int yp, int m_lastw, int m_lasth, int d_x, int d_y) +{ + xp >>= 16; + yp >>= 16; + if (xp < 0 || xp >= m_lastw || yp < 0 || yp >= m_lasth) + { + char buf[512]; + wsprintf(buf,"@ %d,%d on %d,%d (dx,dy=%d,%d)\n",xp,yp,m_lastw,m_lasth,d_x,d_y); + OutputDebugString(buf); + } +} +#endif + + +#ifndef LASER + +#define C_THISCLASS C_DMoveClass +#define MOD_NAME "Trans / Dynamic Movement" + +class C_THISCLASS : public C_RBASE2 { + 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); + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_DYNAMIC_MOVEMENT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + RString effect_exp[4]; + + int m_lastw,m_lasth; + int m_lastxres, m_lastyres, m_xres, m_yres; + int *m_wmul; + int *m_tab; + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_d, *var_b, *var_r, *var_x, *var_y, *var_w, *var_h, *var_alpha; + int inited; + NSEEL_CODEHANDLE codehandle[4]; + int need_recompile; + int buffern; + int subpixel,rectcoords,blend,wrap, nomove; + CRITICAL_SECTION rcs; + + + // smp stuff + int __subpixel,__rectcoords,__blend,__wrap, __nomove; + int w_adj; + int h_adj; + int XRES; + int YRES; + +}; + +#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; + 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); + } + } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + if (len-pos >= 4) { rectcoords=GET_INT(); pos+=4; } + if (len-pos >= 4) { m_xres=GET_INT(); pos+=4; } + if (len-pos >= 4) { m_yres=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { wrap=GET_INT(); pos+=4; } + if (len-pos >= 4) { buffern=GET_INT(); pos+=4; } + else buffern=0; + if (len-pos >= 4) { nomove=GET_INT(); pos+=4; } + else nomove=0; + +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + 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]); + PUT_INT(subpixel); pos+=4; + PUT_INT(rectcoords); pos+=4; + PUT_INT(m_xres); pos+=4; + PUT_INT(m_yres); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(wrap); pos+=4; + PUT_INT(buffern); pos+=4; + PUT_INT(nomove); pos+=4; + return pos; +} + +C_THISCLASS::C_THISCLASS() +{ + AVS_EEL_INITINST(); + InitializeCriticalSection(&rcs); + need_recompile=1; + memset(codehandle,0,sizeof(codehandle)); + m_lasth=m_lastw=0; + m_wmul=0; + m_tab=0; + effect_exp[0].assign(""); + effect_exp[1].assign(""); + effect_exp[2].assign(""); + effect_exp[3].assign(""); + + m_lastxres=m_lastyres=0; + m_xres=16; + m_yres=16; + var_b=0; + subpixel=1; + rectcoords=0; + blend=0; + wrap=0; + buffern=0; + nomove=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=0; + } + AVS_EEL_QUITINST(); + if (m_wmul) GlobalFree(m_wmul); + if (m_tab) GlobalFree(m_tab); + + m_tab=0; + m_wmul=0; + DeleteCriticalSection(&rcs); +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return !__nomove; +} + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + __subpixel=subpixel; + __rectcoords=rectcoords; + __blend=blend; + __wrap=wrap; + __nomove=nomove; + + w_adj=(w-2)<<16; + h_adj=(h-2)<<16; + XRES=m_xres+1; + YRES=m_yres+1; + + if (XRES < 2) XRES=2; + if (XRES > 256) XRES=256; + if (YRES < 2) YRES=2; + if (YRES > 256) YRES=256; + + if (m_lasth != h || m_lastw != w || !m_tab || !m_wmul || + m_lastxres != XRES || m_lastyres != YRES) + { + int y; + m_lastxres = XRES; + m_lastyres = YRES; + m_lastw=w; + m_lasth=h; + if (m_wmul) GlobalFree(m_wmul); + m_wmul=(int*)GlobalAlloc(GMEM_FIXED,sizeof(int)*h); + for (y = 0; y < h; y ++) m_wmul[y]=y*w; + if (m_tab) GlobalFree(m_tab); + + m_tab=(int*)GlobalAlloc(GMEM_FIXED,(XRES*YRES*3 + (XRES*6 + 6)*MAX_SMP_THREADS)*sizeof(int)); + } + + if (!__subpixel) + { + w_adj=(w-1)<<16; + h_adj=(h-1)<<16; + } + + if (need_recompile) + { + int x; + int err=0; + EnterCriticalSection(&rcs); + if (!var_b || g_reset_vars_on_recompile) + { + clearVars(); + var_d = registerVar("d"); + var_b = registerVar("b"); + var_r = registerVar("r"); + var_x = registerVar("x"); + var_y = registerVar("y"); + var_w = registerVar("w"); + var_h = registerVar("h"); + var_alpha = registerVar("alpha"); + inited=0; + } + need_recompile=0; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + LeaveCriticalSection(&rcs); + } + if (isBeat&0x80000000) return 0; + int *fbin = !buffern ? framebuffer : (int *)getGlobalBuffer(w,h,buffern-1,0); + if (!fbin) return 0; + + *var_w=(double)w; + *var_h=(double)h; + *var_b=isBeat?1.0:0.0; + *var_alpha=0.5; + if (codehandle[3] && !inited) { executeCode(codehandle[3],visdata); inited=1; } + executeCode(codehandle[1],visdata); + if (isBeat) executeCode(codehandle[2],visdata); + { + int x; + int y; + int *tabptr=m_tab; + + double xsc=2.0/w,ysc=2.0/h; + double dw2=((double)w*32768.0); + double dh2=((double)h*32768.0); + double max_screen_d=sqrt((double)(w*w+h*h))*0.5; + + double divmax_d=1.0/max_screen_d; + + max_screen_d *= 65536.0; + + int yc_pos, yc_dpos, xc_pos, xc_dpos; + yc_pos=0; + xc_dpos = (w<<16)/(XRES-1); + yc_dpos = (h<<16)/(YRES-1); + for (y = 0; y < YRES; y ++) + { + xc_pos=0; + for (x = 0; x < XRES; x ++) + { + double xd,yd; + + xd=((double)xc_pos-dw2)*(1.0/65536.0); + yd=((double)yc_pos-dh2)*(1.0/65536.0); + + xc_pos+=xc_dpos; + + *var_x=xd*xsc; + *var_y=yd*ysc; + *var_d=sqrt(xd*xd+yd*yd)*divmax_d; + *var_r=atan2(yd,xd) + M_PI*0.5; + + executeCode(codehandle[0],visdata); + + int tmp1,tmp2; + if (!__rectcoords) + { + *var_d *= max_screen_d; + *var_r -= M_PI*0.5; + tmp1=(int) (dw2 + cos(*var_r) * *var_d); + tmp2=(int) (dh2 + sin(*var_r) * *var_d); + } + else + { + tmp1=(int) ((*var_x+1.0)*dw2); + tmp2=(int) ((*var_y+1.0)*dh2); + } + if (!__wrap) + { + if (tmp1 < 0) tmp1=0; + if (tmp1 > w_adj) tmp1=w_adj; + if (tmp2 < 0) tmp2=0; + if (tmp2 > h_adj) tmp2=h_adj; + } + *tabptr++ = tmp1; + *tabptr++ = tmp2; + double va=*var_alpha; + if (va < 0.0) va=0.0; + else if (va > 1.0) va=1.0; + int a=(int)(va*255.0*65536.0); + *tabptr++ = a; + } + yc_pos+=yc_dpos; + } + } + + return max_threads; +} + + +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (max_threads < 1) max_threads=1; + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + int ypos=0; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + int *fbin = !buffern ? framebuffer : (int *)getGlobalBuffer(w,h,buffern-1,0); + if (!fbin) return; + // yay, the table is generated. now we do a fixed point + // interpolation of the whole thing and pray. + + { + int *interptab=m_tab+XRES*YRES*3 + this_thread * (XRES*6+6); + int *rdtab=m_tab; + unsigned int *in=(unsigned int *)fbin; + unsigned int *blendin=(unsigned int *)framebuffer; + unsigned int *out=(unsigned int *)fbout; + int yseek=1; + int xc_dpos, yc_pos=0, yc_dpos; + xc_dpos=(w<<16)/(XRES-1); + yc_dpos=(h<<16)/(YRES-1); + int lypos=0; + int yl=end_l; + while (yl>0) + { + yc_pos+=yc_dpos; + yseek=(yc_pos>>16)-lypos; + if (!yseek) + { + #ifndef NO_MMX + __asm emms; + #endif + return; + } + lypos=yc_pos>>16; + int l=XRES; + int *stab=interptab; + int xr3=XRES*3; + while (l--) + { + int tmp1, tmp2,tmp3; + tmp1=rdtab[0]; + tmp2=rdtab[1]; + tmp3=rdtab[2]; + stab[0]=tmp1; + stab[1]=tmp2; + stab[2]=(rdtab[xr3]-tmp1)/yseek; + stab[3]=(rdtab[xr3+1]-tmp2)/yseek; + stab[4]=tmp3; + stab[5]=(rdtab[xr3+2]-tmp3)/yseek; + rdtab+=3; + stab+=6; + } + + if (yseek > yl) yseek=yl; + yl-=yseek; + + if (yseek > 0) while (yseek--) + { + int d_x; + int d_y; + int d_a; + int ap; + int seek; + int *seektab=interptab; + int xp,yp; + int l=w; + int lpos=0; + int xc_pos=0; + ypos++; + { + while (l>0) + { + xc_pos+=xc_dpos; + seek=(xc_pos>>16)-lpos; + if (!seek) + { + #ifndef NO_MMX + __asm emms; + #endif + return; + } + lpos=xc_pos>>16; + xp=seektab[0]; + yp=seektab[1]; + ap=seektab[4]; + d_a=(seektab[10]-ap)/(seek); + d_x=(seektab[6]-xp)/(seek); + d_y=(seektab[7]-yp)/(seek); + seektab[0] += seektab[2]; + seektab[1] += seektab[3]; + seektab[4] += seektab[5]; + seektab+=6; + + if (seek>l) seek=l; + l-=seek; + if (seek > 0 && ypos <= start_l) + { + blendin+=seek; + if (__nomove) in+=seek; + else out+=seek; + + seek=0; + } + if (seek>0) + { + + #define CHECK + //__docheck(xp,yp,m_lastw,m_lasth,d_x,d_y); + // normal loop + #define NORMAL_LOOP(Z) while ((seek--)) { Z; xp+=d_x; yp+=d_y; } + + #if 0 + // this would be faster, but seems like it might be less reliable: + #define WRAPPING_LOOPS(Z) \ + if (d_x <= 0 && d_y <= 0) NORMAL_LOOP(if (xp < 0) xp += w_adj; if (yp < 0) yp += h_adj; Z) \ + else if (d_x <= 0) NORMAL_LOOP(if (xp < 0) xp += w_adj; if (yp >= h_adj) yp-=h_adj; Z) \ + else if (d_y <= 0) NORMAL_LOOP(if (xp >= w_adj) xp-=w_adj; if (yp < 0) yp += h_adj; Z) \ + else NORMAL_LOOP(if (xp >= w_adj) xp-=w_adj; if (yp >= h_adj) yp-=h_adj; Z) + + #define CLAMPED_LOOPS(Z) \ + if (d_x <= 0 && d_y <= 0) NORMAL_LOOP(if (xp < 0) xp=0; if (yp < 0) yp=0; Z) \ + else if (d_x <= 0) NORMAL_LOOP(if (xp < 0) xp=0; if (yp >= h_adj) yp=h_adj-1; Z) \ + else if (d_y <= 0) NORMAL_LOOP(if (xp >= w_adj) xp=w_adj-1; if (yp < 0) yp=0; Z) \ + else NORMAL_LOOP(if (xp >= w_adj) xp=w_adj-1; if (yp >= h_adj) yp=h_adj-1; Z) + + #else // slower, more reliable loops + + // wrapping loop + #define WRAPPING_LOOPS(Z) \ + NORMAL_LOOP(if (xp < 0) xp += w_adj; \ + else if (xp >= w_adj) xp-=w_adj; \ + if (yp < 0) yp += h_adj; \ + else if (yp >= h_adj) yp-=h_adj; \ + Z) + + #define CLAMPED_LOOPS(Z) \ + NORMAL_LOOP(if (xp < 0) xp=0; \ + else if (xp >= w_adj) xp=w_adj-1; \ + if (yp < 0) yp=0; \ + else if (yp >= h_adj) yp=h_adj-1; \ + Z) + + #endif + + #define LOOPS(DO) \ + if (__blend && __subpixel) DO(CHECK *out++=BLEND_ADJ(BLEND4_16(in+(xp>>16)+(m_wmul[yp>>16]),w,xp,yp),*blendin++,ap>>16); ap+=d_a) \ + else if (__blend) DO(CHECK *out++=BLEND_ADJ(in[(xp>>16)+(m_wmul[yp>>16])],*blendin++,ap>>16); ap+=d_a) \ + else if (__subpixel) DO(CHECK *out++=BLEND4_16(in+(xp>>16)+(m_wmul[yp>>16]),w,xp,yp)) \ + else DO(CHECK *out++=in[(xp>>16)+(m_wmul[yp>>16])]) + + if (__nomove) + { + if (fbin != framebuffer) while (seek--) + { + *blendin=BLEND_ADJ(*in++,*blendin,ap>>16); ap+=d_a; + blendin++; + } + else while (seek--) + { + *blendin=BLEND_ADJ(0,*blendin,ap>>16); ap+=d_a; + blendin++; + } + } + else if (!__wrap) + { + // this might not really be necessary b/c of the clamping in the loop, but I'm sick of crashes + if (xp < 0) xp=0; + else if (xp >= w_adj) xp=w_adj-1; + if (yp < 0) yp=0; + else if (yp >= h_adj) yp=h_adj-1; + + LOOPS(CLAMPED_LOOPS) + } + else // __wrap + { + xp %= w_adj; + yp %= h_adj; + if (xp < 0) xp+=w_adj; + if (yp < 0) yp+=h_adj; + + if (d_x <= -w_adj) d_x=-w_adj+1; + else if (d_x >= w_adj) d_x=w_adj-1; + + if (d_y <= -h_adj) d_y=-h_adj+1; + else if (d_y >= h_adj) d_y=h_adj-1; + + LOOPS(WRAPPING_LOOPS) + } + } // if seek>0 + } + // adjust final (rightmost elem) part of seektab + seektab[0] += seektab[2]; + seektab[1] += seektab[3]; + seektab[4] += seektab[5]; + } + } + } + } + + +#ifndef NO_MMX + __asm emms; +#endif + +} + +C_RBASE *R_DMove(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +typedef struct +{ + char *name; + int rect; + int wrap; + int grid1; + int grid2; + char *init; + char *point; + char *frame; + char *beat; +} presetType; + +static presetType presets[]= +{ + {"Random Rotate", 0, 1, 2, 2, "","r = r + dr;","","dr = (rand(100) / 100) * $PI;\r\nd = d * .95;"}, + {"Random Direction", 1, 1, 2, 2, "speed=.05;dr = (rand(200) / 100) * $PI;","x = x + dx;\r\ny = y + dy;","dx = cos(dr) * speed;\r\ndy = sin(dr) * speed;","dr = (rand(200) / 100) * $PI;"}, + {"In and Out", 0, 1, 2, 2, "speed=.2;c=0;","d = d * dd;","","c = c + ($PI/2);\r\ndd = 1 - (sin(c) * speed);"}, + {"Unspun Kaleida", 0, 1, 33, 33, "c=200;f=0;dt=0;dl=0;beatdiv=8","r=cos(r*dr);","f = f + 1;\r\nt = ((f * $pi * 2)/c)/beatdiv;\r\ndt = dl + t;\r\ndr = 4+(cos(dt)*2);","c=f;f=0;dl=dt"}, + {"Roiling Gridley", 1, 1, 32, 32, "c=200;f=0;dt=0;dl=0;beatdiv=8","x=x+(sin(y*dx) * .03);\r\ny=y-(cos(x*dy) * .03);","f = f + 1;\r\nt = ((f * $pi * 2)/c)/beatdiv;\r\ndt = dl + t;\r\ndx = 14+(cos(dt)*8);\r\ndy = 10+(sin(dt*2)*4);","c=f;f=0;dl=dt"}, + {"6-Way Outswirl", 0, 0, 32, 32, "c=200;f=0;dt=0;dl=0;beatdiv=8","d=d*(1+(cos(r*6) * .05));\r\nr=r-(sin(d*dr) * .05);\r\nd = d * .98;","f = f + 1;\r\nt = ((f * $pi * 2)/c)/beatdiv;\r\ndt = dl + t;\r\ndr = 18+(cos(dt)*12);","c=f;f=0;dl=dt"}, + {"Wavy", 1, 1, 6, 6, "c=200;f=0;dx=0;dl=0;beatdiv=16;speed=.05","y = y + ((sin((x+dx) * $PI))*speed);\r\nx = x + .025","f = f + 1;\r\nt = ( (f * 2 * 3.1415) / c ) / beatdiv;\r\ndx = dl + t;","c = f;\r\nf = 0;\r\ndl = dx;"}, + {"Smooth Rotoblitter", 0, 1, 2, 2, "c=200;f=0;dt=0;dl=0;beatdiv=4;speed=.15","r = r + dr;\r\nd = d * dd;","f = f + 1;\r\nt = ((f * $pi * 2)/c)/beatdiv;\r\ndt = dl + t;\r\ndr = cos(dt)*speed*2;\r\ndd = 1 - (sin(dt)*speed);","c=f;f=0;dl=dt"}, +}; + + +static C_THISCLASS *g_this; +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + static int isstart; + 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()); + if (g_this->blend) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->subpixel) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (g_this->rectcoords) + CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + if (g_this->wrap) + CheckDlgButton(hwndDlg,IDC_WRAP,BST_CHECKED); + if (g_this->nomove) + CheckDlgButton(hwndDlg,IDC_NOMOVEMENT,BST_CHECKED); + + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)WASABI_API_LNGSTRING(IDS_CURRENT)); + { + int i=0; + char txt[64]; + for (i=0;i<NBUF;i++) + { + wsprintf(txt, WASABI_API_LNGSTRING(IDS_BUFFER_X), i+1); + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_ADDSTRING, 0, (int)txt); + } + } + SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_SETCURSEL, (WPARAM) g_this->buffern, 0); + + SetDlgItemInt(hwndDlg,IDC_EDIT5,g_this->m_xres,FALSE); + SetDlgItemInt(hwndDlg,IDC_EDIT6,g_this->m_yres,FALSE); + isstart=0; + + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { + char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_DYNAMIC_MOVEMENT,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_DYNAMIC_MOVEMENT),4095-titlelen); + compilerfunctionlist(hwndDlg,text); + } + + if (LOWORD(wParam)==IDC_CHECK1) + { + g_this->blend=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + if (LOWORD(wParam)==IDC_CHECK2) + { + g_this->subpixel=IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?1:0; + } + if (LOWORD(wParam)==IDC_CHECK3) + { + g_this->rectcoords=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?1:0; + } + if (LOWORD(wParam)==IDC_WRAP) + { + g_this->wrap=IsDlgButtonChecked(hwndDlg,IDC_WRAP)?1:0; + } + if (LOWORD(wParam)==IDC_NOMOVEMENT) + { + g_this->nomove=IsDlgButtonChecked(hwndDlg,IDC_NOMOVEMENT)?1:0; + } + // Load preset examples from the examples table. + if (LOWORD(wParam) == IDC_BUTTON4) + { + RECT r; + HMENU hMenu; + MENUITEMINFO i={sizeof(i),}; + hMenu=CreatePopupMenu(); + int x; + for (x = 0; x < sizeof(presets)/sizeof(presets[0]); x ++) + { + i.fMask=MIIM_TYPE|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.wID = x+16; + i.dwTypeData=presets[x].name; + i.cch=strlen(presets[x].name); + InsertMenuItem(hMenu,x,TRUE,&i); + } + GetWindowRect(GetDlgItem(hwndDlg,IDC_BUTTON1),&r); + x=TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,r.right,r.top,0,hwndDlg,NULL); + if (x >= 16 && x < 16+sizeof(presets)/sizeof(presets[0])) + { + SetDlgItemText(hwndDlg,IDC_EDIT1,presets[x-16].point); + SetDlgItemText(hwndDlg,IDC_EDIT2,presets[x-16].frame); + SetDlgItemText(hwndDlg,IDC_EDIT3,presets[x-16].beat); + SetDlgItemText(hwndDlg,IDC_EDIT4,presets[x-16].init); + SetDlgItemInt(hwndDlg,IDC_EDIT5,presets[x-16].grid1,FALSE); + SetDlgItemInt(hwndDlg,IDC_EDIT6,presets[x-16].grid2,FALSE); + if (presets[x-16].rect) + { + g_this->rectcoords = 1; + CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + } + else + { + g_this->rectcoords = 0; + CheckDlgButton(hwndDlg,IDC_CHECK3,0); + } + if (presets[x-16].wrap) + { + g_this->wrap = 1; + CheckDlgButton(hwndDlg,IDC_WRAP,BST_CHECKED); + } + else + { + g_this->wrap = 0; + CheckDlgButton(hwndDlg,IDC_WRAP,0); + } + SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_EDIT4,EN_CHANGE),0); + } + DestroyMenu(hMenu); + } + + if (!isstart && HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMBO1) // handle clicks to combo box + g_this->buffern = SendDlgItemMessage(hwndDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0); + + if (!isstart && HIWORD(wParam) == EN_CHANGE) + { + if (LOWORD(wParam) == IDC_EDIT5 || LOWORD(wParam) == IDC_EDIT6) + { + BOOL t; + g_this->m_xres=GetDlgItemInt(hwndDlg,IDC_EDIT5,&t,0); + g_this->m_yres=GetDlgItemInt(hwndDlg,IDC_EDIT6,&t,0); + } + + if (LOWORD(wParam) == IDC_EDIT1||LOWORD(wParam) == IDC_EDIT2||LOWORD(wParam) == IDC_EDIT3||LOWORD(wParam) == IDC_EDIT4) + { + 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->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT4) g_this->inited = 0; + 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_DMOVE,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_DMove(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_dotfnt.cpp b/Src/Plugins/Visualization/vis_avs/r_dotfnt.cpp new file mode 100644 index 00000000..2ec518a9 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_dotfnt.cpp @@ -0,0 +1,324 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <stdio.h> +#include <math.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + +#define C_THISCLASS C_DotFountainClass +#define MOD_NAME "Render / Dot Fountain" + +#define NUM_ROT_DIV 30 +#define NUM_ROT_HEIGHT 256 +typedef struct { + float r, dr; + float h, dh; + float ax,ay; + int c; +} FountainPoint; + + +class C_THISCLASS : public C_RBASE { + protected: + float r; + FountainPoint points[NUM_ROT_HEIGHT][NUM_ROT_DIV]; + int color_tab[64]; + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int, int); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_DOT_FOUNTAIN,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int rotvel,angle; + int colors[5]; + + void initcolortab(); +}; + + +#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; + if (len-pos >= 4) { rotvel=GET_INT(); pos+=4; } + int x; + for (x = 0; x < 5; x ++) + { + if (len-pos >= 4) { colors[x]=GET_INT(); pos+=4; } + } + if (len-pos >= 4) { angle=GET_INT(); pos+=4; } + if (len-pos >= 4) { int rr=GET_INT(); pos+=4; r=rr/32.0f;} + + + initcolortab(); +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int rr; + int pos=0; + int x; + PUT_INT(rotvel); pos+=4; + for (x = 0; x < 5; x ++) + { + PUT_INT(colors[x]); pos+=4; + } + PUT_INT(angle); pos+=4; + rr=(int)(r*32.0f); + PUT_INT(rr); pos+=4; + return pos; +} + + +void C_THISCLASS::initcolortab() +{ + int x,r,g,b,dr,dg,db,t; + for (t=0; t < 4; t ++) + { + r=(colors[t]&255)<<16; + g=((colors[t]>>8)&255)<<16; + b=((colors[t]>>16)&255)<<16; + dr=(((colors[t+1]&255)-(colors[t]&255))<<16)/16; + dg=((((colors[t+1]>>8)&255)-((colors[t]>>8)&255))<<16)/16; + db=((((colors[t+1]>>16)&255)-((colors[t]>>16)&255))<<16)/16; + for (x = 0; x < 16; x ++) + { + color_tab[t*16+x]=(r>>16)|((g>>16)<<8)|((b>>16)<<16); + r+=dr;g+=dg;b+=db; + } + } +} + +C_THISCLASS::C_THISCLASS() +{ + colors[0]=RGB(24,107,28); // reverse BGR :) + colors[1]=RGB(35,10,255); + colors[2]=RGB(116,29,42); + colors[3]=RGB(217,54,144); + colors[4]=RGB(255,136,107); + initcolortab(); + + memset(points,0,sizeof(points)); + + angle=-20; + rotvel=16; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int width, int height) +{ + if (isBeat&0x80000000) return 0; + int fo, p; + float matrix[16],matrix2[16]; + matrixRotate(matrix,2,r); + matrixRotate(matrix2,1,(float)angle); + matrixMultiply(matrix,matrix2); + matrixTranslate(matrix2,0.0f,-20.0f,400.0f); + matrixMultiply(matrix,matrix2); + + + FountainPoint pb[NUM_ROT_DIV]; + FountainPoint *in, *out; + memcpy(pb,&points[0],sizeof(pb)); + fo = NUM_ROT_HEIGHT-2; + do // transform points and remove old ones + { + float booga = 1.3f / (fo+100); + in = &points[fo][0]; + out = &points[fo+1][0]; + for (p = 0; p < NUM_ROT_DIV; p ++) + { + *out = *in; + out->r += out->dr; + out->dh += 0.05f; + out->dr += booga; + out->h += out->dh; + out++; + in++; + } + } while (fo--); + + out = &points[0][0]; + in = pb; + { // create new points + float a; + unsigned char *sd = (unsigned char *) visdata[1][0]; + for (p = 0; p < NUM_ROT_DIV; p ++) + { + int t; + if (p >= NUM_ROT_DIV) t= (sd[576] ^ 128); + else t= (*sd ^ 128); + sd++; + t*=5; + t/=4; + t-=64; + if (isBeat) t+=128; + if (t > 255) t=255; +// t+=sd[576]^128; + // t/=2; + out->r = 1.0f; + float dr = t/200.0f; + if (dr < 0) dr = -dr; + out->h = 250; + dr += 1.0; + out->dh = -dr * (100.0f + (out->dh - in->dh)) / 100.0f * 2.8f; + t = t/4; + if (t > 63) t = 63; + out->c = color_tab[t]; + a = p* 3.14159f * 2.0f / NUM_ROT_DIV; + out->ax=(float)sin(a); + out->ay=(float)cos(a); + out->dr =0.0; + out++; + in++; + } + } + + float adj=width*440.0f/640.0f; + float adj2=height*440.0f/480.0f; + if (adj2 < adj) adj=adj2; + in = &points[0][0]; + for (fo = 0; fo < NUM_ROT_HEIGHT; fo ++) + { + for (p = 0; p < NUM_ROT_DIV; p ++) + { + register float x, y, z; + matrixApply(matrix,in->ax*in->r,in->h,in->ay*in->r,&x,&y,&z); + z = adj / z; + if (z > 0.0000001) + { + register int ix = (int) (x * z) + width/2; + register int iy = (int) (y * z) + height/2; + if (iy >= 0 && iy < height && ix >= 0 && ix < width) + { + BLEND_LINE(framebuffer + iy*width + ix,in->c); + } + } + in++; + } + } + r += rotvel/5.0f; + if (r >= 360.0f) r -= 360.0f; + if (r < 0.0f) r += 360.0f; + return 0; +} + +C_RBASE *R_DotFountain(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_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { + g_this->rotvel=0; + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,50); + } + if (LOWORD(wParam) >= IDC_C1 && LOWORD(wParam) <= IDC_C5) { + GR_SelectColor(hwndDlg,&g_this->colors[IDC_C5-LOWORD(wParam)]); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + g_this->initcolortab(); + } + return 0; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID >= IDC_C1 && di->CtlID <= IDC_C5) + { + GR_DrawColoredButton(di,g_this->colors[IDC_C5-di->CtlID]); + } + } + return 0; + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,101); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->rotvel+50); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETRANGEMAX,0,181); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETPOS,1,g_this->angle+90); + + 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->rotvel=t-50; + } + if (swnd == GetDlgItem(hwndDlg,IDC_ANGLE)) + { + g_this->angle=t-90; + } + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_DOTPLANE,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_DotFountain(char *desc) {return NULL; } + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_dotgrid.cpp b/Src/Plugins/Visualization/vis_avs/r_dotgrid.cpp new file mode 100644 index 00000000..129c6410 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_dotgrid.cpp @@ -0,0 +1,331 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" + +#include <math.h> +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_DotGridClass +#define MOD_NAME "Render / Dot Grid" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_DOT_GRID,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int num_colors; + int colors[16]; + + int color_pos; + + int xp; + int yp; + int x_move; + int y_move; + int spacing; + int blend; +}; + + +#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) { spacing=GET_INT(); pos+=4; } + if (len-pos >= 4) { x_move=GET_INT(); pos+=4; } + if (len-pos >= 4) { y_move=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } +} + +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(spacing); pos+=4; + PUT_INT(x_move); pos+=4; + PUT_INT(y_move); pos+=4; + PUT_INT(blend); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + xp=0; + yp=0; + x_move=128; + y_move=128; + spacing=8; + blend=3; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int x,y; + int current_color; + + if (isBeat&0x80000000) return 0; + 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); + } + if (spacing<2)spacing=2; + while (yp < 0) yp+=spacing*256; + while (xp < 0) xp+=spacing*256; + + int sy=(yp>>8)%spacing; + int sx=(xp>>8)%spacing; + framebuffer += sy*w; + for (y = sy; y < h; y += spacing) + { + if (blend==1) + for (x = sx; x < w; x += spacing) + framebuffer[x]=BLEND(framebuffer[x],current_color); + else if (blend == 2) + for (x = sx; x < w; x += spacing) + framebuffer[x]=BLEND_AVG(framebuffer[x],current_color); + else if (blend == 3) + for (x = sx; x < w; x += spacing) + BLEND_LINE(framebuffer+x,current_color); + else + for (x = sx; x < w; x += spacing) + framebuffer[x]=current_color; + framebuffer += w*spacing; + } + xp+=x_move; + yp+=y_move; + + return 0; +} + +C_RBASE *R_DotGrid(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={ (COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,33); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->x_move/32+16); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,33); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->y_move/32+16); + + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + SetDlgItemInt(hwndDlg,IDC_EDIT1,g_this->spacing,FALSE); + if (g_this->blend==1) + CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + else if (g_this->blend==2) + CheckDlgButton(hwndDlg,IDC_RADIO3,BST_CHECKED); + else if (g_this->blend==3) + CheckDlgButton(hwndDlg,IDC_RADIO4,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + 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->x_move=(t-16)*32; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->y_move=(t-16)*32; + } + } + return 0; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_BUTTON1: + g_this->x_move=0; + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,16); + return 0; + case IDC_BUTTON3: + g_this->y_move=0; + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,16); + return 0; + case IDC_RADIO1: + case IDC_RADIO2: + case IDC_RADIO3: + case IDC_RADIO4: + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) g_this->blend=0; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO2)) g_this->blend=1; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO3)) g_this->blend=2; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO4)) g_this->blend=3; + 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_EDIT1: + { + int p; + BOOL tr=FALSE; + p=GetDlgItemInt(hwndDlg,IDC_EDIT1,&tr,FALSE); + if (tr) + { + if (p < 2) p = 2; + g_this->spacing=p; + } + } + 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; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_DOTGRID,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_DotGrid(char *desc) { return NULL; } +#endif diff --git a/Src/Plugins/Visualization/vis_avs/r_dotpln.cpp b/Src/Plugins/Visualization/vis_avs/r_dotpln.cpp new file mode 100644 index 00000000..0f94b133 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_dotpln.cpp @@ -0,0 +1,313 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <math.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_DotPlaneClass +#define MOD_NAME "Render / Dot Plane" + +#define NUM_WIDTH 64 + + +class C_THISCLASS : public C_RBASE { + protected: + float r; + float atable[NUM_WIDTH*NUM_WIDTH]; + float vtable[NUM_WIDTH*NUM_WIDTH]; + int ctable[NUM_WIDTH*NUM_WIDTH]; + int color_tab[64]; + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int, int); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_DOT_PLANE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int rotvel,angle; + int colors[5]; + + void initcolortab(); +}; + + +#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; + if (len-pos >= 4) { rotvel=GET_INT(); pos+=4; } + int x; + for (x = 0; x < 5; x ++) + { + if (len-pos >= 4) { colors[x]=GET_INT(); pos+=4; } + } + if (len-pos >= 4) { angle=GET_INT(); pos+=4; } + if (len-pos >= 4) { int rr=GET_INT(); pos+=4; r=rr/32.0f;} + + + initcolortab(); +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int rr; + int pos=0; + int x; + PUT_INT(rotvel); pos+=4; + for (x = 0; x < 5; x ++) + { + PUT_INT(colors[x]); pos+=4; + } + PUT_INT(angle); pos+=4; + rr=(int)(r*32.0f); + PUT_INT(rr); pos+=4; + return pos; +} + + +void C_THISCLASS::initcolortab() +{ + int x,r,g,b,dr,dg,db,t; + for (t=0; t < 4; t ++) + { + r=(colors[t]&255)<<16; + g=((colors[t]>>8)&255)<<16; + b=((colors[t]>>16)&255)<<16; + dr=(((colors[t+1]&255)-(colors[t]&255))<<16)/16; + dg=((((colors[t+1]>>8)&255)-((colors[t]>>8)&255))<<16)/16; + db=((((colors[t+1]>>16)&255)-((colors[t]>>16)&255))<<16)/16; + for (x = 0; x < 16; x ++) + { + color_tab[t*16+x]=(r>>16)|((g>>16)<<8)|((b>>16)<<16); + r+=dr;g+=dg;b+=db; + } + } +} + +C_THISCLASS::C_THISCLASS() +{ + colors[0]=RGB(24,107,28); // reverse BGR :) + colors[1]=RGB(35,10,255); + colors[2]=RGB(116,29,42); + colors[3]=RGB(217,54,144); + colors[4]=RGB(255,136,107); + initcolortab(); + + memset(atable,0,sizeof(atable)); + memset(vtable,0,sizeof(vtable)); + memset(ctable,0,sizeof(ctable)); + + angle=-20; + rotvel=16; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int width, int height) +{ + if (isBeat&0x80000000) return 0; + float btable[NUM_WIDTH]; + int fo, p; + float matrix[16],matrix2[16]; + matrixRotate(matrix,2,r); + matrixRotate(matrix2,1,(float)angle); + matrixMultiply(matrix,matrix2); + matrixTranslate(matrix2,0.0f,-20.0f,400.0f); + matrixMultiply(matrix,matrix2); + + memcpy(btable,&atable[0],sizeof(float)*NUM_WIDTH); + for (fo = 0; fo < NUM_WIDTH; fo ++) + { + float *i, *o, *v, *ov; + int *c,*oc; + int t=(NUM_WIDTH-(fo+2))*NUM_WIDTH; + i = &atable[t]; + o = &atable[t+NUM_WIDTH]; + v = &vtable[t]; + ov = &vtable[t+NUM_WIDTH]; + c = &ctable[t]; + oc = &ctable[t+NUM_WIDTH]; + if (fo == NUM_WIDTH-1) + { + unsigned char *sd = (unsigned char *)&visdata[0][0][0]; + i = btable; + for (p = 0; p < NUM_WIDTH; p ++) + { + register int t; + t=max(sd[0],sd[1]); + t=max(t,sd[2]); + *o = (float)t; + t>>=2; + if (t > 63) t=63; + *oc++=color_tab[t]; + + *ov++ = (*o++ - *i++) / 90.0f; + sd+=3; + } + } + else for (p = 0; p < NUM_WIDTH; p ++) + { + *o = *i++ + *v; + if (*o < 0.0f) *o=0.0f; + *ov++ = *v++ - 0.15f*(*o++/255.0f); + *oc++ = *c++; + + } + } + + float adj=width*440.0f/640.0f; + float adj2=height*440.0f/480.0f; + if (adj2 < adj) adj=adj2; + for (fo = 0; fo < NUM_WIDTH; fo ++) + { + int f = (r < 90.0 || r > 270.0) ? NUM_WIDTH-fo-1 : fo; + float dw=350.0f/(float)NUM_WIDTH, w = -(NUM_WIDTH*0.5f)*dw; + float q = (f - NUM_WIDTH*0.5f)*dw; + int *ct = &ctable[f*NUM_WIDTH]; + float *at = &atable[f*NUM_WIDTH]; + int da=1; + if (r < 180.0) + { + da=-1; + dw=-dw; + w=-w+dw; + ct += NUM_WIDTH-1; + at += NUM_WIDTH-1; + } + for (p = 0; p < NUM_WIDTH; p ++) + { + float x, y, z; + matrixApply(matrix,w,64.0f-*at,q,&x,&y,&z); + z = adj / z; + register int ix = (int) (x * z) + (width/2); + register int iy = (int) (y * z) + (height/2); + if (iy >= 0 && iy < height && ix >= 0 && ix < width) + { + BLEND_LINE(framebuffer + iy*width + ix,*ct); + } + w+=dw; + ct+=da; + at+=da; + } + } + r += rotvel/5.0f; + if (r >= 360.0f) r -= 360.0f; + if (r < 0.0f) r += 360.0f; + return 0; +} + +C_RBASE *R_DotPlane(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_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { + g_this->rotvel=0; + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,50); + } + if (LOWORD(wParam) >= IDC_C1 && LOWORD(wParam) <= IDC_C5) { + GR_SelectColor(hwndDlg,&g_this->colors[IDC_C5-LOWORD(wParam)]); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + g_this->initcolortab(); + } + return 0; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID >= IDC_C1 && di->CtlID <= IDC_C5) + { + GR_DrawColoredButton(di,g_this->colors[IDC_C5-di->CtlID]); + } + } + return 0; + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,101); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->rotvel+50); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETRANGEMAX,0,181); + SendDlgItemMessage(hwndDlg,IDC_ANGLE,TBM_SETPOS,1,g_this->angle+90); + + 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->rotvel=t-50; + } + if (swnd == GetDlgItem(hwndDlg,IDC_ANGLE)) + { + g_this->angle=t-90; + } + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_DOTPLANE,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_DotPlane(char *desc) { return NULL; } + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_fadeout.cpp b/Src/Plugins/Visualization/vis_avs/r_fadeout.cpp new file mode 100644 index 00000000..335b64cf --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_fadeout.cpp @@ -0,0 +1,280 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_FadeOutClass +#define MOD_NAME "Trans / Fadeout" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_FADEOUT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + void maketab(void); + + unsigned char fadtab[3][256]; + int fadelen, color; +}; + +void C_THISCLASS::maketab(void) +{ + int rseek=color&0xff; + int gseek=(color>>8)&0xff; + int bseek=(color>>16)&0xff; + int x; + for (x = 0; x < 256; x ++) + { + int r=x; + int g=x; + int b=x; + if (r <= rseek-fadelen) r+=fadelen; + else if (r >= rseek+fadelen) r-=fadelen; + else r=rseek; + + if (g <= gseek-fadelen) g+=fadelen; + else if (g >= gseek+fadelen) g-=fadelen; + else g=gseek; + if (b <= bseek-fadelen) b+=fadelen; + else if (b >= bseek+fadelen) b-=fadelen; + else b=bseek; + + fadtab[0][x]=r; + fadtab[1][x]=g; + fadtab[2][x]=b; + } +} + +#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; + if (len-pos >= 4) { fadelen=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + maketab(); +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(fadelen); pos+=4; + PUT_INT(color); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + color=0; + fadelen=16; + maketab(); +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + if (!fadelen) return 0; + timingEnter(1); + if ( +#ifdef NO_MMX + 1 +#else + color +#endif + ) + { + unsigned char *t=(unsigned char *)framebuffer; + int x=w*h; + while (x--) + { + t[0]=fadtab[0][t[0]]; + t[1]=fadtab[1][t[1]]; + t[2]=fadtab[2][t[2]]; + t+=4; + } + } +#ifndef NO_MMX + else + { + int l=(w*h); + char fadj[8]; + int x; + unsigned char *t=fadtab[0]; + for (x = 0; x < 8; x ++) fadj[x]=this->fadelen; + __asm + { + mov edx, l + mov edi, framebuffer + movq mm7, [fadj] + shr edx, 3 + align 16 + _l1: + movq mm0, [edi] + + movq mm1, [edi+8] + + movq mm2, [edi+16] + psubusb mm0, mm7 + + movq mm3, [edi+24] + psubusb mm1, mm7 + + movq [edi], mm0 + psubusb mm2, mm7 + + movq [edi+8], mm1 + psubusb mm3, mm7 + + movq [edi+16], mm2 + + movq [edi+24], mm3 + + add edi, 8*4 + + dec edx + jnz _l1 + + mov edx, l + sub eax, eax + + and edx, 7 + jz _l3 + + sub ebx, ebx + sub ecx, ecx + + mov esi, t + _l2: + mov al, [edi] + mov bl, [edi+1] + mov cl, [edi+2] + sub al, [esi+eax] + sub bl, [esi+ebx] + sub cl, [esi+ecx] + mov [edi], al + mov [edi+1], bl + mov [edi+2], cl + add edi, 4 + dec edx + jnz _l2 + _l3: + emms + } + } +#endif + timingLeave(1); + return 0; +} + +C_RBASE *R_FadeOut(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; + switch (di->CtlID) + { + case IDC_LC: + GR_DrawColoredButton(di,g_this->color); + break; + } + } + return 0; + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,92); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->fadelen); + + 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->fadelen=t; + g_this->maketab(); + } + } + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_LC: + GR_SelectColor(hwndDlg,&g_this->color); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + g_this->maketab(); + return 0; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_FADE,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_FadeOut(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_fastbright.cpp b/Src/Plugins/Visualization/vis_avs/r_fastbright.cpp new file mode 100644 index 00000000..f30a6710 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_fastbright.cpp @@ -0,0 +1,279 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_FastBright +#define MOD_NAME "Trans / Fast Brightness" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_FAST_BRIGHTNESS,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); +#ifdef NO_MMX + int tab[3][256]; +#endif + + int dir; +}; + + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + dir=0; + if (len-pos >= 4) { dir=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(dir); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ +#ifdef NO_MMX + int x; + for (x = 0; x < 128; x ++) + { + tab[0][x]=x+x; + tab[1][x]=x<<9; + tab[2][x]=x<<17; + } + for (; x < 256; x ++) + { + tab[0][x]=255; + tab[1][x]=255<<8; + tab[2][x]=255<<16; + } +#endif + dir=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; +#ifdef NO_MMX // the non mmx x2 version really isn't any , in terms faster than normal brightness with no exclusions turned on + { + unsigned int *t=(unsigned int *)framebuffer; + int x; + unsigned int mask = 0x7F7F7F7F; + + x=w*h/2; + if (dir == 0) + while (x--) + { + unsigned int v1=t[0]; + unsigned int v2=t[1]; + v1=tab[0][v1&0xff]|tab[1][(v1>>8)&0xff]|tab[2][(v1>>16)&0xff]|(v1&0xff000000); + v2=tab[0][v2&0xff]|tab[1][(v2>>8)&0xff]|tab[2][(v2>>16)&0xff]|(v2&0xff000000); + t[0]=v1; + t[1]=v2; + t+=2; + } + else if (dir == 1) + while (x--) + { + unsigned int v1=t[0]>>1; + unsigned int v2=t[1]>>1; + t[0]=v1&mask; + t[1]=v2&mask; + t+=2; + } + } +#else + int mask[2] = + { + 0x7F7F7F7F, + 0x7F7F7F7F, + }; + int l=(w*h); + if (dir == 0) __asm + { + mov edx, l + mov edi, framebuffer + shr edx, 3 // 8 pixels at a time + align 16 + _l1: + movq mm0, [edi] + movq mm1, [edi+8] + movq mm2, [edi+16] + paddusb mm0, mm0 + movq mm3, [edi+24] + paddusb mm1, mm1 + paddusb mm2, mm2 + movq [edi], mm0 + paddusb mm3, mm3 + movq [edi+8], mm1 + movq [edi+16], mm2 + movq [edi+24], mm3 + + add edi, 32 + + dec edx + jnz _l1 + + mov edx, l + and edx, 7 + shr edx, 1 // up the last 7 pixels (two at a time) + jz _l3 + + _l2: + movq mm3, [edi] + paddusb mm3, mm3 + movq [edi], mm3 + add edi, 8 + dec edx + jnz _l2 + _l3: + emms + } + else if (dir == 1) __asm + { + mov edx, l + movq mm7, [mask] + mov edi, framebuffer + shr edx, 3 // 8 pixels at a time + align 16 + _lr1: + movq mm0, [edi] + movq mm1, [edi+8] + + movq mm2, [edi+16] + psrl mm0, 1 + + movq mm3, [edi+24] + pand mm0, mm7 + + psrl mm1, 1 + movq [edi], mm0 + + psrl mm2, 1 + pand mm1, mm7 + + movq [edi+8], mm1 + pand mm2, mm7 + + psrl mm3, 1 + movq [edi+16], mm2 + + pand mm3, mm7 + movq [edi+24], mm3 + + add edi, 32 + + dec edx + jnz _lr1 + + mov edx, l + and edx, 7 + shr edx, 1 // up the last 7 pixels (two at a time) + jz _lr3 + + _lr2: + movq mm3, [edi] + psrl mm3, 1 + pand mm3, mm7 + movq [edi], mm3 + add edi, 8 + dec edx + jnz _lr2 + _lr3: + emms + } +#endif + return 0; +} + +C_RBASE *R_FastBright(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + if (g_this->dir==0) CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + else if (g_this->dir == 1) CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_RADIO3,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_RADIO1) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) + g_this->dir=0; + if (LOWORD(wParam) == IDC_RADIO2) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO2)) + g_this->dir=1; + if (LOWORD(wParam) == IDC_RADIO3) + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO3)) + g_this->dir=2; + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_FASTBRIGHT,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_FastBright(char *desc) { return NULL; } + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_grain.cpp b/Src/Plugins/Visualization/vis_avs/r_grain.cpp new file mode 100644 index 00000000..ed8f368b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_grain.cpp @@ -0,0 +1,406 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Grain" +#define C_THISCLASS C_GrainClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_GRAIN,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + unsigned char __inline fastrandbyte(void); + void reinit(int w, int h); + int enabled; + int blend, blendavg, smax; + unsigned char *depthBuffer; + int oldx, oldy; + int staticgrain; + unsigned char randtab[491]; + int randtab_pos; +}; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() // set up default configuration +{ +if (depthBuffer) + GlobalFree(depthBuffer); +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + blend=0; + blendavg=0; + smax=100; + enabled=1; + oldx=0; + oldy=0; + staticgrain=0; + depthBuffer=NULL; + int x; + for (x = 0 ;x < sizeof(randtab); x ++) + randtab[x]=rand()&255; + randtab_pos=rand()%sizeof(randtab); +} + +unsigned char __inline C_THISCLASS::fastrandbyte(void) +{ + unsigned char r=randtab[randtab_pos]; + randtab_pos++; + if (!(randtab_pos&15)) + { + randtab_pos+=rand()%73; + } + if (randtab_pos >= 491) randtab_pos-=491; + return r; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { smax=GET_INT(); pos+=4; } + if (len-pos >= 4) { staticgrain=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(smax); pos+=4; + PUT_INT(staticgrain); pos+=4; + return pos; +} + +void C_THISCLASS::reinit(int w, int h) +{ +int x,y; +unsigned char *p; +if (depthBuffer) + GlobalFree(depthBuffer); +depthBuffer = (unsigned char *)GlobalAlloc(GMEM_FIXED,w*h*2); +p = depthBuffer; +if (p) + for (y=0;y<h;y++) + for (x=0;x<w;x++) + { + *p++ = (rand()%255); + *p++ = (rand()%100); + } + +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + if (!enabled) return 0; + + int smax_sc = (smax*255)/100; + int *p; + unsigned char *q; + int l=w*h; + + if (w != oldx || h != oldy) + { + reinit(w, h); + oldx = w; + oldy = h; + } + randtab_pos+=rand()%300; + if (randtab_pos >= 491) randtab_pos-=491; + + p = framebuffer; + q = depthBuffer; + if (staticgrain) + { + if (blend) + { + while (l--) + { + if (*p) + { + int c=0; + if (q[1] < smax_sc) + { + int s = q[0]; + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = BLEND(*p, c); + } + p++; + q+=2; + } + } + else if (blendavg) + { + while (l--) + { + if (*p) + { + int c=0; + if (q[1] < smax_sc) + { + int s = q[0]; + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = BLEND_AVG(*p, c); + } + p++; + q+=2; + } + } + else + { + while (l--) + { + if (*p) + { + int c=0; + if (q[1] < smax_sc) + { + int s = q[0]; + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = c; + } + p++; + q+=2; + } + } + } + else + { + if (blend) + { + while (l--) + { + if (*p) + { + int c=0; + if (fastrandbyte() < smax_sc) + { + int s = fastrandbyte(); + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = BLEND(*p, c); + } + p++; + q+=2; + } + } + else if (blendavg) + { + while (l--) + { + if (*p) + { + int c=0; + if (fastrandbyte() < smax_sc) + { + int s = fastrandbyte(); + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = BLEND_AVG(*p, c); + } + p++; + q+=2; + } + } + else + { + while (l--) + { + if (*p) + { + int c=0; + if (fastrandbyte() < smax_sc) + { + int s = fastrandbyte(); + int r=(((p[0]&0xff0000)*s)>>8); + if (r > 0xff0000) r=0xff0000; + c|=r&0xff0000; + r=(((p[0]&0xff00)*s)>>8); + if (r > 0xff00) r=0xff00; + c|=r&0xff00; + r=(((p[0]&0xff)*s)>>8); + if (r > 0xff) r=0xff; + c|=r; + } + *p = c; + } + p++; + q+=2; + } + } + } + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_MAX, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_MAX, TBM_SETRANGE, TRUE, MAKELONG(0, 100)); + SendDlgItemMessage(hwndDlg, IDC_MAX, TBM_SETPOS, TRUE, g_ConfigThis->smax); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->staticgrain) CheckDlgButton(hwndDlg,IDC_STATGRAIN,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_MAX) + g_ConfigThis->smax = SendDlgItemMessage(hwndDlg, IDC_MAX, TBM_GETPOS, 0, 0); + return 0; + } + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_STATGRAIN) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->staticgrain=IsDlgButtonChecked(hwndDlg,IDC_STATGRAIN)?1:0; + } + return 0; + } +return 0; +} + + + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_GRAIN,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Grain(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + +#else +C_RBASE *R_Grain(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_interf.cpp b/Src/Plugins/Visualization/vis_avs/r_interf.cpp new file mode 100644 index 00000000..40b4e4bd --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_interf.cpp @@ -0,0 +1,525 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <commctrl.h> +#include <math.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Interferences" +#define C_THISCLASS C_InterferencesClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + float GET_FLOAT(unsigned char *data, int pos); + void PUT_FLOAT(float f, unsigned char *data, int pos); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_INTERFERENCES,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + int nPoints; + int distance; + int alpha; + int rotation; + int rotationinc; + int distance2; + int alpha2; + int rotationinc2; + int rgb; + int blend; + int blendavg; + float speed; + int onbeat; + float a; + int _distance; + int _alpha; + int _rotationinc; + int _rgb; + float status; + }; + +#define PI 3.14159 + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ +enabled=1; +nPoints = 2; +distance=10; +alpha=128; +rotation=0; +rotationinc=0; +rgb=1; +blendavg=0; +blend=0; +onbeat=1; +distance2=32; +rotationinc2=25; +alpha2=192; +status=2; +speed = (float)0.2; +a=(float)rotation/255*(float)PI*2; +} + +void C_THISCLASS::PUT_FLOAT(float f, unsigned char *data, int pos) +{ +int y = *(int *)&f; +data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255; +} + +float C_THISCLASS::GET_FLOAT(unsigned char *data, int pos) +{ +int a = data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24); +float f = *(float *)&a; +return f; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { nPoints=GET_INT(); pos+=4; } + if (len-pos >= 4) { rotation=GET_INT(); pos+=4; } + if (len-pos >= 4) { distance=GET_INT(); pos+=4; } + if (len-pos >= 4) { alpha=GET_INT(); pos+=4; } + if (len-pos >= 4) { rotationinc=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { distance2=GET_INT(); pos+=4; } + if (len-pos >= 4) { alpha2=GET_INT(); pos+=4; } + if (len-pos >= 4) { rotationinc2=GET_INT(); pos+=4; } + if (len-pos >= 4) { rgb=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { speed=GET_FLOAT(data, pos); pos+=4; } + a=(float)rotation/255*(float)PI*2; + status=(float)PI; +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + + PUT_INT(enabled); pos+=4; + PUT_INT(nPoints); pos+=4; + PUT_INT(rotation); pos+=4; + PUT_INT(distance); pos+=4; + PUT_INT(alpha); pos+=4; + PUT_INT(rotationinc); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(distance2); pos+=4; + PUT_INT(alpha2); pos+=4; + PUT_INT(rotationinc2); pos+=4; + PUT_INT(rgb); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_FLOAT(speed, data, pos); pos+=4; + + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +#define MAX_POINTS 8 + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int pnts=nPoints; + int x,y; + int i; + int mask=0; + float s; + + if (isBeat&0x80000000) return 0; + if (!enabled) return 0; + if (pnts == 0) return 0; + + float angle=(float)(2*PI)/pnts; + + if (onbeat && isBeat) + if (status >= PI) + status=0; + + s = (float)sin(status); + _rotationinc = rotationinc + (int)((float)(rotationinc2-rotationinc) * s); + _alpha = alpha + (int)((float)(alpha2-alpha) * s); + _distance = distance + (int)((float)(distance2-distance) * s); + + a=(float)rotation/255*(float)PI*2; + + int xpoints[MAX_POINTS],ypoints[MAX_POINTS]; + + int minx=0, maxx=0; + int miny=0, maxy=0; + + for (i=0;i<pnts;i++) + { + xpoints[i] = (int)(cos(a)*_distance); + ypoints[i] = (int)(sin(a)*_distance); + if (ypoints[i] > miny) miny=ypoints[i]; + if (-ypoints[i] > maxy) maxy=-ypoints[i]; + if (xpoints[i] > minx) minx=xpoints[i]; + if (-xpoints[i] > maxx) maxx=-xpoints[i]; + a += angle; + } + + unsigned char *bt=g_blendtable[_alpha]; + + int *outp=fbout; + for (y = 0; y < h; y ++) + { + int yp=ypoints[i]; + int yoffs[MAX_POINTS]; + for (i = 0; i < pnts; i ++) + { + if (y >= ypoints[i] && y-ypoints[i] < h) + yoffs[i]=(y-ypoints[i])*w; + else yoffs[i]=-1; + } + if (rgb && (pnts==3 || pnts==6)) + { + if (pnts == 3) for (x = 0; x < w; x ++) + { + int r=0,g=0,b=0; + int xp; + xp=x-xpoints[0]; + if (xp >= 0 && xp < w && yoffs[0]!=-1) + { + int pix=framebuffer[xp+yoffs[0]]; + r=bt[pix&0xff]; + } + xp=x-xpoints[1]; + if (xp >= 0 && xp < w && yoffs[1]!=-1) + { + int pix=framebuffer[xp+yoffs[1]]; + g=bt[(pix>>8)&0xff]; + } + xp=x-xpoints[2]; + if (xp >= 0 && xp < w && yoffs[2]!=-1) + { + int pix=framebuffer[xp+yoffs[2]]; + b=bt[(pix>>16)&0xff]; + } + *outp++ = r|(g<<8)|(b<<16); + } + else for (x = 0; x < w; x ++) + { + int r=0,g=0,b=0; + int xp; + xp=x-xpoints[0]; + if (xp >= 0 && xp < w && yoffs[0]!=-1) + { + int pix=framebuffer[xp+yoffs[0]]; + r=bt[pix&0xff]; + } + xp=x-xpoints[1]; + if (xp >= 0 && xp < w && yoffs[1]!=-1) + { + int pix=framebuffer[xp+yoffs[1]]; + g=bt[(pix>>8)&0xff]; + } + xp=x-xpoints[2]; + if (xp >= 0 && xp < w && yoffs[2]!=-1) + { + int pix=framebuffer[xp+yoffs[2]]; + b=bt[(pix>>16)&0xff]; + } + xp=x-xpoints[3]; + if (xp >= 0 && xp < w && yoffs[3]!=-1) + { + int pix=framebuffer[xp+yoffs[3]]; + r+=bt[pix&0xff]; + } + xp=x-xpoints[4]; + if (xp >= 0 && xp < w && yoffs[4]!=-1) + { + int pix=framebuffer[xp+yoffs[4]]; + g+=bt[(pix>>8)&0xff]; + } + xp=x-xpoints[5]; + if (xp >= 0 && xp < w && yoffs[5]!=-1) + { + int pix=framebuffer[xp+yoffs[5]]; + b+=bt[(pix>>16)&0xff]; + } + if (r > 255) r=255; + if (g > 255) g=255; + if (b > 255) b=255; + *outp++ = r|(g<<8)|(b<<16); + } + } + else if (y > miny && y < h-maxy && minx+maxx < w) // no y clipping required + { + for (x = 0; x < minx; x ++) + { + int r=0,g=0,b=0; + for (i = 0; i < pnts; i++) + { + int xp=x-xpoints[i]; + if (xp >= 0 && xp < w) + { + int pix=framebuffer[xp+yoffs[i]]; + r+=bt[pix&0xff]; + g+=bt[(pix>>8)&0xff]; + b+=bt[(pix>>16)&0xff]; + } + } + if (r > 255) r=255; + if (g > 255) g=255; + if (b > 255) b=255; + *outp++ = r|(g<<8)|(b<<16); + } + int *lfb=framebuffer+x; + for (; x < w-maxx; x ++) + { + int r=0,g=0,b=0; + for (i = 0; i < pnts; i++) + { + int pix=lfb[yoffs[i]-xpoints[i]]; + r+=bt[pix&0xff]; + g+=bt[(pix>>8)&0xff]; + b+=bt[(pix>>16)&0xff]; + } + if (r > 255) r=255; + if (g > 255) g=255; + if (b > 255) b=255; + lfb++; + *outp++ = r|(g<<8)|(b<<16); + } + for (; x < w; x ++) + { + int r=0,g=0,b=0; + for (i = 0; i < pnts; i++) + { + int xp=x-xpoints[i]; + if (xp >= 0 && xp < w) + { + int pix=framebuffer[xp+yoffs[i]]; + r+=bt[pix&0xff]; + g+=bt[(pix>>8)&0xff]; + b+=bt[(pix>>16)&0xff]; + } + } + if (r > 255) r=255; + if (g > 255) g=255; + if (b > 255) b=255; + *outp++ = r|(g<<8)|(b<<16); + } + } + else for (x = 0; x < w; x ++) + { + int r=0,g=0,b=0; + for (i = 0; i < pnts; i++) + { + int xp=x-xpoints[i]; + if (xp >= 0 && xp < w && yoffs[i]!=-1) + { + int pix=framebuffer[xp+yoffs[i]]; + r+=bt[pix&0xff]; + g+=bt[(pix>>8)&0xff]; + b+=bt[(pix>>16)&0xff]; + } + } + if (r > 255) r=255; + if (g > 255) g=255; + if (b > 255) b=255; + *outp++ = r|(g<<8)|(b<<16); + } + } + + + + + + rotation+=_rotationinc; + rotation=rotation>255 ? rotation-255 : rotation; + rotation=rotation<-255 ? rotation+255 : rotation; + + status += speed; + status=min(status, (float)PI); + if (status<-PI) status = (float) PI; + + int *p = framebuffer; + int *d = fbout; + + if (!blend && !blendavg) return 1; + if (blendavg) + { + int i=w*h/4; + while (i--) + { + p[0] = BLEND_AVG(p[0], d[0]); + p[1] = BLEND_AVG(p[1], d[1]); + p[2] = BLEND_AVG(p[2], d[2]); + p[3] = BLEND_AVG(p[3], d[3]); + p+=4; + d+=4; + } + } + else + mmx_addblend_block(p,d,w*h); + + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETRANGE, TRUE, MAKELONG(0, 8)); + SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_SETPOS, TRUE, g_ConfigThis->nPoints); + SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETTICFREQ, 16, 0); + SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETRANGE, TRUE, MAKELONG(1, 255)); + SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_SETPOS, TRUE, g_ConfigThis->alpha); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETTICFREQ, 8, 0); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETRANGE, TRUE, MAKELONG(1, 64)); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_SETPOS, TRUE, g_ConfigThis->distance); + SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETTICFREQ, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_SETPOS, TRUE, g_ConfigThis->rotationinc*-1+32); + SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETTICFREQ, 16, 0); + SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETRANGE, TRUE, MAKELONG(1, 255)); + SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_SETPOS, TRUE, g_ConfigThis->alpha2); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETTICFREQ, 8, 0); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETRANGE, TRUE, MAKELONG(1, 64)); + SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_SETPOS, TRUE, g_ConfigThis->distance2); + SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETTICFREQ, 2, 0); + SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_SETPOS, TRUE, g_ConfigThis->rotationinc2*-1+32); + SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETTICFREQ, 16, 0); + SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_SETPOS, TRUE, 255-g_ConfigThis->rotation); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETTICFREQ, 1000, 0); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(1, 128)); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->speed*100)); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_RGB), (g_ConfigThis->nPoints == 3 || g_ConfigThis->nPoints==6)); + CheckDlgButton(hwndDlg,IDC_RGB,g_ConfigThis->rgb ? BST_CHECKED: BST_UNCHECKED); + CheckDlgButton(hwndDlg,IDC_ONBEAT,g_ConfigThis->onbeat ? BST_CHECKED: BST_UNCHECKED); + return 1; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_RGB) || + (LOWORD(wParam) == IDC_ONBEAT) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->rgb=IsDlgButtonChecked(hwndDlg,IDC_RGB)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0; + } + return 0; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_NPOINTS) + { + g_ConfigThis->nPoints = SendDlgItemMessage(hwndDlg, IDC_NPOINTS, TBM_GETPOS, 0, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_RGB), (g_ConfigThis->nPoints == 3 || g_ConfigThis->nPoints==6)); + } + if (LOWORD(wParam) == IDC_ALPHA) + g_ConfigThis->alpha = SendDlgItemMessage(hwndDlg, IDC_ALPHA, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_DISTANCE) + g_ConfigThis->distance = SendDlgItemMessage(hwndDlg, IDC_DISTANCE, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_ROTATE) + g_ConfigThis->rotationinc= -1*(SendDlgItemMessage(hwndDlg, IDC_ROTATE, TBM_GETPOS, 0, 0)-32); + if (LOWORD(wParam) == IDC_INITROT) + g_ConfigThis->rotation = 255-SendDlgItemMessage(hwndDlg, IDC_INITROT, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_SPEED) + g_ConfigThis->speed = (float)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)/100; + if (LOWORD(wParam) == IDC_ALPHA2) + g_ConfigThis->alpha2 = SendDlgItemMessage(hwndDlg, IDC_ALPHA2, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_DISTANCE2) + g_ConfigThis->distance2 = SendDlgItemMessage(hwndDlg, IDC_DISTANCE2, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_ROTATE2) + g_ConfigThis->rotationinc2= -1*(SendDlgItemMessage(hwndDlg, IDC_ROTATE2, TBM_GETPOS, 0, 0)-32); + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_INTERF,hwndParent,g_DlgProc); +} + +// export stuff + +C_RBASE *R_Interferences(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + + +#else +C_RBASE *R_Interferences(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ +return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_interleave.cpp b/Src/Plugins/Visualization/vis_avs/r_interleave.cpp new file mode 100644 index 00000000..62b1ae19 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_interleave.cpp @@ -0,0 +1,381 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Interleave" +#define C_THISCLASS C_InterleaveClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_INTERLEAVE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int x, y; + int enabled; + int color; + int blend; + int blendavg; + int onbeat, x2,y2,beatdur; + double cur_x,cur_y; +}; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() // set up default configuration +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + onbeat=0; + beatdur=4; + + color = 0; + x2=x=1; + y2=y=1; + cur_x=cur_y=1.0; + enabled=1; + blend=0; + blendavg=0; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { x=GET_INT(); pos+=4; } + if (len-pos >= 4) { y=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { x2=GET_INT(); pos+=4; } + if (len-pos >= 4) { y2=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatdur=GET_INT(); pos+=4; } + cur_x=x; + cur_y=y; +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(x); pos+=4; + PUT_INT(y); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_INT(x2); pos+=4; + PUT_INT(y2); pos+=4; + PUT_INT(beatdur); pos+=4; + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + if (!enabled) return 0; + int ystat=0; + int yp=0; + + double sc1=(beatdur+512.0-64.0)/512.0; + cur_x=(cur_x*sc1+x*(1.0-sc1)); + cur_y=(cur_y*sc1+y*(1.0-sc1)); + + if (isBeat && onbeat) + { + cur_x=x2; + cur_y=y2; + } + int tx=(int)cur_x; + int ty=(int)cur_y; + int xos=0; + + int *p=framebuffer; + int j; + if (!ty) + { + ystat=1; + } + if (tx > 0) + { + xos=(w%tx)/2; + } + if (ty > 0) yp=(h%ty)/2; + if (tx>=0 && ty >=0) for (j=0;j<h;j++) + { + int xstat=0; + if (ty && ++yp>=ty) + { + ystat=!ystat; + yp=0; + } + int l=w; + + if (!ystat) // this line is pure color + { + if (blend) + { + while (l--) + { + *p=BLEND(*p, color); + p++; + } + } + else if (blendavg) + { + while (l--) + { + *p=BLEND_AVG(*p, color); + p++; + } + } + else + { + while (l--) + { + *p++=color; + } + } + } + else if (tx) + { + if (blend) + { + int xo=xos; + while (l>0) + { + int l2=min(l,tx-xo); + xo=0; + l-=l2; + if (xstat) p+=l2; + else while (l2--) { *p=BLEND(*p,color); p++; } + xstat=!xstat; + } + } + else if (blendavg) + { + int xo=xos; + while (l>0) + { + int l2=min(l,tx-xo); + xo=0; + l-=l2; + if (xstat) p+=l2; + else while (l2--) { *p=BLEND_AVG(*p,color); p++; } + xstat=!xstat; + } + } + else + { + int xo=xos; + while (l>0) + { + int l2=min(l,tx-xo); + xo=0; + l-=l2; + if (xstat) p+=l2; + else while (l2--) { *p++=color; } + xstat=!xstat; + } + } + } + else p+=w; + } + + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_X, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_X, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_X, TBM_SETPOS, TRUE, g_ConfigThis->x); + SendDlgItemMessage(hwndDlg, IDC_Y, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_Y, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_Y, TBM_SETPOS, TRUE, g_ConfigThis->y); + SendDlgItemMessage(hwndDlg, IDC_X2, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_X2, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_X2, TBM_SETPOS, TRUE, g_ConfigThis->x2); + SendDlgItemMessage(hwndDlg, IDC_Y2, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_Y2, TBM_SETRANGE, TRUE, MAKELONG(0, 64)); + SendDlgItemMessage(hwndDlg, IDC_Y2, TBM_SETPOS, TRUE, g_ConfigThis->y2); + SendDlgItemMessage(hwndDlg, IDC_X3, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_X3, TBM_SETRANGE, TRUE, MAKELONG(1, 64)); + SendDlgItemMessage(hwndDlg, IDC_X3, TBM_SETPOS, TRUE, g_ConfigThis->beatdur); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_CHECK8,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_X)) + { + g_ConfigThis->cur_x=(double)(g_ConfigThis->x = t); + } + else if (swnd == GetDlgItem(hwndDlg,IDC_Y)) + { + g_ConfigThis->cur_y=(double)(g_ConfigThis->y = t); + } + else if (swnd == GetDlgItem(hwndDlg,IDC_X2)) + { + g_ConfigThis->cur_x=(double)(g_ConfigThis->x2 = t); + } + else if (swnd == GetDlgItem(hwndDlg,IDC_Y2)) + { + g_ConfigThis->cur_y=(double)(g_ConfigThis->y2 = t); + } + else if (swnd == GetDlgItem(hwndDlg,IDC_X3)) + { + g_ConfigThis->beatdur=t; + } + } + return 0; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_CHECK8) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_CHECK8)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + } + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_INTERLEAVE,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Interleave(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Interleave(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_invert.cpp b/Src/Plugins/Visualization/vis_avs/r_invert.cpp new file mode 100644 index 00000000..50520b4b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_invert.cpp @@ -0,0 +1,186 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Invert" +#define C_THISCLASS C_InvertClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_INVERT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + enabled=1; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int i=w*h; + int *p=framebuffer; + + if (isBeat&0x80000000) return 0; + if (!enabled) return 0; + +#ifndef NO_MMX + int a[2]={0xffffff,0xffffff}; + __asm + { + mov ecx, i + shr ecx, 3 + movq mm0, [a] + mov edi, p + align 16 +_mmx_invert_loop: + movq mm1, [edi] + movq mm2, [edi+8] + pxor mm1, mm0 + movq mm3, [edi+16] + pxor mm2, mm0 + movq mm4, [edi+24] + pxor mm3, mm0 + movq [edi], mm1 + pxor mm4, mm0 + movq [edi+8], mm2 + movq [edi+16], mm3 + movq [edi+24], mm4 + add edi, 32 + dec ecx + jnz _mmx_invert_loop + mov ecx, i + shr ecx, 1 + and ecx, 3 + jz _mmx_invert_noendloop +_mmx_invert_endloop: + movq mm1, [edi] + pxor mm1, mm0 + movq [edi], mm1 + add edi, 8 + dec ecx + jnz _mmx_invert_endloop + +_mmx_invert_noendloop: + emms + } +#else + while (i--) *p++ = 0xFFFFFF^*p; +#endif + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK1) + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_INVERT,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Invert(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Invert(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_linemode.cpp b/Src/Plugins/Visualization/vis_avs/r_linemode.cpp new file mode 100644 index 00000000..370c1922 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_linemode.cpp @@ -0,0 +1,190 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +int g_line_blend_mode; + +static int line_blendmodes[]= +{ + IDS_REPLACE, + IDS_ADDITIVE, + IDS_MAXIMUM_BLEND, + IDS_50_50_BLEND, + IDS_SUBTRACTIVE_BLEND_1, + IDS_SUBTRACTIVE_BLEND_2, + IDS_MULTIPLY_BLEND, + IDS_ADJUSTABLE_BLEND, + IDS_XOR, + IDS_MINIMUM_BLEND, +}; + +#define C_THISCLASS C_LineModeClass +#define MOD_NAME "Misc / Set render mode" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_MISC_SET_RENDER_MODE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int newmode; +}; + +#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; + if (len-pos >= 4) { newmode=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(newmode); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + newmode=0x80010000; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + if (newmode&0x80000000) + { + g_line_blend_mode=newmode&0x7fffffff; + } + return 0; +} + +C_RBASE *R_LineMode(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 0; x<sizeof(line_blendmodes)/sizeof(line_blendmodes[0]); x ++) + { + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)WASABI_API_LNGSTRING(line_blendmodes[x])); + } + } + if (g_this->newmode&0x80000000) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_ALPHASLIDE, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_ALPHASLIDE, TBM_SETPOS, TRUE, (int)(g_this->newmode>>8)&0xff); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_SETCURSEL,(WPARAM)g_this->newmode&0xff,0); + EnableWindow(GetDlgItem(hwndDlg, IDC_OUTSLIDE), (g_this->newmode&0xff) == 7); + SetDlgItemInt(hwndDlg,IDC_EDIT1,(g_this->newmode>>16)&0xff,FALSE); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_EDIT1: + { + int r,t; + r=GetDlgItemInt(hwndDlg,IDC_EDIT1,&t,FALSE); + if (t) + { + g_this->newmode&=~0xff0000; + g_this->newmode|=(r&0xff)<<16; + } + } + break; + case IDC_CHECK1: + g_this->newmode&=0x7fffffff; + g_this->newmode|=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?0x80000000:0; + break; + case IDC_COMBO1: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int r=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (r!=CB_ERR) + { + g_this->newmode&=~0xff; + g_this->newmode|=r; + EnableWindow(GetDlgItem(hwndDlg, IDC_OUTSLIDE), r == 7); + } + } + break; + } + return 0; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_ALPHASLIDE) + { + g_this->newmode &= ~0xff00; + g_this->newmode |= (SendDlgItemMessage(hwndDlg, IDC_ALPHASLIDE, TBM_GETPOS, 0, 0)&0xff)<<8; + } + break; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_LINEMODE,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_LineMode(char *desc) +{ + return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_list.cpp b/Src/Plugins/Visualization/vis_avs/r_list.cpp new file mode 100644 index 00000000..d0ee55a6 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_list.cpp @@ -0,0 +1,1401 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdio.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "r_unkn.h" +#include "r_list.h" +#include "render.h" +#include "undo.h" + +#include "avs_eelif.h" +#include "../Agave/Language/api_language.h" + +#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)) + +char *C_RenderListClass::get_desc() { static char desc[128]; return WASABI_API_LNGSTRING_BUF(isroot?IDS_MAIN:IDS_EFFECT_LIST,desc,128); } + +int g_config_seh=1; +extern int g_config_smp_mt,g_config_smp; + +static char extsigstr[]="AVS 2.8+ Effect List Config"; + +void C_RenderListClass::load_config_code(unsigned char *data, int len) +{ + int pos=0; + if (len-pos >= 4) + { + use_code=GET_INT(); pos+=4; + load_string(effect_exp[0],data,pos,len); + load_string(effect_exp[1],data,pos,len); + } + +} + +void C_RenderListClass::load_config(unsigned char *data, int len) +{ + int pos=0,ext; + if (pos<len) { mode=data[pos++]; } + if (mode&0x80) + { + mode&=~0x80; + mode=mode|GET_INT(); pos+=4; + } + ext = get_extended_datasize()+5; + if (ext > 5) + { + if (pos<ext) { inblendval=GET_INT(); pos+=4; } + if (pos<ext) { outblendval=GET_INT(); pos+=4; } + if (pos<ext) { bufferin=GET_INT(); pos+=4; } + if (pos<ext) { bufferout=GET_INT(); pos+=4; } + if (pos<ext) { ininvert=GET_INT(); pos+=4; } + if (pos<ext) { outinvert=GET_INT(); pos+=4; } + if (pos<ext-4) { beat_render=GET_INT(); pos+=4; } //BU + if (pos<ext-4) { beat_render_frames=GET_INT(); pos+=4; } + } + use_code=0; + effect_exp[0].assign(""); + effect_exp[1].assign(""); + while (pos < len) + { + char s[33]; + T_RenderListType t; + int l_len; + t.effect_index=GET_INT(); pos+=4; + if (t.effect_index >= DLLRENDERBASE) + { + if (pos+32 > len) break; + memcpy(s,data+pos,32); + s[32]=0; + t.effect_index=(int)s; + pos+=32; + } + if (pos+4 > len) break; + l_len=GET_INT(); pos+=4; + if (pos+l_len > len || l_len < 0) break; + + if (ext>5 && t.effect_index >= DLLRENDERBASE && !memcmp(s,extsigstr,strlen(extsigstr)+1)) + { + load_config_code(data+pos,l_len); + } + else + { + t.render=g_render_library->CreateRenderer(&t.effect_index,&t.has_rbase2); + if (t.render) + { + t.render->load_config(data+pos,l_len); + insertRender(&t,-1); + } + } + pos+=l_len; + } +} + +int C_RenderListClass::save_config_code(unsigned char *data) +{ + int pos=0; + PUT_INT(use_code); pos+=4; + save_string(data,pos,effect_exp[0]); + save_string(data,pos,effect_exp[1]); + return pos; +} + +int C_RenderListClass::save_config(unsigned char *data) +{ + return save_config_ex(data,0); +} +int C_RenderListClass::save_config_ex(unsigned char *data, int rootsave) +{ + int pos=0; + int x; + if (!rootsave) + { + set_extended_datasize(36); // size of extended data + 4 cause we fucked up + data[pos++]=(mode&0xff)|0x80; + PUT_INT(mode); pos+=4; + // extended_data + PUT_INT(inblendval); pos+=4; + PUT_INT(outblendval); pos+=4; + PUT_INT(bufferin); pos+=4; + PUT_INT(bufferout); pos+=4; + PUT_INT(ininvert); pos+=4; + PUT_INT(outinvert); pos+=4; + PUT_INT(beat_render); pos+=4; + PUT_INT(beat_render_frames); pos+=4; + // end extended data + } + else data[pos++] = mode; + + if (!rootsave) + { + // write in our ext field + PUT_INT(DLLRENDERBASE); pos+=4; + char s[33]; + strncpy(s,extsigstr,32); + memcpy(data+pos,s,32); + pos+=32; + int t=save_config_code(data+pos+4); + PUT_INT(t); + pos+=4+t; + } + + + for (x = 0; x < num_renders; x ++) + { + int t; + int idx=renders[x].effect_index; + if (idx==UNKN_ID) + { + C_UnknClass *r=(C_UnknClass *)renders[x].render; + if (!r->idString[0]) { PUT_INT(r->id); pos+=4; } + else + { + PUT_INT(r->id); pos+=4; + memcpy(data+pos,r->idString,32); + pos+=32; + } + } + else + { + PUT_INT(idx); pos+=4; + if (idx >= DLLRENDERBASE) + { + char s[33]; + strncpy(s,(char*)idx,32); + memcpy(data+pos,s,32); + pos+=32; + } + } + + t=renders[x].render->save_config(data+pos+4); + PUT_INT(t); + pos+=4+t; + } + + + + return pos; +} + + +C_RenderListClass::C_RenderListClass(int iroot) +{ + AVS_EEL_INITINST(); + isstart=0; +#ifndef LASER + nsaved=0; + memset(nbw_save,0,sizeof(nbw_save)); + memset(nbw_save2,0,sizeof(nbw_save2)); + memset(nbh_save,0,sizeof(nbh_save)); + memset(nbh_save2,0,sizeof(nbh_save2)); + memset(nb_save,0,sizeof(nb_save)); + memset(nb_save2,0,sizeof(nb_save2)); +#endif + inblendval=128; + outblendval=128; + ininvert=0; + + InitializeCriticalSection(&rcs); + use_code=0; + inited=0; + need_recompile=1; + memset(codehandle,0,sizeof(codehandle)); + var_beat=0; + + + effect_exp[0].assign(""); + effect_exp[1].assign(""); + outinvert=0; + bufferin=0; + bufferout=0; + isroot=iroot; + num_renders=0; + num_renders_alloc=0; + renders=NULL; + thisfb=NULL; + l_w=l_h=0; + mode=0; + beat_render = 0; + beat_render_frames = 1; + fake_enabled = 0; +#ifdef LASER + if (!iroot) line_save=createLineList(); + else line_save=NULL; +#endif +} + +extern int g_n_buffers_w[NBUF],g_n_buffers_h[NBUF]; +extern void *g_n_buffers[NBUF]; + +#ifndef LASER +void C_RenderListClass::set_n_Context() +{ + if (!isroot) return; + if (nsaved) return; + nsaved=1; + memcpy(nbw_save2,g_n_buffers_w,sizeof(nbw_save2)); + memcpy(nbh_save2,g_n_buffers_h,sizeof(nbh_save2)); + memcpy(nb_save2,g_n_buffers,sizeof(nb_save2)); + + memcpy(g_n_buffers_w,nbw_save,sizeof(nbw_save)); + memcpy(g_n_buffers_h,nbh_save,sizeof(nbh_save)); + memcpy(g_n_buffers,nb_save,sizeof(nb_save)); +} + +void C_RenderListClass::unset_n_Context() +{ + if (!isroot) return; + if (!nsaved) return; + nsaved=0; + + memcpy(nbw_save,g_n_buffers_w,sizeof(nbw_save)); + memcpy(nbh_save,g_n_buffers_h,sizeof(nbh_save)); + memcpy(nb_save,g_n_buffers,sizeof(nb_save)); + + memcpy(g_n_buffers_w,nbw_save2,sizeof(nbw_save2)); + memcpy(g_n_buffers_h,nbh_save2,sizeof(nbh_save2)); + memcpy(g_n_buffers,nb_save2,sizeof(nb_save2)); + +} +#endif + +void C_RenderListClass::smp_cleanupthreads() +{ + + if (smp_parms.threadTop>0) + { + if (smp_parms.hQuitHandle) SetEvent(smp_parms.hQuitHandle); + + WaitForMultipleObjects(smp_parms.threadTop,smp_parms.hThreads,TRUE,INFINITE); + int x; + for (x = 0; x < smp_parms.threadTop; x ++) + { + CloseHandle(smp_parms.hThreads[x]); + CloseHandle(smp_parms.hThreadSignalsDone[x]); + CloseHandle(smp_parms.hThreadSignalsStart[x]); + } + } + + if (smp_parms.hQuitHandle) CloseHandle(smp_parms.hQuitHandle); + + memset(&smp_parms,0,sizeof(smp_parms)); +} + +void C_RenderListClass::freeBuffers() +{ +#ifndef LASER + if (isroot) + { + int x; + for (x = 0; x < NBUF; x ++) + { + if (nb_save[x]) GlobalFree(nb_save[x]); + nb_save[x]=NULL; + nbw_save[x]=nbh_save[x]=0; + } + } +#endif +} + +C_RenderListClass::~C_RenderListClass() +{ +#ifdef LASER + if (line_save) delete line_save; +#endif + clearRenders(); + + // free nb_save + freeBuffers(); + + int x; + for (x = 0; x < 2; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=0; + } + AVS_EEL_QUITINST(); + DeleteCriticalSection(&rcs); +} + +static int __inline depthof(int c, int i) +{ + int r= max(max((c & 0xFF), ((c & 0xFF00)>>8)), (c & 0xFF0000)>>16); + return i ? 255 - r : r; +} + + + +int C_RenderListClass::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int is_preinit = (isBeat&0x80000000); + + if (isBeat && beat_render) + fake_enabled = beat_render_frames; + + int use_enabled=enabled(); + int use_inblendval = inblendval; + int use_outblendval = outblendval; + int use_clear=clearfb(); + + if (!isroot && use_code) + { + if (need_recompile) + { + EnterCriticalSection(&rcs); + + if (!var_beat || g_reset_vars_on_recompile) + { + clearVars(); + var_beat = registerVar("beat"); + var_alphain = registerVar("alphain"); + var_alphaout = registerVar("alphaout"); + var_enabled = registerVar("enabled"); + var_clear = registerVar("clear"); + var_w = registerVar("w"); + var_h = registerVar("h"); + inited=0; + } + + need_recompile=0; + int x; + for (x = 0; x < 2; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + + LeaveCriticalSection(&rcs); + } + + *var_beat = ((isBeat&1) && !is_preinit) ?1.0:0.0; + *var_enabled=use_enabled ? 1.0:0.0; + *var_w=(double)w; + *var_h=(double)h; + *var_clear=use_clear ? 1.0:0.0; + *var_alphain=use_inblendval/255.0; + *var_alphaout=use_outblendval/255.0; + if (codehandle[0] && !inited) { executeCode(codehandle[0],visdata); inited=1; } + executeCode(codehandle[1],visdata); + + if (!is_preinit) + { + isBeat = *var_beat > 0.1 || *var_beat < -0.1; + } + use_inblendval = (int) (*var_alphain * 255.0); + if (use_inblendval < 0) use_inblendval=0; + else if (use_inblendval>255) use_inblendval=255; + use_outblendval = (int) (*var_alphaout * 255.0); + if (use_outblendval < 0) use_outblendval=0; + else if (use_outblendval>255) use_outblendval=255; + + use_enabled = *var_enabled > 0.1 || *var_enabled < -0.1; + use_clear = *var_clear > 0.1 || *var_clear < -0.1; + + // code execute + } + +#ifndef LASER + // root/replaceinout special cases + if (isroot || (use_enabled && blendin()==1 && blendout()==1)) +#endif + { + int s=0,x; +#ifndef LASER + int line_blend_mode_save=g_line_blend_mode; + if (thisfb) GlobalFree((HGLOBAL)thisfb); + thisfb=NULL; + if (use_clear&&(isroot||blendin()!=1)) + memset(framebuffer,0,w*h*sizeof(int)); + if (!is_preinit) + { + g_line_blend_mode=0; + set_n_Context(); + } +#else + if (isroot || use_enabled) + { + void LineListSwap(C_LineListBase *item1, C_LineListBase *item2); + if (!isroot) + { + line_save->ClearLineList(); + LineListSwap(line_save,g_laser_linelist); + } +#endif + for (x = 0; x < num_renders; x ++) + { + int t=0; + int smp_max_threads = g_config_smp ? g_config_smp_mt : 0; + C_RBASE2 *rb2 = (C_RBASE2*)renders[x].render; + + if (renders[x].has_rbase2 && smp_max_threads > 1 && (rb2->smp_getflags()&1)) + { + if (smp_max_threads>MAX_SMP_THREADS) smp_max_threads=MAX_SMP_THREADS; + + int nt=smp_max_threads; + nt=rb2->smp_begin(nt,visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + if (!is_preinit && nt>0) + { + if (nt>smp_max_threads)nt=smp_max_threads; + + // launch threads + smp_Render(nt,rb2,visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + + + t=rb2->smp_finish(visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + } + + } + else + { + if (g_config_seh && renders[x].effect_index != LIST_ID) + { + __try + { + t=renders[x].render->render(visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + t=0; + } + } + else + { + t=renders[x].render->render(visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + } + } + + + if (t&1) s^=1; + if (!is_preinit) + { + if (t&0x10000000) isBeat=1; + if (t&0x20000000) isBeat=0; + } + } +#ifdef LASER + if (!isroot) + { + LineListSwap(line_save,g_laser_linelist); + int us=g_laser_linelist->GetUsedLines(); + int n=g_laser_linelist->GetMaxLines()-us; + if (line_save->GetUsedLines() < n) n=line_save->GetUsedLines(); + g_laser_linelist->SetLines(line_save->GetLineList(),us,n); + g_laser_linelist->SetUsedLines(us+n); + } + } +#else + if (!is_preinit) + { + g_line_blend_mode=line_blend_mode_save; + unset_n_Context(); + } +#endif + fake_enabled--; + return s; + } + +#ifndef LASER + // check to see if we're enabled + if (!use_enabled) + { + if (thisfb) GlobalFree((HGLOBAL)thisfb); + thisfb=NULL; + return 0; + } + + fake_enabled--; + + + // handle resize + if (l_w != w || l_h != h || !thisfb) + { + extern int config_reuseonresize; + int do_resize=config_reuseonresize && !!thisfb && l_w && l_h && !use_clear; + + int *newfb=(int*)GlobalAlloc(do_resize?GMEM_FIXED:GPTR,w*h*sizeof(int)); + if (newfb && do_resize) + { + int x,y; + int dxpos=(l_w<<16)/w; + int ypos=0; + int dypos=(l_h<<16)/h; + int *out=newfb; + for (y = 0; y < h; y++) + { + int *p=thisfb + l_w * (ypos>>16); + int xpos=0; + for (x = 0; x < w; x ++) + { + *out++=p[xpos>>16]; + xpos+=dxpos; + } + ypos+=dypos; + } + } + l_w=w; + l_h=h; + if (thisfb) GlobalFree((HGLOBAL)thisfb); + thisfb=newfb; + } + // handle clear mode + if (use_clear) memset(thisfb,0,w*h*sizeof(int)); + + + // blend parent framebuffer into current, if necessary + + if (!is_preinit) + { + int x=w*h; + int *tfb=framebuffer; + int *o=thisfb; + set_n_Context(); + int use_blendin=blendin(); + if (use_blendin == 10 && use_inblendval >= 255) + use_blendin=1; + + switch (use_blendin) + { + case 1: + memcpy(o,tfb,w*h*sizeof(int)); + break; + case 2: + mmx_avgblend_block(o,tfb,x); + break; + case 3: + while (x--) + { + *o=BLEND_MAX(*o,*tfb++); + o++; + } + break; + case 4: + mmx_addblend_block(o,tfb,x); + break; + case 5: + while (x--) + { + *o=BLEND_SUB(*o,*tfb++); + o++; + } + break; + case 6: + while (x--) + { + *o=BLEND_SUB(*tfb++,*o); + o++; + } + break; + case 7: + { + int y=h/2; + while (y-- > 0) + { + memcpy(o,tfb,w*sizeof(int)); + tfb+=w*2; + o+=w*2; + } + } + break; + case 8: + { + int r=0; + int y=h; + while (y-- > 0) + { + int *out, *in; + int x=w/2; + out=o+r; + in=tfb+r; + r^=1; + while (x-- > 0) + { + *out=*in; + out+=2; + in+=2; + } + o+=w; + tfb+=w; + } + } + break; + case 9: + while (x--) + { + *o=*o^*tfb++; + o++; + } + break; + case 10: + mmx_adjblend_block(o,tfb,o,x,use_inblendval); + break; + case 11: + mmx_mulblend_block(o,tfb,x); + break; + case 13: + while (x--) + { + *o=BLEND_MIN(*o,*tfb++); + o++; + } + break; + case 12: + { + int *buf=(int*)getGlobalBuffer(w,h,bufferin,0); + if (!buf) break; + while (x--) + { + *o=BLEND_ADJ(*tfb++,*o, depthof(*buf, ininvert)); + o++; + buf++; + } + } +#ifndef NO_MMX + __asm emms; +#endif + break; + default: + break; + } + unset_n_Context(); + } + + int s=0; + int x; + int line_blend_mode_save=g_line_blend_mode; + if (!is_preinit) g_line_blend_mode=0; + + for (x = 0; x < num_renders; x ++) + { + int t=0; + + int smp_max_threads; + C_RBASE2 *rb2; + + if (renders[x].has_rbase2 && (smp_max_threads=g_config_smp ? g_config_smp_mt : 0) > 1 && ((rb2 = (C_RBASE2*)renders[x].render)->smp_getflags()&1)) + { + if (smp_max_threads>MAX_SMP_THREADS) smp_max_threads=MAX_SMP_THREADS; + + int nt=smp_max_threads; + nt=rb2->smp_begin(nt,visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + if (!is_preinit && nt>0) + { + if (nt>smp_max_threads)nt=smp_max_threads; + + // launch threads + smp_Render(nt,rb2,visdata,isBeat,s?fbout:thisfb,s?thisfb:fbout,w,h); + + t=rb2->smp_finish(visdata,isBeat,s?fbout:framebuffer,s?framebuffer:fbout,w,h); + } + + } + else if (g_config_seh && renders[x].effect_index != LIST_ID) + { + __try + { + t=renders[x].render->render(visdata,isBeat,s?fbout:thisfb,s?thisfb:fbout,w,h); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + t=0; + } + } + else + { + t=renders[x].render->render(visdata,isBeat,s?fbout:thisfb,s?thisfb:fbout,w,h); + } + + + if (t&1) s^=1; + if (!is_preinit) + { + if (t&0x10000000) + isBeat=1; + if (t&0x20000000) + isBeat=0; + } + } + if (!is_preinit) g_line_blend_mode=line_blend_mode_save; + + // if s==1 at this point, data we want is in fbout. + + if (!is_preinit) + { + if (s) memcpy(thisfb,fbout,w*h*sizeof(int)); + + int *tfb=s?fbout:thisfb; + int *o=framebuffer; + x=w*h; + set_n_Context(); + + int use_blendout=blendout(); + if (use_blendout == 10 && use_outblendval >= 255) + use_blendout=1; + switch (use_blendout) + { + case 1: + if (s) + { + unset_n_Context(); + return 1; + } + memcpy(o,tfb,x*sizeof(int)); + break; + case 2: + mmx_avgblend_block(o,tfb,x); + break; + case 3: + while (x--) + { + *o=BLEND_MAX(*o,*tfb++); + o++; + } + break; + case 4: + mmx_addblend_block(o,tfb,x); + break; + case 5: + while (x--) + { + *o=BLEND_SUB(*o,*tfb++); + o++; + } + break; + case 6: + while (x--) + { + *o=BLEND_SUB(*tfb++,*o); + o++; + } + break; + case 7: + { + int y=h/2; + while (y-- > 0) + { + memcpy(o,tfb,w*sizeof(int)); + tfb+=w*2; + o+=w*2; + } + } + break; + case 8: + { + int r=0; + int y=h; + while (y-- > 0) + { + int *out, *in; + int x=w/2; + out=o+r; + in=tfb+r; + r^=1; + while (x-- > 0) + { + *out=*in; + out+=2; + in+=2; + } + o+=w; + tfb+=w; + } + } + break; + case 9: + while (x--) + { + *o=*o^*tfb++; + o++; + } + break; + case 10: + mmx_adjblend_block(o,tfb,o,x,use_outblendval); + break; + case 11: + mmx_mulblend_block(o,tfb,x); + break; + case 13: + while (x--) + { + *o=BLEND_MIN(*o,*tfb++); + o++; + } + break; + case 12: + { + int *buf=(int*)getGlobalBuffer(w,h,bufferout,0); + if (!buf) break; + while (x--) + { + *o=BLEND_ADJ(*tfb++,*o, depthof(*buf, outinvert)); + o++; + buf++; + } + #ifndef NO_MMX + __asm emms; + #endif + } + break; + default: + break; + } + unset_n_Context(); + } + return 0; +#endif // !LASER +} + +int C_RenderListClass::getNumRenders(void) +{ + return num_renders; +} + +C_RenderListClass::T_RenderListType *C_RenderListClass::getRender(int index) +{ + if (index >= 0 && index < num_renders) return &renders[index]; + return NULL; +} + +int C_RenderListClass::findRender(T_RenderListType *r) +{ + int idx; + if (!r) return -1; + for (idx=0;idx<num_renders&&renders[idx].render!=r->render; idx++); + if (idx<num_renders) return idx; + return -1; +} + +int C_RenderListClass::removeRenderFrom(T_RenderListType *r, int del) +{ + int idx; + if (!r) return 1; + for (idx=0;idx<num_renders&&renders[idx].render!=r->render; idx++); + return removeRender(idx,del); +} + +int C_RenderListClass::removeRender(int index, int del) +{ + if (index >= 0 && index < num_renders) + { + if (del&&renders[index].render) delete renders[index].render; + num_renders--; + while (index<num_renders) + { + renders[index]=renders[index+1]; + index++; + } + if (!num_renders) + { + num_renders_alloc=0; + if (renders) GlobalFree((HGLOBAL)renders); + renders=NULL; + } + return 0; + } + return 1; +} +void C_RenderListClass::clearRenders(void) +{ + int x; + if (renders) + { + for (x = 0; x < num_renders; x ++) + { + delete renders[x].render; + } + GlobalFree((HGLOBAL)renders); + } + num_renders=0; + num_renders_alloc=0; + renders=NULL; + if (thisfb) GlobalFree((HGLOBAL)thisfb); + thisfb=0; +} + +int C_RenderListClass::insertRenderBefore(T_RenderListType *r, T_RenderListType *before) +{ + int idx; + if (!before) idx=num_renders; + else for (idx=0;idx<num_renders&&renders[idx].render!=before->render; idx++); + return insertRender(r,idx); +} + +int C_RenderListClass::insertRender(T_RenderListType *r, int index) // index=-1 for add +{ + if (num_renders+1 >= num_renders_alloc || !renders) + { + num_renders_alloc=num_renders+16; + T_RenderListType *newr=(T_RenderListType *) GlobalAlloc(GPTR,num_renders_alloc*sizeof(T_RenderListType)); + if (!newr) return -1; + if (num_renders&&renders) + { + memcpy(newr,renders,num_renders*sizeof(T_RenderListType)); + } + if (renders) + { + GlobalFree((HGLOBAL)renders); + } + renders=newr; + } + + if (index<0 || index>=num_renders) + { + renders[num_renders]=*r; + return num_renders++; + } + int x; + for (x=num_renders++; x > index; x--) + { + renders[x]=renders[x-1]; + } + renders[x]=*r; + + return x; +} + +void C_RenderListClass::FillBufferCombo(HWND dlg, int ctl) +{ +int i=0; +char txt[64]; +for (i=0;i<NBUF;i++) + { + wsprintf(txt, WASABI_API_LNGSTRING(IDS_BUFFER_X), i+1); + SendDlgItemMessage(dlg, ctl, CB_ADDSTRING, 0, (LPARAM)txt); + } +} + + +static C_RenderListClass *g_this; +int blendmodes[] = +{ + IDS_IGNORE, + IDS_REPLACE, + IDS_50_50, + IDS_MAXIMUM, + IDS_ADDITIVE, + IDS_SUBTRACTIVE_1, + IDS_SUBTRACTIVE_2, + IDS_EVERY_OTHER_LINE, + IDS_EVERY_OTHER_PIXEL, + IDS_XOR, + IDS_ADJUSTABLE, + IDS_MULTIPLY, + IDS_BUFFER, + IDS_MINIMUM, +}; + + + +BOOL CALLBACK C_RenderListClass::g_DlgProcRoot(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: +#ifdef LASER + ShowWindow(GetDlgItem(hwndDlg,IDC_CHECK1),SW_HIDE); +#endif + { +#ifndef LASER + if (g_this->clearfb()) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); +#endif + } + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_CHECK1: + g_this->set_clearfb(IsDlgButtonChecked(hwndDlg,IDC_CHECK1)); + break; + } + break; + } + return 0; +} + + +BOOL CALLBACK C_RenderListClass::g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: +#ifdef LASER + ShowWindow(GetDlgItem(hwndDlg,IDC_CHECK1),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INSLIDE), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_OUTSLIDE), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF1), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT1), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO1), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_COMBO2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_FR1), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_FR2), SW_HIDE); +#endif + { +#ifndef LASER + { + int x; + for (x = 0; x < sizeof(blendmodes)/sizeof(blendmodes[0]); x ++) + { + char blendStr[64]; + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)WASABI_API_LNGSTRING_BUF(blendmodes[x],blendStr,64)); + SendDlgItemMessage(hwndDlg,IDC_COMBO2,CB_ADDSTRING,0,(LPARAM)blendStr); + } + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_SETCURSEL,(WPARAM)g_this->blendout(),0); + SendDlgItemMessage(hwndDlg,IDC_COMBO2,CB_SETCURSEL,(WPARAM)g_this->blendin(),0); + ShowWindow(GetDlgItem(hwndDlg, IDC_INSLIDE), (g_this->blendin() == 10) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_OUTSLIDE), (g_this->blendout() == 10) ? SW_NORMAL : SW_HIDE); + SendDlgItemMessage(hwndDlg, IDC_INSLIDE, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_INSLIDE, TBM_SETPOS, TRUE, (int)(g_this->inblendval)); + SendDlgItemMessage(hwndDlg, IDC_OUTSLIDE, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_OUTSLIDE, TBM_SETPOS, TRUE, (int)(g_this->outblendval)); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF1), (g_this->blendin() == 12) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF2), (g_this->blendout() == 12) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT1), (g_this->blendin() == 12) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT2), (g_this->blendout() == 12) ? SW_NORMAL : SW_HIDE); + g_this->FillBufferCombo(hwndDlg, IDC_CBBUF1); + g_this->FillBufferCombo(hwndDlg, IDC_CBBUF2); + SendDlgItemMessage(hwndDlg, IDC_CBBUF1, CB_SETCURSEL, (WPARAM) g_this->bufferin, 0); + SendDlgItemMessage(hwndDlg, IDC_CBBUF2, CB_SETCURSEL, (WPARAM) g_this->bufferout, 0); + if (g_this->ininvert) CheckDlgButton(hwndDlg,IDC_INVERT1,BST_CHECKED); + if (g_this->outinvert) CheckDlgButton(hwndDlg,IDC_INVERT2,BST_CHECKED); + } + if (g_this->clearfb()) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); +#endif + g_this->isstart=1; + SetDlgItemText(hwndDlg,IDC_EDIT4,g_this->effect_exp[0].get()); + SetDlgItemText(hwndDlg,IDC_EDIT5,g_this->effect_exp[1].get()); + g_this->isstart=0; + + + if (((g_this->mode&2)^2)) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (g_this->beat_render) CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + else EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT1), FALSE); + if (g_this->use_code) CheckDlgButton(hwndDlg,IDC_CHECK4,BST_CHECKED); + char buf[999]; + wsprintf(buf, "%d", g_this->beat_render_frames); + SetDlgItemText(hwndDlg,IDC_EDIT1,buf); + } + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_EDIT4: + case IDC_EDIT5: + if (!g_this->isstart && HIWORD(wParam) == EN_CHANGE) + { + EnterCriticalSection(&g_this->rcs); + g_this->effect_exp[0].get_from_dlgitem(hwndDlg,IDC_EDIT4); + g_this->effect_exp[1].get_from_dlgitem(hwndDlg,IDC_EDIT5); + g_this->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT4) g_this->inited = 0; + LeaveCriticalSection(&g_this->rcs); + } + break; + case IDC_COMBO1: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int r=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (r!=CB_ERR) + { + g_this->set_blendout(r); + ShowWindow(GetDlgItem(hwndDlg, IDC_OUTSLIDE), (r == 10) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF2), (g_this->blendout() == 12) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT2), (g_this->blendout() == 12) ? SW_NORMAL : SW_HIDE); + } + } + break; + case IDC_COMBO2: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int r=SendDlgItemMessage(hwndDlg,IDC_COMBO2,CB_GETCURSEL,0,0); + if (r!=CB_ERR) + { + g_this->set_blendin(r); + ShowWindow(GetDlgItem(hwndDlg, IDC_INSLIDE), (r == 10) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_CBBUF1), (g_this->blendin() == 12) ? SW_NORMAL : SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INVERT1), (g_this->blendin() == 12) ? SW_NORMAL : SW_HIDE); + } + } + break; + case IDC_CBBUF1: + if (HIWORD(wParam) == CBN_SELCHANGE) + g_this->bufferin = SendDlgItemMessage(hwndDlg, IDC_CBBUF1, CB_GETCURSEL, 0, 0); + break; + case IDC_CBBUF2: + if (HIWORD(wParam) == CBN_SELCHANGE) + g_this->bufferout = SendDlgItemMessage(hwndDlg, IDC_CBBUF2, CB_GETCURSEL, 0, 0); + break; + case IDC_CHECK1: + g_this->set_clearfb(IsDlgButtonChecked(hwndDlg,IDC_CHECK1)); + break; + case IDC_CHECK2: + g_this->set_enabled(IsDlgButtonChecked(hwndDlg,IDC_CHECK2)); + break; + case IDC_INVERT1: + g_this->ininvert = IsDlgButtonChecked(hwndDlg,IDC_INVERT1); + break; + case IDC_INVERT2: + g_this->outinvert = IsDlgButtonChecked(hwndDlg,IDC_INVERT2); + break; + case IDC_CHECK3: + g_this->beat_render = IsDlgButtonChecked(hwndDlg,IDC_CHECK3); + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT1), g_this->beat_render); + break; + case IDC_CHECK4: + g_this->use_code = !!IsDlgButtonChecked(hwndDlg,IDC_CHECK4); + break; + case IDC_EDIT1: + if (HIWORD(wParam) == EN_CHANGE) { + char buf[999]="1"; + GetDlgItemText(hwndDlg, IDC_EDIT1, buf, 999); + buf[998] = 0; + g_this->beat_render_frames = atoi(buf); + } + break; + case IDC_BUTTON2: + { +/* char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_EFFECT_LIST,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_EFFECT_LIST),4095-titlelen); +*/ + char *text="Effect List\0" + "Read/write 'enabled' to get/set whether the effect list is enabled for this frame\r\n" + "Read/write 'beat' to get/set whether there is currently a beat\r\n" + "Read/write 'clear' to get/set whether to clear the framebuffer\r\n" + "If the input blend is set to adjustable, 'alphain' can be set from 0.0-1.0\r\n" + "If the output blend is set to adjustable, 'alphaout' can be set from 0.0-1.0\r\n" + "'w' and 'h' are set with the current width and height of the frame\r\n" + ; + + compilerfunctionlist(hwndDlg,text); + } + break; + } + break; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_INSLIDE) + g_this->inblendval = SendDlgItemMessage(hwndDlg, IDC_INSLIDE, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_OUTSLIDE) + g_this->outblendval = SendDlgItemMessage(hwndDlg, IDC_OUTSLIDE, TBM_GETPOS, 0, 0); + break; + } + return 0; +} + + +HWND C_RenderListClass::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(isroot?IDD_CFG_LISTROOT:IDD_CFG_LIST,hwndParent,(WNDPROC)(isroot?g_DlgProcRoot:g_DlgProc)); +// return NULL; +} + +char C_RenderListClass::sig_str[] = "Nullsoft AVS Preset 0.2\x1a"; + +int C_RenderListClass::__SavePreset(char *filename) +{ + EnterCriticalSection(&g_render_cs); + unsigned char *data = (unsigned char *) GlobalAlloc(GPTR,1124*1024); + int success=-1; + if (data) + { + int pos=0; + memcpy(data+pos,sig_str,strlen(sig_str)); pos += strlen(sig_str); + pos+=save_config_ex(data+pos,1); + if (pos < 1024*1024) + { + HANDLE fp=CreateFile(filename,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); + if (fp!=INVALID_HANDLE_VALUE) + { + DWORD dw; + success=0; + WriteFile(fp,data,pos,&dw,NULL); + CloseHandle(fp); + } + else success=2; + } + else success=1; + GlobalFree((HGLOBAL)data); + } + LeaveCriticalSection(&g_render_cs); + return success; +} + +int C_RenderListClass::__LoadPreset(char *filename, int clear) +{ + EnterCriticalSection(&g_render_cs); + unsigned char *data = (unsigned char *) GlobalAlloc(GPTR,1024*1024); + int success=1; + if (clear) clearRenders(); + if (data) + { + // OutputDebugString(filename); + HANDLE fp=CreateFile(filename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); + if (fp!=INVALID_HANDLE_VALUE) + { + DWORD len=GetFileSize(fp,NULL); + if (len == 0xffffffff) len=0; + if (!ReadFile(fp,data,min(len,1024*1024),&len,NULL)) len=0; + CloseHandle(fp); + if (len>strlen(sig_str)+2 && !memcmp(data,sig_str,strlen(sig_str)-2) && + data[strlen(sig_str)-2] >= '1' && + data[strlen(sig_str)-2] <= '2' && + data[strlen(sig_str)-1] == '\x1a') + { + load_config(data+strlen(sig_str),len-strlen(sig_str)); + success=0; + } + else + { + // if (len<=strlen(sig_str)+2) MessageBox(NULL,"Error loading preset: len",filename,MB_OK); + // else MessageBox(NULL,"Error loading preset: signature",filename,MB_OK); + } + } + // else MessageBox(NULL,"Error loading preset: fopen",filename,MB_OK); + GlobalFree((HGLOBAL)data); + } +// else MessageBox(NULL,"Error loading preset: MALLOC",filename,MB_OK); + LeaveCriticalSection(&g_render_cs); + return success; +} + +int C_RenderListClass::__SavePresetToUndo(C_UndoItem &item) +{ + EnterCriticalSection(&g_render_cs); + unsigned char *data = (unsigned char *) GlobalAlloc(GPTR,1124*1024); + int success=-1; + if (data) + { + // Do whatever the file saving stuff did + int pos=0; + memcpy(data+pos,sig_str,strlen(sig_str)); pos += strlen(sig_str); + pos+=save_config_ex(data+pos,1); + + // And then set the data into the undo object. + if (pos < 1024*1024) + { + item.set(data, pos, true); // all undo items start dirty. + } + + else success=1; + GlobalFree((HGLOBAL)data); + } + LeaveCriticalSection(&g_render_cs); + return success; +} + +int C_RenderListClass::__LoadPresetFromUndo(C_UndoItem &item, int clear) +{ + EnterCriticalSection(&g_render_cs); + unsigned char *data = (unsigned char *) GlobalAlloc(GPTR,1024*1024); + int success=1; + if (clear) clearRenders(); + if (data) + { + if (item.size() < 1024*1024) + { + // Get the data from the undo object. + DWORD len = item.size(); + if (len == 0xffffffff) len=0; + memcpy(data, item.get(), item.size()); + + // And then do whatever the file loading stuff did. + if (!memcmp(data,sig_str,strlen(sig_str)-2) && + data[strlen(sig_str)-2] >= '1' && + data[strlen(sig_str)-2] <= '2' && + data[strlen(sig_str)-1] == '\x1a') + { + load_config(data+strlen(sig_str),len-strlen(sig_str)); + success=0; + } + } + GlobalFree((HGLOBAL)data); + } + LeaveCriticalSection(&g_render_cs); + return success; +} + + + + +/// smp fun + +void C_RenderListClass::smp_Render(int minthreads, C_RBASE2 *render, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int x; + smp_parms.nthreads=minthreads; + if (!smp_parms.hQuitHandle) smp_parms.hQuitHandle=CreateEvent(NULL,TRUE,FALSE,NULL); + + smp_parms.vis_data_ptr=visdata; + smp_parms.isBeat=isBeat; + smp_parms.framebuffer=framebuffer; + smp_parms.fbout=fbout; + smp_parms.w=w; + smp_parms.h=h; + smp_parms.render=render; + for (x = 0; x < minthreads; x ++) + { + if (x >= smp_parms.threadTop) + { + DWORD id; + smp_parms.hThreadSignalsStart[x]=CreateEvent(NULL,FALSE,TRUE,NULL); + smp_parms.hThreadSignalsDone[x]=CreateEvent(NULL,FALSE,FALSE,NULL); + + smp_parms.hThreads[x]=CreateThread(NULL,0,smp_threadProc,(LPVOID)(x),0,&id); + smp_parms.threadTop=x+1; + } + else + SetEvent(smp_parms.hThreadSignalsStart[x]); + } + WaitForMultipleObjects(smp_parms.nthreads,smp_parms.hThreadSignalsDone,TRUE,INFINITE); +} + +DWORD WINAPI C_RenderListClass::smp_threadProc(LPVOID parm) +{ + int which=(int)parm; + HANDLE hdls[2]={smp_parms.hThreadSignalsStart[which],smp_parms.hQuitHandle}; + for (;;) + { + if (WaitForMultipleObjects(2,hdls,FALSE,INFINITE) == WAIT_OBJECT_0 + 1) return 0; + + smp_parms.render->smp_render(which,smp_parms.nthreads, + *(char (*)[2][2][576])smp_parms.vis_data_ptr, + + smp_parms.isBeat,smp_parms.framebuffer,smp_parms.fbout,smp_parms.w,smp_parms.h); + SetEvent(smp_parms.hThreadSignalsDone[which]); + } +} + +C_RenderListClass::_s_smp_parms C_RenderListClass::smp_parms;
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_list.h b/Src/Plugins/Visualization/vis_avs/r_list.h new file mode 100644 index 00000000..e1036ca4 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_list.h @@ -0,0 +1,173 @@ +/* + 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. + +*/ +#ifndef _R_LIST_H_ +#define _R_LIST_H_ + +#include "avs_eelif.h" +#define LIST_ID 0xfffffffe + +extern unsigned char blendtable[256][256]; +extern BOOL blendtableInited; + +class C_RenderTransitionClass; +class C_UndoItem; + +class C_RenderListClass : public C_RBASE { + friend C_RenderTransitionClass; + public: + typedef struct + { + C_RBASE *render; + int effect_index; + int has_rbase2; + } T_RenderListType; + + protected: + static char sig_str[]; + int *thisfb; + int l_w, l_h; + int isroot; + + int num_renders,num_renders_alloc; + T_RenderListType *renders; + int inblendval, outblendval; + int bufferin, bufferout; + int ininvert, outinvert; + + int use_code; + RString effect_exp[2]; + + int inited; + NSEEL_CODEHANDLE codehandle[4]; + int need_recompile; + CRITICAL_SECTION rcs; + + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_beat, *var_alphain, *var_alphaout, *var_enabled, *var_clear, *var_w, *var_h; + int isstart; + + int mode; + + int beat_render, beat_render_frames; + int fake_enabled; + +#ifdef LASER + C_LineListBase *line_save; +#else + void set_n_Context(); + void unset_n_Context(); + + int nbw_save[NBUF],nbh_save[NBUF]; // these are our framebuffers + void *nb_save[NBUF]; + + int nbw_save2[NBUF],nbh_save2[NBUF]; // this are temp space for saving the global ones + void *nb_save2[NBUF]; + int nsaved; +#endif + +#define MAX_SMP_THREADS 8 + // smp stuff + void smp_Render(int minthreads, C_RBASE2 *render, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + typedef struct + { + void *vis_data_ptr; + int nthreads; + int isBeat; + int *framebuffer; + int *fbout; + int w; + int h; + C_RBASE2 *render; + + + + HANDLE hQuitHandle; + HANDLE hThreads[MAX_SMP_THREADS]; + HANDLE hThreadSignalsStart[MAX_SMP_THREADS]; + HANDLE hThreadSignalsDone[MAX_SMP_THREADS]; + + int threadTop; + + } _s_smp_parms; + + + static _s_smp_parms smp_parms; + static DWORD WINAPI smp_threadProc(LPVOID parm); + + public: + + static void smp_cleanupthreads(); + + C_RenderListClass(int iroot=0); + virtual ~C_RenderListClass(); + + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + virtual char *get_desc(); + + int getNumRenders(void); + T_RenderListType *getRender(int index); + int findRender(T_RenderListType *r); + int removeRender(int index, int del); // return 0 on success + int removeRenderFrom(T_RenderListType *r, int del); // return 0 on success + int insertRender(T_RenderListType *r, int index); // return -1 on failure, actual position on success + int insertRenderBefore(T_RenderListType *r, T_RenderListType *before); // return -1 on failure, actual position on success + void clearRenders(void); + void freeBuffers(); + + int __SavePreset(char *filename); + int __LoadPreset(char *filename, int clear); + + int __SavePresetToUndo(C_UndoItem &item); + int __LoadPresetFromUndo(C_UndoItem &item, int clear); + + int clearfb() { return mode&1; } + void set_clearfb(int v) { if (v) mode|=1; else mode&=~1; } + + int blendin() { return ((mode>>8)&31); } + void set_blendin(int v) { mode&=~(31<<8); mode|=(v&31)<<8; } + int blendout() { return ((mode>>16)&31)^1; } + void set_blendout(int v) { mode&=~(31<<16); mode|=((v^1)&31)<<16; } + unsigned char get_extended_datasize(void) { return ((mode & 0xFF000000) >> 24); } + void set_extended_datasize(unsigned char s) { mode &= 0xFFFFFF; mode |= s << 24; } + + int enabled() { return ((mode&2)^2) || fake_enabled>0; } + void set_enabled(int v) { if (!v) mode|=2; else mode&=~2; } + static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); + static BOOL CALLBACK g_DlgProcRoot(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); + int save_config_ex(unsigned char *data, int rootsave); + void load_config_code(unsigned char *data, int len); + int save_config_code(unsigned char *data); + void FillBufferCombo(HWND dlg, int ctl); +}; + +#endif // _R_LIST_H_ diff --git a/Src/Plugins/Visualization/vis_avs/r_mirror.cpp b/Src/Plugins/Visualization/vis_avs/r_mirror.cpp new file mode 100644 index 00000000..2573cb3e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_mirror.cpp @@ -0,0 +1,385 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Mirror" +#define C_THISCLASS C_MirrorClass + + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_MIRROR,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int framecount; + int enabled; + int mode; + int onbeat; + int rbeat; + int smooth; + int slower; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + +#define HORIZONTAL1 1 +#define HORIZONTAL2 2 +#define VERTICAL1 4 +#define VERTICAL2 8 + +#define D_HORIZONTAL1 0 +#define D_HORIZONTAL2 8 +#define D_VERTICAL1 16 +#define D_VERTICAL2 24 +#define M_HORIZONTAL1 0xFF +#define M_HORIZONTAL2 0xFF00 +#define M_VERTICAL1 0xFF0000 +#define M_VERTICAL2 0xFF000000 + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + framecount=0; + enabled=1; + onbeat=0; + smooth=0; + slower=4; + mode=HORIZONTAL1; +} + + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { mode=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { smooth=GET_INT(); pos+=4; } + if (len-pos >= 4) { slower=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(mode); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_INT(smooth); pos+=4; + PUT_INT(slower); pos+=4; + return pos; +} + +static unsigned int __inline BLEND_ADAPT(unsigned int a, unsigned int b, /*float*/int divisor) +{ +return ((((a >> 4) & 0x0F0F0F) * (16-divisor) + (((b >> 4) & 0x0F0F0F) * divisor))); +} + + + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int hi,t,j,halfw,halfh,m,d; + int *thismode=&mode; + static int lastMode; + static int divisors=0; + static int inc=0; + int divis; + int *fbp; + + if (isBeat&0x80000000) return 0; + if (!enabled) return 0; + + t=w*h; + halfw = w / 2 ; + halfh = h / 2 ; + + if (onbeat) + { + if (isBeat) rbeat = (rand()%16) & mode; + thismode=&rbeat; + } + + if (*thismode != lastMode) + { + int dif = *thismode ^ lastMode; + int i; + for (i=1,m=0xFF,d=0;i<16;i<<=1,m<<=8,d+=8) + if (dif & i) + { + inc = (inc & ~m) | ((lastMode & i) ? 0xFF : 1) << d; + if (!(divisors & m)) divisors = (divisors & ~m) | ((lastMode & i) ? 16 : 1) << d; + } + lastMode = *thismode; + } + + fbp=framebuffer; + if (*thismode & VERTICAL1 || (smooth && (divisors & 0x00FF0000))) + { + divis = (divisors & M_VERTICAL1) >> D_VERTICAL1; + for ( hi=0 ; hi < h ; hi++) + { + if (smooth && divis) + { + int *tmp=fbp+w-1; + int n=halfw; + while (n--) *tmp-- = BLEND_ADAPT(*tmp, *fbp++, divis); + } + else + { + int *tmp=fbp+w-1; + int n=halfw; + while (n--) *tmp-- = *fbp++; + } + fbp+=halfw; + } + } + fbp=framebuffer; + if (*thismode & VERTICAL2 || (smooth && (divisors & 0xFF000000))) + { + divis = (divisors & M_VERTICAL2) >> D_VERTICAL2; + for ( hi=0 ; hi < h ; hi++) + { + if (smooth && divis) + { + int *tmp=fbp+w-1; + int n=halfw; + while (n--) *fbp++ = BLEND_ADAPT(*fbp,*tmp--,divis); + } + else + { + int *tmp=fbp+w-1; + int n=halfw; + while (n--) *fbp++ = *tmp--; + } + fbp+=halfw; + } + } + fbp=framebuffer; + j=t-w; + if (*thismode & HORIZONTAL1 || (smooth && (divisors & 0x000000FF))) + { + divis = (divisors & M_HORIZONTAL1) >> D_HORIZONTAL1; + for ( hi=0 ; hi < halfh ; hi++) + { + if (smooth && divis) + { + int n=w; + while (n--) fbp++[j]=BLEND_ADAPT(fbp[j], *fbp, divis); + } + else + { + memcpy(fbp+j,fbp,w*sizeof(int)); + fbp+=w; + } + j-=2*w; + } + } + fbp=framebuffer; + j=t-w; + if (*thismode & HORIZONTAL2 || (smooth && (divisors & 0x0000FF00))) + { + divis = (divisors & M_HORIZONTAL2) >> D_HORIZONTAL2; + for ( hi=0 ; hi < halfh ; hi++) + { + if (smooth && divis) + { + int n=w; + while (n--) + *fbp++ = BLEND_ADAPT(*fbp, fbp[j], divis); + } + else + { + memcpy(fbp,fbp+j,w*sizeof(int)); + fbp+=w; + } + j-=2*w; + } + } + + if (smooth && !(++framecount % slower)) + { + int i; + for (i=1,m=0xFF,d=0;i<16;i<<=1,m<<=8,d+=8) + { + if (divisors & m) + divisors = (divisors & ~m) | ((((divisors & m) >> d) + (unsigned char)((inc & m) >> d)) % 16) << d; + } + } + return 0; +} + +int getMode(HWND hwndDlg) +{ +int a; +a=IsDlgButtonChecked(hwndDlg,IDC_HORIZONTAL1)?HORIZONTAL1:0; +a|=IsDlgButtonChecked(hwndDlg,IDC_HORIZONTAL2)?HORIZONTAL2:0; +a|=IsDlgButtonChecked(hwndDlg,IDC_VERTICAL1)?VERTICAL1:0; +a|=IsDlgButtonChecked(hwndDlg,IDC_VERTICAL2)?VERTICAL2:0; +return a; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_SLOWER, TBM_SETTICFREQ, 1, 0); + SendDlgItemMessage(hwndDlg, IDC_SLOWER, TBM_SETRANGE, TRUE, MAKELONG(1, 16)); + SendDlgItemMessage(hwndDlg, IDC_SLOWER, TBM_SETPOS, TRUE, g_ConfigThis->slower); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->smooth) CheckDlgButton(hwndDlg,IDC_SMOOTH,BST_CHECKED); + if (g_ConfigThis->mode & VERTICAL1) + CheckDlgButton(hwndDlg,IDC_VERTICAL1,BST_CHECKED); + if (g_ConfigThis->mode & VERTICAL2) + CheckDlgButton(hwndDlg,IDC_VERTICAL2,BST_CHECKED); + if (g_ConfigThis->mode & HORIZONTAL1) + CheckDlgButton(hwndDlg,IDC_HORIZONTAL1,BST_CHECKED); + if (g_ConfigThis->mode & HORIZONTAL2) + CheckDlgButton(hwndDlg,IDC_HORIZONTAL2,BST_CHECKED); + if (g_ConfigThis->onbeat) + CheckDlgButton(hwndDlg,IDC_ONBEAT,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_STAT,BST_CHECKED); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_SLOWER) + g_ConfigThis->slower = SendDlgItemMessage(hwndDlg, IDC_SLOWER, TBM_GETPOS, 0, 0); + return 0; + } + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK1) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + if (LOWORD(wParam) == IDC_HORIZONTAL1) + { + g_ConfigThis->mode = getMode(hwndDlg); + if ((g_ConfigThis->mode & HORIZONTAL1) && (g_ConfigThis->mode & HORIZONTAL2) && !(g_ConfigThis->onbeat)) + { + CheckDlgButton(hwndDlg,IDC_HORIZONTAL2,BST_UNCHECKED); + g_ConfigThis->mode = getMode(hwndDlg); + } + } + if (LOWORD(wParam) == IDC_HORIZONTAL2) + { + g_ConfigThis->mode = getMode(hwndDlg); + if ((g_ConfigThis->mode & HORIZONTAL1) && (g_ConfigThis->mode & HORIZONTAL2) && !(g_ConfigThis->onbeat)) + { + CheckDlgButton(hwndDlg,IDC_HORIZONTAL1,BST_UNCHECKED); + g_ConfigThis->mode = getMode(hwndDlg); + } + } + if (LOWORD(wParam) == IDC_VERTICAL1) + { + g_ConfigThis->mode = getMode(hwndDlg); + if ((g_ConfigThis->mode & VERTICAL1) && (g_ConfigThis->mode & VERTICAL2) && !(g_ConfigThis->onbeat)) + { + CheckDlgButton(hwndDlg,IDC_VERTICAL2,BST_UNCHECKED); + g_ConfigThis->mode = getMode(hwndDlg); + } + } + if (LOWORD(wParam) == IDC_VERTICAL2) + { + g_ConfigThis->mode = getMode(hwndDlg); + if ((g_ConfigThis->mode & VERTICAL1) && (g_ConfigThis->mode & VERTICAL2) && !(g_ConfigThis->onbeat)) + { + CheckDlgButton(hwndDlg,IDC_VERTICAL1,BST_UNCHECKED); + g_ConfigThis->mode = getMode(hwndDlg); + } + } + if (LOWORD(wParam) == IDC_STAT || LOWORD(wParam) == IDC_ONBEAT) + { + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0; + if (!(g_ConfigThis->onbeat)) + { + if ((g_ConfigThis->mode & HORIZONTAL1) && (g_ConfigThis->mode & HORIZONTAL2)) + CheckDlgButton(hwndDlg,IDC_HORIZONTAL2,BST_UNCHECKED); + if ((g_ConfigThis->mode & VERTICAL1) && (g_ConfigThis->mode & VERTICAL2)) + CheckDlgButton(hwndDlg,IDC_VERTICAL2,BST_UNCHECKED); + g_ConfigThis->mode = getMode(hwndDlg); + } + } + if (LOWORD(wParam) == IDC_SMOOTH) + g_ConfigThis->smooth=IsDlgButtonChecked(hwndDlg,IDC_SMOOTH)?1:0; + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_MIRROR,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Mirror(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Mirror(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_mosaic.cpp b/Src/Plugins/Visualization/vis_avs/r_mosaic.cpp new file mode 100644 index 00000000..b298c3d0 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_mosaic.cpp @@ -0,0 +1,299 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +#define MOD_NAME "Trans / Mosaic" +#define C_THISCLASS C_MosaicClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + float GET_FLOAT(unsigned char *data, int pos); + void PUT_FLOAT(float f, unsigned char *data, int pos); + void InitializeStars(int Start); + void CreateStar(int A); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_MOSAIC,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + int quality; + int quality2; + int blend; + int blendavg; + int onbeat; + int durFrames; + int nF; + int thisQuality; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + enabled=1; + quality = 50; + blend = 0; + blendavg = 0; + onbeat = 0; + durFrames = 15; + nF=0; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { quality=GET_INT(); pos+=4; } + if (len-pos >= 4) { quality2=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { durFrames=GET_INT(); pos+=4; } +} + +#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 + +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(quality); pos+=4; + PUT_INT(quality2); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_INT(durFrames); pos+=4; + return pos; +} + + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int rval=0; + + if (isBeat&0x80000000) return 0; + + if (!enabled) return 0; + + if (onbeat && isBeat) + { + thisQuality=quality2; + nF = durFrames; + } + else if (!nF) thisQuality = quality; + + if (thisQuality<100) + { + int y; + int *p = fbout; + int *p2 = framebuffer; + int sXInc = (w*65536) / thisQuality; + int sYInc = (h*65536) / thisQuality; + int ypos=(sYInc>>17); + int dypos=0; + + for (y = 0; y < h; y ++) + { + int x=w; + int *fbread=framebuffer+ypos*w; + int dpos=0; + int xpos=(sXInc>>17); + int src=fbread[xpos]; + + if (blend) + { + while (x--) + { + *p++ = BLEND(*p2++, src); + dpos+=1<<16; + if (dpos>=sXInc) + { + xpos+=dpos>>16; + if (xpos >= w) break; + src=fbread[xpos]; + dpos-=sXInc; + } + } + } + else if (blendavg) + { + while (x--) + { + *p++ = BLEND_AVG(*p2++, src); + dpos+=1<<16; + if (dpos>=sXInc) + { + xpos+=dpos>>16; + if (xpos >= w) break; + src=fbread[xpos]; + dpos-=sXInc; + } + } + } + else + { + while (x--) + { + *p++ = src; + dpos+=1<<16; + if (dpos>=sXInc) + { + xpos+=dpos>>16; + if (xpos >= w) break; + src=fbread[xpos]; + dpos-=sXInc; + } + } + } + dypos+=1<<16; + if (dypos>=sYInc) + { + ypos+=(dypos>>16); + dypos-=sYInc; + if (ypos >= h) break; + } + } + rval=1; + } + + if (nF) + { + nF--; + if (nF) + { + int a = abs(quality - quality2) / durFrames; + thisQuality += a * (quality2 > quality ? -1 : 1); + } + } + + return rval; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_QUALITY, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_QUALITY, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_QUALITY, TBM_SETPOS, TRUE, g_ConfigThis->quality); + SendDlgItemMessage(hwndDlg, IDC_QUALITY2, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_QUALITY2, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_QUALITY2, TBM_SETPOS, TRUE, g_ConfigThis->quality2); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_SETPOS, TRUE, g_ConfigThis->durFrames); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_ONBEAT,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_QUALITY2) + g_ConfigThis->quality2 = SendDlgItemMessage(hwndDlg, IDC_QUALITY2, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_BEATDUR) + g_ConfigThis->durFrames = SendDlgItemMessage(hwndDlg, IDC_BEATDUR, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_QUALITY) + g_ConfigThis->quality = SendDlgItemMessage(hwndDlg, IDC_QUALITY, TBM_GETPOS, 0, 0); + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ONBEAT) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_MOSAIC,hwndParent,g_DlgProc); +} + +// export stuff + +C_RBASE *R_Mosaic(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Mosaic(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_multidelay.cpp b/Src/Plugins/Visualization/vis_avs/r_multidelay.cpp new file mode 100644 index 00000000..7f742e63 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_multidelay.cpp @@ -0,0 +1,440 @@ +/* + 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. + +*/ +// video delay +// copyright tom holden, 2002 +// mail: cfp@myrealbox.com + +#include <windows.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#define MOD_NAME "Trans / Multi Delay" +#define C_DELAY C_MultiDelayClass + +// R_MultiDelay / #define UNIQUEIDSTRING "Holden05: Multi Delay" + +// saved +bool usebeats[6]; +int delay[6]; + +// unsaved +LPVOID buffer[6]; +LPVOID inpos[6]; +LPVOID outpos[6]; +unsigned long buffersize[6]; +unsigned long virtualbuffersize[6]; +unsigned long oldvirtualbuffersize[6]; +unsigned long framedelay[6]; +unsigned int numinstances = 0; +unsigned long framessincebeat; +unsigned long framesperbeat; +unsigned long framemem; +unsigned long oldframemem; +unsigned int renderid; + +class C_DELAY : public C_RBASE +{ + protected: + public: + // standard ape members + C_DELAY(); + virtual ~C_DELAY(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + // saved members + int mode; + int activebuffer; + + // unsaved members + unsigned int creationid; +}; + +// global configuration dialog pointer +static C_DELAY *g_Delay; +// global DLL instance pointer +static HINSTANCE g_hDllInstance; + +// configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + char value[16]; + unsigned int objectcode, objectmessage; + HWND hwndEdit; + switch (uMsg) + { + case WM_INITDIALOG: //init + { + int i; + for (i=0;i<3;i++) CheckDlgButton(hwndDlg,1100+i,g_Delay->mode==i); + for (i=0;i<6;i++) + { + CheckDlgButton(hwndDlg,1000+i,g_Delay->activebuffer==i); + CheckDlgButton(hwndDlg,1020+i,usebeats[i]); + CheckDlgButton(hwndDlg,1030+i,!usebeats[i]); + hwndEdit = GetDlgItem(hwndDlg,1010+i); + _itoa(delay[i],value,10); + SetWindowText(hwndEdit,value); + } + } + return 1; + case WM_COMMAND: + objectcode = LOWORD(wParam); + objectmessage = HIWORD(wParam); + // mode stuff + if (objectcode >= 1100) + { + if(IsDlgButtonChecked(hwndDlg,objectcode)==1) + { + g_Delay->mode = objectcode - 1100; + for (int i=1100;i<1103;i++) if (objectcode != i) CheckDlgButton(hwndDlg,i,BST_UNCHECKED); + } + return 0; + } + // frames stuff + if (objectcode >= 1030) + { + if(IsDlgButtonChecked(hwndDlg,objectcode)==1) + { + usebeats[objectcode-1030] = false; + CheckDlgButton(hwndDlg,objectcode-10,BST_UNCHECKED); + framedelay[objectcode-1030] = delay[objectcode-1030]+1; + } + else usebeats[objectcode-1030] = true; + return 0; + } + // beats stuff + if (objectcode >= 1020) + { + if(IsDlgButtonChecked(hwndDlg,objectcode)==1) + { + usebeats[objectcode-1020] = true; + CheckDlgButton(hwndDlg,objectcode+10,BST_UNCHECKED); + framedelay[objectcode-1020] = framesperbeat+1; + } + else usebeats[objectcode-1020] = false; + return 0; + } + // edit box stuff + if (objectcode >= 1010) + { + hwndEdit = GetDlgItem(hwndDlg,objectcode); + if (objectmessage == EN_CHANGE) + { + GetWindowText(hwndEdit,value,16); + delay[objectcode-1010] = max(atoi(value),0); + framedelay[objectcode-1010] = (usebeats[objectcode-1010]?framesperbeat:delay[objectcode-1010])+1; + } + else if (objectmessage == EN_KILLFOCUS) + { + _itoa(delay[objectcode-1010],value,10); + SetWindowText(hwndEdit,value); + } + return 0; + } + // active buffer stuff + if (objectcode >= 1000) + { + if(IsDlgButtonChecked(hwndDlg,objectcode)==1) + { + g_Delay->activebuffer = objectcode - 1000; + for (int i=1000;i<1006;i++) if (objectcode != i) CheckDlgButton(hwndDlg,i,BST_UNCHECKED); + } + return 0; + } + } + return 0; +} + +// set up default configuration +C_DELAY::C_DELAY() +{ + // enable + mode = 0; + activebuffer = 0; + numinstances++; + creationid = numinstances; + if (creationid == 1) + { + for (int i=0; i<6; i++) + { + renderid = 0; + framessincebeat = 0; + framesperbeat = 0; + framemem = 1; + oldframemem = 1; + usebeats[i] = false; + delay[i] = 0; + framedelay[i] = 0; + buffersize[i] = 1; + virtualbuffersize[i] = 1; + oldvirtualbuffersize[i] = 1; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + inpos[i] = buffer[i]; + outpos[i] = buffer[i]; + } + } +} + +// virtual destructor +C_DELAY::~C_DELAY() +{ + numinstances--; + if (numinstances == 0) for (int i=0; i<6; i++) VirtualFree(buffer[i],buffersize[i],MEM_DECOMMIT); +} + +// RENDER FUNCTION: +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout +// w and h are the-width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_DELAY::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + + if (renderid == numinstances) renderid = 0; + renderid++; + if (renderid == 1) + { + framemem = w*h*4; + if (isBeat) + { + framesperbeat = framessincebeat; + for (int i=0;i<6;i++) if (usebeats[i]) framedelay[i] = framesperbeat+1; + framessincebeat = 0; + } + framessincebeat++; + for (int i=0;i<6;i++) + { + if (framedelay[i]>1) + { + virtualbuffersize[i] = framedelay[i]*framemem; + if (framemem == oldframemem) + { + if (virtualbuffersize[i] != oldvirtualbuffersize[i]) + { + if (virtualbuffersize[i] > oldvirtualbuffersize[i]) + { + if (virtualbuffersize[i] > buffersize[i]) + { + // allocate new memory + if (!VirtualFree(buffer[i],buffersize[i],MEM_DECOMMIT)) return 0; + if (usebeats[i]) + { + buffersize[i] = 2*virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + if (buffer[i] == NULL) + { + buffersize[i] = virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + } + } + else + { + buffersize[i] = virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + } + outpos[i] = buffer[i]; + inpos[i] = (LPVOID)(((unsigned long)buffer[i])+virtualbuffersize[i]-framemem); + if (buffer[i] == NULL) + { + framedelay[i] = 0; + if (usebeats[i]) + { + framesperbeat = 0; + framessincebeat = 0; + framedelay[i] = 0; + delay[i] = 0; + } + } + } + else + { + unsigned long size = (((unsigned long)buffer[i])+oldvirtualbuffersize[i]) - ((unsigned long)outpos[i]); + unsigned long l = ((unsigned long)buffer[i])+virtualbuffersize[i]; + unsigned long d = l - size; + MoveMemory((LPVOID)d, outpos[i], size); + for (l = (unsigned long)outpos[i]; l < d; l += framemem) CopyMemory((LPVOID)l,(LPVOID)d,framemem); + } + } + else + { // virtualbuffersize < oldvirtualbuffersize + unsigned long presegsize = ((unsigned long)outpos[i])-((unsigned long)buffer[i]); + if (presegsize > virtualbuffersize[i]) + { + MoveMemory(buffer[i],(LPVOID)(((unsigned long)buffer[i])+presegsize-virtualbuffersize[i]),virtualbuffersize[i]); + inpos[i] = (LPVOID)(((unsigned long)buffer[i])+virtualbuffersize[i]-framemem); + outpos[i] = buffer[i]; + } + else if (presegsize < virtualbuffersize[i]) MoveMemory(outpos[i],(LPVOID)(((unsigned long)buffer[i])+oldvirtualbuffersize[i]+presegsize-virtualbuffersize[i]),virtualbuffersize[i]-presegsize); + } + oldvirtualbuffersize[i] = virtualbuffersize[i]; + } + } + else + { + // allocate new memory + if (!VirtualFree(buffer[i],buffersize[i],MEM_DECOMMIT)) return 0; + if (usebeats[i]) + { + buffersize[i] = 2*virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + if (buffer[i] == NULL) + { + buffersize[i] = virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + } + } + else + { + buffersize[i] = virtualbuffersize[i]; + buffer[i] = VirtualAlloc(NULL,buffersize[i],MEM_COMMIT,PAGE_READWRITE); + } + outpos[i] = buffer[i]; + inpos[i] = (LPVOID)(((unsigned long)buffer[i])+virtualbuffersize[i]-framemem); + if (buffer[i] == NULL) + { + framedelay[i] = 0; + if (usebeats[i]) + { + framesperbeat = 0; + framessincebeat = 0; + framedelay[i] = 0; + delay[i] = 0; + } + } + oldvirtualbuffersize[i] = virtualbuffersize[i]; + } + oldframemem = framemem; + } + } + } + if (mode != 0 && framedelay[activebuffer]>1) + { + if (mode == 2) CopyMemory(framebuffer,outpos[activebuffer],framemem); + else CopyMemory(inpos[activebuffer],framebuffer,framemem); + } + if (renderid == numinstances) for (int i=0;i<6;i++) + { + inpos[i] = (LPVOID)(((unsigned long)inpos[i])+framemem); + outpos[i] = (LPVOID)(((unsigned long)outpos[i])+framemem); + if ((unsigned long)inpos[i]>=((unsigned long)buffer[i])+virtualbuffersize[i]) inpos[i] = buffer[i]; + if ((unsigned long)outpos[i]>=((unsigned long)buffer[i])+virtualbuffersize[i]) outpos[i] = buffer[i]; + } + return 0; +} + +HWND C_DELAY::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_Delay = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_MULTIDELAY,hwndParent,g_DlgProc); +} + +char *C_DELAY::get_desc(void) +{ + static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_MULTI_DELAY,desc,128):desc); +} + +// load_/save_config are called when saving and loading presets (.avs files) +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_DELAY::load_config(unsigned char *data, int len) // read configuration of max length "len" from data. +{ + int pos=0; + // always ensure there is data to be loaded + if (len-pos >= 4) + { + // load mode + mode=GET_INT(); + pos+=4; + } + if (len-pos >= 4) + { + // load active buffer + activebuffer=GET_INT(); + pos+=4; + } + if (len-pos >= 4) + { + for (int i=0;i<6;i++) + { + if (len-pos >= 4) + { + // load usebeats + usebeats[i]=(GET_INT()==1); + pos+=4; + } + if (len-pos >= 4) + { + // load delay + delay[i]=GET_INT(); + framedelay[i] = (usebeats[i]?framesperbeat:delay[i])+1; + pos+=4; + } + } + } +} + +// write configuration to data, return length. config data should not exceed 64k. +#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 +int C_DELAY::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(mode); + pos+=4; + PUT_INT(activebuffer); + pos+=4; + if (creationid == 1) + { + for (int i=0;i<6;i++) + { + PUT_INT((int)usebeats[i]); + pos+=4; + PUT_INT(delay[i]); + pos+=4; + } + } + return pos; +} + +// export stuff +C_RBASE *R_MultiDelay(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) + { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_DELAY(); +} diff --git a/Src/Plugins/Visualization/vis_avs/r_multiplier.cpp b/Src/Plugins/Visualization/vis_avs/r_multiplier.cpp new file mode 100644 index 00000000..c59acb5e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_multiplier.cpp @@ -0,0 +1,365 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +#define MD_XI 0 +#define MD_X8 1 +#define MD_X4 2 +#define MD_X2 3 +#define MD_X05 4 +#define MD_X025 5 +#define MD_X0125 6 +#define MD_XS 7 + +// this will be the directory and APE name displayed in the AVS Editor +#define MOD_NAME "Trans / Multiplier" +#define C_THISCLASS C_MultiplierClass + +typedef struct { + int ml; +} apeconfig; + +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); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + apeconfig config; + + HWND hwndDlg; +}; + +// global configuration dialog pointer +static C_THISCLASS *g_ConfigThis; +static HINSTANCE g_hDllInstance; + + +// this is where we deal with the configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int id; + switch (uMsg) + { + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED) { + id = LOWORD(wParam); + switch (id) { + case IDC_XI: + g_ConfigThis->config.ml = MD_XI; + break; + case IDC_X8: + g_ConfigThis->config.ml = MD_X8; + break; + case IDC_X4: + g_ConfigThis->config.ml = MD_X4; + break; + case IDC_X2: + g_ConfigThis->config.ml = MD_X2; + break; + case IDC_X05: + g_ConfigThis->config.ml = MD_X05; + break; + case IDC_X025: + g_ConfigThis->config.ml = MD_X025; + break; + case IDC_X0125: + g_ConfigThis->config.ml = MD_X0125; + break; + case IDC_XS: + g_ConfigThis->config.ml = MD_XS; + break; + } + } + return 0; + + case WM_INITDIALOG: + g_ConfigThis->hwndDlg = hwndDlg; + + switch (g_ConfigThis->config.ml) { + case MD_XI: + id = IDC_XI; + break; + case MD_X8: + id = IDC_X8; + break; + case MD_X4: + id = IDC_X4; + break; + case MD_X2: + id = IDC_X2; + break; + case MD_X05: + id = IDC_X05; + break; + case MD_X025: + id = IDC_X025; + break; + case MD_X0125: + id = IDC_X0125; + break; + case MD_XS: + id = IDC_XS; + break; + } + SendMessage(GetDlgItem(hwndDlg, id), BM_SETCHECK, BST_CHECKED, 0); + + return 1; + + case WM_DESTROY: + return 1; + } + return 0; +} + +// set up default configuration +C_THISCLASS::C_THISCLASS() +{ + memset(&config, 0, sizeof(apeconfig)); + config.ml = MD_X2; +} + +// virtual destructor +C_THISCLASS::~C_THISCLASS() +{ +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + + int b,c; + __int64 mask; + + c = w*h; + switch (config.ml) { + case MD_XI: + __asm { + mov ebx, framebuffer; + mov ecx, c; + mov edx, b; + lp0: + xor eax, eax; + dec ecx; + test ecx, ecx; + jz end; + mov eax, dword ptr [ebx+ecx*4]; + test eax, eax; + jz sk0; + mov eax, 0xFFFFFF; + sk0: + mov [ebx+ecx*4], eax; + jmp lp0; + } + break; + case MD_XS: + __asm { + mov ebx, framebuffer; + mov ecx, c; + mov edx, b; + lp9: + xor eax, eax; + dec ecx; + test ecx, ecx; + jz end; + mov eax, dword ptr [ebx+ecx*4]; + cmp eax, 0xFFFFFF; + je sk9; + mov eax, 0x000000; + sk9: + mov [ebx+ecx*4], eax; + jmp lp9; + } + break; + case MD_X8: + c = w*h/2; + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp1: + movq mm0, [ebx]; + paddusb mm0, mm0; + paddusb mm0, mm0; + paddusb mm0, mm0; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp1; + } + break; + case MD_X4: + c = w*h/2; + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp2: + movq mm0, [ebx]; + paddusb mm0, mm0; + paddusb mm0, mm0; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp2; + } + break; + case MD_X2: + c = w*h/2; + __asm { + mov ebx, framebuffer; + mov ecx, c; + lp3: + movq mm0, [ebx]; + paddusb mm0, mm0; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp3; + } + break; + case MD_X05: + c = w*h/2; + mask = 0x7F7F7F7F7F7F7F7F; + __asm { + mov ebx, framebuffer; + mov ecx, c; + movq mm1, mask; + lp4: + movq mm0, [ebx]; + psrlq mm0, 1; + pand mm0, mm1; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp4; + } + break; + case MD_X025: + c = w*h/2; + mask = 0x3F3F3F3F3F3F3F3F; + __asm { + mov ebx, framebuffer; + mov ecx, c; + movq mm1, mask; + lp5: + movq mm0, [ebx]; + psrlq mm0, 2; + pand mm0, mm1; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp5; + } + break; + case MD_X0125: + c = w*h/2; + mask = 0x1F1F1F1F1F1F1F1F; + __asm { + mov ebx, framebuffer; + mov ecx, c; + movq mm1, mask; + lp6: + movq mm0, [ebx]; + psrlq mm0, 3; + pand mm0, mm1; + movq [ebx], mm0; + add ebx, 8; + dec ecx; + test ecx, ecx; + jz end; + jmp lp6; + } + break; + } + end: + __asm emms; + return 0; +} + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_MULT, hwndParent, (DLGPROC)g_DlgProc); +} + + +char *C_THISCLASS::get_desc(void) +{ + static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_MULTIPLIER,desc,128):desc); +} + +void C_THISCLASS::load_config(unsigned char *data, int len) +{ + if (len == sizeof(apeconfig)) + memcpy(&this->config, data, len); + else + memset(&this->config, 0, sizeof(apeconfig)); +} + + +int C_THISCLASS::save_config(unsigned char *data) +{ + memcpy(data, &this->config, sizeof(apeconfig)); + return sizeof(apeconfig); +} + +C_RBASE *R_Multiplier(char *desc) +{ + if (desc) { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_THISCLASS(); +} + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_nfclr.cpp b/Src/Plugins/Visualization/vis_avs/r_nfclr.cpp new file mode 100644 index 00000000..3c5a393c --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_nfclr.cpp @@ -0,0 +1,233 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_NFClearClass +#define MOD_NAME "Render / OnBeat Clear" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_ONBEAT_CLEAR,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int nf,cf,df; + + int color, blend; +}; + + +#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; + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { nf=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(nf); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + cf=0; + nf=1; + df=0; + color=RGB(255,255,255); + blend=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int p=0; + char *t=(char *)&visdata[1][0][0]; + int np=0; + if (isBeat&0x80000000) return 0; + + if (isBeat) + { + if (nf && ++cf >= nf) + { + cf=df=0; + int i=w*h; + int c=color; + if (!blend) __asm + { + mov ecx, i + mov edi, framebuffer + mov eax, c + rep stosd + } + else + { +#ifdef NO_MMX + while (i--) + { + *framebuffer=BLEND_AVG(*framebuffer,color); + framebuffer++; + } +#else + { + int icolor[2]={this->color,this->color}; + int vc[2] = { ~((1<<7)|(1<<15)|(1<<23)),~((1<<7)|(1<<15)|(1<<23))}; + i/=4; + __asm + { + movq mm6, vc + movq mm7, icolor + psrlq mm7, 1 + pand mm7, mm6 + mov edx, i + mov edi, framebuffer + _l1: + movq mm0, [edi] + + movq mm1, [edi+8] + psrlq mm0, 1 + + pand mm0, mm6 + psrlq mm1, 1 + + paddb mm0, mm7 + pand mm1, mm6 + + movq [edi], mm0 + paddb mm1, mm7 + + movq [edi+8], mm1 + add edi, 16 + dec edx + jnz _l1 + emms + } + } +#endif + } + } + } + else if (++df >= nf) + { + df=0; + // memset(framebuffer,0,w*h*4); + } + return 0; +} + +C_RBASE *R_NFClear(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; + switch (di->CtlID) + { + case IDC_BUTTON1: + GR_DrawColoredButton(di,g_this->color); + break; + } + } + return 0; + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,100); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->nf); + + if (g_this->blend) CheckDlgButton(hwndDlg,IDC_BLEND,BST_CHECKED); + 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->nf=t; + } + } + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON1) + { + GR_SelectColor(hwndDlg,&g_this->color); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + } + if (LOWORD(wParam) == IDC_BLEND) + { + if (IsDlgButtonChecked(hwndDlg,IDC_BLEND)) + g_this->blend=1; + else g_this->blend=0; + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_NFC,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_NFClear(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_onetone.cpp b/Src/Plugins/Visualization/vis_avs/r_onetone.cpp new file mode 100644 index 00000000..c709dac9 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_onetone.cpp @@ -0,0 +1,269 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + +#define MOD_NAME "Trans / Unique tone" +#define C_THISCLASS C_OnetoneClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_UNIQUE_TONE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + void RebuildTable(void); + int __inline depthof(int c); + int enabled; + int invert; + int color; + unsigned char tabler[256]; + unsigned char tableg[256]; + unsigned char tableb[256]; + int blend, blendavg; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + color = 0xFFFFFF; + invert=0; + blend = 0; + blendavg = 0; + enabled=1; + RebuildTable(); +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { invert=GET_INT(); pos+=4; } + RebuildTable(); +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(invert); pos+=4; + return pos; +} + +int __inline C_THISCLASS::depthof(int c) +{ +int r= max(max((c & 0xFF), ((c & 0xFF00)>>8)), (c & 0xFF0000)>>16); +return invert ? 255 - r : r; +} + +void C_THISCLASS::RebuildTable(void) +{ +int i; +for (i=0;i<256;i++) + tableb[i] = (unsigned char)((i / 255.0) * (float)(color & 0xFF)); +for (i=0;i<256;i++) + tableg[i] = (unsigned char)((i / 255.0) * (float)((color & 0xFF00) >> 8)); +for (i=0;i<256;i++) + tabler[i] = (unsigned char)((i / 255.0) * (float)((color & 0xFF0000) >> 16)); +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int i=w*h; + int *p=framebuffer; + int c,d; + + if (!enabled) return 0; + if (isBeat&0x80000000) return 0; + + if (blend) + { + while (i--) + { + d = depthof(*p); + c = tableb[d] | (tableg[d]<<8) | (tabler[d]<<16); + *p++ = BLEND(*p, c); + } + } + else if (blendavg) + { + while (i--) + { + d = depthof(*p); + c = tableb[d] | (tableg[d]<<8) | (tabler[d]<<16); + *p++ = BLEND_AVG(*p, c); + } + } + else + { + while (i--) + { + d = depthof(*p); + *p++ = tableb[d] | (tableg[d]<<8) | (tabler[d]<<16); + } + } + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->invert) CheckDlgButton(hwndDlg,IDC_INVERT,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) || + (LOWORD(wParam) == IDC_INVERT)) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->invert=IsDlgButtonChecked(hwndDlg,IDC_INVERT)?1:0; + } + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + g_ConfigThis->RebuildTable(); + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_ONETONE,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Onetone(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Onetone(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_oscring.cpp b/Src/Plugins/Visualization/vis_avs/r_oscring.cpp new file mode 100644 index 00000000..497662bb --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_oscring.cpp @@ -0,0 +1,356 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 + +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" + +#include "resource.h" +#include "../Agave/Language/api_language.h" + + +#define C_THISCLASS C_OscRingClass +#define MOD_NAME "Render / Ring" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_RING,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int effect; + int num_colors; + int colors[16]; + int size; + + int color_pos; + int source; +}; + + +#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) { effect=GET_INT(); pos+=4; } + 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=1; + if (len-pos >= 4) { size=GET_INT(); pos+=4; } + if (len-pos >= 4) { source=GET_INT(); pos+=4; } + +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + PUT_INT(effect); pos+=4; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + PUT_INT(size); pos+=4; + PUT_INT(source); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + effect=0|(2<<2)|(2<<4); + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + size=8; // of 16 + source=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int x; + int current_color; + unsigned char *fa_data; + char center_channel[576]; + int which_ch=(effect>>2)&3; + int y_pos=(effect>>4); + + if (isBeat&0x80000000) return 0; + 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); + } + + if (which_ch>=2) + { + for (x = 0; x < 576; x ++) center_channel[x]=visdata[source?0:1][0][x]/2+visdata[source?0:1][1][x]/2; + } + if (which_ch < 2) fa_data=(unsigned char *)&visdata[source?0:1][which_ch][0]; + else fa_data=(unsigned char *)center_channel; + + { + double s=size/32.0; +#ifdef LASER + double lx,ly; + double is=s; + double c_x; + double c_y=0; + if (y_pos == 2) c_x = 0; + else if (y_pos == 0) c_x=-0.5; + else c_x=0.5; +#else + int lx,ly; + double is=min((h*s),(w*s)); + int c_x; + int c_y=h/2; + if (y_pos == 2) c_x = w/2; + else if (y_pos == 0) c_x=(w/4); + else c_x=w/2+w/4; +#endif + { + int q=0; + double a=0.0; + double sca; + if (!source) sca=0.1 + ((fa_data[q]^128)/255.0)*0.9; + else sca=0.1 + ((fa_data[q*2]/2+fa_data[q*2+1]/2)/255.0)*0.9; +#ifdef LASER + int n_seg=4; +#else + int n_seg=1; +#endif + lx=c_x+(int)(cos(a)*is*sca); + ly=c_y+(int)(sin(a)*is*sca); + + for (q = 1; q <= 80; q += n_seg) + { +#ifdef LASER + double tx,ty; +#else + int tx,ty; +#endif + a -= 3.14159*2.0 / 80.0 * n_seg; + if (!source) sca=0.1 + ((fa_data[q>40?80-q:q]^128)/255.0)*0.90; + else sca=0.1 + ((fa_data[q>40?(80-q)*2:q*2]/2+fa_data[q>40?(80-q)*2+1:q*2+1]/2)/255.0)*0.9; + tx=c_x+(int)(cos(a)*is*sca); + ty=c_y+(int)(sin(a)*is*sca); +#ifdef LASER + if ((tx > -1.0 && tx < 1.0 && ty > -1.0 && ty < 1.0) || + (lx > -1.0 && lx < 1.0 && ly > -1.0 && ly < 1.0)) + { + LineType l; + l.color=current_color; + l.mode=0; + l.x1=(float)tx; + l.x2=(float)lx; + l.y1=(float)ty; + l.y2=(float)ly; + g_laser_linelist->AddLine(&l); + } +#else + + if ((tx >= 0 && tx < w && ty >= 0 && ty < h) || + (lx >= 0 && lx < w && ly >= 0 && ly < h)) + { + line(framebuffer,tx,ty,lx,ly,w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + } +#endif +// line(framebuffer,tx,ty,c_x,c_y,w,h,current_color); +// if (tx >= 0 && tx < w && ty >= 0 && ty < h) framebuffer[tx+ty*w]=current_color; + lx=tx; + ly=ty; + } + } + } + return 0; +} + +C_RBASE *R_OscRings(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={ (COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + g_this->size=t; + } + } + return 0; + case WM_INITDIALOG: + switch ((g_this->effect>>2)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_LEFTCH,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_RIGHTCH,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_MIDCH,BST_CHECKED); break; + } + switch ((g_this->effect>>4)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_TOP,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_BOTTOM,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_CENTER,BST_CHECKED); break; + } + if (g_this->source) + CheckDlgButton(hwndDlg,IDC_SPEC,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_OSC,BST_CHECKED); + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,1); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->size); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_OSC: g_this->source=0; break; + case IDC_SPEC: g_this->source=1; break; + case IDC_LEFTCH: g_this->effect&=~12; break; + case IDC_RIGHTCH: g_this->effect&=~12; g_this->effect|=4; break; + case IDC_MIDCH: g_this->effect&=~12; g_this->effect|=8; break; + case IDC_TOP: g_this->effect&=~48; break; + case IDC_BOTTOM: g_this->effect&=~48; g_this->effect|=16; break; + case IDC_CENTER: g_this->effect&=~48; g_this->effect|=32; 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; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_OSCRING,hwndParent,g_DlgProc); +} diff --git a/Src/Plugins/Visualization/vis_avs/r_oscstar.cpp b/Src/Plugins/Visualization/vis_avs/r_oscstar.cpp new file mode 100644 index 00000000..1bb37a1b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_oscstar.cpp @@ -0,0 +1,365 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 + +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" + +#include "resource.h" +#include "../Agave/Language/api_language.h" + + +#define C_THISCLASS C_OscStarClass +#define MOD_NAME "Render / Oscilliscope Star" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_OSCILLOSCOPE_STAR,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int effect; + int num_colors; + int colors[16]; + int size, rot; + + int color_pos; + double m_r; +}; + + +#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) { effect=GET_INT(); pos+=4; } + 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=1; + if (len-pos >= 4) { size=GET_INT(); pos+=4; } + if (len-pos >= 4) { rot=GET_INT(); pos+=4; } +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + PUT_INT(effect); pos+=4; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + PUT_INT(size); pos+=4; + PUT_INT(rot); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + effect=0|(2<<2)|(2<<4); + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + m_r=0.0; + size=8; // of 16 + rot=3; // of 16 +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int x; + int current_color; + unsigned char *fa_data; + char center_channel[576]; + int which_ch=(effect>>2)&3; + int y_pos=(effect>>4); + + if (isBeat&0x80000000) return 0; + + 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); + } + + if (which_ch>=2) + { + for (x = 0; x < 576; x ++) center_channel[x]=visdata[1][0][x]/2+visdata[1][1][x]/2; + } + if (which_ch < 2) fa_data=(unsigned char *)&visdata[1][which_ch][0]; + else fa_data=(unsigned char *)center_channel; + + { + double s=size/32.0; +#ifdef LASER + double c_x; + double is=s; + if (y_pos == 2) c_x = 0; + else if (y_pos == 0) c_x=-0.5; + else c_x=0.5; +#else + int c_x; + int is=min((int)(h*s),(int)(w*s)); + if (y_pos == 2) c_x = w/2; + else if (y_pos == 0) c_x=(w/4); + else c_x=w/2+w/4; +#endif + { + int q,ii=0; + for (q = 0; q < 5; q ++) + { + double s,c; + s=sin(m_r+q*(3.14159*2.0/5.0)); + c=cos(m_r+q*(3.14159*2.0/5.0)); + double p=0.0; +#ifdef LASER + double lx=c_x; + double ly=0.0; + int t=6; +#else + if (y_pos == 2) c_x = w/2; + else if (y_pos == 0) c_x=(w/4); + int lx=c_x; + int ly=h/2; + int t=64; +#endif + double dp=is/(double)t; + double dfactor=1.0/1024.0f; + double hw=is; + while (t--) + { + double ale=(((fa_data[ii]^128)-128)*dfactor*hw); +#ifdef LASER + double x,y; + ii+=8; + x=c_x+(c*p)-(s*ale); + y=(s*p)+(c*ale); + if ((x > -1.0 && x < 1.0 && y > -1.0 && y < 1.0) || + (lx > -1.0 && lx < 1.0 && ly > -.10 && ly < 1.0)) + { + LineType l; + l.color=current_color; + l.mode=0; + l.x1=(float)x; + l.x2=(float)lx; + l.y1=(float)y; + l.y2=(float)ly; + g_laser_linelist->AddLine(&l); + } +#else + int x,y; + ii++; + x=c_x+(int)(c*p)-(int)(s*ale); + y=h/2+(int)(s*p)+(int)(c*ale); + if ((x >= 0 && x < w && y >= 0 && y < h) || + (lx >= 0 && lx < w && ly >= 0 && ly < h)) + { + line(framebuffer,x,y,lx,ly,w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + } +#endif + lx=x; + ly=y; + p+=dp; + dfactor -= ((1.0/1024.0f)-(1.0/128.0f))/64.0f; + } + } + + m_r+=0.01 * (double)rot; + if (m_r >= 3.14159*2) + m_r -= 3.14159*2; + } + } + return 0; +} + +C_RBASE *R_OscStars(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={(COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER1)) + { + g_this->size=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->rot=t-16; + } + } + return 0; + case WM_INITDIALOG: + switch ((g_this->effect>>2)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_LEFTCH,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_RIGHTCH,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_MIDCH,BST_CHECKED); break; + } + switch ((g_this->effect>>4)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_TOP,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_BOTTOM,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_CENTER,BST_CHECKED); break; + } + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->size); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,32); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->rot+16); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_LEFTCH: g_this->effect&=~12; break; + case IDC_RIGHTCH: g_this->effect&=~12; g_this->effect|=4; break; + case IDC_MIDCH: g_this->effect&=~12; g_this->effect|=8; break; + case IDC_TOP: g_this->effect&=~48; break; + case IDC_BOTTOM: g_this->effect&=~48; g_this->effect|=16; break; + case IDC_CENTER: g_this->effect&=~48; g_this->effect|=32; 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; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_OSCSTAR,hwndParent,g_DlgProc); +} diff --git a/Src/Plugins/Visualization/vis_avs/r_parts.cpp b/Src/Plugins/Visualization/vis_avs/r_parts.cpp new file mode 100644 index 00000000..085830dd --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_parts.cpp @@ -0,0 +1,311 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" + +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_BPartsClass +#define MOD_NAME "Render / Moving Particle" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_MOVING_PARTICLE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + + int enabled; + int colors; + int maxdist,size,size2; + int blend; + + int s_pos; + + + double c[2]; + double v[2]; + double p[2]; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { colors=GET_INT(); pos+=4; } + 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) { blend=GET_INT(); pos+=4; } + s_pos=size; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(colors); pos+=4; + PUT_INT(maxdist); pos+=4; + PUT_INT(size); pos+=4; + PUT_INT(size2); pos+=4; + PUT_INT(blend); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + blend=1; + size=size2=s_pos=8; + maxdist=16; + enabled=1; + colors=RGB(255,255,255); + c[0]=c[1]=0.0f; + v[0]=-0.01551; + v[1]=0.0; + + p[0]=-0.6; + p[1]=0.3; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!(enabled&1)) return 0; + if (isBeat&0x80000000) return 0; + int xp,yp; + int ss=min(h/2,(w*3)/8); + int oc6 = colors; + + if (isBeat) + { + c[0]=((rand()%33)-16)/48.0f; + c[1]=((rand()%33)-16)/48.0f; + } + + + v[0] -= 0.004*(p[0]-c[0]); + 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=(int)(p[0]*(ss)*(maxdist/32.0))+w/2; + yp=(int)(p[1]*(ss)*(maxdist/32.0))+h/2; + if (isBeat && enabled&2) + s_pos=size2; + int sz=s_pos; + s_pos=(s_pos+size)/2; + if (sz <= 1) + { + framebuffer += xp+(yp)*w; + if (xp >= 0 && yp >= 0 && xp < w && yp < h) + { + if (blend==0) + framebuffer[0]=colors; + else if (blend==2) + framebuffer[0]=BLEND_AVG(framebuffer[0],colors); + else if (blend==3) + BLEND_LINE(framebuffer,colors); + else + framebuffer[0]=BLEND(framebuffer[0],colors); + } + return 0; + } + if (sz > 128) sz=128; + { + int y; + double md=sz*sz*0.25; + yp-=sz/2; + for (y = 0; y < sz; y ++) + { + if (yp+y >= 0 && yp+y < h) + { + double yd=(y-sz*0.5); + double l=sqrt(md-yd*yd); + int xs=(int)(l+0.99); + int x; + if (xs < 1) xs=1; + int xe=xp + xs; + if (xe > w) xe=w; + int xst=xp-xs; + if (xst < 0) xst=0; + int *f=&framebuffer[xst+(yp+y)*w]; + if (blend == 0) for ( x = xst; x < xe; x ++) *f++=colors; + else if (blend == 2) + for ( x = xst; x < xe; x ++) + { + *f=BLEND_AVG(*f,colors); + f++; + } + else if (blend == 3) + for ( x = xst; x < xe; x ++) + { + BLEND_LINE(f++,colors); + } + else + for ( x = xst; x < xe; x ++) + { + *f=BLEND(*f,colors); + f++; + } + } + } + } + return 0; +} + +C_RBASE *R_Parts(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; + switch (di->CtlID) + { + case IDC_LC: + GR_DrawColoredButton(di,g_this->colors); + break; + } + } + return 0; + case WM_INITDIALOG: + 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); + if (g_this->enabled&1) CheckDlgButton(hwndDlg,IDC_LEFT,BST_CHECKED); + if (g_this->enabled&2) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + + if (g_this->blend == 1) CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + else if (g_this->blend == 2) CheckDlgButton(hwndDlg,IDC_RADIO3,BST_CHECKED); + else if (g_this->blend == 3) CheckDlgButton(hwndDlg,IDC_RADIO4,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_RADIO1: + case IDC_RADIO2: + case IDC_RADIO3: + case IDC_RADIO4: + if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) g_this->blend=0; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO2)) g_this->blend=1; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO3)) g_this->blend=2; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO4)) g_this->blend=3; + break; + case IDC_LEFT: + g_this->enabled&=~1; + g_this->enabled|=IsDlgButtonChecked(hwndDlg,IDC_LEFT)?1:0; + return 0; + case IDC_CHECK1: + g_this->enabled&=~2; + g_this->enabled|=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?2:0; + return 0; + case IDC_LC: + if (!a) a=&g_this->colors; + GR_SelectColor(hwndDlg,a); + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,FALSE); + return 0; + + + } + 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_PARTS,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_Parts(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_picture.cpp b/Src/Plugins/Visualization/vis_avs/r_picture.cpp new file mode 100644 index 00000000..9ff29ec5 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_picture.cpp @@ -0,0 +1,372 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + + +#define MOD_NAME "Render / Picture" +#define C_THISCLASS C_PictureClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_PICTURE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + void loadPicture(char *name); + void freePicture(); + + int enabled; + int width,height; + HBITMAP hOldBitmap; + HBITMAP hb; + HBITMAP hb2; + HDC hBitmapDC; + HDC hBitmapDC2; + int lastWidth,lastHeight; + int blend, blendavg, adapt, persist; + int ratio,axis_ratio; + char ascName[MAX_PATH]; + int persistCount; +}; + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + persistCount=0; + enabled=1; + blend=0; + adapt=0; + blendavg=1; + persist=6; + strcpy(ascName,""); + hb=0; ratio=0; axis_ratio=0; + hBitmapDC=0; hBitmapDC2=0; +} +C_THISCLASS::~C_THISCLASS() +{ + freePicture(); +} + +void C_THISCLASS::loadPicture(char *name) +{ + freePicture(); + + char longName[MAX_PATH]; + wsprintf(longName,"%s\\%s",g_path,name); + hb=(HBITMAP)LoadImage(0,longName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE); + + BITMAP bm; + GetObject(hb, sizeof(bm), (LPSTR)&bm); + width=bm.bmWidth; + height=bm.bmHeight; + + lastWidth=lastHeight=0; +} +void C_THISCLASS::freePicture() +{ + if(hb) + { + DeleteObject(hb); + hb=0; + } +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { adapt=GET_INT(); pos+=4; } + if (len-pos >= 4) { persist=GET_INT(); pos+=4; } + + char *p=ascName; + while (data[pos] && len-pos > 0) *p++=data[pos++]; + *p=0; pos++; + + if (len-pos >= 4) { ratio=GET_INT(); pos+=4; } + if (len-pos >= 4) { axis_ratio=GET_INT(); pos+=4; } + + if (*ascName) + loadPicture(ascName); +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(adapt); pos+=4; + PUT_INT(persist); pos+=4; + strcpy((char *)data+pos, ascName); + pos+=strlen(ascName)+1; + PUT_INT(ratio); pos+=4; + PUT_INT(axis_ratio); pos+=4; + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + + if (!enabled) return 0; + + if (!width || !height) return 0; + + + if (lastWidth != w || lastHeight != h) + { + lastWidth = w; + lastHeight = h; + + if(hBitmapDC2) { + DeleteDC(hBitmapDC2); + DeleteObject(hb2); + hBitmapDC2=0; + } + + // Copy the bitmap from hBitmapDC to hBitmapDC2 and stretch it + hBitmapDC = CreateCompatibleDC (NULL); + hOldBitmap = (HBITMAP) SelectObject (hBitmapDC, hb); + hBitmapDC2 = CreateCompatibleDC (NULL); + hb2=CreateCompatibleBitmap (hBitmapDC, w, h); + SelectObject(hBitmapDC2,hb2); + { + HBRUSH b=CreateSolidBrush(0); + HPEN p=CreatePen(PS_SOLID,0,0); + HBRUSH bold; + HPEN pold; + bold=(HBRUSH)SelectObject(hBitmapDC2,b); + pold=(HPEN)SelectObject(hBitmapDC2,p); + Rectangle(hBitmapDC2,0,0,w,h); + SelectObject(hBitmapDC2,bold); + SelectObject(hBitmapDC2,pold); + DeleteObject(b); + DeleteObject(p); + } + SetStretchBltMode(hBitmapDC2,COLORONCOLOR); + int final_height=h,start_height=0; + int final_width=w,start_width=0; + if (ratio) + { + if(axis_ratio==0) { + // ratio on X axis + final_height=height*w/width; + start_height=(h/2)-(final_height/2); + } else { + // ratio on Y axis + final_width=width*h/height; + start_width=(w/2)-(final_width/2); + } + } + StretchBlt(hBitmapDC2,start_width,start_height,final_width,final_height,hBitmapDC,0,0,width,height,SRCCOPY); + DeleteDC(hBitmapDC); + hBitmapDC=0; + } + if (isBeat&0x80000000) return 0; + + // Copy the stretched bitmap to fbout + BITMAPINFO bi; + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bi.bmiHeader.biWidth = w; + bi.bmiHeader.biHeight = h; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = 0; + bi.bmiHeader.biXPelsPerMeter = 0; + bi.bmiHeader.biYPelsPerMeter = 0; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; + GetDIBits(hBitmapDC2, hb2, 0, h, (void *)fbout, &bi, DIB_RGB_COLORS); + + // Copy the bitmap from fbout to framebuffer applying replace/blend/etc... + if (isBeat) + persistCount=persist; + else + if (persistCount>0) persistCount--; + + int *p,*d; + int i,j; + + p = fbout; + d = framebuffer+w*(h-1); + if (blend || (adapt && (isBeat || persistCount))) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + *d=BLEND(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + if (blendavg || adapt) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + *d=BLEND_AVG(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + for (i=0;i<h;i++) + { + memcpy(d, p, w*4); + p+=w; + d-=w; + } + + return 0; +} + + +// configuration dialog stuff + +static void EnableWindows(HWND hwndDlg) +{ + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST),g_ConfigThis->adapt); + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST_TITLE),g_ConfigThis->adapt); + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST_TEXT1),g_ConfigThis->adapt); + EnableWindow(GetDlgItem(hwndDlg,IDC_PERSIST_TEXT2),g_ConfigThis->adapt); + EnableWindow(GetDlgItem(hwndDlg,IDC_X_RATIO),g_ConfigThis->ratio); + EnableWindow(GetDlgItem(hwndDlg,IDC_Y_RATIO),g_ConfigThis->ratio); +} + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_SETRANGE, TRUE, MAKELONG(0, 32)); + SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_SETPOS, TRUE, g_ConfigThis->persist); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_ENABLED,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (g_ConfigThis->adapt) CheckDlgButton(hwndDlg,IDC_ADAPT,BST_CHECKED); + if (!g_ConfigThis->adapt && !g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + if (g_ConfigThis->ratio) CheckDlgButton(hwndDlg,IDC_RATIO,BST_CHECKED); + if (!g_ConfigThis->axis_ratio) CheckDlgButton(hwndDlg,IDC_X_RATIO,BST_CHECKED); + if (g_ConfigThis->axis_ratio) CheckDlgButton(hwndDlg,IDC_Y_RATIO,BST_CHECKED); + EnableWindows(hwndDlg); + loadComboBox(GetDlgItem(hwndDlg,OBJ_COMBO),"*.BMP",g_ConfigThis->ascName); + return 1; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_PERSIST) + g_ConfigThis->persist = SendDlgItemMessage(hwndDlg, IDC_PERSIST, TBM_GETPOS, 0, 0); + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_ENABLED) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_ADAPT) || + (LOWORD(wParam) == IDC_5050) ) { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_ENABLED)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + g_ConfigThis->adapt=IsDlgButtonChecked(hwndDlg,IDC_ADAPT)?1:0; + EnableWindows(hwndDlg); + } + if(LOWORD(wParam) == IDC_RATIO || LOWORD(wParam) == IDC_X_RATIO || LOWORD(wParam) == IDC_Y_RATIO) { + g_ConfigThis->ratio=IsDlgButtonChecked(hwndDlg,IDC_RATIO)?1:0; + g_ConfigThis->axis_ratio=IsDlgButtonChecked(hwndDlg,IDC_Y_RATIO)?1:0; + g_ConfigThis->lastWidth=-1; g_ConfigThis->lastHeight=-1; + EnableWindows(hwndDlg); + } + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == OBJ_COMBO) // handle clicks to combo box + { + int sel = SendDlgItemMessage(hwndDlg, OBJ_COMBO, CB_GETCURSEL, 0, 0); + if (sel != -1) + { + SendDlgItemMessage(hwndDlg, OBJ_COMBO, CB_GETLBTEXT, sel, (LPARAM)g_ConfigThis->ascName); + if (*(g_ConfigThis->ascName)) + g_ConfigThis->loadPicture(g_ConfigThis->ascName); + } + } + return 0; + case WM_HSCROLL: + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_PICTURE,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Picture(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Picture(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ +return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_rotblit.cpp b/Src/Plugins/Visualization/vis_avs/r_rotblit.cpp new file mode 100644 index 00000000..97ee2a05 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_rotblit.cpp @@ -0,0 +1,327 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + +#include <math.h> +#define M_PI 3.1415926536 + +#define C_THISCLASS C_RotBlitClass +#define MOD_NAME "Trans / Roto Blitter" + + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_ROTO_BLITTER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int zoom_scale, rot_dir, blend, beatch, beatch_speed, zoom_scale2, beatch_scale,scale_fpos; + int rot_rev; + int subpixel; + double rot_rev_pos; + + int l_w, l_h; + int *w_mul; +}; + + +#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; + if (len-pos >= 4) { zoom_scale=GET_INT(); pos+=4; } + if (len-pos >= 4) { rot_dir=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatch=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatch_speed=GET_INT(); pos+=4; } + if (len-pos >= 4) { zoom_scale2=GET_INT(); pos+=4; } + if (len-pos >= 4) { beatch_scale=GET_INT(); pos+=4; } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + else subpixel=0; + + scale_fpos=zoom_scale; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(zoom_scale); pos+=4; + PUT_INT(rot_dir); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(beatch); pos+=4; + PUT_INT(beatch_speed); pos+=4; + PUT_INT(zoom_scale2); pos+=4; + PUT_INT(beatch_scale); pos+=4; + PUT_INT(subpixel); pos+=4; + return pos; +} + + +C_THISCLASS::C_THISCLASS() +{ + zoom_scale=31; + rot_dir=31; + blend=0; + rot_rev=1; + rot_rev_pos=1.0; + beatch=0; + l_w=l_h=0; + w_mul=NULL; + beatch_speed=0; + beatch_scale=0; + zoom_scale2=31; + scale_fpos=zoom_scale; + subpixel=1; +} + +C_THISCLASS::~C_THISCLASS() +{ + if (w_mul) GlobalFree(w_mul); + w_mul=NULL; + l_w=l_h=0; +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int y; + + if (l_w != w || l_h != h || !w_mul) // generate width table + { + int x; + if (w_mul) GlobalFree(w_mul); + l_w=w; + l_h=h; + w_mul=(int *)GlobalAlloc(GMEM_FIXED,sizeof(int)*h); + for (x = 0; x < h; x ++) + w_mul[x]=x*w; + } + if (isBeat&0x80000000) return 0; + + unsigned int *dest=(unsigned int *) fbout; + unsigned int *src=(unsigned int *) framebuffer; + unsigned int *bdest=(unsigned int *) framebuffer; + + if (isBeat && beatch) + { + rot_rev=-rot_rev; + } + + if (!beatch) rot_rev=1; + + rot_rev_pos+=(1.0/(1+beatch_speed*4))*(rot_rev-rot_rev_pos); + + if (rot_rev_pos > rot_rev && rot_rev>0) rot_rev_pos=rot_rev; + if (rot_rev_pos < rot_rev && rot_rev<0) rot_rev_pos=rot_rev; + + + if (isBeat && beatch_scale) + { + scale_fpos=zoom_scale2; + } + + int f_val; + if (zoom_scale < zoom_scale2) + { + f_val=max(scale_fpos,zoom_scale); + if (scale_fpos > zoom_scale) scale_fpos -= 3; + } + else + { + f_val=min(scale_fpos,zoom_scale); + if (scale_fpos < zoom_scale) scale_fpos+=3; + } + + double zoom = 1.0 + (f_val-31)/31.0; + + double theta=((rot_dir-32))*rot_rev_pos; + double temp; + int ds_dx, dt_dx, ds_dy, dt_dy, s, t, sstart, tstart; + int x, offset=0; + + temp = cos((theta)*M_PI/180.0)*zoom; + ds_dx = (int) (temp*65536.0); + dt_dy = (int) (temp*65536.0); + temp = sin((theta)*M_PI/180.0)*zoom; + ds_dy = - (int) (temp*65536.0); + dt_dx = (int) (temp*65536.0); + + s = sstart = -(((w-1)/2)*ds_dx + ((h-1)/2)*ds_dy) + (w-1)*(32768 + (1<<20)); + t = tstart = -(((w-1)/2)*dt_dx + ((h-1)/2)*dt_dy) + (h-1)*(32768 + (1<<20)); + int ds, dt; + ds = (w-1)<<16; + dt = (h-1)<<16; + y = h; + + if (ds_dx <= -ds || ds_dx >= ds || dt_dx <= -dt || dt_dx >= dt); + else while (y--) + { + if (ds) s %= ds; + if (dt) t %= dt; + if (s < 0) s+=ds; if (t < 0) t+=dt; + x = w; + offset = y*w; + + +#define DO_LOOP(Z) while (x--) { Z; s += ds_dx; t += dt_dx; } +#define DO_LOOPS(Z) \ + if (ds_dx <= 0 && dt_dx <= 0) DO_LOOP(if (t < 0) t += dt; if (s < 0) s += ds; Z) \ + else if (ds_dx <= 0) DO_LOOP(if (t >= dt) t -= dt; if (s < 0) s += ds; Z) \ + else if (dt_dx <= 0) DO_LOOP(if (t < 0) t += dt; if (s >= ds) s -= ds; Z) \ + else DO_LOOP(if (t >= dt) t -= dt; if (s >= ds) s -= ds; Z) + + + if (subpixel && blend) DO_LOOPS(*dest++ = BLEND_AVG(*bdest++,BLEND4_16(src+(s>>16)+w_mul[t>>16],w,s,t))) + else if (subpixel) DO_LOOPS(*dest++ = BLEND4_16(src+(s>>16)+w_mul[t>>16],w,s,t)) + else if (!blend) DO_LOOPS(*dest++ = src[(s>>16)+w_mul[t>>16]]) + else DO_LOOPS(*dest++ = BLEND_AVG(*bdest++,src[(s>>16)+w_mul[t>>16]])) + + s = (sstart += ds_dy); + t = (tstart += dt_dy); + } +#ifndef NO_MMX + __asm emms; +#endif + + return 1; +} + +C_RBASE *R_RotBlit(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,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETRANGEMAX,0,256); + SendDlgItemMessage(hwndDlg,IDC_SLIDER1,TBM_SETPOS,1,g_this->zoom_scale); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETRANGEMAX,0,256); + SendDlgItemMessage(hwndDlg,IDC_SLIDER6,TBM_SETPOS,1,g_this->zoom_scale2); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETRANGEMAX,0,8); + SendDlgItemMessage(hwndDlg,IDC_SLIDER5,TBM_SETPOS,1,g_this->beatch_speed); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMIN,0,0); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETRANGEMAX,0,64); + SendDlgItemMessage(hwndDlg,IDC_SLIDER2,TBM_SETPOS,1,g_this->rot_dir); + if (g_this->subpixel) CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + else if (g_this->blend==1) CheckDlgButton(hwndDlg,IDC_BLEND,BST_CHECKED); + if (g_this->beatch==1) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->beatch_scale==1) CheckDlgButton(hwndDlg,IDC_CHECK6,BST_CHECKED); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_BLEND: + if (IsDlgButtonChecked(hwndDlg,IDC_BLEND)) + { + g_this->blend=1; + } + else g_this->blend=0; + break; + case IDC_CHECK1: + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK1)) + g_this->beatch=1; + else g_this->beatch=0; + break; + case IDC_CHECK2: + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK2)) + { + g_this->subpixel=1; + } + else g_this->subpixel=0; + break; + case IDC_CHECK6: + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK6)) + g_this->beatch_scale=1; + else g_this->beatch_scale=0; + break; + } + 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->zoom_scale=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER6)) + { + g_this->zoom_scale2=t; + g_this->scale_fpos=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER2)) + { + g_this->rot_dir=t; + } + if (swnd == GetDlgItem(hwndDlg,IDC_SLIDER5)) + { + g_this->beatch_speed=t; + } + } + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_ROTBLT,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_RotBlit(char *desc) +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_rotstar.cpp b/Src/Plugins/Visualization/vis_avs/r_rotstar.cpp new file mode 100644 index 00000000..dd3c038e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_rotstar.cpp @@ -0,0 +1,271 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include "r_defs.h" + +#include <math.h> +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_RotStarClass +#define MOD_NAME "Render / Rotating Stars" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_ROTATING_STARS,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int num_colors; + int colors[16]; + + int color_pos; + double r1; +}; + + +#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; +} + +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; } + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + r1=0.0; + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int x,y,c; + int current_color; + + if (isBeat&0x80000000) return 0; + 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); + } + + x=(int) (cos(r1)*w/4.0); + y=(int) (sin(r1)*h/4.0); + for (c = 0; c < 2; c ++) + { + double r2=-r1; + int s=0; + int t; + int a,b; + int nx, ny; + int lx,ly,l; + a=x; + b=y; + + for (l = 3; l < 14; l ++) + if (visdata[0][c][l] > s && + visdata[0][c][l] > visdata[0][c][l+1]+4 && + visdata[0][c][l] > visdata[0][c][l-1]+4) + s=visdata[0][c][l]; + + if (c==1) { a=-a; b=-b; } + + double vw,vh; + vw=w/8.0*(s+9)/88.0; + vh=h/8.0*(s+9)/88.0; + + nx=(int) (cos(r2)*vw); + ny=(int) (sin(r2)*vh); + lx = w/2+a+nx; + ly = h/2+b+ny; + + r2+=3.14159*4.0/5.0; + + for (t = 0; t < 5; t ++) + { + int nx, ny; + nx=(int) (cos(r2)*vw+w/2+a); + ny=(int) (sin(r2)*vh+h/2+b); + r2+=3.14159*4.0/5.0; + line(framebuffer,lx,ly,nx,ny,w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + lx=nx; + ly=ny; + } + } + r1+=0.1; + return 0; +} + +C_RBASE *R_RotStar(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={(COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + 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; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_ROTSTAR,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_RotStar(char *desc) +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_scat.cpp b/Src/Plugins/Visualization/vis_avs/r_scat.cpp new file mode 100644 index 00000000..99c9f0f6 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_scat.cpp @@ -0,0 +1,161 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_ScatClass +#define MOD_NAME "Trans / Scatter" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_SCATTER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int enabled; + int fudgetable[512],ftw; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + enabled=1; + ftw=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int l; + if (!enabled) return 0; + if (ftw != w) + { + int x; + for (x = 0; x < 512; x ++) + { + int yp; + int xp; + xp=(x%8)-4; + yp=(x/8)%8-4; + if (xp<0) xp++; + if (yp<0) yp++; + fudgetable[x]=w*yp+xp; + } + ftw=w; + + } + if (isBeat&0x80000000) return 0; + + l=w*4; + while (l-- > 0) *fbout++=*framebuffer++; + l=w*(h-8); + while (l-- > 0) + { + *fbout++ = framebuffer[fudgetable[rand()&511]]; + framebuffer++; + } + l=w*4; + while (l-- > 0) *fbout++=*framebuffer++; + + + return 1; +} + +C_RBASE *R_Scat(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + if (g_this->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK1) + { + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK1)) + g_this->enabled=1; + else + g_this->enabled=0; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_SCAT,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_Scat(char *desc) +{return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_shift.cpp b/Src/Plugins/Visualization/vis_avs/r_shift.cpp new file mode 100644 index 00000000..3fcced02 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_shift.cpp @@ -0,0 +1,391 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" +#include "resource.h" +#include "avs_eelif.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + + +#ifndef LASER + +#define C_THISCLASS C_ShiftClass +#define MOD_NAME "Trans / Dynamic Shift" + + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_DYNAMIC_SHIFT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + RString effect_exp[3]; + int blend,subpixel; + + int m_lastw,m_lasth; + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_x, *var_y, *var_w, *var_h, *var_b, *var_alpha; + double max_d; + int inited; + NSEEL_CODEHANDLE codehandle[3]; + int need_recompile; + 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; + 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); + } + else + { + char buf[769]; + if (len-pos >= 768) + { + memcpy(buf,data+pos,768); + pos+=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); + } + } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + data[pos++]=1; + save_string(data,pos,effect_exp[0]); + save_string(data,pos,effect_exp[1]); + save_string(data,pos,effect_exp[2]); + PUT_INT(blend); pos+=4; + PUT_INT(subpixel); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + InitializeCriticalSection(&rcs); + AVS_EEL_INITINST(); + + memset(codehandle,0,sizeof(codehandle)); + m_lasth=m_lastw=0; + + effect_exp[0].assign("d=0;"); // init + effect_exp[1].assign("x=sin(d)*1.4; y=1.4*cos(d); d=d+0.01;"); // frame + effect_exp[2].assign("d=d+2.0"); + blend=0; + subpixel=1; + + need_recompile=1; + var_b=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + int x; + for (x = 0; x < 3; x ++) + { + freeCode(codehandle[x]); + } + AVS_EEL_QUITINST(); + + DeleteCriticalSection(&rcs); +} + + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + //pow(sin(d),dpos)*1.7 + if (need_recompile) + { + int err=0; + int x; + EnterCriticalSection(&rcs); + if (!var_b || g_reset_vars_on_recompile) + { + clearVars(); + var_x = registerVar("x"); + var_y = registerVar("y"); + var_w = registerVar("w"); + var_h = registerVar("h"); + var_b = registerVar("b"); + var_alpha = registerVar("alpha"); + inited=0; + } + need_recompile=0; + for (x = 0; x < 3; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + LeaveCriticalSection(&rcs); + } + *var_w=w; + *var_h=h; + *var_b=isBeat?1.0:0.0; + + if (isBeat&0x80000000) return 0; + + if (codehandle[0] && (!inited || m_lasth != h || m_lastw != w)) + { + m_lastw=w; + m_lasth=h; + *var_x=0; *var_y=0; *var_alpha=0.5; + executeCode(codehandle[0],visdata); + inited=1; + } + + executeCode(codehandle[1],visdata); + if (isBeat) executeCode(codehandle[2],visdata); + + int doblend=blend; + int ialpha=127; + if (doblend) + { + ialpha=(int)(*var_alpha*255.0); + if (ialpha <= 0) return 0; + if (ialpha >= 255) doblend=0; + } + int *inptr=framebuffer; + int *blendptr=framebuffer; + int *outptr=fbout; + int xa=(int)*var_x; + int ya=(int)*var_y; + + // var_x, var_y at this point tell us how to shift, and blend also tell us what to do. + if (!subpixel) + { + int endy=h+ya; + int endx=w+xa; + int x,y; + if (endx > w) endx=w; + if (endy > h) endy=h; + if (ya < 0) inptr += -ya*w; + if (ya > h) ya=h; + if (xa > w) xa=w; + for (y = 0; y < ya; y ++) + { + x=w; + if (!doblend) while (x--) *outptr++ = 0; + else while (x--) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + for (; y < endy; y ++) + { + int *ip=inptr; + if (xa < 0) inptr += -xa; + if (!doblend) + { + for (x = 0; x < xa; x ++) *outptr++=0; + for (; x < endx; x ++) *outptr++=*inptr++; + for (; x < w; x ++) *outptr++=0; + } + else + { + for (x = 0; x < xa; x ++) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + for (; x < endx; x ++) *outptr++ = BLEND_ADJ(*inptr++,*blendptr++,ialpha); + for (; x < w; x ++) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + inptr=ip+w; + } + for (; y < h; y ++) + { + x=w; + if (!doblend) while (x--) *outptr++ = 0; + else while (x--) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + } + else // bilinear filtering version + { + + int xpart,ypart; + + { + double vx=*var_x; + double vy=*var_y; + xpart=(int) ((vx - (int)vx)*255.0); + if (xpart < 0) xpart=-xpart; + else { xa++; xpart=255-xpart; } + if (xpart < 0) xpart=0; + if (xpart > 255) xpart=255; + + ypart=(int) ((vy - (int)vy)*255.0); + if (ypart < 0) ypart=-ypart; + else { ya++; ypart=255-ypart; } + if (ypart < 0) ypart=0; + if (ypart > 255) ypart=255; + } + + int x,y; + if (ya < 1-h) ya=1-h; + if (xa < 1-w) xa=1-w; + if (ya > h-1) ya=h-1; + if (xa > w-1) xa=w-1; + if (ya < 0) inptr += -ya*w; + int endy=h-1+ya; + int endx=w-1+xa; + if (endx > w-1) endx=w-1; + if (endy > h-1) endy=h-1; + if (endx < 0) endx=0; + if (endy < 0) endy=0; + for (y = 0; y < ya; y ++) + { + x=w; + if (!doblend) while (x--) *outptr++ = 0; + else while (x--) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + for (; y < endy; y ++) + { + int *ip=inptr; + if (xa < 0) inptr += -xa; + if (!doblend) + { + for (x = 0; x < xa; x ++) *outptr++=0; + for (; x < endx; x ++) *outptr++=BLEND4((unsigned int *)inptr++,w,xpart,ypart); + for (; x < w; x ++) *outptr++=0; + } + else + { + for (x = 0; x < xa; x ++) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + for (; x < endx; x ++) *outptr++ = BLEND_ADJ(BLEND4((unsigned int *)inptr++,w,xpart,ypart),*blendptr++,ialpha); + for (; x < w; x ++) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + inptr=ip+w; + } + for (; y < h; y ++) + { + x=w; + if (!doblend) while (x--) *outptr++ = 0; + else while (x--) *outptr++ = BLEND_ADJ(0,*blendptr++,ialpha); + } + } + #ifndef NO_MMX + __asm emms; + #endif + + return 1; +} + +C_RBASE *R_Shift(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; + 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()); + isstart=0; + if (g_this->blend) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->subpixel) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_HELPBTN) + { + char *text="Dynamic Shift\0" + "better Dynamic shift help goes here (send me some :)\r\n"; + "Variables:\r\n" + "x,y = amount to shift (in pixels - set these)\r\n" + "w,h = width, height (in pixels)\r\n" + "b = isBeat\r\n" + "alpha = alpha value (0.0-1.0) for blend\r\n" + ; + compilerfunctionlist(hwndDlg,text); + } + if (LOWORD(wParam)==IDC_CHECK1) + { + g_this->blend=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + if (LOWORD(wParam)==IDC_CHECK2) + { + g_this->subpixel=IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?1:0; + } + if (!isstart && (LOWORD(wParam) == IDC_EDIT1||LOWORD(wParam) == IDC_EDIT2||LOWORD(wParam) == IDC_EDIT3) && HIWORD(wParam) == EN_CHANGE) + { + 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->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT1) g_this->inited = 0; + 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_SHIFT,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_Shift(char *desc) +{ + return NULL; +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_simple.cpp b/Src/Plugins/Visualization/vis_avs/r_simple.cpp new file mode 100644 index 00000000..4d910a6f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_simple.cpp @@ -0,0 +1,427 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include "r_defs.h" + +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_SimpleClass +#define MOD_NAME "Render / Simple" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_SIMPLE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int effect; + int num_colors; + int colors[16]; + + 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) { effect=GET_INT(); pos+=4; } + 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; +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0,x=0; + PUT_INT(effect); pos+=4; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + effect=0|(2<<2)|(2<<4); + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!num_colors) return 0; + if (isBeat&0x80000000) return 0; + int x; + float yscale = (float) h / 2.0f / 256.0f; + float xscale = 288.0f/w; + int current_color; + unsigned char *fa_data; + char center_channel[576]; + int which_ch=(effect>>2)&3; + int y_pos=(effect>>4)&3; + 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); + } + + if (which_ch>=2) + { + int w=0; + if ((effect&3)>1) + w=1; + + for (x = 0; x < 576; x ++) center_channel[x]=visdata[w][0][x]/2+visdata[w][1][x]/2; + } + if (which_ch < 2) fa_data=(unsigned char *)&visdata[(effect&3)>1?1:0][which_ch][0]; + else fa_data=(unsigned char *)center_channel; + + if (effect&(1<<6)) + { + switch (effect&2) + { + case 2: // dot scope + { + int yh = y_pos*h / 2; + if (y_pos==2) yh=h/4; + int ys = yh+(int)(yscale*128.0f); + for (x = 0; x < w; x ++) + { + float r=x*xscale; + float s1=r-(int)r; + float yr=(fa_data[(int)r]^128)*(1.0f-s1)+(fa_data[(int)r+1]^128)*(s1); + int y=yh + (int) (yr*yscale); + if (y >= 0 && y < h) framebuffer[x+y*w]=current_color; + } + } + break; + case 0: // dot analyzer + { + int h2=h/2; + float ys=yscale; + float xs=200.0f/w; + int adj=1; + if (y_pos!=1) { ys=-ys; adj=0; } + if (y_pos==2) + { + h2 -= (int) (ys*256/2); + } + for (x = 0; x < w; x ++) + { + float r=x*xs; + float s1=r-(int)r; + float yr=fa_data[(int)r]*(1.0f-s1)+fa_data[(int)r+1]*(s1); + int y=h2+adj+(int)(yr*ys-1.0f); + if (y >= 0 && y < h) framebuffer[x+w*y]=current_color; + } + } + break; + } + } + else + switch (effect&3) + { + case 0: //solid analyzer + { + int h2=h/2; + float ys=yscale; + float xs=200.0f/w; + int adj=1; + if (y_pos!=1) { ys=-ys; adj=0; } + if (y_pos==2) + { + h2 -= (int) (ys*256/2); + } + for (x = 0; x < w; x ++) + { + float r=x*xs; + float s1=r-(int)r; + float yr=fa_data[(int)r]*(1.0f-s1)+fa_data[(int)r+1]*(s1); + line(framebuffer,x,h2-adj,x,h2 + adj + (int) (yr*ys - 1.0f),w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + } + } + break; + case 1: // line analyzer + { + int yh = 0; + int h2=h/2; + int lx,ly,ox,oy; + float xs= 1.0f/xscale*(288.0f/200.f); + float ys=yscale; + if (y_pos!=1) { ys=-ys; } + if (y_pos == 2) + h2 -= (int) (ys*256/2); + + ly=h2 + (int) ((fa_data[0])*ys); + lx=0; + for (x = 1; x < 200; x ++) + { + oy=h2 + (int) ((fa_data[x])*ys); + ox=(int) (x*xs); + line(framebuffer,lx,ly,ox,oy,w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + ly=oy; + lx=ox; + } + } + break; + case 2: // line scope + { + float xs = 1.0f/xscale; + int lx, ly,ox,oy; + int yh; + if (y_pos == 2) + yh = h/4; + else yh = y_pos*h/ 2; + lx=0; + ly=yh + (int) ((int)(fa_data[0]^128)*yscale);; + for (x = 1; x < 288; x ++) + { + ox=(int)(x*xs); + oy = yh + (int) ((int)(fa_data[x]^128)*yscale); + line(framebuffer, lx,ly,ox,oy,w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + lx=ox; + ly=oy; + } + } + break; + case 3: // solid scope + { + int yh = y_pos*h / 2; + if (y_pos==2) yh=h/4; + int ys = yh+(int)(yscale*128.0f); + for (x = 0; x < w; x ++) + { + float r=x*xscale; + float s1=r-(int)r; + float yr=(fa_data[(int)r]^128)*(1.0f-s1)+(fa_data[(int)r+1]^128)*(s1); + line(framebuffer,x,ys-1,x,yh + (int) (yr*yscale),w,h,current_color,(g_line_blend_mode&0xff0000)>>16); + } + } + break; + } + return 0; +} + +C_RBASE *R_SimpleSpectrum(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) +{ + const static int chex[8]= + { + IDC_SA,IDC_SOLID, + IDC_SA,IDC_LINES, + IDC_OSC,IDC_LINES, + IDC_OSC,IDC_SOLID, + }; + 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={(COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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: + if ((g_this->effect>>6)&1) + { + CheckDlgButton(hwndDlg,IDC_DOT,BST_CHECKED); + if (g_this->effect&2) + CheckDlgButton(hwndDlg,IDC_OSC,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_SA,BST_CHECKED); + } + else + { + CheckDlgButton(hwndDlg,chex[(g_this->effect&3)*2],BST_CHECKED); + CheckDlgButton(hwndDlg,chex[(g_this->effect&3)*2+1],BST_CHECKED); + } + + switch ((g_this->effect>>2)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_LEFTCH,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_RIGHTCH,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_MIDCH,BST_CHECKED); break; + } + switch ((g_this->effect>>4)&3) + { + case 0: CheckDlgButton(hwndDlg,IDC_TOP,BST_CHECKED); break; + case 1: CheckDlgButton(hwndDlg,IDC_BOTTOM,BST_CHECKED); break; + case 2: CheckDlgButton(hwndDlg,IDC_CENTER,BST_CHECKED); break; + } + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_DOT: case IDC_SA: case IDC_SOLID: case IDC_OSC: case IDC_LINES: + if (!IsDlgButtonChecked(hwndDlg,IDC_DOT)) + { + int c; + + g_this->effect &= ~(1<<6); + for (c = 0; c < 4; c ++) + { + if (IsDlgButtonChecked(hwndDlg,chex[c*2]) && IsDlgButtonChecked(hwndDlg,chex[c*2+1])) break; + } + if (c!=4) { g_this->effect&=~3; g_this->effect|=c;} + } + else + { + g_this->effect&=~3; + if (!IsDlgButtonChecked(hwndDlg,IDC_SA)) g_this->effect|=2; + g_this->effect |= 1<<6; + } + break; + case IDC_LEFTCH: g_this->effect&=~12; break; + case IDC_RIGHTCH: g_this->effect&=~12; g_this->effect|=4; break; + case IDC_MIDCH: g_this->effect&=~12; g_this->effect|=8; break; + case IDC_TOP: g_this->effect&=~48; break; + case IDC_BOTTOM: g_this->effect&=~48; g_this->effect|=16; break; + case IDC_CENTER: g_this->effect&=~48; g_this->effect|=32; 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; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_SIMPLE,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_SimpleSpectrum(char *desc) +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_sscope.cpp b/Src/Plugins/Visualization/vis_avs/r_sscope.cpp new file mode 100644 index 00000000..c466db2e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_sscope.cpp @@ -0,0 +1,595 @@ +/* + 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 M_PI 3.14159265358979323846 + +#include <windows.h> +#include <commctrl.h> +#include <math.h> +#include "r_defs.h" +#include "resource.h" +#include "avs_eelif.h" +#if 0//syntax highlighting +#include "richedit.h" +#endif +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#define C_THISCLASS C_SScopeClass +#define MOD_NAME "Render / SuperScope" + + + +class C_THISCLASS : public C_RBASE { + protected: + static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); + + public: + C_THISCLASS(); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_SUPERSCOPE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + RString effect_exp[4]; + int which_ch; + int num_colors; + int colors[16]; + int mode; + + int color_pos; + + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + double *var_b, *var_x, *var_y, *var_i, *var_n, *var_v, *var_w, *var_h, *var_red, *var_green, *var_blue; + double *var_skip, *var_linesize, *var_drawmode; + int inited; + NSEEL_CODEHANDLE codehandle[4]; + int need_recompile; + 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; + int x=0; + 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); + } + } + if (len-pos >= 4) { which_ch=GET_INT(); pos+=4; } + 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) { mode=GET_INT(); pos+=4; } + need_recompile=1; +} + +int C_THISCLASS::save_config(unsigned char *data) +{ + int x=0; + int pos=0; + 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]); + PUT_INT(which_ch); pos+=4; + PUT_INT(num_colors); pos+=4; + while (x < num_colors) { PUT_INT(colors[x]); x++; pos+=4; } + PUT_INT(mode); pos+=4; + return pos; +} + + + +C_THISCLASS::C_THISCLASS() +{ + InitializeCriticalSection(&rcs); + AVS_EEL_INITINST(); +#ifdef LASER + mode=1; +#else + mode=0; +#endif + + + need_recompile=1; + which_ch=2; + num_colors=1; + memset(colors,0,sizeof(colors)); + colors[0]=RGB(255,255,255); + color_pos=0; + memset(codehandle,0,sizeof(codehandle)); + +#ifdef LASER + effect_exp[0].assign("d=i+v*0.2; r=t+i*$PI*4; x=cos(r)*d; y=sin(r)*d"); + effect_exp[1].assign("t=t-0.05"); + effect_exp[2].assign(""); + effect_exp[3].assign("n=100"); +#else + effect_exp[0].assign("d=i+v*0.2; r=t+i*$PI*4; x=cos(r)*d; y=sin(r)*d"); + effect_exp[1].assign("t=t-0.05"); + effect_exp[2].assign(""); + effect_exp[3].assign("n=800"); +#endif + + var_n=0; +} + +C_THISCLASS::~C_THISCLASS() +{ + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=0; + } + AVS_EEL_QUITINST(); + DeleteCriticalSection(&rcs); +} + +static __inline int makeint(double t) +{ + if (t <= 0.0) return 0; + if (t >= 1.0) return 255; + return (int)(t*255.0); +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (need_recompile) + { + EnterCriticalSection(&rcs); + + if (!var_n || g_reset_vars_on_recompile) + { + clearVars(); + var_n = registerVar("n"); + var_b = registerVar("b"); + var_x = registerVar("x"); + var_y = registerVar("y"); + var_i = registerVar("i"); + var_v = registerVar("v"); + var_w = registerVar("w"); + var_h = registerVar("h"); + var_red = registerVar("red"); + var_green = registerVar("green"); + var_blue = registerVar("blue"); + var_linesize = registerVar("linesize"); + var_skip = registerVar("skip"); + var_drawmode = registerVar("drawmode"); + *var_n=100.0; + inited=0; + } + + need_recompile=0; + int x; + for (x = 0; x < 4; x ++) + { + freeCode(codehandle[x]); + codehandle[x]=compileCode(effect_exp[x].get()); + } + + LeaveCriticalSection(&rcs); + } + if (isBeat&0x80000000) return 0; + + if (!num_colors) return 0; + + int x; + int current_color; + unsigned char *fa_data; + char center_channel[576]; + int ws=(which_ch&4)?1:0; + int xorv=(ws*128)^128; + + if ((which_ch&3) >=2) + { + for (x = 0; x < 576; x ++) center_channel[x]=visdata[ws^1][0][x]/2+visdata[ws^1][1][x]/2; + fa_data=(unsigned char *)center_channel; + } + else fa_data=(unsigned char *)&visdata[ws^1][which_ch&3][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); + } + + *var_h=h; + *var_w=w; + *var_b=isBeat?1.0:0.0; + *var_blue=(current_color&0xff)/255.0; + *var_green=((current_color>>8)&0xff)/255.0; + *var_red=((current_color>>16)&0xff)/255.0; + *var_skip=0.0; + *var_linesize = (double) ((g_line_blend_mode&0xff0000)>>16); + *var_drawmode = mode ? 1.0 : 0.0; + if (codehandle[3] && !inited) { executeCode(codehandle[3],visdata); inited=1; } + executeCode(codehandle[1],visdata); + if (isBeat) executeCode(codehandle[2],visdata); + if (codehandle[0]) + { + int candraw=0,lx=0,ly=0; +#ifdef LASER + double dlx=0.0,dly=0.0; +#endif + int a; + int l=(int)*var_n; + if (l > 128*1024) l = 128*1024; + for (a = 0; a < l; a ++) + { + int x,y; + double r=(a*576.0)/l; + double s1=r-(int)r; + double yr=(fa_data[(int)r]^xorv)*(1.0f-s1)+(fa_data[(int)r+1]^xorv)*(s1); + *var_v = yr/128.0 - 1.0; + *var_i = (double)a/(double)(l-1); + *var_skip=0.0; + executeCode(codehandle[0],visdata); + x=(int)((*var_x+1.0)*w*0.5); + y=(int)((*var_y+1.0)*h*0.5); + if (*var_skip < 0.00001) + { + int thiscolor=makeint(*var_blue)|(makeint(*var_green)<<8)|(makeint(*var_red)<<16); + if (*var_drawmode < 0.00001) + { + if (y >= 0 && y < h && x >= 0 && x < w) + { + #ifdef LASER + laser_drawpoint((float)*var_x,(float)*var_y,thiscolor); + #else + BLEND_LINE(framebuffer+x+y*w,thiscolor); + #endif + } + } + else + { + if (candraw) + { + #ifdef LASER + LineType l; + l.color=thiscolor; + l.mode=0; + l.x1=(float)*var_x; + l.y1=(float)*var_y; + l.x2=(float)dlx; + l.y2=(float)dly; + g_laser_linelist->AddLine(&l); + #else + if ((thiscolor&0xffffff) || (g_line_blend_mode&0xff)!=1) + { + line(framebuffer,lx,ly,x,y,w,h,thiscolor,(int) (*var_linesize+0.5)); + } + #endif + } // candraw + } // line + } // skip + candraw=1; + lx=x; + ly=y; + #ifdef LASER + dlx=*var_x; + dly=*var_y; + #endif + } + } + + return 0; +} + +C_RBASE *R_SScope(char *desc) +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} +typedef struct +{ + int name; + char *init; + char *point; + char *frame; + char *beat; +} presetType; + +static presetType presets[]= +{ +#ifdef LASER + {"Laser - Bouncing Line","n=8;xp=0;yp=0;d=0.5;r=0;xps=0; yps=0; dtr=0.1; bv=1; gv=1; rv=1;","x=xp+d*cos(r)*sign(i-0.5); y=yp+d*sin(r)*sign(i-0.5);","r=r+dtr; xp=xp*0.99+xps*0.01; yp=yp*0.99+yps*0.01; red=rv; green=gv; blue=bv;","xps=(rand(100)-50)/50; yps=(rand(100)-50)/50; dtr=-dtr; rv=rand(100)/100; gv=rand(100)/100; bv=rand(100)/100;"}, + {"Laser - BeatFlex Scope","n=5; tv=0; dtv=0; tvs=1.0;","x=(i-0.5)*2; y=-sin(i*$PI)*tv+v*0.2;","tv=tv*0.97+tvs*0.03;","tvs=-sign(tvs);"}, + {"Laser - Pulsing Box","n=5;r=$PI/4;","x=cos(i*$PI*2+r); y=sin(i*$PI*2+r); red=rv; green=gv; blue=bv;","rv=rv*0.93; gv=gv*0.93; bv=bv*0.93;","bv=blue; gv=green;rv=red;"}, +#else + {IDS_SPIRAL,"n=800","d=i+v*0.2; r=t+i*$PI*4; x=cos(r)*d; y=sin(r)*d","t=t-0.05",""}, + {IDS_3D_SCOPE_DISH, "n=200","iz=1.3+sin(r+i*$PI*2)*(v+0.5)*0.88; ix=cos(r+i*$PI*2)*(v+0.5)*.88; iy=-0.3+abs(cos(v*$PI)); x=ix/iz;y=iy/iz;","",""}, + {IDS_ROTATING_BOW_THING,"n=80;t=0.0;","r=i*$PI*2; d=sin(r*3)+v*0.5; x=cos(t+r)*d; y=sin(t-r)*d","t=t+0.01",""}, + {IDS_VERTICAL_BOUNCING_SCOPE,"n=100; t=0; tv=0.1;dt=1;","x=t+v*pow(sin(i*$PI),2); y=i*2-1.0;","t=t*0.9+tv*0.1","tv=((rand(50.0)/50.0))*dt; dt=-dt;"}, + {IDS_SPIRAL_GRAPH_FUN,"n=100;t=0;","r=i*$PI*128+t; x=cos(r/64)*0.7+sin(r)*0.3; y=sin(r/64)*0.7+cos(r)*0.3","t=t+0.01;","n=80+rand(120.0)"}, + {IDS_ALTERNATING_DIAGONAL_SCOPE,"n=64; t=1;","sc=0.4*sin(i*$PI); x=2*(i-0.5-v*sc)*t; y=2*(i-0.5+v*sc);","","t=-t;"}, + {IDS_VIBRATING_WORM,"n=w; dt=0.01; t=0; sc=1;","x=cos(2*i+t)*0.9*(v*0.5+0.5); y=sin(i*2+t)*0.9*(v*0.5+0.5);","t=t+dt;dt=0.9*dt+0.001; t=if(above(t,$PI*2),t-$PI*2,t);","dt=sc;sc=-sc;"}, + {IDS_WANDERING_SIMPLE,"n=800;xa=-0.5;ya=0.0;xb=-0.0;yb=0.75;c=200;f=0;\r\nnxa=(rand(100)-50)*.02;nya=(rand(100)-50)*.02;\r\nnxb=(rand(100)-50)*.02;nyb=(rand(100)-50)*.02;","//primary render\r\nx=(ex*i)+xa;\r\ny=(ey*i)+ya;\r\n\r\n//volume offset\r\nx=x+ ( cos(r) * v * dv);\r\ny=y+ ( sin(r) * v * dv);\r\n\r\n//color values\r\nred=i;\r\ngreen=(1-i);\r\nblue=abs(v*6);","f=f+1;\r\nt=1-((cos((f*3.1415)/c)+1)*.5);\r\nxa=((nxa-lxa)*t)+lxa;\r\nya=((nya-lya)*t)+lya;\r\nxb=((nxb-lxb)*t)+lxb;\r\nyb=((nyb-lyb)*t)+lyb;\r\nex=(xb-xa);\r\ney=(yb-ya);\r\nd=sqrt(sqr(ex)+sqr(ey));\r\nr=atan(ey/ex)+(3.1415/2);\r\ndv=d*2","c=f;\r\nf=0;\r\nlxa=nxa;\r\nlya=nya;\r\nlxb=nxb;\r\nlyb=nyb;\r\nnxa=(rand(100)-50)*.02;\r\nnya=(rand(100)-50)*.02;\r\nnxb=(rand(100)-50)*.02;\r\nnyb=(rand(100)-50)*.02"}, + {IDS_FLITTERBUG,"n=180;t=0.0;lx=0;ly=0;vx=rand(200)-100;vy=rand(200)-100;cf=.97;c=200;f=0","x=nx;y=ny;\r\nr=i*3.14159*2; d=(sin(r*5*(1-s))+i*0.5)*(.3-s);\r\ntx=(t*(1-(s*(i-.5))));\r\nx=x+cos(tx+r)*d; y=y+sin(t-y)*d;\r\nred=abs(x-nx)*5;\r\ngreen=abs(y-ny)*5;\r\nblue=1-s-red-green;","f=f+1;t=(f*2*3.1415)/c;\r\nvx=(vx-(lx*.1))*cf;\r\nvy=(vy-(ly*.1))*cf;\r\nlx=lx+vx;ly=ly+vy;\r\nnx=lx*.001;ny=ly*.001;\r\ns=abs(nx*ny)","c=f;f=0;\r\nvx=vx+rand(600)-300;vy=vy+rand(600)-300"}, + {IDS_SPIROSTAR,"n=20;t=0;f=0;c=200;mn=10;dv=2;dn=0","r=if(b,0,((i*dv)*3.14159*128)+(t/2));\r\nx=cos(r)*sz;\r\ny=sin(r)*sz;","f=f+1;t=(f*3.1415*2)/c;\r\nsz=abs(sin(t-3.1415));\r\ndv=if(below(n,12),(n/2)-1,\r\n if(equal(12,n),3,\r\n if(equal(14,n),6,\r\n if(below(n,20),2,4))))","bb = bb + 1;\r\nbeatdiv = 8;\r\nc=if(equal(bb%beatdiv,0),f,c);\r\nf=if(equal(bb%beatdiv,0),0,f);\r\ng=if(equal(bb%beatdiv,0),g+1,g);\r\nn=if(equal(bb%beatdiv,0),(abs((g%17)-8) *2)+4,n);"}, + {IDS_EXPLODING_DAISY,"n = 380 + rand(200) ; k = 0.0; l = 0.0; m = ( rand( 10 ) + 2 ) * .5; c = 0; f = 0","r=(i*3.14159*2)+(a * 3.1415);\r\nd=sin(r*m)*.3;\r\nx=cos(k+r)*d*2;y=( (sin(k-r)*d) + ( sin(l*(i-.5) ) ) ) * .7;\r\nred=abs(x);\r\ngreen=abs(y);\r\nblue=d","a = a + 0.002 ; k = k + 0.04 ; l = l + 0.03","bb = bb + 1;\r\nbeatdiv = 16;\r\nn=if(equal(bb%beatdiv,0),380 + rand(200),n);\r\nt=if(equal(bb%beatdiv,0),0.0,t);\r\na=if(equal(bb%beatdiv,0),0.0,a);\r\nk=if(equal(bb%beatdiv,0),0.0,k);\r\nl=if(equal(bb%beatdiv,0),0.0,l);\r\nm=if(equal(bb%beatdiv,0),(( rand( 100 ) + 2 ) * .1) + 2,m);"}, + {IDS_SWIRLIE_DOTS,"n=45;t=rand(100);u=rand(100)","di = ( i - .5) * 2;\r\nx = di;sin(u*di) * .4;\r\ny = cos(u*di) * .6;\r\nx = x + ( cos(t) * .05 );\r\ny = y + ( sin(t) * .05 );","t = t + .15; u = u + .05","bb = bb + 1;\r\nbeatdiv = 16;\r\nn = if(equal(bb%beatdiv,0),30 + rand( 30 ),n);"}, + {IDS_SWEEP,"n=180;lsv=100;sv=200;ssv=200;c=200;f=0","sv=(sv*abs(cos(lsv)))+(lsv*abs(cos(sv)));\r\nfv=fv+(sin(sv)*dv);\r\nd=i; r=t+(fv * sin(t) * .3)*3.14159*4;\r\nx=cos(r)*d;\r\ny=sin(r)*d;\r\nred=i;\r\ngreen=abs(sin(r))-(red*.15);\r\nblue=fv","f=f+1;t=(f*2*3.1415)/c;\r\nlsv=slsv;sv=ssv;fv=0","bb = bb + 1;\r\nbeatdiv = 8;\r\nc=if(equal(bb%beatdiv,0),f,c);\r\nf=if(equal(bb%beatdiv,0),0,f);\r\ndv=if(equal(bb%beatdiv,0),((rand(100)*.01) * .1) + .02,dv);\r\nn=if(equal(bb%beatdiv,0),80+rand(100),n);\r\nssv=if(equal(bb%beatdiv,0),rand(200)+100,ssv);\r\nslsv=if(equal(bb%beatdiv,0),rand(200)+100,slsv);"}, + {IDS_WHIPLASH_SPIRAL,"n=80;c=200;f=0","d=i;\r\nr=t+i*3.14159*4;\r\nsdt=sin(dt+(i*3.1415*2));\r\ncdt=cos(dt+(i*3.1415*2));\r\nx=(cos(r)*d) + (sdt * .6 * sin(t) );\r\ny=(sin(r)*d) + ( cdt *.6 * sin(t) );\r\nblue=abs(x);\r\ngreen=abs(y);\r\nred=cos(dt*4)","t=t-0.05;f=f+1;dt=(f*2*3.1415)/c","bb = bb + 1;\r\nbeatdiv = 8;\r\nc=if(equal(bb%beatdiv,0),f,c);\r\nf=if(equal(bb%beatdiv,0),0,f);"}, +#endif +}; + +static C_THISCLASS *g_this; +BOOL CALLBACK C_THISCLASS::g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + static int isstart; + switch (uMsg) + { + case WM_INITDIALOG: + isstart=1; +#if 0//syntax highlighting + SendDlgItemMessage(hwndDlg,IDC_EDIT1,EM_SETEVENTMASK,0,ENM_CHANGE); + SendDlgItemMessage(hwndDlg,IDC_EDIT2,EM_SETEVENTMASK,0,ENM_CHANGE); + SendDlgItemMessage(hwndDlg,IDC_EDIT3,EM_SETEVENTMASK,0,ENM_CHANGE); + SendDlgItemMessage(hwndDlg,IDC_EDIT4,EM_SETEVENTMASK,0,ENM_CHANGE); +#endif + SetDlgItemInt(hwndDlg,IDC_NUMCOL,g_this->num_colors,FALSE); + 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()); + +#if 0//syntax highlighting + doAVSEvalHighLight(hwndDlg,IDC_EDIT1,g_this->effect_exp[0].get()); + doAVSEvalHighLight(hwndDlg,IDC_EDIT2,g_this->effect_exp[1].get()); + doAVSEvalHighLight(hwndDlg,IDC_EDIT3,g_this->effect_exp[2].get()); + doAVSEvalHighLight(hwndDlg,IDC_EDIT4,g_this->effect_exp[3].get()); +#endif + + CheckDlgButton(hwndDlg,g_this->mode?IDC_LINES:IDC_DOT,BST_CHECKED); + if ((g_this->which_ch&3)==0) + CheckDlgButton(hwndDlg,IDC_LEFTCH,BST_CHECKED); + else if ((g_this->which_ch&3)==1) + CheckDlgButton(hwndDlg,IDC_RIGHTCH,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_MIDCH,BST_CHECKED); + if (g_this->which_ch&4) + CheckDlgButton(hwndDlg,IDC_SPEC,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_WAVE,BST_CHECKED); + + isstart=0; + return 1; + 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={(COLORREF)BS_SOLID,(COLORREF)color,(COLORREF)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_COMMAND: + if (!isstart) + { + if ((LOWORD(wParam) == IDC_EDIT1||LOWORD(wParam) == IDC_EDIT2||LOWORD(wParam) == IDC_EDIT3||LOWORD(wParam) == IDC_EDIT4) && HIWORD(wParam) == EN_CHANGE) + { + 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->need_recompile=1; + if (LOWORD(wParam) == IDC_EDIT4) g_this->inited = 0; + LeaveCriticalSection(&g_this->rcs); +#if 0//syntax highlighting + if (LOWORD(wParam) == IDC_EDIT1) + doAVSEvalHighLight(hwndDlg,IDC_EDIT1,g_this->effect_exp[0].get()); + if (LOWORD(wParam) == IDC_EDIT2) + doAVSEvalHighLight(hwndDlg,IDC_EDIT2,g_this->effect_exp[1].get()); + if (LOWORD(wParam) == IDC_EDIT3) + doAVSEvalHighLight(hwndDlg,IDC_EDIT3,g_this->effect_exp[2].get()); + if (LOWORD(wParam) == IDC_EDIT4) + doAVSEvalHighLight(hwndDlg,IDC_EDIT4,g_this->effect_exp[3].get()); +#endif + } + if (LOWORD(wParam) == IDC_DOT || LOWORD(wParam) == IDC_LINES) + { + g_this->mode=IsDlgButtonChecked(hwndDlg,IDC_LINES)?1:0; + } + if (LOWORD(wParam) == IDC_WAVE || LOWORD(wParam) == IDC_SPEC) + { + if (IsDlgButtonChecked(hwndDlg,IDC_WAVE)) g_this->which_ch&=~4; + else g_this->which_ch|=4; + } + if (LOWORD(wParam) == IDC_LEFTCH || LOWORD(wParam) == IDC_RIGHTCH || LOWORD(wParam)==IDC_MIDCH) + { + g_this->which_ch&=~3; + if (IsDlgButtonChecked(hwndDlg,IDC_LEFTCH)); + else if (IsDlgButtonChecked(hwndDlg,IDC_RIGHTCH)) g_this->which_ch|=1; + else g_this->which_ch|=2; + } + } + if (LOWORD(wParam) == IDC_BUTTON2) + { +/* + char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_SUPERSCOPE,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_SUPERSCOPE),4095-titlelen); +*/ + char *text="Superscope\0" + "Superscope tutorial:\r\n\n" +// "But for now, here is the old text:\r\n" + "You can specify expressions that run on Init, Frame, and on Beat.\r\n" + " 'n' specifies the number of points to render (set this in Init, Beat, or Frame).\r\n" + "For the 'Per Point' expression (which happens 'n' times per frame), use:\r\n" + " 'x' and 'y' are the coordinates to draw to (-1..1)\r\n" + " 'i' is the position of the scope (0..1)\r\n" + " 'v' is the value at that point (-1..1).\r\n" + " 'b' is 1 if beat, 0 if not.\r\n" + " 'red', 'green' and 'blue' are all (0..1) and can be modified\r\n" + " 'linesize' can be set from 1.0 to 255.0\r\n" + " 'skip' can be set to >0 to skip drawing the current item\r\n" + " 'drawmode' can be set to > 0 for lines, <= 0 for points\r\n" + " 'w' and 'h' are the width and height of the screen, in pixels.\r\n" +// " Anybody want to send me better text to put here? Please :)\r\n" + ; + + compilerfunctionlist(hwndDlg,text); + } + if (LOWORD(wParam) == IDC_BUTTON1) + { + RECT r; + HMENU hMenu; + MENUITEMINFO i={sizeof(i),}; + hMenu=CreatePopupMenu(); + int x; + for (x = 0; x < sizeof(presets)/sizeof(presets[0]); x ++) + { + i.fMask=MIIM_TYPE|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.wID = x+16; + i.dwTypeData=WASABI_API_LNGSTRING(presets[x].name); + i.cch=strlen(i.dwTypeData); + InsertMenuItem(hMenu,x,TRUE,&i); + } + GetWindowRect(GetDlgItem(hwndDlg,IDC_BUTTON1),&r); + x=TrackPopupMenu(hMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON|TPM_NONOTIFY,r.right,r.top,0,hwndDlg,NULL); + if (x >= 16 && x < 16+sizeof(presets)/sizeof(presets[0])) + { + SetDlgItemText(hwndDlg,IDC_EDIT1,presets[x-16].point); + SetDlgItemText(hwndDlg,IDC_EDIT2,presets[x-16].frame); + SetDlgItemText(hwndDlg,IDC_EDIT3,presets[x-16].beat); + SetDlgItemText(hwndDlg,IDC_EDIT4,presets[x-16].init); + SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_EDIT4,EN_CHANGE),0); + } + DestroyMenu(hMenu); + } + if (LOWORD(wParam) == 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); + } + } + if (LOWORD(wParam) == 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; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_SSCOPE,hwndParent,g_DlgProc); +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_stack.cpp b/Src/Plugins/Visualization/vis_avs/r_stack.cpp new file mode 100644 index 00000000..3fca86e0 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_stack.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. + +*/ +// alphachannel safe 11/21/99 +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" +#include "r_stack.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Misc / Buffer Save" + +#define C_THISCLASS C_StackClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_StackClass(); + virtual ~C_StackClass(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc(); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + int clear; + volatile int dir_ch; + + int blend; + int dir; + int which; + int adjblend_val; +}; + +#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; + if (len-pos >= 4) { dir=GET_INT(); pos+=4; } + if (len-pos >= 4) { which=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { adjblend_val=GET_INT(); pos+=4; } + + if (which < 0) which=0; + if (which >= NBUF) which=NBUF-1; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(dir); pos+=4; + PUT_INT(which); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(adjblend_val); pos+=4; + return pos; +} + +char *C_THISCLASS::get_desc() +{ +static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_MISC_BUFFER_SAVE,desc,128):desc); +} + + +C_THISCLASS::C_THISCLASS() +{ + adjblend_val=128; + dir_ch=0; + which=0; + dir=0; + blend=0; + clear=0; +} + +C_THISCLASS::~C_THISCLASS() +{ +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + void *thisbufptr; + if (isBeat&0x80000000) return 0; + if (!(thisbufptr=getGlobalBuffer(w,h,which,dir!=1))) + { + return 0; + } + + if (clear) + { + clear=0; + memset(thisbufptr,0,sizeof(int)*w*h); + } + + { + int t_dir; + t_dir=(dir<2)?dir:((dir&1)^dir_ch); + dir_ch^=1; + int *fbin=(int*)(t_dir==0?framebuffer:thisbufptr); + int *fbout=(int*)(t_dir!=0?framebuffer:thisbufptr); + if (blend == 1) + { + mmx_avgblend_block(fbout,fbin,w*h); + } + else if (blend == 2) + { + mmx_addblend_block(fbout,fbin,w*h); + } + else if (blend == 3) + { + int r=0; + int y=h; + int *bf=fbin; + while (y-- > 0) + { + int *out, *in; + int x=w/2; + out=fbout+r; + in=bf+r; + r^=1; + while (x-- > 0) + { + *out=*in; + out+=2; + in+=2; + } + fbout+=w; + bf+=w; + } + } + else if (blend == 4) + { + int x=w*h; + int *bf=fbin; + while (x-- > 0) + { + *fbout=BLEND_SUB(*fbout,*bf); + fbout++; + bf++; + } + } + else if (blend == 5) + { + int y=h/2; + while (y-- > 0) + { + memcpy(fbout,fbin,w*sizeof(int)); + fbout+=w*2; + fbin+=w*2; + } + } + else if (blend == 6) + { + int x=w*h; + while (x-- > 0) + { + *fbout=*fbout ^ *fbin; + fbout++; + fbin++; + } + } + else if (blend == 7) + { + int x=w*h; + int *bf=fbin; + while (x-- > 0) + { + *fbout=BLEND_MAX(*fbout,*bf); + fbout++; + bf++; + } + } + else if (blend == 8) + { + int x=w*h; + int *bf=fbin; + while (x-- > 0) + { + *fbout=BLEND_MIN(*fbout,*bf); + fbout++; + bf++; + } + } + else if (blend == 9) + { + int x=w*h; + int *bf=fbin; + while (x-- > 0) + { + *fbout=BLEND_SUB(*bf,*fbout); + fbout++; + bf++; + } + } + else if (blend == 10) + { + mmx_mulblend_block(fbout,fbin,w*h); + } + else if (blend == 11) + { + mmx_adjblend_block(fbout,fbin,fbout,w*h,adjblend_val); + } + else memcpy(fbout,fbin,w*h*sizeof(int)); + return 0; + } + + return 0; +} + +C_RBASE *R_Stack(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 1; x <= NBUF; x ++) + { + char s[32]; + wsprintf(s,WASABI_API_LNGSTRING(IDS_BUFFER_X),x); + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_ADDSTRING,0,(LPARAM)s); + } + } + SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_SETCURSEL,g_this->which,0); + if (g_this->dir==1) CheckDlgButton(hwndDlg,IDC_RESTFB,BST_CHECKED); + else if (g_this->dir == 2) CheckDlgButton(hwndDlg,IDC_RADIO1,BST_CHECKED); + else if (g_this->dir == 3) CheckDlgButton(hwndDlg,IDC_RADIO2,BST_CHECKED); + else CheckDlgButton(hwndDlg,IDC_SAVEFB,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_BLENDSLIDE, TBM_SETRANGE, TRUE, MAKELONG(0, 255)); + SendDlgItemMessage(hwndDlg, IDC_BLENDSLIDE, TBM_SETPOS, TRUE, (int)(g_this->adjblend_val)); + if (g_this->blend==0) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND1,BST_CHECKED); + if (g_this->blend==1) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND2,BST_CHECKED); + if (g_this->blend==2) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND3,BST_CHECKED); + if (g_this->blend==3) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND4,BST_CHECKED); + if (g_this->blend==4) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND5,BST_CHECKED); + if (g_this->blend==5) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND6,BST_CHECKED); + if (g_this->blend==6) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND7,BST_CHECKED); + if (g_this->blend==7) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND8,BST_CHECKED); + if (g_this->blend==8) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND9,BST_CHECKED); + if (g_this->blend==9) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND10,BST_CHECKED); + if (g_this->blend==10) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND11,BST_CHECKED); + if (g_this->blend==11) CheckDlgButton(hwndDlg,IDC_RSTACK_BLEND12,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_BUTTON2) + { + g_this->dir_ch^=1; + } + if (LOWORD(wParam) == IDC_BUTTON1) + { + g_this->clear=1; + } + if (LOWORD(wParam) == IDC_SAVEFB || LOWORD(wParam) == IDC_RESTFB || LOWORD(wParam) == IDC_RADIO1 || LOWORD(wParam) == IDC_RADIO2) + { + if (IsDlgButtonChecked(hwndDlg,IDC_SAVEFB)) g_this->dir=0; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO2)) g_this->dir=3; + else if (IsDlgButtonChecked(hwndDlg,IDC_RADIO1)) g_this->dir=2; + else if (IsDlgButtonChecked(hwndDlg,IDC_RESTFB)) g_this->dir=1; + } + if (IsDlgButtonChecked(hwndDlg,LOWORD(wParam))) + { + if (LOWORD(wParam) == IDC_RSTACK_BLEND1) g_this->blend=0; + if (LOWORD(wParam) == IDC_RSTACK_BLEND2) g_this->blend=1; + if (LOWORD(wParam) == IDC_RSTACK_BLEND3) g_this->blend=2; + if (LOWORD(wParam) == IDC_RSTACK_BLEND4) g_this->blend=3; + if (LOWORD(wParam) == IDC_RSTACK_BLEND5) g_this->blend=4; + if (LOWORD(wParam) == IDC_RSTACK_BLEND6) g_this->blend=5; + if (LOWORD(wParam) == IDC_RSTACK_BLEND7) g_this->blend=6; + if (LOWORD(wParam) == IDC_RSTACK_BLEND8) g_this->blend=7; + if (LOWORD(wParam) == IDC_RSTACK_BLEND9) g_this->blend=8; + if (LOWORD(wParam) == IDC_RSTACK_BLEND10) g_this->blend=9; + if (LOWORD(wParam) == IDC_RSTACK_BLEND11) g_this->blend=10; + if (LOWORD(wParam) == IDC_RSTACK_BLEND12) g_this->blend=11; + } + if (LOWORD(wParam) == IDC_COMBO1 && HIWORD(wParam) == CBN_SELCHANGE) + { + int i=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (i != CB_ERR) + g_this->which=i; + } + return 0; + return 0; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_BLENDSLIDE) + g_this->adjblend_val = SendDlgItemMessage(hwndDlg, IDC_BLENDSLIDE, TBM_GETPOS, 0, 0); + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_STACK,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_Stack(char *desc) +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_stack.h b/Src/Plugins/Visualization/vis_avs/r_stack.h new file mode 100644 index 00000000..a62ae57f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_stack.h @@ -0,0 +1,29 @@ +/* + 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. + +*/ diff --git a/Src/Plugins/Visualization/vis_avs/r_stars.cpp b/Src/Plugins/Visualization/vis_avs/r_stars.cpp new file mode 100644 index 00000000..21a1a5fc --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_stars.cpp @@ -0,0 +1,402 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <math.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#define MOD_NAME "Render / Starfield" + +#define C_THISCLASS C_StarField + +typedef struct + { + int X, Y; + float Z; + float Speed; + int OX, OY; + } StarFormat; + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + float GET_FLOAT(unsigned char *data, int pos); + void PUT_FLOAT(float f, unsigned char *data, int pos); + void InitializeStars(void); + void CreateStar(int A); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_STARFIELD,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int enabled; + int color; + int MaxStars,MaxStars_set; + int Xoff; + int Yoff; + int Zoff; + float WarpSpeed; + int blend; + int blendavg; + StarFormat Stars[4096]; + int Width, Height; + int onbeat; + float spdBeat; + float incBeat; + int durFrames; + float CurrentSpeed; + int nc; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + nc=0; + color = 0xFFFFFF; + enabled=1; + MaxStars = 350; + MaxStars_set=350; + Xoff = 0; + Yoff = 0; + Zoff = 255; + WarpSpeed = 6; + CurrentSpeed = 6; + blend = 0; + blendavg = 0; + Width = 0; + Height = 0; + onbeat = 0; + spdBeat = 4; + durFrames = 15; + incBeat = 0; +} + +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) + +float C_THISCLASS::GET_FLOAT(unsigned char *data, int pos) +{ +int a = data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24); +float f = *(float *)&a; +return f; +} + +void C_THISCLASS::load_config(unsigned char *data, int len) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { WarpSpeed=GET_FLOAT(data, pos); pos+=4; } + CurrentSpeed = WarpSpeed; + if (len-pos >= 4) { MaxStars_set=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { spdBeat=GET_FLOAT(data, pos); pos+=4; } + if (len-pos >= 4) { durFrames=GET_INT(); pos+=4; } +} + +#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 +void C_THISCLASS::PUT_FLOAT(float f, unsigned char *data, int pos) +{ +int y = *(int *)&f; +data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255; +} + +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_FLOAT(WarpSpeed, data, pos); pos+=4; + PUT_INT(MaxStars_set); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_FLOAT(spdBeat, data, pos); pos+=4; + PUT_INT(durFrames); pos+=4; + return pos; +} + +void C_THISCLASS::InitializeStars(void) +{ + int i; +#ifdef LASER + MaxStars = MaxStars_set/12; + if (MaxStars < 10) MaxStars=10; +#else + MaxStars = MulDiv(MaxStars_set,Width*Height,512*384); +#endif + if (MaxStars > 4095) MaxStars=4095; + for (i=0;i<MaxStars;i++) + { + Stars[i].X=(rand()%Width)-Xoff; + Stars[i].Y=(rand()%Height)-Yoff; + Stars[i].Z=(float)(rand()%255); + Stars[i].Speed = (float)(rand()%9+1)/10; + } +} + +void C_THISCLASS::CreateStar(int A) +{ + Stars[A].X = (rand()%Width)-Xoff; + Stars[A].Y = (rand()%Height)-Yoff; + Stars[A].Z = (float)Zoff; +} + +static unsigned int __inline BLEND_ADAPT(unsigned int a, unsigned int b, /*float*/int divisor) +{ +return ((((a >> 4) & 0x0F0F0F) * (16-divisor) + (((b >> 4) & 0x0F0F0F) * divisor))); +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ +#ifdef LASER + w=h=1024; +#endif + int i=w*h; + int NX,NY; + int c; + + if (!enabled) return 0; + + if (onbeat && isBeat) + { + CurrentSpeed = spdBeat; + incBeat = (WarpSpeed - CurrentSpeed) / (float)durFrames; + nc = durFrames; + } + + if (Width != w || Height != h) + { + Width = w; + Height = h; + Xoff = Width/2; + Yoff = Height/2; + InitializeStars(); + } + if (isBeat&0x80000000) return 0; + + for (i=0;i<MaxStars;i++) + { + if ((int)Stars[i].Z > 0) + { + NX = ((Stars[i].X << 7) / (int)Stars[i].Z) + Xoff; + NY = ((Stars[i].Y << 7) / (int)Stars[i].Z) + Yoff; + if ((NX > 0) && (NX < w) && (NY > 0) && (NY < h)) + { + c = (int)((255-(int)Stars[i].Z)*Stars[i].Speed); + if (color != 0xFFFFFF) c = BLEND_ADAPT((c|(c<<8)|(c<<16)), color, c>>4); else c = (c|(c<<8)|(c<<16)); +#ifdef LASER + LineType l; + l.color=c; + l.mode=1; + l.x1=(float)NX/512.0f - 1.0f; + l.y1=(float)NY/512.0f - 1.0f; + g_laser_linelist->AddLine(&l); +#else + framebuffer[NY*w+NX] = blend ? BLEND(framebuffer[NY*w+NX], c) : blendavg ? BLEND_AVG(framebuffer[NY*w+NX], c) : c; +#endif + Stars[i].OX = NX; + Stars[i].OY = NY; + Stars[i].Z-=Stars[i].Speed*CurrentSpeed; + } + else + CreateStar(i); + } + else + CreateStar(i); + } + + if (!nc) + CurrentSpeed = WarpSpeed; + else + { + CurrentSpeed = max(0, CurrentSpeed + incBeat); + nc--; + } + + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: +#ifdef LASER + ShowWindow(GetDlgItem(hwndDlg,IDC_ADDITIVE),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_5050),SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg,IDC_REPLACE),SW_HIDE); +#endif + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(1, 5000)); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->WarpSpeed*100)); + SendDlgItemMessage(hwndDlg, IDC_NUMSTARS, TBM_SETTICFREQ, 100, 0); + SendDlgItemMessage(hwndDlg, IDC_NUMSTARS, TBM_SETRANGE, TRUE, MAKELONG(100, 4095)); + SendDlgItemMessage(hwndDlg, IDC_NUMSTARS, TBM_SETPOS, TRUE, g_ConfigThis->MaxStars_set); + SendDlgItemMessage(hwndDlg, IDC_SPDCHG, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_SPDCHG, TBM_SETRANGE, TRUE, MAKELONG(1, 5000)); + SendDlgItemMessage(hwndDlg, IDC_SPDCHG, TBM_SETPOS, TRUE, (int)(g_ConfigThis->spdBeat*100)); + SendDlgItemMessage(hwndDlg, IDC_SPDDUR, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_SPDDUR, TBM_SETRANGE, TRUE, MAKELONG(1, 100)); + SendDlgItemMessage(hwndDlg, IDC_SPDDUR, TBM_SETPOS, TRUE, (int)(g_ConfigThis->durFrames)); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_ONBEAT2,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + return 1; + case WM_NOTIFY: + { + if (LOWORD(wParam) == IDC_SPDCHG) + g_ConfigThis->spdBeat = (float)SendDlgItemMessage(hwndDlg, IDC_SPDCHG, TBM_GETPOS, 0, 0)/100; + if (LOWORD(wParam) == IDC_SPDDUR) + g_ConfigThis->durFrames = SendDlgItemMessage(hwndDlg, IDC_SPDDUR, TBM_GETPOS, 0, 0); + if (LOWORD(wParam) == IDC_SPEED) + { + g_ConfigThis->WarpSpeed = (float)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)/100; + g_ConfigThis->CurrentSpeed = (float)SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0)/100; + } + + if (LOWORD(wParam) == IDC_NUMSTARS) + { +#ifndef LASER + int a = g_ConfigThis->MaxStars_set; +#endif + g_ConfigThis->MaxStars_set = SendDlgItemMessage(hwndDlg, IDC_NUMSTARS, TBM_GETPOS, 0, 0); +#ifndef LASER + if (g_ConfigThis->MaxStars_set > a) +#endif + if (g_ConfigThis->Width && g_ConfigThis->Height) g_ConfigThis->InitializeStars(); + } + return 0; + } + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ONBEAT2) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT2)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + } + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_STARFIELD,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_StarField(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + diff --git a/Src/Plugins/Visualization/vis_avs/r_svp.cpp b/Src/Plugins/Visualization/vis_avs/r_svp.cpp new file mode 100644 index 00000000..97781f0a --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_svp.cpp @@ -0,0 +1,227 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" +#include "../Agave/Language/api_language.h" + +extern HINSTANCE g_hInstance; + +#include "svp_vis.h" + +#ifndef LASER + +#define C_THISCLASS C_SVPClass +#define MOD_NAME "Render / SVP Loader" + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_SVP_LOADER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + + char m_library[MAX_PATH]; + void SetLibrary(); + HMODULE hLibrary; + CRITICAL_SECTION cs; + VisInfo *vi; + VisData vd; +}; + +#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; + if (pos+MAX_PATH <= len) + { + memcpy(m_library,data+pos,MAX_PATH); + pos+=MAX_PATH; + SetLibrary(); + } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + memcpy(data+pos,m_library,MAX_PATH); + pos+=MAX_PATH; + return pos; +} + + + +void C_THISCLASS::SetLibrary() +{ + EnterCriticalSection(&cs); + if (hLibrary) + { + if (vi) vi->SaveSettings("avs.ini"); + vi=NULL; + FreeLibrary(hLibrary); + hLibrary=NULL; + } + + if (!m_library[0]) { LeaveCriticalSection(&cs); return; } + + char buf1[MAX_PATH]; + strcpy(buf1,g_path); + strcat(buf1,"\\"); + strcat(buf1,m_library); + + vi=NULL; + hLibrary = LoadLibrary(buf1); + if (hLibrary) + { + VisInfo* (*qm)(void); + qm=(struct _VisInfo *(__cdecl *)(void))GetProcAddress(hLibrary,"QueryModule"); + if (!qm) + qm=(struct _VisInfo *(__cdecl *)(void))GetProcAddress(hLibrary,"?QueryModule@@YAPAUUltraVisInfo@@XZ"); + + if (!qm || !(vi=qm())) + { + vi=NULL; + FreeLibrary(hLibrary); + hLibrary=NULL; + } + } + if (vi) { + vi->OpenSettings("avs.ini"); vi->Initialize(); + } + LeaveCriticalSection(&cs); +} + + +C_THISCLASS::C_THISCLASS() +{ + InitializeCriticalSection(&cs); + m_library[0]=0; + hLibrary=0; + vi=NULL; +} + +C_THISCLASS::~C_THISCLASS() +{ + if (vi) vi->SaveSettings("avs.ini"); + if (hLibrary) FreeLibrary(hLibrary); + DeleteCriticalSection(&cs); +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + EnterCriticalSection(&cs); + if (vi) + { + // if (vi->lRequired & VI_WAVEFORM) + { + int ch,p; + for (ch = 0; ch < 2; ch ++) + { + unsigned char *v=(unsigned char *)visdata[1][ch]; + for (p = 0; p < 512; p ++) + vd.Waveform[ch][p]=v[p]; + } + } + // if (vi->lRequired & VI_SPECTRUM) + { + int ch,p; + for (ch = 0; ch < 2; ch ++) + { + unsigned char *v=(unsigned char *) visdata[0][ch]; + for (p = 0; p < 256; p ++) + vd.Spectrum[ch][p]=v[p*2]/2+v[p*2+1]/2; + } + } + + vd.MillSec=GetTickCount(); + vi->Render((unsigned long *)framebuffer,w,h,w,&vd); + } + LeaveCriticalSection(&cs); + return 0; +} + +C_RBASE *R_SVP(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + loadComboBox(GetDlgItem(hwndDlg,IDC_COMBO1), "*.SVP", g_this->m_library); + loadComboBox(GetDlgItem(hwndDlg,IDC_COMBO1), "*.UVS", g_this->m_library); + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_COMBO1: + { + int a=SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETCURSEL,0,0); + if (a != CB_ERR) + { + if (SendDlgItemMessage(hwndDlg,IDC_COMBO1,CB_GETLBTEXT,a,(LPARAM)g_this->m_library) == CB_ERR) + { + g_this->m_library[0]=0; + } + } + else + g_this->m_library[0]=0; + g_this->SetLibrary(); + } + return 0; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDC_CFG_SVP,hwndParent,g_DlgProc); +} +#else +C_RBASE *R_SVP(char *desc) +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_text.cpp b/Src/Plugins/Visualization/vis_avs/r_text.cpp new file mode 100644 index 00000000..e0d0edfc --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_text.cpp @@ -0,0 +1,1012 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdio.h> +#include <memory.h> +#include <stdlib.h> +#include <math.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" + +#include "avs_eelif.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + + +#define MOD_NAME "Render / Text" +#define C_THISCLASS C_TextClass + +class C_THISCLASS : public C_RBASE { + protected: + public: + C_THISCLASS(); + void getWord(int n, char *buf, int max); + void reinit(int w, int h); + float GET_FLOAT(unsigned char *data, int pos); + void PUT_FLOAT(float f, unsigned char *data, int pos); + void InitializeStars(int Start); + void CreateStar(int A); + virtual ~C_THISCLASS(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_TEXT,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + CHOOSEFONT cf; + LOGFONT lf; + HBITMAP hRetBitmap; + HBITMAP hOldBitmap; + HFONT hOldFont; + HFONT myFont; + HDC hDesktopDC; + HDC hBitmapDC; + BITMAPINFO bi; + int enabled; + int color; + int blend; + int blendavg; + int onbeat; + int insertBlank; + int randomPos; + int valign; + int halign; + int onbeatSpeed; + int normSpeed; + char *text; + int lw,lh; + bool updating; + int outline; + int shadow; + int outlinecolor; + int outlinesize; + int curword; + int nb; + int forceBeat; + int xshift, yshift; + int _xshift, _yshift; + int forceshift; + int forcealign; + int _valign, _halign; + int oddeven; + int nf; + RECT r; + int *myBuffer; + int forceredraw; + int old_valign, old_halign, old_outline, oldshadow; + int old_curword, old_clipcolor; + char oldtxt[256]; + int old_blend1, old_blend2, old_blend3; + int oldxshift, oldyshift; + int randomword; + int shiftinit; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + +// Reinit bitmap buffer since size changed +void C_THISCLASS::reinit(int w, int h) +{ +// Free anything if needed +if (lw || lh) + { + SelectObject (hBitmapDC, hOldBitmap); + if (hOldFont) SelectObject(hBitmapDC, hOldFont); + DeleteDC (hBitmapDC); + ReleaseDC (NULL, hDesktopDC); + if (myBuffer) GlobalFree(myBuffer); + } + +// Alloc buffers, select objects, init structures + myBuffer = (int *)GlobalAlloc(GMEM_FIXED,w*h*4); + hDesktopDC = GetDC (NULL); + hRetBitmap = CreateCompatibleBitmap (hDesktopDC, w, h); + hBitmapDC = CreateCompatibleDC (hDesktopDC); + hOldBitmap = (HBITMAP) SelectObject (hBitmapDC, hRetBitmap); + SetTextColor(hBitmapDC, ((color & 0xFF0000) >> 16) | (color & 0xFF00) | (color&0xFF)<<16); + SetBkMode(hBitmapDC, TRANSPARENT); + SetBkColor(hBitmapDC, 0); + if (myFont) + hOldFont = (HFONT) SelectObject(hBitmapDC, myFont); + else + hOldFont = NULL; + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bi.bmiHeader.biWidth = w; + bi.bmiHeader.biHeight = h; + bi.bmiHeader.biPlanes = 1; + bi.bmiHeader.biBitCount = 32; + bi.bmiHeader.biCompression = BI_RGB; + bi.bmiHeader.biSizeImage = 0; + bi.bmiHeader.biXPelsPerMeter = 0; + bi.bmiHeader.biYPelsPerMeter = 0; + bi.bmiHeader.biClrUsed = 0; + bi.bmiHeader.biClrImportant = 0; +} + + +C_THISCLASS::~C_THISCLASS() +{ +// Free up everything +if (lw || lh) + { + SelectObject (hBitmapDC, hOldBitmap); + if (hOldFont) SelectObject(hBitmapDC, hOldFont); + DeleteDC (hBitmapDC); + ReleaseDC (NULL, hDesktopDC); + if (myBuffer) GlobalFree(myBuffer); + } +if (text) GlobalFree(text); +if (myFont) + DeleteObject(myFont); +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ +// Init all + randomword=0; + shadow=0; + old_valign=0; + old_halign=0; + old_outline=-1; + old_curword=-1; + old_clipcolor=-1; + oldshadow=-1; + *oldtxt=0; + old_blend1=0; + old_blend2=0; + old_blend3=0; + _xshift=0; + _yshift=0; + forceredraw=0; + myBuffer = NULL; + curword=0; + forceshift=0; + forceBeat=0; + forcealign=1; + xshift=0; + yshift=0; + outlinecolor = 0; + outline=0; + outline=0; + color = 0xFFFFFF; + enabled = 1; + blend = 0; + blendavg = 0; + onbeat = 0; + insertBlank = 0; + randomPos = 0; + halign = DT_CENTER; + valign = DT_VCENTER; + onbeatSpeed=15; + normSpeed=15; + myFont = NULL; + memset(&cf, 0, sizeof(CHOOSEFONT)); + cf.lStructSize = sizeof(CHOOSEFONT); + cf.lpLogFont = &lf; + cf.Flags = CF_EFFECTS|CF_SCREENFONTS |CF_FORCEFONTEXIST|CF_INITTOLOGFONTSTRUCT; + cf.rgbColors = color; + memset(&lf, 0, sizeof(LOGFONT)); + text = NULL; + lw=lh=0; + updating=false; + nb=0; + outlinesize=1; + oddeven=0; + nf=0; + shiftinit=1; +} + +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) + +float C_THISCLASS::GET_FLOAT(unsigned char *data, int pos) +{ +int a = data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24); +float f = *(float *)&a; +return f; +} + +void C_THISCLASS::load_config(unsigned char *data, int len) // read configuration of max length "len" from data. +{ + int pos=0; + int size; + updating=true; + forceredraw=1; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeat=GET_INT(); pos+=4; } + if (len-pos >= 4) { insertBlank=GET_INT(); pos+=4; } + if (len-pos >= 4) { randomPos=GET_INT(); pos+=4; } + if (len-pos >= 4) { valign=GET_INT(); pos+=4; } + if (len-pos >= 4) { halign=GET_INT(); pos+=4; } + if (len-pos >= 4) { onbeatSpeed=GET_INT(); pos+=4; } + if (len-pos >= 4) { normSpeed=GET_INT(); pos+=4; } + if (len-pos >= sizeof(cf)) { memcpy(&cf, data+pos, sizeof(cf)); pos+=sizeof(cf);} + cf.lpLogFont = &lf; + if (len-pos >= sizeof(lf)) { memcpy(&lf, data+pos, sizeof(lf)); pos+=sizeof(lf);} + if (len-pos >= 4) { size=GET_INT(); pos+=4; } + if (size > 0 && len-pos >= size) + { + if (text) GlobalFree(text); + text = (char *)GlobalAlloc(GMEM_FIXED,size+1); + memcpy(text, data+pos, size); + pos+=size; + } + else + { + if (text) GlobalFree(text); + text = NULL; + } + myFont = CreateFontIndirect(&lf); + if (len-pos >= 4) { outline=GET_INT(); pos+=4; } + if (len-pos >= 4) { outlinecolor=GET_INT(); pos+=4; } + if (len-pos >= 4) { xshift=GET_INT(); pos+=4; } + if (len-pos >= 4) { yshift=GET_INT(); pos+=4; } + if (len-pos >= 4) { outlinesize=GET_INT(); pos+=4; } + if (len-pos >= 4) { randomword=GET_INT(); pos+=4; } + if (len-pos >= 4) { shadow=GET_INT(); pos+=4; } + forcealign=1; + forceredraw=1; + forceshift=1; + shiftinit=1; + updating=false; +} + +#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 +void C_THISCLASS::PUT_FLOAT(float f, unsigned char *data, int pos) +{ +int y = *(int *)&f; +data[pos]=(y)&255; data[pos+1]=(y>>8)&255; data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255; +} +extern HWND hwnd_WinampParent; + + +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(onbeat); pos+=4; + PUT_INT(insertBlank); pos+=4; + PUT_INT(randomPos); pos+=4; + PUT_INT(valign); pos+=4; + PUT_INT(halign); pos+=4; + PUT_INT(onbeatSpeed); pos+=4; + PUT_INT(normSpeed); pos+=4; + memcpy(data+pos, &cf, sizeof(cf)); + pos+=sizeof(cf); + memcpy(data+pos, &lf, sizeof(lf)); + pos+=sizeof(lf); + if (text) + { + int l=strlen(text)+1; + PUT_INT(l); pos+=4; + memcpy(data+pos, text, strlen(text)+1); + pos+=strlen(text)+1; + } + else + { PUT_INT(0); pos+=4;} + PUT_INT(outline); pos+=4; + PUT_INT(outlinecolor); pos+=4; + PUT_INT(xshift); pos+=4; + PUT_INT(yshift); pos+=4; + PUT_INT(outlinesize); pos+=4; + PUT_INT(randomword); pos+=4; + PUT_INT(shadow); pos+=4; + + return pos; +} +// Parse text buffer for a specified word +void C_THISCLASS::getWord(int n, char *buf, int maxlen) +{ + int w=0; + char *p=text; + char *d=buf; + *d=0; + if (!p) return; + while (w<n && *p) + { + if (*p==';') + w++; + p++; + } + + maxlen--; // null terminator + while (*p && *p != ';' && maxlen>0) + { + char *endp; + if ((!strnicmp(p,"$(playpos",9) || !strnicmp(p,"$(playlen",9)) && (endp = strstr(p+9,")"))) + { + char buf[128]; + int islen=strnicmp(p,"$(playpos",9); + int add_dig=0; + if (p[9]=='.') + add_dig=atoi(p+10); + + if (add_dig > 3) add_dig=3; + + int pos=0; + + extern HWND hwnd_WinampParent; + if (IsWindow(hwnd_WinampParent)) + { + if (!SendMessageTimeout( hwnd_WinampParent, WM_USER,(WPARAM)!!islen,(LPARAM)105,SMTO_BLOCK,50,(LPDWORD)&pos)) + pos=0; + } + if (islen) pos*=1000; + wsprintf(buf,"%d:%02d",pos/60000,(pos/1000)%60); + if (add_dig>0) + { + char fmt[16]; + wsprintf(fmt,".%%%02dd",add_dig); + int div=1; + int x; + for (x = 0; x < 3-add_dig; x ++) + { + div*=10; + } + wsprintf(buf+strlen(buf),fmt,(pos%1000) / div); + } + + int l=strlen(buf); + if (l > maxlen) l=maxlen; + memcpy(d,buf,l); + maxlen-=l; + d += l; + + p=endp+1; + } + else if (!strnicmp(p,"$(title",7) && (endp = strstr(p+7,")"))) + { + static char this_title[256]; + static unsigned int ltg; + + unsigned int now=GetTickCount(); + + if (!this_title[0] || now-ltg > 1000 || now < ltg) + { + ltg=now; + + char *tpp; + if (IsWindow(hwnd_WinampParent)) + { + DWORD id; + if (!SendMessageTimeout( hwnd_WinampParent,WM_GETTEXT,(WPARAM)sizeof(this_title),(LPARAM)this_title,SMTO_BLOCK,50,&id) || !id) + { + this_title[0]=0; + } + } + tpp = this_title+strlen(this_title); + while (tpp >= this_title) + { + char buf[9]; + memcpy(buf,tpp,8); + buf[8]=0; + if (!lstrcmpi(buf,"- Winamp")) break; + tpp--; + } + if (tpp >= this_title) tpp--; + while (tpp >= this_title && *tpp == ' ') tpp--; + *++tpp=0; + } + + int skipnum=1,max_fmtlen=0; + char *titleptr=this_title; + + if (p[7] == ':') + { + char *ptr=p+8; + if (*ptr == 'n') { ptr++; skipnum=0; } + + max_fmtlen=atoi(ptr); + } + + // use: $(reg00), $(reg00:4.5), $(title), $(title:32), $(title:n32) + + if (skipnum && *titleptr >= '0' && *titleptr <= '9') + { + while (*titleptr >= '0' && *titleptr <= '9') titleptr++; + if (*titleptr == '.') + { + titleptr++; + if (*titleptr == ' ') + { + titleptr++; + } + else titleptr=this_title; + } + else titleptr=this_title; + } + int n=strlen(titleptr); + if (n > maxlen)n=maxlen; + if (max_fmtlen >0 && max_fmtlen < n) n=max_fmtlen; + + memcpy(d,titleptr,n); + maxlen-=n; + d+=n; + p=endp+1; + } + else if (!strnicmp(p,"$(reg",5) && p[5] >= '0' && p[5] <= '9' && + p[6] >= '0' && p[6] <= '9' && (endp = strstr(p+7,")"))) + { + char buf[128]; + char fmt[32]; + int wr=atoi(p+5); + if (wr <0)wr=0; + if (wr>99)wr=99; + p+=7; + char *fmtptr=fmt; + *fmtptr++='%'; + if (*p == ':') + { + p++; + while (fmtptr-fmt < 16 && ((*p >= '0' && *p <= '9') || *p == '.')) + *fmtptr++=*p++; + } + *fmtptr++='f'; + *fmtptr++=0; + + int l=sprintf(buf,fmt,NSEEL_getglobalregs()[wr]); + if (l > maxlen) l=maxlen; + memcpy(d,buf,l); + maxlen-=l; + d += l; + p = endp+1; + } + else + { + *d++=*p++; + maxlen--; + } + } + *d=0; +} + +// Returns number of words in buffer +static int getNWords(char *buf) +{ +char *p=buf; +int n=0; +while (p && *p) + { + if (*p==';') + n++; + p++; + } +return n; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int i,j; + int *p,*d; + int clipcolor; + char thisText[256]; + + if (updating) return 0; + if (!enabled) return 0; + if (isBeat&0x80000000) return 0; + + if (forcealign) + { + forcealign=false; + _halign = halign; + _valign = valign; + } + if (shiftinit) + { + shiftinit=0; + _xshift = xshift; + _yshift = yshift; + } + + // If not beat sensitive and time is up for this word + // OR if beat sensitive and this frame is a beat and time is up for last beat + if ((!onbeat && nf >= normSpeed) || (onbeat && isBeat && !nb)) + { // Then choose which word to show + if (!(insertBlank && !(oddeven % 2))) + { + if (randomword) + curword=rand()%(getNWords(text)+1); + else + { + curword++; + curword%=(getNWords(text)+1); + } + } + oddeven++; + oddeven%=2; + } + + if (forceBeat) + { + isBeat = 1; + forceBeat=0; + } + + // If beat sensitive and frame is a beat and last beat expired, start frame timer for this beat + if (onbeat && isBeat && !nb) + nb = onbeatSpeed; + + // Get the word(s) to show + getWord(curword, thisText, 256); + if (insertBlank && !oddeven) + *thisText=0; + + // Same test as above but takes care of nb init + if ((!onbeat && nf >= normSpeed) || (onbeat && isBeat && nb == onbeatSpeed)) + { + nf=0; + if (randomPos && w && h) // Handle random position + { + SIZE size={0,0}; + GetTextExtentPoint32(hBitmapDC, thisText, strlen(thisText), &size); // Don't write outside the screen + _halign = DT_LEFT; + if (size.cx < w) + _xshift = rand() % (int)(((float)(w-size.cx) / (float)w) * 100.0F); + _valign = DT_TOP; + if (size.cy < h) + _yshift = rand() % (int)(((float)(h-size.cy) / (float)h) * 100.0F); + forceshift=1; + } + else + { // Reset position to what is specified + _halign = halign; + _valign = valign; + _xshift = xshift; + _yshift = yshift; + } + } + + // Choose cliping color + if (color != 0 && outlinecolor != 0) + clipcolor = 0; + else + if (color != 0x000008 && outlinecolor != 0x000008) + clipcolor = 8; + else + if (color != 0x0000010 && outlinecolor != 0x0000010) + clipcolor = 10; + + // If size changed or if we're forced to shift the buffer + if ((lw != w || lh != h) || forceshift) + { + if (lw != w || lh != h) // only if size changed then reinit buffer, not if its only a forcedshifting + reinit(w, h); + forceshift=0; + forceredraw=1; // do redraw! + // remember last state + lw = w; + lh = h; + // Compute buffer position + r.left = 0; + r.right = w; + r.top = 0; + r.bottom = h; + r.left += (int)((float)_xshift * (float)w / 100.0F); + r.right += (int)((float)_xshift * (float)w / 100.0F); + r.top += (int)((float)_yshift * (float)h / 100.0F); + r.bottom += (int)((float)_yshift * (float)h / 100.0F); + forceredraw=1; + } + + // Check if we need to redraw the buffer + if (forceredraw || + old_halign != _halign || + old_valign != _valign || + curword != old_curword || + (*thisText && strcmp(thisText, oldtxt)) || + old_clipcolor != clipcolor || + (old_blend1 != (blend && !(onbeat && !nb))) || + (old_blend2 != (blendavg && !(onbeat && !nb))) || + (old_blend3 != (!(onbeat && !nb))) || + old_outline != outline || + oldshadow != shadow || + _xshift != oldxshift || + _yshift != oldyshift) + { + forceredraw=0; + old_halign = _halign; + old_valign = _valign; + old_curword = curword; + if (thisText) strcpy(oldtxt, thisText); + old_clipcolor = clipcolor; + old_blend1 = (blend && !(onbeat && !nb)); + old_blend2 = (blendavg && !(onbeat && !nb)); + old_blend3 = !(onbeat && !nb); + old_outline = outline; + oldshadow = shadow; + oldxshift = _xshift; + oldyshift = _yshift; + + // Draw everything + p = myBuffer; + while (p < myBuffer+h*w) { *p = clipcolor; p++; } + SetDIBits(hBitmapDC, hRetBitmap, 0, h, (void *)myBuffer, &bi, DIB_RGB_COLORS); + if (*thisText) + { + if (outline) + { + SetTextColor(hBitmapDC, ((outlinecolor&0xFF0000) >> 16) | (outlinecolor& 0xFF00) | (outlinecolor&0xFF)<<16); + r.left-=outlinesize; r.right-=outlinesize; r.top-=outlinesize; r.bottom-=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left+=outlinesize; r.right+=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left+=outlinesize; r.right+=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.top+=outlinesize; r.bottom+=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.top+=outlinesize; r.bottom+=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left-=outlinesize; r.right-=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left-=outlinesize; r.right-=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.top-=outlinesize; r.bottom-=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left+=outlinesize; r.right+=outlinesize; + SetTextColor(hBitmapDC, ((color&0xFF0000) >> 16) | (color& 0xFF00) | (color&0xFF)<<16); + } + else if (shadow) + { + SetTextColor(hBitmapDC, ((outlinecolor&0xFF0000) >> 16) | (outlinecolor& 0xFF00) | (outlinecolor&0xFF)<<16); + r.left+=outlinesize; r.right+=outlinesize; r.top+=outlinesize; r.bottom+=outlinesize; + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + r.left-=outlinesize; r.right-=outlinesize; r.top-=outlinesize; r.bottom-=outlinesize; + SetTextColor(hBitmapDC, ((color&0xFF0000) >> 16) | (color& 0xFF00) | (color&0xFF)<<16); + } + DrawText(hBitmapDC, thisText, strlen(thisText), &r, _valign | _halign | DT_NOCLIP | DT_SINGLELINE); + } + GetDIBits(hBitmapDC, hRetBitmap, 0, h, (void *)myBuffer, &bi, DIB_RGB_COLORS); + } + + // Now render the bitmap text buffer over framebuffer, handle blending options. + // Separate blocks here so we don4t have to make w*h tests + p = myBuffer; + d = framebuffer+w*(h-1); + + if (blend && !(onbeat && !nb)) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + if (*p != clipcolor) *d=BLEND(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + if (blendavg && !(onbeat && !nb)) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + if (*p != clipcolor) *d=BLEND_AVG(*p, *d); + d++; + p++; + } + d -= w*2; + } + else + if (!(onbeat && !nb)) + for (i=0;i<h;i++) + { + for (j=0;j<w;j++) + { + if (*p != clipcolor) + *d=*p; + d++; + p++; + } + d -= w*2; + } + + // Advance frame counter + if (!onbeat) nf++; + // Decrease frametimer + if (onbeat && nb) nb--; + + + return 0; +} + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + SetDlgItemText(hwndDlg, IDC_EDIT, g_ConfigThis->text); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETTICFREQ, 10, 0); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(1, 400)); + SendDlgItemMessage(hwndDlg, IDC_OUTLINESIZE, TBM_SETTICFREQ, 15, 0); + SendDlgItemMessage(hwndDlg, IDC_OUTLINESIZE, TBM_SETRANGE, TRUE, MAKELONG(1, 16)); + SendDlgItemMessage(hwndDlg, IDC_OUTLINESIZE, TBM_SETPOS, TRUE, g_ConfigThis->outlinesize); + SendDlgItemMessage(hwndDlg, IDC_VSHIFT, TBM_SETTICFREQ, 50, 0); + SendDlgItemMessage(hwndDlg, IDC_VSHIFT, TBM_SETRANGE, TRUE, MAKELONG(0, 200)); + SendDlgItemMessage(hwndDlg, IDC_VSHIFT, TBM_SETPOS, TRUE, g_ConfigThis->yshift+100); + SendDlgItemMessage(hwndDlg, IDC_HSHIFT, TBM_SETTICFREQ, 50, 0); + SendDlgItemMessage(hwndDlg, IDC_HSHIFT, TBM_SETRANGE, TRUE, MAKELONG(0, 200)); + SendDlgItemMessage(hwndDlg, IDC_HSHIFT, TBM_SETPOS, TRUE, g_ConfigThis->xshift+100); + if (g_ConfigThis->onbeat) + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->onbeatSpeed)); + else + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->normSpeed)); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->onbeat) CheckDlgButton(hwndDlg,IDC_ONBEAT,BST_CHECKED); + if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->outline) CheckDlgButton(hwndDlg,IDC_OUTLINE,BST_CHECKED); + if (g_ConfigThis->shadow) CheckDlgButton(hwndDlg,IDC_SHADOW,BST_CHECKED); + if (!g_ConfigThis->outline && !g_ConfigThis->shadow) CheckDlgButton(hwndDlg,IDC_PLAIN,BST_CHECKED); + if (g_ConfigThis->randomword) CheckDlgButton(hwndDlg,IDC_RANDWORD, BST_CHECKED); + switch (g_ConfigThis->valign) + { + case DT_TOP: + CheckDlgButton(hwndDlg,IDC_VTOP,BST_CHECKED); + break; + case DT_BOTTOM: + CheckDlgButton(hwndDlg,IDC_VBOTTOM,BST_CHECKED); + break; + case DT_VCENTER: + CheckDlgButton(hwndDlg,IDC_VCENTER,BST_CHECKED); + break; + } + switch (g_ConfigThis->halign) + { + case DT_LEFT: + CheckDlgButton(hwndDlg,IDC_HLEFT,BST_CHECKED); + break; + case DT_RIGHT: + CheckDlgButton(hwndDlg,IDC_HRIGHT,BST_CHECKED); + break; + case DT_CENTER: + CheckDlgButton(hwndDlg,IDC_HCENTER,BST_CHECKED); + break; + } + if (g_ConfigThis->insertBlank) CheckDlgButton(hwndDlg,IDC_BLANKS,BST_CHECKED); + if (g_ConfigThis->randomPos) { + CheckDlgButton(hwndDlg,IDC_RANDOMPOS,BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_VTOP), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBOTTOM), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VCENTER), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HLEFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HRIGHT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HCENTER), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HSHIFT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VSHIFT), FALSE); + } + return 1; + case WM_NOTIFY: + { + if ((LOWORD(wParam) == IDC_VSHIFT) || (LOWORD(wParam) == IDC_HSHIFT)) + { + g_ConfigThis->yshift = SendDlgItemMessage(hwndDlg, IDC_VSHIFT, TBM_GETPOS, 0, 0)-100; + g_ConfigThis->xshift = SendDlgItemMessage(hwndDlg, IDC_HSHIFT, TBM_GETPOS, 0, 0)-100; + g_ConfigThis->forceshift=1; + g_ConfigThis->forceredraw=1; + g_ConfigThis->shiftinit=1; + } + if (LOWORD(wParam) == IDC_OUTLINESIZE) + { + g_ConfigThis->outlinesize = SendDlgItemMessage(hwndDlg, IDC_OUTLINESIZE, TBM_GETPOS, 0, 0); + g_ConfigThis->forceredraw=1; + } + if (LOWORD(wParam) == IDC_SPEED) + { + if (g_ConfigThis->onbeat) + { + g_ConfigThis->onbeatSpeed = SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0); + if (g_ConfigThis->nb > g_ConfigThis->onbeatSpeed) + g_ConfigThis->nb = g_ConfigThis->onbeatSpeed; + } + else + g_ConfigThis->normSpeed = SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0); + } + return 0; + } + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL || di->CtlID == IDC_DEFOUTCOL) // paint nifty color button + { + GR_DrawColoredButton(di,di->CtlID == IDC_DEFCOL ? g_ConfigThis->color : g_ConfigThis->outlinecolor); + } + } + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_HRESET) + { + g_ConfigThis->xshift = 0; + SendDlgItemMessage(hwndDlg, IDC_HSHIFT, TBM_SETPOS, TRUE, 100); + g_ConfigThis->forceshift=1; + g_ConfigThis->forceredraw=1; + g_ConfigThis->shiftinit=1; + } + if (LOWORD(wParam) == IDC_VRESET) + { + g_ConfigThis->yshift = 0; + SendDlgItemMessage(hwndDlg, IDC_VSHIFT, TBM_SETPOS, TRUE, 100); + g_ConfigThis->forceshift=1; + g_ConfigThis->forceredraw=1; + g_ConfigThis->shiftinit=1; + } + if (LOWORD(wParam) == IDC_EDIT) + if (HIWORD(wParam) == EN_CHANGE) + { + int l; + if (g_ConfigThis->text) + GlobalFree(g_ConfigThis->text); + l = SendDlgItemMessage(hwndDlg, IDC_EDIT, WM_GETTEXTLENGTH, 0, 0); + if (!l) + g_ConfigThis->text = NULL; + else + { + g_ConfigThis->text = (char *)GlobalAlloc(GMEM_FIXED,l+2); + GetDlgItemText(hwndDlg, IDC_EDIT, g_ConfigThis->text, l+1); + } + g_ConfigThis->forceredraw=1; + } + if (LOWORD(wParam) == IDC_CHOOSEFONT) + { + g_ConfigThis->cf.hwndOwner = hwndDlg; + ChooseFont(&(g_ConfigThis->cf)); + g_ConfigThis->updating=true; + g_ConfigThis->myFont = CreateFontIndirect(&(g_ConfigThis->lf)); + g_ConfigThis->forceredraw=1; + if (g_ConfigThis->hOldFont) + SelectObject(g_ConfigThis->hBitmapDC, g_ConfigThis->hOldFont); + if (g_ConfigThis->myFont) + g_ConfigThis->hOldFont = (HFONT)SelectObject(g_ConfigThis->hBitmapDC, g_ConfigThis->myFont); + else + g_ConfigThis->hOldFont = NULL; + g_ConfigThis->updating=false; + } + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ONBEAT) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_BLANKS) || + (LOWORD(wParam) == IDC_RANDOMPOS) || + (LOWORD(wParam) == IDC_OUTLINE) || + (LOWORD(wParam) == IDC_SHADOW) || + (LOWORD(wParam) == IDC_PLAIN) || + (LOWORD(wParam) == IDC_HLEFT) || + (LOWORD(wParam) == IDC_HRIGHT) || + (LOWORD(wParam) == IDC_HCENTER) || + (LOWORD(wParam) == IDC_VTOP) || + (LOWORD(wParam) == IDC_VBOTTOM) || + (LOWORD(wParam) == IDC_VCENTER) || + (LOWORD(wParam) == IDC_RANDWORD) || + (LOWORD(wParam) == IDC_5050) ) + { + g_ConfigThis->forceredraw=1; + g_ConfigThis->randomword=IsDlgButtonChecked(hwndDlg,IDC_RANDWORD)?1:0; + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->outline=IsDlgButtonChecked(hwndDlg,IDC_OUTLINE)?1:0; + g_ConfigThis->shadow=IsDlgButtonChecked(hwndDlg,IDC_SHADOW)?1:0; + g_ConfigThis->onbeat=IsDlgButtonChecked(hwndDlg,IDC_ONBEAT)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + if (g_ConfigThis->onbeat) + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->onbeatSpeed)); + else + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, (int)(g_ConfigThis->normSpeed)); + g_ConfigThis->insertBlank=IsDlgButtonChecked(hwndDlg,IDC_BLANKS)?1:0; + g_ConfigThis->randomPos=IsDlgButtonChecked(hwndDlg,IDC_RANDOMPOS)?1:0; + g_ConfigThis->valign=IsDlgButtonChecked(hwndDlg,IDC_VTOP)?DT_TOP:g_ConfigThis->valign; + g_ConfigThis->valign=IsDlgButtonChecked(hwndDlg,IDC_VCENTER)?DT_VCENTER:g_ConfigThis->valign; + g_ConfigThis->valign=IsDlgButtonChecked(hwndDlg,IDC_VBOTTOM)?DT_BOTTOM:g_ConfigThis->valign; + g_ConfigThis->halign=IsDlgButtonChecked(hwndDlg,IDC_HLEFT)?DT_LEFT:g_ConfigThis->halign; + g_ConfigThis->halign=IsDlgButtonChecked(hwndDlg,IDC_HRIGHT)?DT_RIGHT:g_ConfigThis->halign; + g_ConfigThis->halign=IsDlgButtonChecked(hwndDlg,IDC_HCENTER)?DT_CENTER:g_ConfigThis->halign; + EnableWindow(GetDlgItem(hwndDlg, IDC_VTOP), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBOTTOM), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VCENTER), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HLEFT), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HRIGHT), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HCENTER), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HSHIFT), g_ConfigThis->randomPos ? FALSE : TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_VSHIFT), g_ConfigThis->randomPos ? FALSE : TRUE); + if ((LOWORD(wParam) == IDC_ONBEAT) && g_ConfigThis->onbeat) + g_ConfigThis->nb=g_ConfigThis->onbeatSpeed; + if ((LOWORD(wParam) == IDC_RANDOMPOS) && g_ConfigThis->randomPos) + g_ConfigThis->forcealign=1; + } + if (LOWORD(wParam) == IDC_DEFCOL ||LOWORD(wParam) == IDC_DEFOUTCOL) // handle clicks to nifty color button + { + int *a=&(LOWORD(wParam) == IDC_DEFCOL ? g_ConfigThis->color : g_ConfigThis->outlinecolor); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + if (LOWORD(wParam) == IDC_DEFCOL) + g_ConfigThis->color = *a; + else + g_ConfigThis->outlinecolor = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,LOWORD(wParam)),NULL,TRUE); + g_ConfigThis->updating=true; + SetTextColor(g_ConfigThis->hBitmapDC, ((g_ConfigThis->color&0xFF0000) >> 16) | (g_ConfigThis->color& 0xFF00) | (g_ConfigThis->color&0xFF)<<16); + g_ConfigThis->forceredraw=1; + g_ConfigThis->updating=false; + } + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_TEXT,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Text(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + + + +#else +C_RBASE *R_Text(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_timescope.cpp b/Src/Plugins/Visualization/vis_avs/r_timescope.cpp new file mode 100644 index 00000000..2cd67dc5 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_timescope.cpp @@ -0,0 +1,289 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" +#include <stdio.h> + + +#ifndef LASER + +#define MOD_NAME "Render / Timescope" +#define C_THISCLASS C_TimescopeClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_RENDER_TIMESCOPE,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + int which_ch; + int enabled; + int color; + int blend, blendavg; + int nbands; + int x; + int oldh; + }; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + +C_THISCLASS::~C_THISCLASS() +{ +} + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + x = 0; + color = 0xFFFFFF; + blend = 2; + blendavg = 0; + enabled=1; + nbands = 576; + oldh=-1; + which_ch=2; +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { color=GET_INT(); pos+=4; } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { blendavg=GET_INT(); pos+=4; } + if (len-pos >= 4) { which_ch=GET_INT(); pos+=4; } + if (len-pos >= 4) { nbands=GET_INT(); pos+=4; } + oldh=-1; +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(color); pos+=4; + PUT_INT(blend); pos+=4; + PUT_INT(blendavg); pos+=4; + PUT_INT(which_ch); pos+=4; + PUT_INT(nbands); pos+=4; + return pos; +} + +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + int i,j; + int c; + char center_channel[576]; + unsigned char *fa_data; + + if (!enabled) return 0; + if (isBeat&0x80000000) return 0; + + if (which_ch >=2) + { + for (j = 0; j < 576; j ++) center_channel[j]=visdata[1][0][j]/2+visdata[1][1][j]/2; + fa_data=(unsigned char *)center_channel; + } + else fa_data=(unsigned char *)&visdata[1][which_ch][0]; + + x++; + x %= w; + framebuffer+=x; + int r,g,b; + r=color&0xff; + g=(color>>8)&0xff; + b=(color>>16)&0xff; + for (i=0;i<h;i++) + { + c = visdata[0][0][(i*nbands)/h] & 0xFF; + c = (r*c)/256 + (((g*c)/256)<<8) + (((b*c)/256)<<16); + if (blend == 2) + BLEND_LINE(framebuffer,c); + else if (blend == 1) + framebuffer[0]=BLEND(framebuffer[0],c); + else if (blendavg) + framebuffer[0]=BLEND_AVG(framebuffer[0],c); + else + framebuffer[0]=c; + framebuffer+=w; + } + + return 0; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ +switch (uMsg) + { + case WM_INITDIALOG: + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_ConfigThis->blend==2) CheckDlgButton(hwndDlg,IDC_DEFAULTBLEND,BST_CHECKED); + else if (g_ConfigThis->blend) CheckDlgButton(hwndDlg,IDC_ADDITIVE,BST_CHECKED); + if (g_ConfigThis->blendavg) CheckDlgButton(hwndDlg,IDC_5050,BST_CHECKED); + if (!g_ConfigThis->blend && !g_ConfigThis->blendavg) + CheckDlgButton(hwndDlg,IDC_REPLACE,BST_CHECKED); + SendDlgItemMessage(hwndDlg, IDC_BANDS, TBM_SETTICFREQ, 32, 0); + SendDlgItemMessage(hwndDlg, IDC_BANDS, TBM_SETRANGE, TRUE, MAKELONG(16, 576)); + SendDlgItemMessage(hwndDlg, IDC_BANDS, TBM_SETPOS, TRUE, g_ConfigThis->nbands); + { + char txt[64]; + wsprintf(txt, WASABI_API_LNGSTRING(IDS_DRAW_X_BANDS), g_ConfigThis->nbands); + SetDlgItemText(hwndDlg, IDC_BANDTXT, txt); + } + if (g_ConfigThis->which_ch==0) + CheckDlgButton(hwndDlg,IDC_LEFT,BST_CHECKED); + else if (g_ConfigThis->which_ch==1) + CheckDlgButton(hwndDlg,IDC_RIGHT,BST_CHECKED); + else + CheckDlgButton(hwndDlg,IDC_CENTER,BST_CHECKED); + return 1; + case WM_DRAWITEM: + { + DRAWITEMSTRUCT *di=(DRAWITEMSTRUCT *)lParam; + if (di->CtlID == IDC_DEFCOL) // paint nifty color button + { + int w=di->rcItem.right-di->rcItem.left; + int _color=g_ConfigThis->color; + _color = ((_color>>16)&0xff)|(_color&0xff00)|((_color<<16)&0xff0000); + + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + LOGBRUSH lb={ (COLORREF)BS_SOLID,(COLORREF)_color,(COLORREF)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,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); + DeleteObject(hBrush); + DeleteObject(hPen); + } + } + return 0; + case WM_COMMAND: + if ((LOWORD(wParam) == IDC_CHECK1) || + (LOWORD(wParam) == IDC_ADDITIVE) || + (LOWORD(wParam) == IDC_REPLACE) || + (LOWORD(wParam) == IDC_5050) || + (LOWORD(wParam) == IDC_DEFAULTBLEND)) + { + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_ADDITIVE)?1:0; + if (!g_ConfigThis->blend) + g_ConfigThis->blend=IsDlgButtonChecked(hwndDlg,IDC_DEFAULTBLEND)?2:0; + g_ConfigThis->blendavg=IsDlgButtonChecked(hwndDlg,IDC_5050)?1:0; + } + if (LOWORD(wParam) == IDC_DEFCOL) // handle clicks to nifty color button + { + int *a=&(g_ConfigThis->color); + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwndDlg; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + g_ConfigThis->color = *a; + } + InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),NULL,TRUE); + } + if (LOWORD(wParam) == IDC_LEFT || LOWORD(wParam) == IDC_RIGHT || LOWORD(wParam)==IDC_CENTER) + { + if (IsDlgButtonChecked(hwndDlg,IDC_LEFT)) g_ConfigThis->which_ch=0; + else if (IsDlgButtonChecked(hwndDlg,IDC_RIGHT)) g_ConfigThis->which_ch=1; + else g_ConfigThis->which_ch=2; + } + break; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_BANDS) + { + g_ConfigThis->nbands = SendDlgItemMessage(hwndDlg, IDC_BANDS, TBM_GETPOS, 0, 0); + { + char txt[64]; + wsprintf(txt, WASABI_API_LNGSTRING(IDS_DRAW_X_BANDS), g_ConfigThis->nbands); + SetDlgItemText(hwndDlg, IDC_BANDTXT, txt); + } + } + return 0; + } +return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_TIMESCOPE,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_Timescope(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_Timescope(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_trans.cpp b/Src/Plugins/Visualization/vis_avs/r_trans.cpp new file mode 100644 index 00000000..9181c354 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_trans.cpp @@ -0,0 +1,982 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 +#define M_PI 3.14159265358979323846 + +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "avs_eelif.h" +#include "../Agave/Language/api_language.h" +#include "../nu/AutoWide.h" +#include <math.h> + + +#ifndef LASER + +#define C_THISCLASS C_TransTabClass +#define MOD_NAME "Trans / Movement" + +#define REFFECT_MIN 3 +#define REFFECT_MAX 23 + +typedef struct { +// int index; // Just here for descriptive purposes, makes it easy to match stuff up. + int list_desc; // The string to show in the listbox. + char *eval_desc; // The optional string to display in the evaluation editor. + char uses_eval; // If this is true, the preset engages the eval library and there is NULL in the radial_effects array for its entry + char uses_rect; // This value sets the checkbox for rectangular calculation +} Description; + +static Description descriptions[]= +{ + {/* 0,*/ IDS_NONE, "", 0, 0}, + {/* 1,*/ IDS_SLIGHT_FUZZIFY, "", 0, 0}, + {/* 2,*/ IDS_SHIFT_ROTATE_LEFT, "x=x+1/32; // use wrap for this one", 0, 1}, + {/* 3,*/ IDS_BIG_SWIRL_OUT, "r = r + (0.1 - (0.2 * d));\r\nd = d * 0.96;", 0, 0}, + {/* 4,*/ IDS_MEDIUM_SWIRL, "d = d * (0.99 * (1.0 - sin(r-$PI*0.5) / 32.0));\r\nr = r + (0.03 * sin(d * $PI * 4));", 0, 0}, + {/* 5,*/ IDS_SUNBURSTER, "d = d * (0.94 + (cos((r-$PI*0.5) * 32.0) * 0.06));", 0, 0}, + {/* 6,*/ IDS_SWIRL_TO_CENTER, "d = d * (1.01 + (cos((r-$PI*0.5) * 4) * 0.04));\r\nr = r + (0.03 * sin(d * $PI * 4));", 0, 0}, + {/* 7,*/ IDS_BLOCKY_PARTIAL_OUT, "", 0, 0}, + {/* 8,*/ IDS_SWIRLING_AROUND_BOTH_WAYS, "r = r + (0.1 * sin(d * $PI * 5));", 0, 0}, + {/* 9,*/ IDS_BUBBLING_OUTWARD, "t = sin(d * $PI);\r\nd = d - (8*t*t*t*t*t)/sqrt((sw*sw+sh*sh)/4);", 0, 0}, + {/*10,*/ IDS_BUBBLING_OUTWARD_WITH_SWIRL, "t = sin(d * $PI);\r\nd = d - (8*t*t*t*t*t)/sqrt((sw*sw+sh*sh)/4);\r\nt=cos(d*$PI/2.0);\r\nr= r + 0.1*t*t*t;", 0, 0}, + {/*11,*/ IDS_5_POINTED_DISTRO, "d = d * (0.95 + (cos(((r-$PI*0.5) * 5.0) - ($PI / 2.50)) * 0.03));", 0, 0}, + {/*12,*/ IDS_TUNNELING, "r = r + 0.04;\r\nd = d * (0.96 + cos(d * $PI) * 0.05);", 0, 0}, + {/*13,*/ IDS_BLEEDIN, "t = cos(d * $PI);\r\nr = r + (0.07 * t);\r\nd = d * (0.98 + t * 0.10);", 0, 0}, + {/*14,*/ IDS_SHIFTED_BIG_SWIRL_OUT, "// this is a very bad approximation in script. fixme.\r\nd=sqrt(x*x+y*y); r=atan2(y,x);\r\nr=r+0.1-0.2*d; d=d*0.96;\r\nx=cos(r)*d + 8/128; y=sin(r)*d;", 0, 1}, + {/*15,*/ IDS_PSYCHOTIC_BEAMING_OUTWARD, "d = 0.15", 0, 0}, + {/*16,*/ IDS_COSINE_RADIAL_3_WAY, "r = cos(r * 3)", 0, 0}, + {/*17,*/ IDS_SPINNY_TUBE, "d = d * (1 - ((d - .35) * .5));\r\nr = r + .1;", 0, 0}, + {/*18,*/ IDS_RADIAL_SWIRLIES, "d = d * (1 - (sin((r-$PI*0.5) * 7) * .03));\r\nr = r + (cos(d * 12) * .03);", 1, 0}, + {/*19,*/ IDS_SWILL, "d = d * (1 - (sin((r - $PI*0.5) * 12) * .05));\r\nr = r + (cos(d * 18) * .05);\r\nd = d * (1-((d - .4) * .03));\r\nr = r + ((d - .4) * .13)", 1, 0}, + {/*20,*/ IDS_GRIDLEY, "x = x + (cos(y * 18) * .02);\r\ny = y + (sin(x * 14) * .03);", 1, 1}, + {/*21,*/ IDS_GRAPEVINE, "x = x + (cos(abs(y-.5) * 8) * .02);\r\ny = y + (sin(abs(x-.5) * 8) * .05);\r\nx = x * .95;\r\ny = y * .95;", 1, 1}, + {/*22,*/ IDS_QUADRANT, "y = y * ( 1 + (sin(r + $PI/2) * .3) );\r\nx = x * ( 1 + (cos(r + $PI/2) * .3) );\r\nx = x * .995;\r\ny = y * .995;", 1, 1}, + {/*23,*/ IDS_6_WAY_KALAEIDA, "y = (r*6)/($PI); x = d;", 1, 1}, +}; + +#define MAKE_REFFECT(n,x) void _ref##n(double &r, double &d, double max_d, int &xo, int &yo) { x } + +typedef void t_reffect(double &r, double &d, double max_d, int &xo, int &yo); + +MAKE_REFFECT(3, r+=0.1-0.2*(d/max_d); d*=0.96;) +MAKE_REFFECT(4, d*=0.99*(1.0-sin(r)/32.0); r+=0.03*sin(d/max_d * M_PI * 4);) +MAKE_REFFECT(5, d*=0.94+(cos(r*32.0)*0.06);) +MAKE_REFFECT(6, d*=1.01+(cos(r*4.0)*0.04); r+=0.03*sin(d/max_d * M_PI * 4);) +MAKE_REFFECT(8, r+=0.1*sin(d/max_d*M_PI*5);) +MAKE_REFFECT(9, double t; t=sin(d/max_d*M_PI); d-=8*t*t*t*t*t; ) +MAKE_REFFECT(10,double t; t=sin(d/max_d*M_PI); d-=8*t*t*t*t*t; t=cos((d/max_d)*M_PI/2.0); r+=0.1*t*t*t; ) +MAKE_REFFECT(11, d*=0.95+(cos(r*5.0 - M_PI/2.50)*0.03); ) +MAKE_REFFECT(12, r+=0.04; d*=0.96+cos(d/max_d*M_PI)*0.05; ) +MAKE_REFFECT(13, double t; t=cos(d/max_d*M_PI); r+=0.07*t; d*=0.98+t*0.10; ) +MAKE_REFFECT(14, r+=0.1-0.2*(d/max_d); d*=0.96; xo=8; ) +MAKE_REFFECT(15, d=max_d*0.15;) +MAKE_REFFECT(16, r=cos(r*3);) +MAKE_REFFECT(17, d*=(1-(((d/max_d)-.35)*.5)); r+=.1;) + +static t_reffect *radial_effects[REFFECT_MAX-REFFECT_MIN+1]= +{ + _ref3, _ref4, _ref5, _ref6, NULL, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, + _ref14, _ref15, _ref16, _ref17, NULL/*18*/, NULL/*19*/, NULL/*20*/, NULL/*21*/, + NULL/*22*/, NULL/*23*/, +}; + +static inline bool effect_uses_eval(int t) +{ + bool retval = false; + if ((t >= REFFECT_MIN) && (t <= REFFECT_MAX)) + { + if (descriptions[t].uses_eval) + { + retval = true; + } + } + return retval; +} + + +class C_THISCLASS : public C_RBASE2 { + 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); + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + + 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 *trans_tab, trans_tab_w, trans_tab_h, trans_tab_subpixel; + int trans_effect; + RString effect_exp; + int effect_exp_ch; + int effect,blend; + int sourcemapped; + int rectangular; + int subpixel; + int wrap; + 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; + if (len-pos >= 4) { effect=GET_INT(); pos+=4; } + if (effect == 32767) + { + if (!memcmp(data+pos,"!rect ",6)) + { + pos+=6; + rectangular=1; + } + if (data[pos]==1) + { + pos++; + int l=GET_INT(); pos+=4; + if (l > 0 && len-pos >= l) + { + effect_exp.resize(l); + memcpy(effect_exp.get(), data+pos, l); + pos+=l; + } + else + { + effect_exp.resize(1); + effect_exp.get()[0]=0; + } + } + else if (len-pos >= 256) + { + char buf[257]; + int l=256-(rectangular?6:0); + memcpy(buf,data+pos,l); + buf[l]=0; + effect_exp.assign(buf); + pos+=l; + } + } + if (len-pos >= 4) { blend=GET_INT(); pos+=4; } + if (len-pos >= 4) { sourcemapped=GET_INT(); pos+=4; } + if (len-pos >= 4) { rectangular=GET_INT(); pos+=4; } + if (len-pos >= 4) { subpixel=GET_INT(); pos+=4; } + else subpixel=0; + if (len-pos >= 4) { wrap=GET_INT(); pos+=4; } + else wrap=0; + if (!effect && len-pos >= 4) + { + effect=GET_INT(); pos+=4; + } + + if (effect != 32767 && effect > REFFECT_MAX || effect < 0) + effect=0; + + // Once we know what our _real_ effect value is, if it uses the evaluator, allocate and stuff the string, here. + /* + if (effect_uses_eval(effect)) + { + const char *eval_string = descriptions[effect].eval_desc; + int length = strlen(eval_string); + effect_exp.resize(length+1); + strcpy(effect_exp.get(), eval_string); + } + */ + + effect_exp_ch=1; +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + + // the reason this is 15, and not REFFECT_MAX, is because old versions of AVS barf + // if effect is > 15, so we put 0, and at the end put the new value + if (effect > 15 && effect != 32767) + { + PUT_INT(0); + pos += 4; + } + else + { + PUT_INT(effect); + pos+=4; + } + if (effect == 32767) + { + int l=strlen(effect_exp.get())+1; + data[pos++]=1; + PUT_INT(l); + pos+=4; + memcpy(data+pos,effect_exp.get(),strlen(effect_exp.get())+1); + pos+=strlen(effect_exp.get())+1; + } + PUT_INT(blend); pos+=4; + PUT_INT(sourcemapped); pos+=4; + PUT_INT(rectangular); pos+=4; + PUT_INT(subpixel); pos+=4; + PUT_INT(wrap); pos+=4; + + // see note on '15' above =) + if (effect > 15 && effect != 32767) + { + PUT_INT(effect); + pos+=4; + } + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + InitializeCriticalSection(&rcs); + sourcemapped=0; + trans_tab=NULL; + trans_tab_w=trans_tab_h=0; + effect=1; + trans_effect=0; + blend=0; + effect_exp.assign(""); + rectangular=0; + subpixel=1; + wrap=0; + trans_tab_subpixel=0; + effect_exp_ch=1; +} + +C_THISCLASS::~C_THISCLASS() +{ + if (trans_tab) GlobalFree(trans_tab); + trans_tab=NULL; + trans_tab_w=trans_tab_h=0; + trans_effect=0; + DeleteCriticalSection(&rcs); +} + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!effect) return 0; + + if (!trans_tab || trans_tab_w != w || trans_tab_h != h || effect != trans_effect || + effect_exp_ch) + { + int p; + int *transp,x; + if (trans_tab) GlobalFree(trans_tab); + trans_tab_w=w; + trans_tab_h=h; + trans_tab=(int*)GlobalAlloc(GMEM_FIXED,trans_tab_w*trans_tab_h*sizeof(int)); + trans_effect=effect; + trans_tab_subpixel=(subpixel && trans_tab_w*trans_tab_h < (1<<22) && + ((trans_effect >= REFFECT_MIN && trans_effect <= REFFECT_MAX + && trans_effect != 1 && trans_effect != 2 && trans_effect != 7 + )||trans_effect ==32767)); + + /* generate trans_tab */ + transp=trans_tab; + x=w*h; + p=0; + + if (trans_effect == 1) + { + while (x--) + { + int r=(p++)+(rand()%3)-1 + ((rand()%3)-1)*w; + *transp++ = min(w*h-1,max(r,0)); + } + } + else if (trans_effect == 2) + { + int y=h; + while (y--) + { + int x=w; + int lp=w/64; + while (x--) + { + *transp++ = p+lp++; + if (lp >= w) lp-=w; + } + p+=w; + } + } + else if (trans_effect == 7) + { + int y; + for (y = 0; y < h; y ++) + { + for (x = 0; x < w; x ++) + { + if (x&2 || y&2) + { + *transp++ = x+y*w; + } + else + { + int xp=w/2+(((x&~1)-w/2)*7)/8; + int yp=h/2+(((y&~1)-h/2)*7)/8; + *transp++=xp+yp*w; + } + } + } + } + else if (trans_effect >= REFFECT_MIN && trans_effect <= REFFECT_MAX && !effect_uses_eval(trans_effect)) + { + double max_d=sqrt((w*w+h*h)/4.0); + int y; + t_reffect *ref=radial_effects[trans_effect-REFFECT_MIN]; + if (ref) for (y = 0; y < h; y ++) + { + for (x = 0; x < w; x ++) + { + double r,d; + double xd,yd; + int ow,oh,xo=0,yo=0; + xd=x-(w/2); + yd=y-(h/2); + d=sqrt(xd*xd+yd*yd); + r=atan2(yd,xd); + + ref(r,d,max_d,xo,yo); + + double tmp1,tmp2; + tmp1= ((h/2) + sin(r)*d + 0.5) + (yo*h)*(1.0/256.0); + tmp2= ((w/2) + cos(r)*d + 0.5) + (xo*w)*(1.0/256.0); + oh=(int)tmp1; + ow=(int)tmp2; + if (trans_tab_subpixel) + { + int xpartial=(int)(32.0*(tmp2-ow)); + int ypartial=(int)(32.0*(tmp1-oh)); + if (wrap) + { + ow%=(w-1); + oh%=(h-1); + if (ow<0)ow+=w-1; + if (oh<0)oh+=h-1; + } + else + { + if (ow < 0) { xpartial=0; ow=0; } + if (ow >= w-1) { xpartial=31; ow=w-2; } + if (oh < 0) { ypartial=0; oh=0; } + if (oh >= h-1) {ypartial=31; oh=h-2; } + } + *transp++ = ow+oh*w | (ypartial<<22) | (xpartial<<27); + } + else + { + if (wrap) + { + ow%=(w); + oh%=(h); + if (ow<0)ow+=w; + if (oh<0)oh+=h; + } + else + { + if (ow < 0) ow=0; + if (ow >= w) ow=w-1; + if (oh < 0) oh=0; + if (oh >= h) oh=h-1; + } + *transp++ = ow+oh*w; + } + } + } + } + else if (trans_effect == 32767 || effect_uses_eval(trans_effect)) + { + NSEEL_VMCTX AVS_EEL_CONTEXTNAME; + AVS_EEL_INITINST(); + double max_d=sqrt((double)(w*w+h*h))/2.0; + double divmax_d=1.0/max_d; + int y; + double *d = registerVar("d"); + double *r = registerVar("r"); + double *px = registerVar("x"); + double *py = registerVar("y"); + double *pw = registerVar("sw"); + double *ph = registerVar("sh"); + NSEEL_CODEHANDLE codehandle=0; + int offs=0; + int is_rect = trans_effect == 32767 ? rectangular : descriptions[trans_effect].uses_rect; + *pw=w; + *ph=h; + EnterCriticalSection(&rcs); + codehandle=compileCode( + trans_effect == 32767 ? effect_exp.get() : descriptions[trans_effect].eval_desc + ); + LeaveCriticalSection(&rcs); + if (codehandle) + { + double w2=w/2; + double h2=h/2; + double xsc=1.0/w2,ysc=1.0/h2; + + for (y = 0; y < h; y ++) + { + for (x = 0; x < w; x ++) + { + double xd,yd; + int ow,oh; + xd=x-w2; + yd=y-h2; + *px=xd*xsc; + *py=yd*ysc; + *d=sqrt(xd*xd+yd*yd)*divmax_d; + *r=atan2(yd,xd) + M_PI*0.5; + + executeCode(codehandle,visdata); + + double tmp1,tmp2; + if (!is_rect) + { + *d *= max_d; + *r -= M_PI/2.0; + tmp1=((h/2) + sin(*r)* *d); + tmp2=((w/2) + cos(*r)* *d); + } + else + { + tmp1=((*py+1.0)*h2); + tmp2=((*px+1.0)*w2); + } + if (trans_tab_subpixel) + { + oh=(int) tmp1; + ow=(int) tmp2; + int xpartial=(int)(32.0*(tmp2-ow)); + int ypartial=(int)(32.0*(tmp1-oh)); + if (wrap) + { + ow%=(w-1); + oh%=(h-1); + if (ow<0)ow+=w-1; + if (oh<0)oh+=h-1; + } + else + { + if (ow < 0) { xpartial=0; ow=0; } + if (ow >= w-1) { xpartial=31; ow=w-2; } + if (oh < 0) { ypartial=0; oh=0; } + if (oh >= h-1) {ypartial=31; oh=h-2; } + } + *transp++ = ow+oh*w | (ypartial<<22) | (xpartial<<27); + } + else + { + tmp1+=0.5; + tmp2+=0.5; + oh=(int) tmp1; + ow=(int) tmp2; + if (wrap) + { + ow%=(w); + oh%=(h); + if (ow<0)ow+=w; + if (oh<0)oh+=h; + } + else + { + if (ow < 0) ow=0; + if (ow >= w) ow=w-1; + if (oh < 0) oh=0; + if (oh >= h) oh=h-1; + } + *transp++ = ow+oh*w; + } + } + } + } + else + { + transp=trans_tab; + trans_tab_subpixel=0; + for (x = 0; x < w*h; x ++) + *transp++=x; + } + freeCode(codehandle); + AVS_EEL_QUITINST(); + } + effect_exp_ch=0; + } + + if (!(isBeat & 0x80000000)) + { + if ((sourcemapped&2)&&isBeat) sourcemapped^=1; + if (sourcemapped&1) + { + if (!blend) memset(fbout,0,w*h*sizeof(int)); + else memcpy(fbout,framebuffer,w*h*sizeof(int)); + } + } + return max_threads; +} + +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!effect) return; + +#define OFFSET_MASK ((1<<22)-1) + + unsigned int *inp = (unsigned int *) framebuffer; + unsigned int *outp; + int *transp, x; + + if (max_threads < 1) max_threads=1; + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + int skip_pix=start_l*w; + transp=trans_tab; + + outp = (unsigned int *) fbout; + x=(w*outh)/4; + if (sourcemapped&1) + { + inp += skip_pix; + transp += skip_pix; + if (trans_tab_subpixel) + { + timingEnter(3); + while (x--) + { + fbout[transp[0]&OFFSET_MASK]=BLEND_MAX(inp[0],fbout[transp[0]&OFFSET_MASK]); + fbout[transp[1]&OFFSET_MASK]=BLEND_MAX(inp[1],fbout[transp[1]&OFFSET_MASK]); + fbout[transp[2]&OFFSET_MASK]=BLEND_MAX(inp[2],fbout[transp[2]&OFFSET_MASK]); + fbout[transp[3]&OFFSET_MASK]=BLEND_MAX(inp[3],fbout[transp[3]&OFFSET_MASK]); + inp+=4; + transp+=4; + } + timingLeave(3); + x = (w*outh)&3; + if (x>0) while (x--) + { + fbout[transp[0]&OFFSET_MASK]=BLEND_MAX(inp++[0],fbout[transp[0]&OFFSET_MASK]); + transp++; + } + } + else + { + { + timingEnter(3); + while (x--) + { + fbout[transp[0]]=BLEND_MAX(inp[0],fbout[transp[0]]); + fbout[transp[1]]=BLEND_MAX(inp[1],fbout[transp[1]]); + fbout[transp[2]]=BLEND_MAX(inp[2],fbout[transp[2]]); + fbout[transp[3]]=BLEND_MAX(inp[3],fbout[transp[3]]); + inp+=4; + transp+=4; + } + timingLeave(3); + x = (w*outh)&3; + if (x>0) while (x--) + { + fbout[transp[0]]=BLEND_MAX(inp++[0],fbout[transp[0]]); + transp++; + } + } + } + if (blend) + { + framebuffer += skip_pix; + fbout += skip_pix; + x=(w*outh)/4; + while (x--) + { + fbout[0]=BLEND_AVG(fbout[0],framebuffer[0]); + fbout[1]=BLEND_AVG(fbout[1],framebuffer[1]); + fbout[2]=BLEND_AVG(fbout[2],framebuffer[2]); + fbout[3]=BLEND_AVG(fbout[3],framebuffer[3]); + fbout+=4; + framebuffer+=4; + } + x=(w*outh)&3; + while (x--) + { + fbout[0]=BLEND_AVG(fbout[0],framebuffer[0]); + fbout++; + framebuffer++; + } + } + } + else + { + inp += skip_pix; + outp += skip_pix; + transp += skip_pix; + if (trans_tab_subpixel&&blend) + { + while (x--) + { + int offs=transp[0]&OFFSET_MASK; + outp[0]=BLEND_AVG(inp[0],BLEND4((unsigned int *)framebuffer+offs,w,((transp[0]>>24)&(31<<3)),((transp[0]>>19)&(31<<3)))); + offs=transp[1]&OFFSET_MASK; + outp[1]=BLEND_AVG(inp[1],BLEND4((unsigned int *)framebuffer+offs,w,((transp[1]>>24)&(31<<3)),((transp[1]>>19)&(31<<3)))); + offs=transp[2]&OFFSET_MASK; + outp[2]=BLEND_AVG(inp[2],BLEND4((unsigned int *)framebuffer+offs,w,((transp[2]>>24)&(31<<3)),((transp[2]>>19)&(31<<3)))); + offs=transp[3]&OFFSET_MASK; + outp[3]=BLEND_AVG(inp[3],BLEND4((unsigned int *)framebuffer+offs,w,((transp[3]>>24)&(31<<3)),((transp[3]>>19)&(31<<3)))); + transp+=4; + outp+=4; + inp+=4; + } + x=(w*outh)&3; + while (x--) + { + int offs=transp[0]&OFFSET_MASK; + outp++[0]=BLEND_AVG(inp[0],BLEND4((unsigned int *)framebuffer+offs,w,((transp[0]>>24)&(31<<3)),((transp[0]>>19)&(31<<3)))); + transp++; + inp++; + } + #ifndef NO_MMX + __asm emms; + #endif + } + else if (trans_tab_subpixel) + { + while (x--) + { + int offs=transp[0]&OFFSET_MASK; + outp[0]=BLEND4((unsigned int *)framebuffer+offs,w,((transp[0]>>24)&(31<<3)),((transp[0]>>19)&(31<<3))); + offs=transp[1]&OFFSET_MASK; + outp[1]=BLEND4((unsigned int *)framebuffer+offs,w,((transp[1]>>24)&(31<<3)),((transp[1]>>19)&(31<<3))); + offs=transp[2]&OFFSET_MASK; + outp[2]=BLEND4((unsigned int *)framebuffer+offs,w,((transp[2]>>24)&(31<<3)),((transp[2]>>19)&(31<<3))); + offs=transp[3]&OFFSET_MASK; + outp[3]=BLEND4((unsigned int *)framebuffer+offs,w,((transp[3]>>24)&(31<<3)),((transp[3]>>19)&(31<<3))); + transp+=4; + outp+=4; + } + x=(w*outh)&3; + while (x--) + { + int offs=transp[0]&OFFSET_MASK; + outp++[0]=BLEND4((unsigned int *)framebuffer+offs,w,((transp[0]>>24)&(31<<3)),((transp[0]>>19)&(31<<3))); + transp++; + } + #ifndef NO_MMX + __asm emms; + #endif + } + else if (blend) + { + timingEnter(3); + while (x--) + { + outp[0]=BLEND_AVG(inp[0],framebuffer[transp[0]]); + outp[1]=BLEND_AVG(inp[1],framebuffer[transp[1]]); + outp[2]=BLEND_AVG(inp[2],framebuffer[transp[2]]); + outp[3]=BLEND_AVG(inp[3],framebuffer[transp[3]]); + outp+=4; + inp+=4; + transp+=4; + } + timingLeave(3); + x = (w*outh)&3; + if (x>0) while (x--) + { + outp++[0]=BLEND_AVG(inp++[0],framebuffer[transp++[0]]); + } + } + else + { + timingEnter(4); + while (x--) + { + outp[0]=framebuffer[transp[0]]; + outp[1]=framebuffer[transp[1]]; + outp[2]=framebuffer[transp[2]]; + outp[3]=framebuffer[transp[3]]; + outp+=4; + transp+=4; + } + timingLeave(4); + x = (w*outh)&3; + if (x>0) while (x--) + { + outp++[0]=framebuffer[transp++[0]]; + } + } + } +} + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return !!effect; +} + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + +C_RBASE *R_Trans(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; + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 0; x < sizeof(descriptions)/sizeof(descriptions[0]); x ++) + { + SendDlgItemMessage( hwndDlg, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM)(const wchar_t *)AutoWide( WASABI_API_LNGSTRING( descriptions[ x ].list_desc ), CP_UTF8 ) ); + } + + isstart=1; + SetDlgItemText(hwndDlg,IDC_EDIT1,g_this->effect_exp.get()); + // After we set whatever value into the edit box, that's the new saved value (ie: don't change the save format) + isstart=0; + + if (g_this->blend) + CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (g_this->subpixel) + CheckDlgButton(hwndDlg,IDC_CHECK4,BST_CHECKED); + if (g_this->wrap) + CheckDlgButton(hwndDlg,IDC_WRAP,BST_CHECKED); + if (g_this->rectangular) + CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + if (g_this->sourcemapped&2) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_INDETERMINATE); + else if (g_this->sourcemapped&1) + CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + + SendDlgItemMessage( hwndDlg, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM)(const wchar_t *)AutoWide( WASABI_API_LNGSTRING( IDS_USER_DEFINED ), CP_UTF8 ) ); + SendDlgItemMessage(hwndDlg,IDC_LIST1,LB_SETCURSEL,(g_this->effect==32767)?sizeof(descriptions)/sizeof(descriptions[0]):g_this->effect,0); + if (g_this->effect == 32767) + { + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),1); + } + else if (g_this->effect >= 0 && g_this->effect <= REFFECT_MAX) + { + if (strlen(descriptions[g_this->effect].eval_desc) > 0) + { + SetDlgItemTextA(hwndDlg,IDC_EDIT1,descriptions[g_this->effect].eval_desc); + CheckDlgButton(hwndDlg,IDC_CHECK3,descriptions[g_this->effect].uses_rect?BST_CHECKED:0); + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),1); + } + else + { + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),0); + } + } + else + { + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),0); + } + } + return 1; + case WM_TIMER: + if (wParam == 1) + { + KillTimer(hwndDlg,1); + EnterCriticalSection(&g_this->rcs); + g_this->effect=32767; + g_this->effect_exp.get_from_dlgitem(hwndDlg,IDC_EDIT1); + g_this->effect_exp_ch=1; + LeaveCriticalSection(&g_this->rcs); + } + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_EDIT1 && HIWORD(wParam) == EN_CHANGE) + { + KillTimer(hwndDlg,1); + if (!isstart) SetTimer(hwndDlg,1,1000,NULL); + + // If someone edits the editwnd, force the "(user defined)" to be the new selection. + if (SendDlgItemMessageA(hwndDlg,IDC_LIST1,LB_GETCURSEL,0,0) != sizeof(descriptions)/sizeof(descriptions[0])) + { + g_this->rectangular=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?1:0; + SendDlgItemMessageA(hwndDlg,IDC_LIST1,LB_SETCURSEL,sizeof(descriptions)/sizeof(descriptions[0]),0); + } + } + if (LOWORD(wParam)==IDC_LIST1 && HIWORD(wParam)==LBN_SELCHANGE) + { + int t; + t=SendDlgItemMessageA(hwndDlg,IDC_LIST1,LB_GETCURSEL,0,0); + if (t == sizeof(descriptions)/sizeof(descriptions[0])) + { + g_this->effect=32767; + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),1); + + SetDlgItemText(hwndDlg,IDC_EDIT1,g_this->effect_exp.get()); + CheckDlgButton(hwndDlg,IDC_CHECK3,g_this->rectangular); + + // always reinit =) + { + EnterCriticalSection(&g_this->rcs); + g_this->effect_exp.get_from_dlgitem(hwndDlg,IDC_EDIT1); + g_this->effect_exp_ch=1; + LeaveCriticalSection(&g_this->rcs); + } + } + else + { + g_this->effect=t; + + // If there is a string to stuff in the eval box, + if (strlen(descriptions[t].eval_desc) > 0) + { + // save the value to be able to restore it later + // stuff it and make sure the boxes are editable + SetDlgItemText(hwndDlg,IDC_EDIT1,descriptions[t].eval_desc); + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),1); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),1); + CheckDlgButton(hwndDlg,IDC_CHECK3,descriptions[t].uses_rect?BST_CHECKED:0); + } + else + { + // otherwise, they're not editable. + CheckDlgButton(hwndDlg,IDC_CHECK3,g_this->rectangular?BST_CHECKED:0); + SetDlgItemText(hwndDlg,IDC_EDIT1,""); + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT1),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK3),0); + EnableWindow(GetDlgItem(hwndDlg,IDC_LABEL1),0); + } + } + + } + if (LOWORD(wParam)==IDC_CHECK1) + { + g_this->blend=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + } + if (LOWORD(wParam)==IDC_CHECK4) + { + g_this->subpixel=IsDlgButtonChecked(hwndDlg,IDC_CHECK4)?1:0; + g_this->effect_exp_ch=1; + } + if (LOWORD(wParam)==IDC_WRAP) + { + g_this->wrap=IsDlgButtonChecked(hwndDlg,IDC_WRAP)?1:0; + g_this->effect_exp_ch=1; + } + if (LOWORD(wParam)==IDC_CHECK2) + { + int a=IsDlgButtonChecked(hwndDlg,IDC_CHECK2); + if (a == BST_INDETERMINATE) + g_this->sourcemapped=2; + else if (a == BST_CHECKED) + g_this->sourcemapped=1; + else + g_this->sourcemapped=0; + } + if (LOWORD(wParam) == IDC_CHECK3) + { + g_this->rectangular=IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?1:0; + if (SendDlgItemMessageA(hwndDlg,IDC_LIST1,LB_GETCURSEL,0,0) != sizeof(descriptions)/sizeof(descriptions[0])) + { + EnterCriticalSection(&g_this->rcs); + g_this->effect=32767; + g_this->effect_exp.get_from_dlgitem(hwndDlg,IDC_EDIT1); + g_this->effect_exp_ch=1; + LeaveCriticalSection(&g_this->rcs); + SendDlgItemMessageA(hwndDlg,IDC_LIST1,LB_SETCURSEL,sizeof(descriptions)/sizeof(descriptions[0]),0); + } + else + g_this->effect_exp_ch=1; + } + if (LOWORD(wParam) == IDC_BUTTON2) + { +/* + char text[4096]; + WASABI_API_LNGSTRING_BUF(IDS_MOVEMENT,text,4096); + int titlelen = lstrlen(text)+1; + lstrcpyn(text+titlelen,GetTextResource(IDR_MOVEMENT),4095-titlelen); +*/ + + char *text="Movement\0" + "Movement help:\r\n" +"To use the custom table, modify r,d,x or y.\r\n" +"Rect coords: x,y are in (-1..1) . Otherwise: d is (0..1) and r is (0..2PI).\r\n" +"You can also access 'sw' and 'sh' for screen dimensions in pixels (might be useful)\r\n" + ; + compilerfunctionlist(hwndDlg,text); + } + return 0; + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_TRANS,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_Trans(char *desc){return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_transition.cpp b/Src/Plugins/Visualization/vis_avs/r_transition.cpp new file mode 100644 index 00000000..0d94f64d --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_transition.cpp @@ -0,0 +1,632 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdio.h> +#include <commctrl.h> +#include <process.h> +#include "draw.h" +#include "resource.h" +#include "cfgwnd.h" +#include "r_defs.h" +#include "r_unkn.h" +#include "r_transition.h" +#include "render.h" +#include <math.h> +#include "../Agave/Language/api_language.h" + +extern char *scanstr_back(char *str, char *toscan, char *defval); + +int transitionmodes[] = +{ + IDS_RANDOM, + IDS_CROSS_DISSOLVE, + IDS_L_R_PUSH, + IDS_R_L_PUSH, + IDS_T_B_PUSH, + IDS_B_T_PUSH, + IDS_9_RANDOM_BLOCKS, + IDS_SPLIT_L_R_PUSH, + IDS_L_R_CENTER_PUSH, + IDS_L_R_CENTER_SQUEEZE, + IDS_L_R_WIPE, + IDS_R_L_WIPE, + IDS_T_B_WIPE, + IDS_B_T_WIPE, + IDS_DOT_DISSOLVE, +}; + +static C_RenderTransitionClass *g_this; +C_RenderTransitionClass::C_RenderTransitionClass() +{ + last_file[0]=0; + l_w=l_h=0; + memset(fbs,0,sizeof(fbs)); + enabled=0; + start_time=0; + _dotransitionflag=0; + initThread=0; +} + +C_RenderTransitionClass::~C_RenderTransitionClass() +{ + int x; + if (initThread) + { + WaitForSingleObject(initThread,INFINITE); + CloseHandle(initThread); + initThread=0; + } for (x = 0; x < 4; x ++) + { + if (fbs[x]) GlobalFree(fbs[x]); + fbs[x]=NULL; + } +} + +unsigned int WINAPI C_RenderTransitionClass::m_initThread(LPVOID p) +{ + C_RenderTransitionClass *_this=(C_RenderTransitionClass*)p; + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + srand(ft.dwLowDateTime|ft.dwHighDateTime^GetCurrentThreadId()); + if (cfg_transitions2&32) + { + extern HANDLE g_hThread; + int d=GetThreadPriority(g_hThread); + if (d == THREAD_PRIORITY_TIME_CRITICAL) d=THREAD_PRIORITY_HIGHEST; + else if (d == THREAD_PRIORITY_HIGHEST) d=THREAD_PRIORITY_ABOVE_NORMAL; + else if (d == THREAD_PRIORITY_ABOVE_NORMAL) d=THREAD_PRIORITY_NORMAL; + else if (d == THREAD_PRIORITY_NORMAL) d=THREAD_PRIORITY_BELOW_NORMAL; + else if (d == THREAD_PRIORITY_BELOW_NORMAL) d=THREAD_PRIORITY_LOWEST; + else if (d == THREAD_PRIORITY_LOWEST) d=THREAD_PRIORITY_IDLE; + SetThreadPriority(GetCurrentThread(),d); + } + int *fb=(int *)GlobalAlloc(GPTR,_this->l_w*_this->l_h*sizeof(int)); + char last_visdata[2][2][576]={0,}; + g_render_effects2->render(last_visdata,0x80000000,fb,fb,_this->l_w,_this->l_h); + GlobalFree((HGLOBAL)fb); + + _this->_dotransitionflag=2; + + _endthreadex(0); + return 0; +} + + +int C_RenderTransitionClass::LoadPreset(char *file, int which, C_UndoItem *item) +{ + if (initThread) + { + if (WaitForSingleObject(initThread,0)==WAIT_TIMEOUT) + { + DDraw_SetStatusText("loading [wait]...",1000*100); + return 2; + } + CloseHandle(initThread); + initThread=0; + } + + + EnterCriticalSection(&g_render_cs); + if (enabled) + { + enabled=0; + } + + int r = 0; + + if (item) + { + g_render_effects2->__LoadPresetFromUndo(*item,1); + last_which=which; + _dotransitionflag=2; + } + else + { + lstrcpyn(last_file,file,sizeof(last_file)); + if (file[0]) r=g_render_effects2->__LoadPreset(file,1); + else + { + g_render_effects2->clearRenders(); + } + if (!r && l_w && l_h && (cfg_transitions2&which) && ((cfg_transitions2&128)||DDraw_IsFullScreen())) + { + DWORD id; + last_which=which; + _dotransitionflag=1; + initThread=(HANDLE)_beginthreadex(NULL,0,m_initThread,(LPVOID)this,0,(unsigned int*)&id); + DDraw_SetStatusText("loading...",1000*100); + } + else + { + last_which=which; + _dotransitionflag=2; + } + + if (r) + { + char s[MAX_PATH*2]; + wsprintf(s,WASABI_API_LNGSTRING(IDS_ERROR_LOADING_X),scanstr_back(last_file,"\\",last_file-1)+1); + DDraw_SetStatusText(s); + _dotransitionflag=3; + } + C_UndoStack::clear(); + C_UndoStack::saveundo(1); + C_UndoStack::cleardirty(); + } + LeaveCriticalSection(&g_render_cs); + + return !!r; +} + +#define PI 3.14159265358979323846 +//264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848... + +extern int g_rnd_cnt; + +int C_RenderTransitionClass::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (_dotransitionflag||enabled) g_rnd_cnt=0; + if (_dotransitionflag==2 || _dotransitionflag == 3) + { + int notext=_dotransitionflag==3; + _dotransitionflag=0; + if (cfg_transitions&last_which) + { + curtrans = (cfg_transition_mode&0x7fff) ? (cfg_transition_mode&0x7fff) : (rand() % ((sizeof(transitionmodes)/sizeof(transitionmodes[0]))-1))+1; + if (cfg_transition_mode&0x8000) curtrans|=0x8000; + ep[0]=0; + ep[1]=2; + mask=0; + start_time=0; + enabled=1; + } + C_RenderListClass *temp=g_render_effects; + g_render_effects=g_render_effects2; + g_render_effects2=temp; + extern int need_repop; + extern char *extension(char *fn); + need_repop=1; + PostMessage(g_hwndDlg,WM_USER+20,0,0); + if (!notext && stricmp("aph",extension(last_file))) + { + char buf[512]; + strncpy(buf,scanstr_back(last_file,"\\",last_file-1)+1,510); + buf[510]=0; + scanstr_back(buf,".",buf+strlen(buf))[0]=0; + strcat(buf," "); + DDraw_SetStatusText(buf); + } + } + + if (!enabled) + { + int x; + l_w=w; + l_h=h; + if (fbs[0]) for (x = 0; x < 4; x ++) + { + if (fbs[x]) + { + GlobalFree(fbs[x]); + fbs[x]=NULL; + } + } + if (!initThread && g_render_effects2->getNumRenders()) + { + g_render_effects2->clearRenders(); + g_render_effects2->freeBuffers(); + } + return g_render_effects->render(visdata,isBeat,framebuffer,fbout,w,h); + } + + // handle resize + if (l_w != w || l_h != h || !fbs[0]) + { + l_w=w; + l_h=h; + int x; + for (x = 0; x < 4; x ++) + { + if (fbs[x]) GlobalFree(fbs[x]); + fbs[x]=(int*)GlobalAlloc(GPTR,l_w*l_h*sizeof(int)); + } + } + + if (start_time == 0) + { + memcpy(fbs[ep[0]],framebuffer,sizeof(int)*l_w*l_h); + memcpy(fbs[ep[1]],framebuffer,sizeof(int)*l_w*l_h); + } + + + // maybe there's a faster way than using 3 more buffers without screwing + // any effect... justin ? + if (curtrans&0x8000) + ep[1]^=g_render_effects2->render(visdata,isBeat,fbs[ep[1]],fbs[ep[1]^1],w,h)&1; + ep[0]^=g_render_effects->render(visdata,isBeat,fbs[ep[0]],fbs[ep[0]^1],w,h)&1; + + int *p = fbs[ep[1]]; + int *d = fbs[ep[0]]; + int *o = framebuffer; + int x=w*h; + + int ttime=250*cfg_transitions_speed; + if (ttime<100) ttime=100; + + int n; + if (!start_time) { n=0; start_time=GetTickCount(); } + else n=MulDiv(GetTickCount()-start_time,256,ttime); + + if (n >= 255) n=255; + + float sintrans = (float)(sin(((float)n/255)*PI-PI/2)/2+0.5); // used for smoothing transitions + // now sintrans does a smooth curve + // from 0 to 1 + switch (curtrans&0x7fff) + { + case 1: // Crossfade + mmx_adjblend_block(o,d,p,x,n); + break; + case 2: // Left to right push + { + int i = (int)(sintrans*w); + int j; + for (j=0;j<h;j++) + { + memcpy(framebuffer+(j*w), d+(j*w)+(w-i), i*4); + memcpy(framebuffer+(j*w)+i, p+(j*w), (w-i)*4); + } + } + break; + case 3: // Right to left push + { + int i = (int)(sintrans*w); + int j; + for (j=0;j<h;j++) + { + memcpy(framebuffer+(j*w), p+(i+j*w), (w-i)*4); + memcpy(framebuffer+(j*w)+(w-i), d+(j*w), i*4); + } + } + break; + case 4: // Top to bottom push + { + int i = (int)(sintrans*h); + memcpy(framebuffer, d+(h-i)*w, w*i*4); + memcpy(framebuffer+w*i, p, w*(h-i)*4); + } + break; + case 5: // Bottom to Top push + { + int i = (int)(sintrans*h); + memcpy(framebuffer,p+i*w, w*(h-i)*4); + memcpy(framebuffer+w*(h-i), d, w*i*4); + } + break; + case 6: // 9 random blocks + { + if (!(mask&(1<<(10+n/28)))) + { + int r=0; + if ((mask & 0x1ff) != 0x1ff) + { + do + { + r = rand()%9; + } + while ((1 << r) & mask); + } + mask |= (1<<r)|(1<<(10+n/28)); + } + int j; + int tw=w/3, th=h/3; + int twr=w-2*tw; + memcpy(framebuffer, p, w*h*4); + int i; + for (i=0;i<9;i++) + { + if (mask & (1<<i)) + { + int end=i/3*th+th; + if (i > 5) end=h; + for (j=i/3*th;j<end;j++) + memcpy(framebuffer+(j*w)+(i%3)*tw, d+(j*w)+(i%3)*tw, (i%3==2) ? twr*4 : tw*4); + } + } + } + break; + case 7: // Left/Right to Right/Left + { + int i = (int)(sintrans*w); + int j; + for (j=0;j<h/2;j++) + { + memcpy(framebuffer+(i+j*w), p+(j*w), (w-i)*4); + memcpy(framebuffer+(j*w), d+((j+1)*w)-i, i*4); + } + for (j=h/2;j<h;j++) + { + memcpy(framebuffer+(j*w), p+(i+j*w), (w-i)*4); + memcpy(framebuffer+(j*w)+(w-i), d+(j*w), i*4); + } + } + break; + case 8: // Left/Right to Center + { + int i = (int)(sintrans*w/2); + int j; + for (j=0;j<h;j++) + { + memcpy(framebuffer+(j*w), d+((j+1)*w-i-w/2), i*4); + memcpy(framebuffer+((j+1)*w-i), d+(j*w+w/2), i*4); + memcpy(framebuffer+(j*w)+i, p+(j*w)+i, (w-i*2)*4); + } + } + break; + case 9: // Left/Right to Center, squeeze + { + int i = (int)(sintrans*w/2); + int j; + for (j=0;j<h;j++) + { + if (i) + { + int xl=i; + int xp=0; + int dxp=((w/2)<<16)/xl; + int *ot=framebuffer+(j*w); + int *it=d+(j*w); + while (xl--) + { + *ot++=it[xp>>16]; + xp+=dxp; + } + } + + if (i*2 != w) + { + int xl=w-i*2; + int xp=0; + int dxp=(w<<16)/xl; + int *ot=framebuffer+(j*w)+i; + int *it=p+(j*w); + while (xl--) + { + *ot++=it[xp>>16]; + xp+=dxp; + } + } + if (i) + { + int xl=i; + int xp=0; + int dxp=((w/2)<<16)/xl; + int *ot=framebuffer+(j*w)+w-i; + int *it=d+(j*w)+w/2; + while (xl--) + { + *ot++=it[xp>>16]; + xp+=dxp; + } + } + + + } + } + break; + case 10: // Left to right wipe + { + int i = (int)(sintrans*w); + int j; + for (j=0;j<h;j++) + { + memcpy(framebuffer+(i+j*w), p+(j*w)+i, (w-i)*4); + memcpy(framebuffer+(j*w), d+(j*w), i*4); + } + } + break; + case 11: // Right to left wipe + { + int i = (int)(sintrans*w); + int j; + for (j=0;j<h;j++) + { + memcpy(framebuffer+(j*w), p+(j*w), (w-i)*4); + memcpy(framebuffer+(j*w)+(w-i), d+(j*w)+(w-i), i*4); + } + } + break; + case 12: // Top to bottom wipe + { + int i = (int)(sintrans*h); + memcpy(framebuffer, d, w*i*4); + memcpy(framebuffer+w*i, p+w*i, w*(h-i)*4); + } + break; + case 13: // Bottom to top wipe + { + int i = (int)(sintrans*h); + memcpy(framebuffer, p, w*(h-i)*4); + memcpy(framebuffer+w*(h-i), d+w*(h-i), w*i*4); + } + break; + case 14: // dot dissolve + { + int i=((int)(sintrans*5))-5; + int j; + int t=0; + int dir=1; + + if (i < 0) + { + dir=!dir; + i++; + i=-i; + } + i=1<<i; + for (j = 0; j < h; j ++) + { + if (t++==i) + { + int x=w; + t=0; + int t2=0; + int *of=framebuffer+j*w; + int *p2=(dir?p:d)+j*w; + int *d2=(dir?d:p)+j*w; + while (x--) + { + if (t2++==i) + { + of[0]=p2[0]; + t2=0; + } + else of[0]=d2[0]; + p2++; + d2++; + of++; + } + } + else + memcpy(framebuffer+j*w,(dir?d:p)+j*w,w*sizeof(int)); + } + } + break; + default: + break; + } + + if (n == 255) + { + int x; + enabled=0; + start_time=0; + for (x = 0; x < 4; x ++) + { + if (fbs[x]) GlobalFree(fbs[x]); + fbs[x]=NULL; + } + g_render_effects2->clearRenders(); + g_render_effects2->freeBuffers(); + } + return 0; +} + +BOOL CALLBACK C_RenderTransitionClass::g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + int x; + for (x = 0; x < sizeof(transitionmodes)/sizeof(transitionmodes[0]); x ++) + SendDlgItemMessage(hwndDlg,IDC_TRANSITION,CB_ADDSTRING,0,(LPARAM)WASABI_API_LNGSTRING(transitionmodes[x])); + SendDlgItemMessage(hwndDlg,IDC_TRANSITION,CB_SETCURSEL,(WPARAM)cfg_transition_mode&0x7fff,0); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETRANGE, TRUE, MAKELONG(1, 32)); + SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_SETPOS, TRUE, cfg_transitions_speed); + if (cfg_transition_mode&0x8000) CheckDlgButton(hwndDlg,IDC_CHECK9,BST_CHECKED); + if (cfg_transitions&1) CheckDlgButton(hwndDlg,IDC_CHECK2,BST_CHECKED); + if (cfg_transitions&2) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + if (cfg_transitions&4) CheckDlgButton(hwndDlg,IDC_CHECK8,BST_CHECKED); + if (cfg_transitions2&1) CheckDlgButton(hwndDlg,IDC_CHECK10,BST_CHECKED); + if (cfg_transitions2&2) CheckDlgButton(hwndDlg,IDC_CHECK11,BST_CHECKED); + if (cfg_transitions2&4) CheckDlgButton(hwndDlg,IDC_CHECK3,BST_CHECKED); + if (cfg_transitions2&32) CheckDlgButton(hwndDlg,IDC_CHECK4,BST_CHECKED); + if (!(cfg_transitions2&128)) CheckDlgButton(hwndDlg,IDC_CHECK5,BST_CHECKED); + + } + return 1; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_TRANSITION: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int r=SendDlgItemMessage(hwndDlg,IDC_TRANSITION,CB_GETCURSEL,0,0); + if (r!=CB_ERR) + { + cfg_transition_mode&=~0x7fff; + cfg_transition_mode |= r; + } + } + break; + case IDC_CHECK9: + cfg_transition_mode&=0x7fff; + cfg_transition_mode |= IsDlgButtonChecked(hwndDlg,IDC_CHECK9)?0x8000:0; + break; + case IDC_CHECK2: + cfg_transitions &= ~1; + cfg_transitions |= IsDlgButtonChecked(hwndDlg,IDC_CHECK2)?1:0; + break; + case IDC_CHECK1: + cfg_transitions &= ~2; + cfg_transitions |= IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?2:0; + break; + case IDC_CHECK8: + cfg_transitions &= ~4; + cfg_transitions |= IsDlgButtonChecked(hwndDlg,IDC_CHECK8)?4:0; + break; + case IDC_CHECK10: + cfg_transitions2 &= ~1; + cfg_transitions2 |= IsDlgButtonChecked(hwndDlg,IDC_CHECK10)?1:0; + break; + case IDC_CHECK11: + cfg_transitions2 &= ~2; + cfg_transitions2 |= IsDlgButtonChecked(hwndDlg,IDC_CHECK11)?2:0; + break; + case IDC_CHECK3: + cfg_transitions2 &= ~4; + cfg_transitions2 |= IsDlgButtonChecked(hwndDlg,IDC_CHECK3)?4:0; + break; + case IDC_CHECK4: + cfg_transitions2 &= ~32; + cfg_transitions2 |= IsDlgButtonChecked(hwndDlg,IDC_CHECK4)?32:0; + break; + case IDC_CHECK5: + cfg_transitions2 &= ~128; + cfg_transitions2 |= IsDlgButtonChecked(hwndDlg,IDC_CHECK5)?0:128; + break; + } + break; + case WM_NOTIFY: + if (LOWORD(wParam) == IDC_SPEED) + cfg_transitions_speed = SendDlgItemMessage(hwndDlg, IDC_SPEED, TBM_GETPOS, 0, 0); + break; + } + return 0; +} + + +HWND C_RenderTransitionClass::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_GCFG_TRANSITIONS,hwndParent,g_DlgProc); +} + diff --git a/Src/Plugins/Visualization/vis_avs/r_transition.h b/Src/Plugins/Visualization/vis_avs/r_transition.h new file mode 100644 index 00000000..cf808739 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_transition.h @@ -0,0 +1,63 @@ +/* + 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. + +*/ +#ifndef _R_TRANSITION_H_ +#define _R_TRANSITION_H_ + +#include "undo.h" + +class C_RenderTransitionClass { + protected: + + int *fbs[4]; + int ep[2]; + int l_w, l_h; + int enabled; + int start_time; + int curtrans; + int mask; + HANDLE initThread; + char last_file[MAX_PATH]; + int last_which; + int _dotransitionflag; + + public: + + static unsigned int WINAPI m_initThread(LPVOID p); + + int LoadPreset(char *file, int which, C_UndoItem *item=0); // 0 on success + C_RenderTransitionClass(); + virtual ~C_RenderTransitionClass(); + + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +}; + +#endif // _R_TRANSITION_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_unkn.cpp b/Src/Plugins/Visualization/vis_avs/r_unkn.cpp new file mode 100644 index 00000000..7d58ef3e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_unkn.cpp @@ -0,0 +1,114 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#define MOD_NAME "Unknown Render Object" + +#include "r_unkn.h" + +char *C_UnknClass::get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_UNKNOWN_RENDER_OBJECT,desc,128):desc); } +void C_UnknClass::SetID(int d, char *dString) { id=d; memset(idString,0,sizeof(idString)); strcpy(idString,dString); } + + +#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_UnknClass::load_config(unsigned char *data, int len) +{ + if (configdata) GlobalFree(configdata); + configdata=(char *)GlobalAlloc(GMEM_FIXED,len); + memcpy(configdata,data,len); + configdata_len=len; +// char s[1024]=""; +// for (int x = 0 ;x < configdata_len; x ++) +// wsprintf(s+strlen(s),"%X,",configdata[x]); +// MessageBox(NULL,s,"loaded config",0); + +} +int C_UnknClass::save_config(unsigned char *data) +{ + int pos=0; +// char s[1024]=""; +// for (int x = 0 ;x < configdata_len; x ++) +// wsprintf(s+strlen(s),"%X,",configdata[x]); +// MessageBox(NULL,s,"saving config",0); + memcpy(data+pos,configdata,configdata_len); + pos+=configdata_len; + return pos; +} + + +C_UnknClass::C_UnknClass() +{ + configdata=0; + configdata_len=0; + id=0; + idString[0]=0; +} + +C_UnknClass::~C_UnknClass() +{ + if (configdata) GlobalFree(configdata); + configdata=0; +} + +int C_UnknClass::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + return 0; +} + +static C_UnknClass *g_this; + +BOOL CALLBACK C_UnknClass::g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + char s[512]=""; + if (g_this->idString[0]) wsprintf(s,"APE: %s\r\n",g_this->idString); + else wsprintf(s,WASABI_API_LNGSTRING(IDS_BUILTIN_ID),g_this->id); + wsprintf(s+strlen(s),WASABI_API_LNGSTRING(IDS_CONFIG_SIZE),g_this->configdata_len); + SetDlgItemText(hwndDlg,IDC_EDIT1,s); + } + return 1; + } + return 0; +} + + +HWND C_UnknClass::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_UNKN,hwndParent,g_DlgProc); +}
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_unkn.h b/Src/Plugins/Visualization/vis_avs/r_unkn.h new file mode 100644 index 00000000..5c2be157 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_unkn.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. + +*/ +#ifndef _R_UNKN_H_ +#define _R_UNKN_H_ + +#define UNKN_ID 0xffffffff + +class C_UnknClass : public C_RBASE { + protected: + char *configdata; + int configdata_len; + public: + C_UnknClass(); + virtual ~C_UnknClass(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + virtual char *get_desc(); + + virtual void SetID(int d, char *dString); + int id; + char idString[33]; + + static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam); +}; + +#endif // _R_UNKN_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_videodelay.cpp b/Src/Plugins/Visualization/vis_avs/r_videodelay.cpp new file mode 100644 index 00000000..e8a3e1fc --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_videodelay.cpp @@ -0,0 +1,365 @@ +/* + 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. + +*/ +// video delay +// copyright tom holden, 2002 +// mail: cfp@myrealbox.com + +#include <windows.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Video Delay" +#define C_DELAY C_VideoDelayClass + +class C_DELAY : public C_RBASE +{ + protected: + public: + // standard ape members + C_DELAY(); + virtual ~C_DELAY(); + virtual int render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual char *get_desc(); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + // saved members + bool enabled; + bool usebeats; + unsigned int delay; + + // unsaved members + LPVOID buffer; + LPVOID inoutpos; + unsigned long buffersize; + unsigned long virtualbuffersize; + unsigned long oldvirtualbuffersize; + unsigned long framessincebeat; + unsigned long framedelay; + unsigned long framemem; + unsigned long oldframemem; +}; + +// global configuration dialog pointer +static C_DELAY *g_Delay; +// global DLL instance pointer +static HINSTANCE g_hDllInstance; + +// configuration screen +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + char value[16]; + int val; + unsigned int objectcode, objectmessage; + HWND hwndEdit; + switch (uMsg) + { + case WM_INITDIALOG: //init + CheckDlgButton(hwndDlg,IDC_CHECK1,g_Delay->enabled); + CheckDlgButton(hwndDlg,IDC_RADIO1,g_Delay->usebeats); + CheckDlgButton(hwndDlg,IDC_RADIO2,!g_Delay->usebeats); + hwndEdit = GetDlgItem(hwndDlg,IDC_EDIT1); + _itoa(g_Delay->delay,value,10); + SetWindowText(hwndEdit,value); + return 1; + case WM_COMMAND: + objectcode = LOWORD(wParam); + objectmessage = HIWORD(wParam); + // see if enable checkbox is checked + if (objectcode == IDC_CHECK1) + { + g_Delay->enabled = IsDlgButtonChecked(hwndDlg,IDC_CHECK1)==1; + return 0; + } + // see if beats radiobox is checked + if (objectcode == IDC_RADIO1) + { + if(IsDlgButtonChecked(hwndDlg,IDC_RADIO1)==1) + { + g_Delay->usebeats = true; + CheckDlgButton(hwndDlg,IDC_RADIO2,BST_UNCHECKED); + g_Delay->framedelay = 0; + g_Delay->framessincebeat = 0; + hwndEdit = GetDlgItem(hwndDlg,IDC_EDIT1); //new + if (g_Delay->delay>16) { //new + g_Delay->delay = 16; //new + SetWindowText(hwndEdit,"16"); //new + } //new + } + else g_Delay->usebeats = false; + return 0; + } + // see if frames radiobox is checked + if (objectcode == IDC_RADIO2) + { + if(IsDlgButtonChecked(hwndDlg,IDC_RADIO2)==1) + { + g_Delay->usebeats = false; + CheckDlgButton(hwndDlg,IDC_RADIO1,BST_UNCHECKED); + g_Delay->framedelay = g_Delay->delay; + } + else g_Delay->usebeats = true; + return 0; + } + //get and put data from the delay box + if (objectcode == IDC_EDIT1) + { + hwndEdit = GetDlgItem(hwndDlg,IDC_EDIT1); + if (objectmessage == EN_CHANGE) + { + GetWindowText(hwndEdit,value,16); + val = atoi(value); + if (g_Delay->usebeats) {if (val > 16) val = 16;} //new + else {if (val > 200) val = 200;} //new + g_Delay->delay = val; + g_Delay->framedelay = g_Delay->usebeats?0:g_Delay->delay; + } + else if (objectmessage == EN_KILLFOCUS) + { + _itoa(g_Delay->delay,value,10); + SetWindowText(hwndEdit,value); + } + return 0; + } + } + return 0; +} + +// set up default configuration +C_DELAY::C_DELAY() +{ + // enable + enabled = true; + usebeats = false; + delay = 10; + framedelay = 10; + framessincebeat = 0; + buffersize = 1; + virtualbuffersize = 1; + oldvirtualbuffersize = 1; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + inoutpos = buffer; +} + +// virtual destructor +C_DELAY::~C_DELAY() +{ + VirtualFree(buffer,buffersize,MEM_DECOMMIT); +} + +// RENDER FUNCTION: +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout +// w and h are the-width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. + +int C_DELAY::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (isBeat&0x80000000) return 0; + + framemem = w*h*4; + if (usebeats) + { + if (isBeat) + { + framedelay = framessincebeat*delay; //changed + if (framedelay > 400) framedelay = 400; //new + framessincebeat = 0; + } + framessincebeat++; + } + if (enabled && framedelay!=0) + { + virtualbuffersize = framedelay*framemem; + if (framemem == oldframemem) + { + if (virtualbuffersize != oldvirtualbuffersize) + { + if (virtualbuffersize > oldvirtualbuffersize) + { + if (virtualbuffersize > buffersize) + { + // allocate new memory + if (!VirtualFree(buffer,buffersize,MEM_DECOMMIT)) return 0; + if (usebeats) + { + buffersize = 2*virtualbuffersize; + if (buffersize > framemem*400) buffersize = framemem*400; //new + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + if (buffer == NULL) + { + buffersize = virtualbuffersize; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + } + } + else + { + buffersize = virtualbuffersize; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + } + inoutpos = buffer; + if (buffer == NULL) + { + framedelay = 0; + framessincebeat = 0; + return 0; + } + } + else + { + unsigned long size = (((unsigned long)buffer)+oldvirtualbuffersize) - ((unsigned long)inoutpos); + unsigned long l = ((unsigned long)buffer)+virtualbuffersize; + unsigned long d = l - size; + MoveMemory((LPVOID)d, inoutpos, size); + for (l = (unsigned long)inoutpos; l < d; l += framemem) CopyMemory((LPVOID)l,(LPVOID)d,framemem); + } + } + else + { // virtualbuffersize < oldvirtualbuffersize + unsigned long presegsize = ((unsigned long)inoutpos)-((unsigned long)buffer)+framemem; + if (presegsize > virtualbuffersize) + { + MoveMemory(buffer,(LPVOID)(((unsigned long)buffer)+presegsize-virtualbuffersize),virtualbuffersize); + inoutpos = (LPVOID)(((unsigned long)buffer)+virtualbuffersize-framemem); + } + else if (presegsize < virtualbuffersize) MoveMemory((LPVOID)(((unsigned long)inoutpos)+framemem),(LPVOID)(((unsigned long)buffer)+oldvirtualbuffersize+presegsize-virtualbuffersize),virtualbuffersize-presegsize); + } + oldvirtualbuffersize = virtualbuffersize; + } + } + else + { + // allocate new memory + if (!VirtualFree(buffer,buffersize,MEM_DECOMMIT)) return 0; + if (usebeats) + { + buffersize = 2*virtualbuffersize; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + if (buffer == NULL) + { + buffersize = virtualbuffersize; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + } + } + else + { + buffersize = virtualbuffersize; + buffer = VirtualAlloc(NULL,buffersize,MEM_COMMIT,PAGE_READWRITE); + } + inoutpos = buffer; + if (buffer == NULL) + { + framedelay = 0; + framessincebeat = 0; + return 0; + } + oldvirtualbuffersize = virtualbuffersize; + } + oldframemem = framemem; + CopyMemory(fbout,inoutpos,framemem); + CopyMemory(inoutpos,framebuffer,framemem); + inoutpos = (LPVOID)(((unsigned long)inoutpos)+framemem); + if ((unsigned long)inoutpos>=((unsigned long)buffer)+virtualbuffersize) inoutpos = buffer; + return 1; + } + else return 0; +} + +HWND C_DELAY::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_Delay = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_VIDEODELAY,hwndParent,g_DlgProc); +} + +char *C_DELAY::get_desc(void) +{ + static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_VIDEO_DELAY,desc,128):desc); +} + +// load_/save_config are called when saving and loading presets (.avs files) +#define GET_INT() (data[pos]|(data[pos+1]<<8)|(data[pos+2]<<16)|(data[pos+3]<<24)) +void C_DELAY::load_config(unsigned char *data, int len) // read configuration of max length "len" from data. +{ + int pos=0; + // always ensure there is data to be loaded + if (len-pos >= 4) + { + // load activation toggle + enabled=(GET_INT()==1); + pos+=4; + } + if (len-pos >= 4) + { + // load beats toggle + usebeats=(GET_INT()==1); + pos+=4; + } + if (len-pos >= 4) + { + // load delay + delay=GET_INT(); + + if (usebeats) {if (delay > 16) delay = 16;} //new + else {if (delay > 200) delay = 200;} //new + + pos+=4; + } +} + +// write configuration to data, return length. config data should not exceed 64k. +#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 +int C_DELAY::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT((int)enabled); + pos+=4; + PUT_INT((int)usebeats); + pos+=4; + PUT_INT((unsigned int)delay); + pos+=4; + return pos; +} + +// export stuff +C_RBASE *R_VideoDelay(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) + { + strcpy(desc,MOD_NAME); + return NULL; + } + return (C_RBASE *) new C_DELAY(); +} + +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_water.cpp b/Src/Plugins/Visualization/vis_avs/r_water.cpp new file mode 100644 index 00000000..424ec4dd --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_water.cpp @@ -0,0 +1,502 @@ +/* + 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. + +*/ +// alphachannel safe 11/21/99 + +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" + +#include "timing.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define C_THISCLASS C_WaterClass +#define MOD_NAME "Trans / Water" + +class C_THISCLASS : public C_RBASE2 { + 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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_WATER,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + + virtual int smp_getflags() { return 1; } + virtual int smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual void smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); + virtual int smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h); // return value is that of render() for fbstuff etc + + unsigned int *lastframe; + int lastframe_len; + + int enabled; +}; + +#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; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } +} +int C_THISCLASS::save_config(unsigned char *data) +{ + int pos=0; + PUT_INT(enabled); pos+=4; + return pos; +} + + + + +C_THISCLASS::C_THISCLASS() +{ + enabled=1; + lastframe_len=0; + lastframe=NULL; +} + +C_THISCLASS::~C_THISCLASS() +{ + if (lastframe) GlobalFree(lastframe); +} + + + +#define _R(x) (( x ) & 0xff) +#define _G(x) ((( x )) & 0xff00) +#define _B(x) ((( x )) & 0xff0000) +#define _RGB(r,g,b) (( r ) | (( g ) & 0xff00) | (( b ) & 0xff0000)) + +static const int zero=0; + +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + smp_begin(1,visdata,isBeat,framebuffer,fbout,w,h); + if (isBeat & 0x80000000) return 0; + + smp_render(0,1,visdata,isBeat,framebuffer,fbout,w,h); + return smp_finish(visdata,isBeat,framebuffer,fbout,w,h); +} + + +int C_THISCLASS::smp_begin(int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return 0; + + if (!lastframe || w*h != lastframe_len) + { + if (lastframe) GlobalFree(lastframe); + lastframe_len=w*h; + lastframe=(unsigned int *)GlobalAlloc(GPTR,w*h*sizeof(int)); + } + + return max_threads; +} + + +int C_THISCLASS::smp_finish(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) // return value is that of render() for fbstuff etc +{ + return !!enabled; +} + + +void C_THISCLASS::smp_render(int this_thread, int max_threads, char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return; + + unsigned int *f = (unsigned int *) framebuffer; + unsigned int *of = (unsigned int *) fbout; + unsigned int *lfo = (unsigned int *) lastframe; + + + int start_l = ( this_thread * h ) / max_threads; + int end_l; + + if (this_thread >= max_threads - 1) end_l = h; + else end_l = ( (this_thread+1) * h ) / max_threads; + + int outh=end_l-start_l; + if (outh<1) return; + + int skip_pix=start_l*w; + + f += skip_pix; + of+= skip_pix; + lfo += skip_pix; + + int at_top=0, at_bottom=0; + + if (!this_thread) at_top=1; + if (this_thread >= max_threads - 1) at_bottom=1; + + + timingEnter(0); + + { + + if (at_top) + // top line + { + int x; + + // left edge + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + f++; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + + // middle of line + x=(w-2); + while (x--) + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[-1]); g += _G(f[-1]); b += _B(f[-1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + f++; + + r/=2; g/=2; b/=2; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + + // right block + { + int r=_R(f[-1]); int g=_G(f[-1]); int b=_B(f[-1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + f++; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + } + + + // middle block + { + int y=outh-at_top-at_bottom; + while (y--) + { + int x; + + // left edge + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r/=2; g/=2; b/=2; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + + // middle of line + x=(w-2); +#ifdef NO_MMX + while (x--) + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[-1]); g += _G(f[-1]); b += _B(f[-1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r/=2; g/=2; b/=2; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } +#else + __asm + { + mov esi, f + mov edi, of + mov edx, lfo + mov ecx, x + mov ebx, w + shl ebx, 2 + shr ecx, 1 + sub esi, ebx + align 16 +mmx_water_loop1: + movd mm0, [esi+ebx+4] + + movd mm1, [esi+ebx-4] + punpcklbw mm0, [zero] + + movd mm2, [esi+ebx*2] + punpcklbw mm1, [zero] + + movd mm3, [esi] + punpcklbw mm2, [zero] + + movd mm4, [edx] + paddw mm0, mm1 + + punpcklbw mm3, [zero] + movd mm7, [esi+ebx+8] + + punpcklbw mm4, [zero] + paddw mm2, mm3 + + movd mm6, [esi+ebx] + paddw mm0, mm2 + + psrlw mm0, 1 + punpcklbw mm7, [zero] + + movd mm2, [esi+ebx*2+4] + psubw mm0, mm4 + + movd mm3, [esi+4] + packuswb mm0, mm0 + + movd [edi], mm0 + punpcklbw mm6, [zero] + + movd mm4, [edx+4] + punpcklbw mm2, [zero] + + paddw mm7, mm6 + punpcklbw mm3, [zero] + + punpcklbw mm4, [zero] + paddw mm2, mm3 + + paddw mm7, mm2 + add edx, 8 + + psrlw mm7, 1 + add esi, 8 + + psubw mm7, mm4 + + packuswb mm7, mm7 + + movd [edi+4], mm7 + + add edi, 8 + + dec ecx + jnz mmx_water_loop1 + + add esi, ebx + mov f, esi + mov of, edi + mov lfo, edx + }; +#endif + // right block + { + int r=_R(f[-1]); int g=_G(f[-1]); int b=_B(f[-1]); + r += _R(f[w]); g += _G(f[w]); b += _B(f[w]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r/=2; g/=2; b/=2; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + } + } + // bottom line + if (at_bottom) + { + int x; + + // left edge + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + + // middle of line + x=(w-2); + while (x--) + { + int r=_R(f[1]); int g=_G(f[1]); int b=_B(f[1]); + r += _R(f[-1]); g += _G(f[-1]); b += _B(f[-1]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r/=2; g/=2; b/=2; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + + // right block + { + int r=_R(f[-1]); int g=_G(f[-1]); int b=_B(f[-1]); + r += _R(f[-w]); g += _G(f[-w]); b += _B(f[-w]); + f++; + + r-=_R(lfo[0]); g-=_G(lfo[0]); b-=_B(lfo[0]); + lfo++; + + if (r < 0) r=0; + else if (r > 255) r=255; + if (g < 0) g=0; + else if (g > 255*256) g=255*256; + if (b < 0) b=0; + else if (b > 255*65536) b=255*65536; + *of++=_RGB(r,g,b); + } + } + } + + memcpy(lastframe+skip_pix,framebuffer+skip_pix,w*outh*sizeof(int)); + +#ifndef NO_MMX + __asm emms; +#endif + timingLeave(0); +} + +C_RBASE *R_Water(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) +{ + switch (uMsg) + { + case WM_INITDIALOG: + if (g_this->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + return 1; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK1) + { + if (IsDlgButtonChecked(hwndDlg,IDC_CHECK1)) + g_this->enabled=1; + else + g_this->enabled=0; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) +{ + g_this = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_WATER,hwndParent,g_DlgProc); +} + +#else +C_RBASE *R_Water(char *desc) { return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/r_waterbump.cpp b/Src/Plugins/Visualization/vis_avs/r_waterbump.cpp new file mode 100644 index 00000000..92a6c85f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/r_waterbump.cpp @@ -0,0 +1,439 @@ +/* + 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. + +*/ +#include <windows.h> +#include <stdlib.h> +#include <vfw.h> +#include <commctrl.h> +#include <math.h> +#include "resource.h" +#include "r_defs.h" +#include "../Agave/Language/api_language.h" + +#ifndef LASER + +#define MOD_NAME "Trans / Water Bump" +#define C_THISCLASS C_WaterBumpClass + +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); + virtual char *get_desc() { static char desc[128]; return (!desc[0]?WASABI_API_LNGSTRING_BUF(IDS_TRANS_WATER_BUMP,desc,128):desc); } + virtual HWND conf(HINSTANCE hInstance, HWND hwndParent); + virtual void load_config(unsigned char *data, int len); + virtual int save_config(unsigned char *data); + void SineBlob(int x, int y, int radius, int height, int page); + void CalcWater(int npage, int density); + void CalcWaterSludge(int npage, int density); + void HeightBlob(int x, int y, int radius, int height, int page); + + int enabled; + int *buffers[2]; + int buffer_w,buffer_h; + int page; + int density; + int depth; + int random_drop; + int drop_position_x; + int drop_position_y; + int drop_radius; + int method; +}; + + +static C_THISCLASS *g_ConfigThis; // global configuration dialog pointer +static HINSTANCE g_hDllInstance; // global DLL instance pointer (not needed in this example, but could be useful) + + + +// configuration read/write + +C_THISCLASS::C_THISCLASS() // set up default configuration +{ + int i; + enabled=1; density=6; depth=600; random_drop=0; drop_position_x=1; drop_position_y=1; drop_radius=40; method=0; + buffer_w=0; buffer_h=0; + for(i=0;i<2;i++) + buffers[i]=NULL; + page=0; +} +C_THISCLASS::~C_THISCLASS() +{ + int i; + for(i=0;i<2;i++) { + if(buffers[i]) GlobalFree(buffers[i]); + buffers[i]=NULL; + } +} + +#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) // read configuration of max length "len" from data. +{ + int pos=0; + if (len-pos >= 4) { enabled=GET_INT(); pos+=4; } + if (len-pos >= 4) { density=GET_INT(); pos+=4; } + if (len-pos >= 4) { depth=GET_INT(); pos+=4; } + if (len-pos >= 4) { random_drop=GET_INT(); pos+=4; } + if (len-pos >= 4) { drop_position_x=GET_INT(); pos+=4; } + if (len-pos >= 4) { drop_position_y=GET_INT(); pos+=4; } + if (len-pos >= 4) { drop_radius=GET_INT(); pos+=4; } + if (len-pos >= 4) { method=GET_INT(); pos+=4; } +} + +#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 +int C_THISCLASS::save_config(unsigned char *data) // write configuration to data, return length. config data should not exceed 64k. +{ + int pos=0; + PUT_INT(enabled); pos+=4; + PUT_INT(density); pos+=4; + PUT_INT(depth); pos+=4; + PUT_INT(random_drop); pos+=4; + PUT_INT(drop_position_x); pos+=4; + PUT_INT(drop_position_y); pos+=4; + PUT_INT(drop_radius); pos+=4; + PUT_INT(method); pos+=4; + return pos; +} + + +void C_THISCLASS::SineBlob(int x, int y, int radius, int height, int page) +{ + int cx, cy; + int left,top,right,bottom; + int square; + double dist; + int radsquare = radius * radius; + double length = (1024.0/(float)radius)*(1024.0/(float)radius); + + if(x<0) x = 1+radius+ rand()%(buffer_w-2*radius-1); + if(y<0) y = 1+radius+ rand()%(buffer_h-2*radius-1); + + + radsquare = (radius*radius); + + left=-radius; right = radius; + top=-radius; bottom = radius; + + // Perform edge clipping... + if(x - radius < 1) left -= (x-radius-1); + if(y - radius < 1) top -= (y-radius-1); + if(x + radius > buffer_w-1) right -= (x+radius-buffer_w+1); + if(y + radius > buffer_h-1) bottom-= (y+radius-buffer_h+1); + + for(cy = top; cy < bottom; cy++) + { + for(cx = left; cx < right; cx++) + { + square = cy*cy + cx*cx; + if(square < radsquare) + { + dist = sqrt(square*length); + buffers[page][buffer_w*(cy+y) + cx+x] + += (int)((cos(dist)+0xffff)*(height)) >> 19; + } + } + } +} + +void C_THISCLASS::HeightBlob(int x, int y, int radius, int height, int page) +{ + int rquad; + int cx, cy, cyq; + int left, top, right, bottom; + + rquad = radius * radius; + + // Make a randomly-placed blob... + if(x<0) x = 1+radius+ rand()%(buffer_w-2*radius-1); + if(y<0) y = 1+radius+ rand()%(buffer_h-2*radius-1); + + left=-radius; right = radius; + top=-radius; bottom = radius; + + // Perform edge clipping... + if(x - radius < 1) left -= (x-radius-1); + if(y - radius < 1) top -= (y-radius-1); + if(x + radius > buffer_w-1) right -= (x+radius-buffer_w+1); + if(y + radius > buffer_h-1) bottom-= (y+radius-buffer_h+1); + + + for(cy = top; cy < bottom; cy++) + { + cyq = cy*cy; + for(cx = left; cx < right; cx++) + { + if(cx*cx + cyq < rquad) + buffers[page][buffer_w*(cy+y) + (cx+x)] += height; + } + } + +} + + +void C_THISCLASS::CalcWater(int npage, int density) +{ + int newh; + int count = buffer_w + 1; + + int *newptr = buffers[npage]; + int *oldptr = buffers[!npage]; + + int x, y; + + for (y = (buffer_h-1)*buffer_w; count < y; count += 2) + { + for (x = count+buffer_w-2; count < x; count++) + { +// This does the eight-pixel method. It looks much better. + + newh = ((oldptr[count + buffer_w] + + oldptr[count - buffer_w] + + oldptr[count + 1] + + oldptr[count - 1] + + oldptr[count - buffer_w - 1] + + oldptr[count - buffer_w + 1] + + oldptr[count + buffer_w - 1] + + oldptr[count + buffer_w + 1] + ) >> 2 ) + - newptr[count]; + + + newptr[count] = newh - (newh >> density); + } + } +} + +/* +void C_THISCLASS::CalcWaterSludge(int npage, int density) +{ + int newh; + int count = buffer_w + 1; + + int *newptr = buffers[npage]; + int *oldptr = buffers[!npage]; + + int x, y; + + for (y = (buffer_h-1)*buffer_w; count < y; count += 2) + { + for (x = count+buffer_w-2; count < x; count++) + { +// This is the "sludge" method... + newh = (oldptr[count]<<2) + + oldptr[count-1-buffer_w] + + oldptr[count+1-buffer_w] + + oldptr[count-1+buffer_w] + + oldptr[count+1+buffer_w] + + ((oldptr[count-1] + + oldptr[count+1] + + oldptr[count-buffer_w] + + oldptr[count+buffer_w])<<1); + + newptr[count] = (newh-(newh>>6)) >> density; + } + } +} +*/ +// render function +// render should return 0 if it only used framebuffer, or 1 if the new output data is in fbout. this is +// used when you want to do something that you'd otherwise need to make a copy of the framebuffer. +// w and h are the width and height of the screen, in pixels. +// isBeat is 1 if a beat has been detected. +// visdata is in the format of [spectrum:0,wave:1][channel][band]. +int C_THISCLASS::render(char visdata[2][2][576], int isBeat, int *framebuffer, int *fbout, int w, int h) +{ + if (!enabled) return 0; + int l,i; + l=w*h; + + if(buffer_w!=w||buffer_h!=h) { + for(i=0;i<2;i++) { + if(buffers[i])GlobalFree(buffers[i]); + buffers[i]=NULL; + } + } + if(buffers[0]==NULL) { + for(i=0;i<2;i++) { + buffers[i]=(int *)GlobalAlloc(GPTR,w*h*sizeof(int)); + } + buffer_w=w; + buffer_h=h; + } + if (isBeat&0x80000000) return 0; + + if(isBeat) { + if(random_drop) { + int max=w; + if(h>w) max=h; + SineBlob(-1,-1,drop_radius*max/100,-depth,page); + } else { + int x,y; + switch(drop_position_x) { + case 0: x=w/4; break; + case 1: x=w/2; break; + case 2: x=w*3/4; break; + } + switch(drop_position_y) { + case 0: y=h/4; break; + case 1: y=h/2; break; + case 2: y=h*3/4; break; + } + SineBlob(x,y,drop_radius,-depth,page); + } +// HeightBlob(-1,-1,80/2,1400,page); + } + +{ + int dx, dy; + int x, y; + int ofs,len=buffer_h*buffer_w; + + int offset=buffer_w + 1; + + int *ptr = buffers[page]; + + for (y = (buffer_h-1)*buffer_w; offset < y; offset += 2) + { + for (x = offset+buffer_w-2; offset < x; offset++) + { + dx = ptr[offset] - ptr[offset+1]; + dy = ptr[offset] - ptr[offset+buffer_w]; + ofs=offset + buffer_w*(dy>>3) + (dx>>3); + if((ofs<len)&&(ofs>-1)) + fbout[offset] = framebuffer[ofs]; + else + fbout[offset] = framebuffer[offset]; + + offset++; + dx = ptr[offset] - ptr[offset+1]; + dy = ptr[offset] - ptr[offset+buffer_w]; + ofs=offset + buffer_w*(dy>>3) + (dx>>3); + if((ofs<len)&&(ofs>-1)) + fbout[offset] = framebuffer[ofs]; + else + fbout[offset] = framebuffer[offset]; + + } + } +} + + CalcWater(!page,density); + + page=!page; + + return 1; +} + + +// configuration dialog stuff + + +static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + if (g_ConfigThis->enabled) CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED); + SendDlgItemMessage(hwndDlg,IDC_DAMP,TBM_SETRANGEMIN,0,2); + SendDlgItemMessage(hwndDlg,IDC_DAMP,TBM_SETRANGEMAX,0,10); + SendDlgItemMessage(hwndDlg,IDC_DAMP,TBM_SETPOS,1,g_ConfigThis->density); + SendDlgItemMessage(hwndDlg,IDC_DEPTH,TBM_SETRANGEMIN,0,100); + SendDlgItemMessage(hwndDlg,IDC_DEPTH,TBM_SETRANGEMAX,0,2000); + SendDlgItemMessage(hwndDlg,IDC_DEPTH,TBM_SETPOS,1,g_ConfigThis->depth); + SendDlgItemMessage(hwndDlg,IDC_RADIUS,TBM_SETRANGEMIN,0,10); + SendDlgItemMessage(hwndDlg,IDC_RADIUS,TBM_SETRANGEMAX,0,100); + SendDlgItemMessage(hwndDlg,IDC_RADIUS,TBM_SETPOS,1,g_ConfigThis->drop_radius); + CheckDlgButton(hwndDlg,IDC_RANDOM_DROP,g_ConfigThis->random_drop); + CheckDlgButton(hwndDlg,IDC_DROP_LEFT,g_ConfigThis->drop_position_x==0); + CheckDlgButton(hwndDlg,IDC_DROP_CENTER,g_ConfigThis->drop_position_x==1); + CheckDlgButton(hwndDlg,IDC_DROP_RIGHT,g_ConfigThis->drop_position_x==2); + CheckDlgButton(hwndDlg,IDC_DROP_TOP,g_ConfigThis->drop_position_y==0); + CheckDlgButton(hwndDlg,IDC_DROP_MIDDLE,g_ConfigThis->drop_position_y==1); + CheckDlgButton(hwndDlg,IDC_DROP_BOTTOM,g_ConfigThis->drop_position_y==2); + return 1; + case WM_DRAWITEM: + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK1) + g_ConfigThis->enabled=IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0; + if (LOWORD(wParam) == IDC_RANDOM_DROP) + g_ConfigThis->random_drop=IsDlgButtonChecked(hwndDlg,IDC_RANDOM_DROP); + if (LOWORD(wParam) == IDC_DROP_LEFT) + g_ConfigThis->drop_position_x=0; + if (LOWORD(wParam) == IDC_DROP_CENTER) + g_ConfigThis->drop_position_x=1; + if (LOWORD(wParam) == IDC_DROP_RIGHT) + g_ConfigThis->drop_position_x=2; + if (LOWORD(wParam) == IDC_DROP_TOP) + g_ConfigThis->drop_position_y=0; + if (LOWORD(wParam) == IDC_DROP_MIDDLE) + g_ConfigThis->drop_position_y=1; + if (LOWORD(wParam) == IDC_DROP_BOTTOM) + g_ConfigThis->drop_position_y=2; + return 0; + case WM_HSCROLL: + { + HWND swnd = (HWND) lParam; + int t = (int) SendMessage(swnd,TBM_GETPOS,0,0); + if (swnd == GetDlgItem(hwndDlg,IDC_DAMP)) + g_ConfigThis->density=t; + if (swnd == GetDlgItem(hwndDlg,IDC_DEPTH)) + g_ConfigThis->depth=t; + if (swnd == GetDlgItem(hwndDlg,IDC_RADIUS)) + g_ConfigThis->drop_radius=t; + } + return 0; + } + return 0; +} + + +HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent) // return NULL if no config dialog possible +{ + g_ConfigThis = this; + return WASABI_API_CREATEDIALOG(IDD_CFG_WATERBUMP,hwndParent,g_DlgProc); +} + + + +// export stuff + +C_RBASE *R_WaterBump(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{ + if (desc) { strcpy(desc,MOD_NAME); return NULL; } + return (C_RBASE *) new C_THISCLASS(); +} + +#else +C_RBASE *R_WaterBump(char *desc) // creates a new effect object if desc is NULL, otherwise fills in desc with description +{return NULL; } +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/reaplay_avs.dsp b/Src/Plugins/Visualization/vis_avs/reaplay_avs.dsp new file mode 100644 index 00000000..b0c144d9 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/reaplay_avs.dsp @@ -0,0 +1,641 @@ +# Microsoft Developer Studio Project File - Name="reaplay_avs" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=reaplay_avs - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "reaplay_avs.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "reaplay_avs.mak" CFG="reaplay_avs - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "reaplay_avs - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "reaplay_avs - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "reaplay_avs - Win32 Laser Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "reaplay_avs - Win32 NoMMX Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/reaplay_avs", RDAAAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "reaplay_avs - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /G6 /MD /W3 /O2 /Ob2 /I "evallib/" /D "NDEBUG" /D "WA2_EMBED" /D "REAPLAY_PLUGIN" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /D "NSEEL_EEL1_COMPAT_MODE" /D "EEL_NO_CHANGE_FPFLAGS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"..\jmde\Release\plugins\reaplay_avs.dll" +# SUBTRACT LINK32 /debug + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "evallib/" /D "_DEBUG" /D "WA2_EMBED" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /D "NSEEL_EEL1_COMPAT_MODE" /D "EEL_NO_CHANGE_FPFLAGS" /D "REAPLAY_PLUGIN" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /debug /machine:I386 /out:"..\jmde\Debug\plugins\reaplay_avs.dll" /pdbtype:sept + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Laser Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "reaplay_avs___Win32_Laser_Release" +# PROP BASE Intermediate_Dir "reaplay_avs___Win32_Laser_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "reaplay_avs___Win32_Laser_Release" +# PROP Intermediate_Dir "reaplay_avs___Win32_Laser_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "NDEBUG" /D "LASER" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /D "NSEEL_EEL1_COMPAT_MODE" /D "EEL_NO_CHANGE_FPFLAGS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "LASER" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /machine:I386 /out:"c:\program files\winamp\plugins\reaplay_avs.dll" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /machine:I386 /out:"c:\program files\winamp\plugins\reaplay_avs_laser.dll" +# SUBTRACT LINK32 /debug + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 NoMMX Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "reaplay_avs___Win32_NoMMX_Release" +# PROP BASE Intermediate_Dir "reaplay_avs___Win32_NoMMX_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "reaplay_avs___Win32_NoMMX_Release" +# PROP Intermediate_Dir "reaplay_avs___Win32_NoMMX_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /Ob2 /I "evallib/" /D "NDEBUG" /D "NO_MMX" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /D "NSEEL_EEL1_COMPAT_MODE" /D "EEL_NO_CHANGE_FPFLAGS" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"c:\progra~1\winamp\plugins\reaplay_avs.dll" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"c:\progra~1\winamp\plugins\reaplay_avs.dll" +# SUBTRACT LINK32 /debug + +!ENDIF + +# Begin Target + +# Name "reaplay_avs - Win32 Release" +# Name "reaplay_avs - Win32 Debug" +# Name "reaplay_avs - Win32 Laser Release" +# Name "reaplay_avs - Win32 NoMMX Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Renders" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\r_avi.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_blit.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_blur.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bpm.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bright.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bspin.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bump.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_chanshift.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_clear.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_colorfade.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_colorreduction.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_comment.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_contrast.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dcolormod.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_ddm.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dmove.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotfnt.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotgrid.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotpln.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_fadeout.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_fastbright.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_grain.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_interf.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_interleave.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_invert.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_linemode.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_mirror.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_mosaic.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_multidelay.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_multiplier.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_nfclr.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_onetone.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_oscring.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_oscstar.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_parts.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_picture.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_rotblit.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_rotstar.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_scat.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_shift.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_simple.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_sscope.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_stack.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_stars.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_svp.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_text.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_timescope.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_trans.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_videodelay.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_water.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_waterbump.cpp +# End Source File +# End Group +# Begin Group "EvalLib" + +# PROP Default_Filter "" +# Begin Group "eel2" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE="..\WDL\eel2\ns-eel-addfuncs.h" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\ns-eel-int.h" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\ns-eel.h" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-caltab.c" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-cfunc.c" + +!IF "$(CFG)" == "reaplay_avs - Win32 Release" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Debug" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Laser Release" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 NoMMX Release" + +# ADD CPP /O1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-compiler.c" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-eval.c" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-lextab.c" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-ram.c" +# End Source File +# Begin Source File + +SOURCE="..\WDL\eel2\nseel-yylex.c" +# End Source File +# End Group +# Begin Source File + +SOURCE=.\avs_eelif.cpp + +!IF "$(CFG)" == "reaplay_avs - Win32 Release" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Debug" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 Laser Release" + +!ELSEIF "$(CFG)" == "reaplay_avs - Win32 NoMMX Release" + +# ADD CPP /O1 + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\avs_eelif.h +# End Source File +# End Group +# Begin Group "Render utils" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\linedraw.cpp +# End Source File +# Begin Source File + +SOURCE=.\matrix.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_defs.h +# End Source File +# Begin Source File + +SOURCE=.\r_list.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_list.h +# End Source File +# Begin Source File + +SOURCE=.\r_transition.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_transition.h +# End Source File +# Begin Source File + +SOURCE=.\r_unkn.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_unkn.h +# End Source File +# Begin Source File + +SOURCE=.\util.cpp +# End Source File +# End Group +# Begin Group "laser" + +# PROP Default_Filter "" +# Begin Group "laser renders" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\laser\rl_beathold.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_bren.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_cones.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_line.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_trans.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\laser\laser.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\laserline.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\laserline.h +# End Source File +# Begin Source File + +SOURCE=.\laser\ld32.c +# End Source File +# Begin Source File + +SOURCE=.\laser\Ld32.h +# End Source File +# Begin Source File + +SOURCE=.\laser\linelist.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\linelist.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\bpm.cpp +# End Source File +# Begin Source File + +SOURCE=.\cfgwin.cpp +# End Source File +# Begin Source File + +SOURCE=.\draw.cpp +# End Source File +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# Begin Source File + +SOURCE=.\render.cpp +# End Source File +# Begin Source File + +SOURCE=.\res.rc +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\rlib.cpp +# End Source File +# Begin Source File + +SOURCE=.\TIMING.C +# End Source File +# Begin Source File + +SOURCE=.\TIMING.H +# End Source File +# Begin Source File + +SOURCE=.\undo.cpp +# End Source File +# Begin Source File + +SOURCE=.\wnd.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ape.h +# End Source File +# Begin Source File + +SOURCE=.\bpm.h +# End Source File +# Begin Source File + +SOURCE=.\cfgwnd.h +# End Source File +# Begin Source File + +SOURCE=.\draw.h +# End Source File +# Begin Source File + +SOURCE=.\render.h +# End Source File +# Begin Source File + +SOURCE=.\rlib.h +# End Source File +# Begin Source File + +SOURCE=.\undo.h +# End Source File +# Begin Source File + +SOURCE=.\wnd.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/Src/Plugins/Visualization/vis_avs/render.cpp b/Src/Plugins/Visualization/vis_avs/render.cpp new file mode 100644 index 00000000..72fd3fb9 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/render.cpp @@ -0,0 +1,141 @@ +/* + 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. + +*/ +#include <windows.h> +#include "render.h" +#include "timing.h" +#include "undo.h" + +#ifdef LASER +C_LineListBase *g_laser_linelist; +#endif + +C_RenderListClass *g_render_effects; +C_RenderListClass *g_render_effects2; +C_RenderTransitionClass *g_render_transition; +C_RLibrary *g_render_library; + +int is_mmx(void) { + DWORD retval1,retval2; + __try { + _asm { + mov eax, 1 // set up CPUID to return processor version and features + // 0 = vendor string, 1 = version info, 2 = cache info + _emit 0x0f // code bytes = 0fh, 0a2h + _emit 0xa2 + mov retval1, eax + mov retval2, edx + } + } __except(EXCEPTION_EXECUTE_HANDLER) { retval1 = retval2= 0;} + if (!retval1) return 0; + return (retval2&0x800000)?1:0; +} + + +unsigned char g_blendtable[256][256]; +unsigned int const mmx_blend4_revn[2]={0xff00ff,0xff00ff};//{0x1000100,0x1000100}; <<- this is actually more correct, but we're going for consistency vs. the non-mmx ver-jf +int const mmx_blendadj_mask[2] = { 0xff00ff,0xff00ff}; +int const mmx_blend4_zero=0; + +void Render_Init(HINSTANCE hDllInstance) +{ +#ifdef LASER + laser_connect(); + g_laser_linelist=createLineList(); +#endif + timingInit(); + { + int i,j; + for (j=0;j<256;j++) + for (i=0;i<256;i++) + g_blendtable[i][j] = (unsigned char)((i / 255.0) * (float)j); + } + + g_render_library=new C_RLibrary(); + g_render_effects=new C_RenderListClass(1); + g_render_effects2=new C_RenderListClass(1); + g_render_transition=new C_RenderTransitionClass(); + + char INI_FILE[MAX_PATH]; + char *p=INI_FILE; + GetModuleFileName(hDllInstance,INI_FILE,sizeof(INI_FILE)); + if (p[0]) while (p[1]) p++; + while (p >= INI_FILE && *p != '\\') p--; +#ifdef LASER + strcpy(p,"\\vis_avs_laser.dat"); +#else + strcpy(p,"\\vis_avs.dat"); +#endif + extern int g_saved_preset_dirty; + // clear the undo stack before loading a file. + C_UndoStack::clear(); + g_render_effects->__LoadPreset(INI_FILE,1); + // then add the new load to the undo stack but mark it clean if it is supposed to be + C_UndoStack::saveundo(); + if (!g_saved_preset_dirty) + { + C_UndoStack::cleardirty(); + } +} + +void Render_Quit(HINSTANCE hDllInstance) +{ + if (g_render_transition) delete g_render_transition; + g_render_transition=NULL; + if (g_render_effects) + { + char INI_FILE[MAX_PATH]; + char *p=INI_FILE; + GetModuleFileName(hDllInstance,INI_FILE,sizeof(INI_FILE)); + if (p[0]) while (p[1]) p++; + while (p >= INI_FILE && *p != '\\') p--; + #ifdef LASER + strcpy(p,"\\vis_avs_laser.dat"); + #else + strcpy(p,"\\vis_avs.dat"); + #endif + + g_render_effects->__SavePreset(INI_FILE); + } + + if (g_render_effects) delete g_render_effects; + g_render_effects=NULL; + if (g_render_effects2) delete g_render_effects2; + g_render_effects2=NULL; + + if (g_render_library) delete g_render_library; + g_render_library=NULL; + + timingPrint(); +#ifdef LASER + if (g_laser_linelist) delete g_laser_linelist; + g_laser_linelist=0; + laser_disconnect(); +#endif +} diff --git a/Src/Plugins/Visualization/vis_avs/render.h b/Src/Plugins/Visualization/vis_avs/render.h new file mode 100644 index 00000000..fe216269 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/render.h @@ -0,0 +1,43 @@ +/* + 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. + +*/ +#include "r_defs.h" +#include "r_list.h" +#include "r_transition.h" +#include "rlib.h" + +void Render_Init(HINSTANCE hDllInstance); +void Render_Quit(HINSTANCE hDllInstance); + +extern C_RenderListClass *g_render_effects; +extern C_RenderListClass *g_render_effects2; +extern C_RenderTransitionClass *g_render_transition; +extern C_RLibrary *g_render_library; + +extern CRITICAL_SECTION g_render_cs; diff --git a/Src/Plugins/Visualization/vis_avs/res.rc b/Src/Plugins/Visualization/vis_avs/res.rc new file mode 100644 index 00000000..ffe2e4ae --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/res.rc @@ -0,0 +1,2329 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Data +// + +#if defined(APSTUDIO_INVOKED) || defined(WA3_COMPONENT) +#if defined(APSTUDIO_INVOKED) +IDB_TAB_NORMAL$(WA3_COMPONENT) RCDATA DISCARDABLE "avs-normal.png" +#else +IDB_TAB_NORMAL RCDATA DISCARDABLE "avs-normal.png" +#endif +#endif +#if defined(APSTUDIO_INVOKED) || defined(WA3_COMPONENT) +#if defined(APSTUDIO_INVOKED) +IDB_TAB_HILITED$(WA3_COMPONENT) RCDATA DISCARDABLE "avs-hilited.png" +#else +IDB_TAB_HILITED RCDATA DISCARDABLE "avs-hilited.png" +#endif +#endif +#if defined(APSTUDIO_INVOKED) || defined(WA3_COMPONENT) +#if defined(APSTUDIO_INVOKED) +IDB_TAB_SELECTED$(WA3_COMPONENT) RCDATA DISCARDABLE "avs-selected.png" +#else +IDB_TAB_SELECTED RCDATA DISCARDABLE "avs-selected.png" +#endif +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 400, 241 +STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOOLWINDOW +CAPTION "Winamp AVS Editor" +MENU IDR_MENU1 +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "-",IDC_REMSEL,121,2,14,12 + PUSHBUTTON "+",IDC_ADD,4,2,14,12 + PUSHBUTTON "x2",IDC_CLONESEL,22,2,14,12,BS_CENTER + CONTROL "",IDC_EFFECTRECT,"Static",SS_BLACKRECT | NOT WS_VISIBLE, + 145,9,245,214 + GROUPBOX "No effect/setting selected",IDC_EFNAME,139,0,257,229 + LTEXT "",IDC_FPS,2,230,374,8 + CONTROL "Tree1",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS | + TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS | WS_BORDER | + WS_TABSTOP,4,18,131,137 + CONTROL "",IDC_RRECT,"Static",SS_BLACKRECT | SS_NOTIFY,4,159,131,69 +END + +IDD_CFG_SIMPLE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Spectrum",IDC_SA,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,6,13,60,8 + CONTROL "Oscilliscope",IDC_OSC,"Button",BS_AUTORADIOBUTTON,70,13,65,8 + CONTROL "Lines",IDC_LINES,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,6,26,41,8 + CONTROL "Solid",IDC_SOLID,"Button",BS_AUTORADIOBUTTON,51,26,40,8 + CONTROL "Dots",IDC_DOT,"Button",BS_AUTORADIOBUTTON,95,26,40,8 + CONTROL "Left Channel",IDC_LEFTCH,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,6,57,75,8 + CONTROL "Right Channel",IDC_RIGHTCH,"Button",BS_AUTORADIOBUTTON, + 6,69,75,8 + CONTROL "Center Channel",IDC_MIDCH,"Button",BS_AUTORADIOBUTTON,6,80,75,8 + CONTROL "Top",IDC_TOP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,110,57,45,10 + CONTROL "Bottom",IDC_BOTTOM,"Button",BS_AUTORADIOBUTTON,110,69,45,10 + CONTROL "Center",IDC_CENTER,"Button",BS_AUTORADIOBUTTON,110,80,45,10 + GROUPBOX "Effect options",IDC_STATIC,0,45,245,51 + EDITTEXT IDC_NUMCOL,53,110,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW,6,122,127,11 + GROUPBOX "Render Effect",IDC_STATIC,0,2,245,39 + GROUPBOX "Colors",IDC_STATIC,0,101,137,36 + LTEXT "Cycle through ",IDC_STATIC,7,112,46,8 + LTEXT "colors (max 16)",IDC_STATIC,77,112,48,8 +END + +IDD_CFG_FADE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,3,9,129,13 + CONTROL "fade to color",IDC_LC,"Button",BS_OWNERDRAW | + WS_TABSTOP,0,51,78,20 + GROUPBOX "Fade velocity",IDC_STATIC,0,0,137,47 + LTEXT "None .. slow",IDC_STATIC,7,25,40,8 + LTEXT "..fast",IDC_STATIC,110,25,16,8 +END + +IDD_CFG_BLT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP,4,10,128,13 + CONTROL "Enable on-beat changes",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX,5,51,93,10 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP,4,63,128,13 + GROUPBOX "Blitter direction (onbeat)",IDC_STATIC,0,41,137,50 + CONTROL "Blend blitter",IDC_BLEND,"Button",BS_AUTOCHECKBOX,0,95, + 53,10 + GROUPBOX "Blitter direction",IDC_STATIC,0,0,137,38 + LTEXT "Zooming in",IDC_STATIC,8,26,36,8 + LTEXT "Zooming out",IDC_STATIC,88,26,40,8 + LTEXT "Zooming in",IDC_STATIC,8,78,36,8 + LTEXT "Zooming out",IDC_STATIC,88,78,40,8 + CONTROL "Bilinear filtering",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,104,63,10 +END + +IDD_CFG_DOTPLANE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,6,17,95,15 + PUSHBUTTON "zero",IDC_BUTTON1,103,15,28,10 + CONTROL "Slider1",IDC_ANGLE,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,6,45,126,15 + CONTROL "Top",IDC_C1,"Button",BS_OWNERDRAW | WS_TABSTOP,7,79,41, + 10 + CONTROL "High",IDC_C2,"Button",BS_OWNERDRAW | WS_TABSTOP,7,90,41, + 10 + CONTROL "Mid",IDC_C3,"Button",BS_OWNERDRAW | WS_TABSTOP,7,101,41, + 10 + CONTROL "Low",IDC_C4,"Button",BS_OWNERDRAW | WS_TABSTOP,7,112,41, + 10 + CONTROL "Bottom",IDC_C5,"Button",BS_OWNERDRAW | WS_TABSTOP,7,123, + 41,10 + GROUPBOX "Rotation",IDC_STATIC,0,0,137,36 + LTEXT "Left",IDC_STATIC,12,9,13,8 + LTEXT "Right",IDC_STATIC,80,9,18,8 + GROUPBOX "Dot colors",IDC_STATIC,0,69,53,68 + GROUPBOX "Angle",IDC_STATIC,0,36,137,29 +END + +IDD_CFG_OSCSTAR DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,10,128,13 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,3,43,128,13 + CONTROL "Left Channel",IDC_LEFTCH,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,8,68,56,10 + CONTROL "Right Channel",IDC_RIGHTCH,"Button",BS_AUTORADIOBUTTON, + 8,78,61,10 + CONTROL "Center Channel",IDC_MIDCH,"Button",BS_AUTORADIOBUTTON,8, + 88,65,10 + CONTROL "Left",IDC_TOP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,86,68,28,10 + CONTROL "Right",IDC_BOTTOM,"Button",BS_AUTORADIOBUTTON,86,78,33, + 10 + CONTROL "Center",IDC_CENTER,"Button",BS_AUTORADIOBUTTON,86,88,37, + 10 + EDITTEXT IDC_NUMCOL,53,107,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,6,122, + 127,11 + GROUPBOX "Star size",IDC_STATIC,0,0,137,39 + GROUPBOX "Rotation",IDC_STATIC,0,34,137,30 + GROUPBOX "Star source and position",IDC_STATIC,0,59,137,42 + GROUPBOX "Colors",IDC_STATIC,0,101,137,36 + LTEXT "Cycle through ",IDC_STATIC,7,109,46,8 + LTEXT "colors (max 16)",IDC_STATIC,77,109,48,8 + LTEXT "Small",IDC_STATIC,8,24,18,8 + LTEXT "Large",IDC_STATIC,106,25,19,8 +END + +IDD_CFG_NFC DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,9,128,13 + CONTROL "Color...",IDC_BUTTON1,"Button",BS_OWNERDRAW | + WS_TABSTOP,0,40,46,10 + CONTROL "Blend to color",IDC_BLEND,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,49,40,59,10 + GROUPBOX "Clear every N beats",IDC_STATIC,0,0,137,36 + LTEXT "0",IDC_STATIC,7,24,8,8 + LTEXT "100",IDC_STATIC,115,24,13,8 +END + +IDD_CFG_BLUR DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "No blur",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,2,1,39,10 + CONTROL "Light blur",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,2,12, + 45,10 + CONTROL "Medium blur",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,2, + 23,54,10 + CONTROL "Heavy blur",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,2,34, + 50,10 + CONTROL "Round down",IDC_ROUNDDOWN,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,3,58,57,10 + CONTROL "Round up",IDC_ROUNDUP,"Button",BS_AUTORADIOBUTTON,3,69, + 47,10 +END + +IDD_CFG_BSPIN DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Left enabled",IDC_LEFT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,55,10 + CONTROL "Right enabled",IDC_RIGHT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,11,60,10 + CONTROL "left color",IDC_LC,"Button",BS_OWNERDRAW | WS_TABSTOP, + 61,0,40,10 + CONTROL "right color",IDC_RC,"Button",BS_OWNERDRAW | WS_TABSTOP, + 61,11,40,10 + CONTROL "Filled Triangles",IDC_TRI,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,23,63,10 + CONTROL "Lines",IDC_LINES,"Button",BS_AUTORADIOBUTTON,0,32,33,10 +END + +IDD_GCFG_DISP DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Wait for retrace",IDC_CHECK6,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,5,10,65,10 + CONTROL "Pixel doubling (half resolution)",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,20,115,10 + LTEXT "Windowed performance:",IDC_STATIC,5,33,78,8 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,40,127,14 + LTEXT "Higher framerate",IDC_STATIC,8,56,54,9 + CONTROL "Suppress status text in windowed",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,67,121,10 + CONTROL "Suppress title text in windowed",IDC_CHECK5,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,77,113,10 + CONTROL "Reuse image on window resize",IDC_CHECK2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,88,113,10 + CONTROL "Enable (Win2k/XP only)",IDC_TRANS_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,122,99,10 + CONTROL "Slider1",IDC_TRANS_SLIDER,"msctls_trackbar32", + TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,6,140,119,10 + CONTROL "color",IDC_OVERLAYCOLOR,"Button",BS_OWNERDRAW | + WS_TABSTOP,146,23,40,10 + PUSHBUTTON "default",IDC_DEFOVERLAYCOLOR,190,23,40,10 + CONTROL "Set desktop to color",IDC_SETDESKTOPCOLOR,"Button", + BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,146,76,82,11 + COMBOBOX IDC_THREAD_PRIORITY,144,138,86,65,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Projection zones...",IDC_L_PROJZONES,5,169,78,14,NOT + WS_VISIBLE + GROUPBOX "Windowed settings",IDC_STATIC,0,0,137,104 + LTEXT "Lower framerate",IDC_STATIC,77,56,53,8 + GROUPBOX "Alpha blending",IDC_STATIC_ALPHA,0,107,137,49 + LTEXT "Total",IDC_STATIC_TRANS_TOTAL,5,133,17,8 + LTEXT "None",IDC_STATIC_TRANS_NONE,108,133,18,8 + GROUPBOX "Laser",IDC_L_FRAME,0,158,232,56,NOT WS_VISIBLE + GROUPBOX "Overlay mode",IDC_STATIC,140,0,93,91 + CONTROL "Overlay mode",IDC_BKGND_RENDER,"Button",BS_AUTOCHECKBOX | + BS_MULTILINE | WS_TABSTOP,145,9,82,11 + LTEXT "Note that the overlay color must be carefully selected at non-32bpp color depths.", + IDC_STATIC,148,41,75,33 + GROUPBOX "Priority",IDC_STATIC,140,107,93,49 + LTEXT "Render thread priority:",IDC_STATIC,145,122,70,8 + CONTROL "Suppress laser-related messages",IDC_L_SUPPRESS_DIALOGS, + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP, + 99,188,119,10 + CONTROL "Suppress laser output when Winamp or AVS/Laser is not active", + IDC_L_ACTIVEOUTPUT,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,5,198,216,10 + CONTROL "Suppress laser output",IDC_L_SUPPRESS_OUTPUT,"Button", + BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,5,187,84, + 10 + CONTROL "Sync with laser (no call to DBStatus)",IDC_L_SYNC, + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP, + 90,171,130,10 + GROUPBOX "SMP support",IDC_THREADSBORDER,1,160,232,29 + CONTROL "Experimental multiprocessor support:",IDC_CHECK4,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,8,171,130,10 + EDITTEXT IDC_EDIT1,139,170,28,12,ES_AUTOHSCROLL + LTEXT "threads",IDC_THREADS,170,172,24,8 +END + +IDD_CFG_PARTS DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "enabled",IDC_LEFT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,0,41,10 + CONTROL "color",IDC_LC,"Button",BS_OWNERDRAW | WS_TABSTOP,43,0, + 40,10 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,21,130,16 + CONTROL "Slider1",IDC_SLIDER3,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,47,130,16 + CONTROL "Onbeat sizechange enabled.",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,9,75,107,10 + CONTROL "Slider1",IDC_SLIDER4,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,84,130,16 + CONTROL "Replace",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,5,114,43,10 + CONTROL "Additive",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,51,114, + 41,10 + CONTROL "50/50",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,93,114,35, + 10 + CONTROL "Default render blend mode",IDC_RADIO4,"Button", + BS_AUTORADIOBUTTON,5,124,99,9 + GROUPBOX "Distance from center",IDC_STATIC,0,13,137,32 + GROUPBOX "Particle size",IDC_STATIC,0,40,137,30 + GROUPBOX "Particle size (onbeat)",IDC_STATIC,0,65,137,45 + GROUPBOX "Blending",IDC_STATIC,0,105,137,32 +END + +IDD_CFG_ROTBLT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,10,128,15 + CONTROL "Enable on-beat change",IDC_CHECK6,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,5,28,90,10 + CONTROL "Slider1",IDC_SLIDER6,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,37,128,13 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,78,128,15 + CONTROL "Enable on-beat reversal",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,7,107,91,10 + CONTROL "Slider1",IDC_SLIDER5,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,115,128,15 + CONTROL "Blend blitter",IDC_BLEND,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,147,53,10 + GROUPBOX "Zoom",IDC_STATIC,0,0,137,146 + LTEXT "Zooming in",IDC_STATIC,8,52,36,8 + LTEXT "Zooming out",IDC_STATIC,88,52,40,8 + GROUPBOX "Rotation",IDC_STATIC,0,69,137,77 + LTEXT "Rotating Left",IDC_STATIC,7,96,42,8 + LTEXT "Rotating Right",IDC_STATIC,83,96,46,8 + LTEXT "Fast reversal",IDC_STATIC,8,132,41,8 + LTEXT "Slow reversal",IDC_STATIC,83,132,43,8 + CONTROL "Bilinear filtering",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,55,147,63,10 +END + +IDC_CFG_SVP DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + GROUPBOX "SVP/UVS library",IDC_STATIC,0,0,233,34 + COMBOBOX IDC_COMBO1,4,12,225,222,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + +IDD_CFG_COLORFADE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable colorfade",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,69,10 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,0,11,100,14 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,0,28,100,14 + CONTROL "Slider1",IDC_SLIDER3,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,0,46,100,14 + CONTROL "Onbeat Randomize",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,9,79,73,10 + CONTROL "OnBeat Change",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,67,67,10 + CONTROL "Slider1",IDC_SLIDER4,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,7,90,100,14 + CONTROL "Slider1",IDC_SLIDER5,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,7,107,100,14 + CONTROL "Slider1",IDC_SLIDER6,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,7,125,100,14 +END + +IDD_CFG_CONTRASTENHANCE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Off",IDC_OFF,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,0,0,25,10 + CONTROL "Below",IDC_BELOW,"Button",BS_AUTORADIOBUTTON,0,10,35,10 + CONTROL "Above",IDC_ABOVE,"Button",BS_AUTORADIOBUTTON,0,20,37,10 + CONTROL "Near",IDC_NEAR,"Button",BS_AUTORADIOBUTTON,0,30,31,10 + CONTROL "Slider1",IDC_DISTANCE,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,36,29,101,13 + CONTROL "color",IDC_LC,"Button",BS_OWNERDRAW | WS_TABSTOP,0,46, + 26,10 + PUSHBUTTON "->",IDC_BUTTON1,28,46,17,10 + CONTROL "outcolor",IDC_LC2,"Button",BS_OWNERDRAW | WS_TABSTOP,47, + 46,37,10 +END + +IDD_CFG_ROTSTAR DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_NUMCOL,53,6,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW,6,21,127,11 + GROUPBOX "Colors",-1,0,0,137,36 + LTEXT "Cycle through ",-1,7,8,46,8 + LTEXT "colors (max 16)",-1,77,8,48,8 +END + +IDD_CFG_OSCRING DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,4,10,128,15 + CONTROL "Oscilliscope",IDC_OSC,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,8,56,53,10 + CONTROL "Spectrum",IDC_SPEC,"Button",BS_AUTORADIOBUTTON,65,56,46, + 10 + CONTROL "Left Channel",IDC_LEFTCH,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,8,68,56,10 + CONTROL "Right Channel",IDC_RIGHTCH,"Button",BS_AUTORADIOBUTTON, + 8,78,61,10 + CONTROL "Center Channel",IDC_MIDCH,"Button",BS_AUTORADIOBUTTON,8, + 88,65,10 + CONTROL "Left",IDC_TOP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,86,68,28,10 + CONTROL "Right",IDC_BOTTOM,"Button",BS_AUTORADIOBUTTON,86,78,33, + 10 + CONTROL "Center",IDC_CENTER,"Button",BS_AUTORADIOBUTTON,86,88,37, + 10 + EDITTEXT IDC_NUMCOL,53,107,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,6,122, + 127,11 + GROUPBOX "Ring size",-1,0,0,137,42 + GROUPBOX "Ring source and position",-1,0,44,137,57 + GROUPBOX "Colors",-1,0,101,137,36 + LTEXT "Cycle through ",-1,7,109,46,8 + LTEXT "colors (max 16)",-1,77,109,48,8 + LTEXT "Small",-1,8,29,18,8 + LTEXT "Large",-1,106,30,19,8 +END + +IDD_GCFG_PRESET DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + COMBOBOX IDC_COMBO1,5,11,64,203,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "save to hotkey",IDC_BUTTON1,5,26,56,14 + PUSHBUTTON "load from hotkey",IDC_BUTTON2,66,26,56,14 + CONTROL "Randomly switch presets",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,180,93,10 + EDITTEXT IDC_EDIT1,38,191,21,12,ES_AUTOHSCROLL | ES_NUMBER + PUSHBUTTON "All",IDC_BUTTON3,0,161,233,15,BS_LEFT + GROUPBOX "Hotkeys",IDC_STATIC,0,0,135,112 + LTEXT "Note: you can load hotkey settings in the render window by hitting the hotkey. \n\nYou can save hotkey settings in the render window by holding control and hitting the hotkey.", + IDC_STATIC,5,49,114,57 + LTEXT "seconds",IDC_STATIC,61,193,28,8 + LTEXT "Every",IDC_STATIC,15,193,19,8 + LTEXT "Preset (sub) directory to use for random/cycle:", + IDC_STATIC,0,150,146,8 + CONTROL "Prompt to save unsaved presets when loading other presets", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,124, + 204,10 +END + +IDD_CFG_SCAT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable scatter effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,81,10 +END + +IDD_CFG_DOTGRID DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_NUMCOL,53,6,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,6,21, + 127,11 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,16,47,85,13 + PUSHBUTTON "zero",IDC_BUTTON1,103,50,28,10 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,16,65,85,13 + PUSHBUTTON "zero",IDC_BUTTON3,103,68,28,10 + CONTROL "Replace",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,5,99,43,10 + CONTROL "Additive",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,51,99, + 41,10 + CONTROL "50/50",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,93,99,35, + 10 + CONTROL "Default render blend mode",IDC_RADIO4,"Button", + BS_AUTORADIOBUTTON,5,109,99,10 + EDITTEXT IDC_EDIT1,44,125,20,12,ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Colors",IDC_STATIC,0,0,137,36 + LTEXT "Cycle through ",IDC_STATIC,7,8,46,8 + LTEXT "colors (max 16)",IDC_STATIC,77,8,48,8 + LTEXT "Dot spacing: ",IDC_STATIC,0,127,43,8 + LTEXT "pixels",IDC_STATIC,67,127,18,8 + GROUPBOX "Grid movement",IDC_STATIC,0,37,137,52 + LTEXT "X",IDC_STATIC,8,50,8,8 + LTEXT "Y",IDC_STATIC,8,69,8,8 + GROUPBOX "Blending",IDC_STATIC,0,90,137,34 +END + +IDD_CFG_STACK DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Save framebuffer",IDC_SAVEFB,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,5,7,70,10 + CONTROL "Restore framebuffer",IDC_RESTFB,"Button", + BS_AUTORADIOBUTTON,5,17,78,10 + CONTROL "Alternate Save/Restore",IDC_RADIO1,"Button", + BS_AUTORADIOBUTTON,5,28,91,10 + CONTROL "Alternate Restore/Save",IDC_RADIO7,"Button", + BS_AUTORADIOBUTTON,5,38,91,10 + PUSHBUTTON "Nudge parity",IDC_BUTTON2,100,31,50,14 + COMBOBOX IDC_COMBO1,32,53,74,90,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Replace",IDC_RSTACK_BLEND1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,12,79,43,10 + CONTROL "50/50",IDC_RSTACK_BLEND2,"Button",BS_AUTORADIOBUTTON,12, + 89,35,10 + CONTROL "Additive",IDC_RSTACK_BLEND3,"Button",BS_AUTORADIOBUTTON, + 12,99,41,10 + CONTROL "Every other pixel",IDC_RSTACK_BLEND4,"Button", + BS_AUTORADIOBUTTON,12,109,68,10 + CONTROL "Every other line",IDC_RSTACK_BLEND6,"Button", + BS_AUTORADIOBUTTON,12,118,65,10 + CONTROL "Subtractive 1",IDC_RSTACK_BLEND5,"Button", + BS_AUTORADIOBUTTON,12,128,58,10 + CONTROL "Subtractive 2",IDC_RSTACK_BLEND10,"Button", + BS_AUTORADIOBUTTON,12,138,58,10 + CONTROL "Xor",IDC_RSTACK_BLEND7,"Button",BS_AUTORADIOBUTTON,12, + 148,27,10 + CONTROL "Maximum",IDC_RSTACK_BLEND8,"Button",BS_AUTORADIOBUTTON, + 12,158,45,10 + CONTROL "Minimum",IDC_RSTACK_BLEND9,"Button",BS_AUTORADIOBUTTON, + 12,168,43,10 + CONTROL "Multiply",IDC_RSTACK_BLEND11,"Button", + BS_AUTORADIOBUTTON,12,178,39,10 + CONTROL "Adjustable:",IDC_RSTACK_BLEND12,"Button", + BS_AUTORADIOBUTTON,12,188,51,10 + CONTROL "Slider2",IDC_BLENDSLIDE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,62,188,111,11 + PUSHBUTTON "Clear buffer",IDC_BUTTON1,99,11,50,14 + GROUPBOX "Blending",IDC_STATIC,8,68,172,138 + LTEXT "Buffer:",IDC_STATIC,8,55,22,8 +END + +IDD_DIALOG2 DIALOGEX 0, 0, 205, 150 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About AVS" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Close",IDOK,77,129,50,14 + LTEXT "version string",IDC_VERSTR,7,7,191,8 + LTEXT "Copyright (C) 1998-2023 Winamp SA",IDC_STATIC,7,16,191,8 + CTEXT "Justin Frankel, Francis Gastellu, Christophe Thibault\r\nBrennan Underwood && mig", + IDC_STATIC,22,85,168,19 + LTEXT "Portions Copyright (C) 2010 Cockos Incorporated\r\r\nThis software is BSD-licensed open source.", + IDC_STATIC,7,26,191,26 + CTEXT "You are welcome to use AVS at parties, clubs, concerts, and whatnot. Just give credit where credit is due.", + IDC_STATIC,7,54,191,17 + LTEXT "Love,",IDC_STATIC,7,74,19,8 + CTEXT "Special thanks to Steven Wittens and Tom Holden for their contributions.", + IDC_STATIC,7,107,191,19 +END + +IDD_CFG_WATER DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Water effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,79,10 +END + +IDD_CFG_COMMENT DIALOGEX 0, 0, 233, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT1,0,0,233,214,ES_MULTILINE | ES_AUTOVSCROLL | + ES_WANTRETURN | WS_VSCROLL +END + +IDD_CFG_BRIGHTNESS DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Brightness filter",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,87,10 + CONTROL "Slider1",IDC_RED,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,25,13,97,13 + PUSHBUTTON "><",IDC_BRED,125,12,12,14 + CONTROL "Slider1",IDC_GREEN,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,25,28,97,13 + PUSHBUTTON "><",IDC_BGREEN,125,28,12,14 + CONTROL "Slider1",IDC_BLUE,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,25,44,97,13 + PUSHBUTTON "><",IDC_BBLUE,125,44,12,14 + CONTROL "Dissociate RGB values",IDC_DISSOC,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,60,89,10 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,71,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,81,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,92, + 55,10 + CONTROL "Exclude color range",IDC_EXCLUDE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,103,79,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,0,114, + 29,13 + CONTROL "Slider1",IDC_DISTANCE,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,31,114,106,13 + LTEXT "Red",IDC_STATIC,0,15,14,8 + LTEXT "Blue",IDC_STATIC,0,47,15,8 + LTEXT "Green",IDC_STATIC,0,31,20,8 +END + +IDD_CFG_INTERLEAVE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Interleave effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,91,10 + CONTROL "Slider1",IDC_X,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,0,12,137,13 + CONTROL "Slider1",IDC_Y,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,0,27,137,13 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,0,43, + 137,13 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,58,43,10 + CONTROL "50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,42,58,35,10 + CONTROL "Add",IDC_ADDITIVE,"Button",BS_AUTORADIOBUTTON,77,58,29, + 10 + CONTROL "OnBeat",IDC_CHECK8,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,70,40,10 + CONTROL "Slider1",IDC_X2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,0,83,137,13 + CONTROL "Slider1",IDC_Y2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,0,98,137,13 + CONTROL "Slider1",IDC_X3,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,41,112,95,13 + LTEXT "Duration",IDC_STATIC,3,115,32,8 +END + +IDD_CFG_GRAIN DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Grain filter",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,71,10 + CONTROL "Slider1",IDC_MAX,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_BOTH | WS_BORDER | WS_TABSTOP,0,12,137,13 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,28,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,38,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,49, + 55,10 + CONTROL "Static grain",IDC_STATGRAIN,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,60,51,10 +END + +IDD_CFG_CLEAR DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Clear screen",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,79,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,0,15, + 137,13 + CONTROL "First frame only",IDC_CLEARFIRSTFRAME,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,30,63,10 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,41,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,51,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,61, + 55,10 + CONTROL "Default render blend mode",IDC_DEFRENDBLEND,"Button", + BS_AUTORADIOBUTTON,0,71,99,10 +END + +IDD_CFG_MIRROR DIALOGEX 0, 0, 245, 213 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Mirror effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,77,10 + CONTROL "Static",IDC_STAT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,0,20,34,10 + CONTROL "OnBeat random",IDC_ONBEAT,"Button",BS_AUTORADIOBUTTON,0, + 29,65,10 + CONTROL "Copy Top to Bottom",IDC_HORIZONTAL1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,3,44,79,10 + CONTROL "Copy Bottom to Top",IDC_HORIZONTAL2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,3,54,88,9 + CONTROL "Copy Left to Right",IDC_VERTICAL1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,3,63,88,10 + CONTROL "Copy Right to Left",IDC_VERTICAL2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,3,73,98,10 + CONTROL "Smooth transitions",IDC_SMOOTH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,90,73,10 + CONTROL "Slider1",IDC_SLOWER,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_BORDER | WS_TABSTOP,0,103,137,11 + GROUPBOX "",IDC_STATIC,0,36,137,51 + LTEXT "Faster",IDC_STATIC,0,114,20,8 + LTEXT "Slower",IDC_STATIC,115,114,22,8 +END + +IDD_CFG_STARFIELD DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Starfield",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,65,10 + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,13,137,11 + CONTROL "Slider2",IDC_NUMSTARS,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,32,137,11 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,52,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,62,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,72, + 55,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,100,57, + 37,15 + CONTROL "OnBeat Speed changes",IDC_ONBEAT2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,82,92,10 + CONTROL "Slider1",IDC_SPDCHG,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,93,137,11 + CONTROL "Slider2",IDC_SPDDUR,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,112,137,11 + LTEXT "Fast",IDC_STATIC,123,23,14,8 + LTEXT "Slow",IDC_STATIC,0,23,16,8 + LTEXT "More stars",IDC_STATIC,103,42,34,8 + LTEXT "Fewer stars",IDC_STATIC,0,42,37,8 + LTEXT "Faster",IDC_STATIC,117,103,20,8 + LTEXT "Slower",IDC_STATIC,0,103,22,8 + LTEXT "Longer",IDC_STATIC,114,122,23,8 + LTEXT "Shorter",IDC_STATIC,0,122,24,8 +END + +IDD_CFG_TEXT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Text",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,1,51,10 + CONTROL "OnBeat",IDC_ONBEAT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,11,40,10 + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,57,1,102,11 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,21,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,42,21,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,103, + 21,55,10 + CONTROL "Color",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,5, + 45,32,11 + CONTROL "Outline/Shadow color",IDC_DEFOUTCOL,"Button", + BS_OWNERDRAW | WS_TABSTOP,5,76,109,11 + PUSHBUTTON "Choose font",IDC_CHOOSEFONT,43,45,57,11 + CONTROL "Random",IDC_RANDOMPOS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,6,113,43,10 + CONTROL "Left",IDC_HLEFT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,14,133,28,10 + CONTROL "Center",IDC_HCENTER,"Button",BS_AUTORADIOBUTTON,14,143, + 33,10 + CONTROL "Right",IDC_HRIGHT,"Button",BS_AUTORADIOBUTTON,14,154,29, + 10 + CONTROL "Slider1",IDC_HSHIFT,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,8,165,37,10 + PUSHBUTTON "><",IDC_HRESET,48,166,9,9 + CONTROL "Top",IDC_VTOP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,71,135,29,10 + CONTROL "Center",IDC_VCENTER,"Button",BS_AUTORADIOBUTTON,71,146, + 33,10 + CONTROL "Bottom",IDC_VBOTTOM,"Button",BS_AUTORADIOBUTTON,71,157, + 34,10 + CONTROL "Slider1",IDC_VSHIFT,"msctls_trackbar32",TBS_VERT | + TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,112,130,9,35 + PUSHBUTTON "><",IDC_VRESET,112,166,9,9 + CONTROL "insert blanks",IDC_BLANKS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,165,191,55,10 + CONTROL "Slider1",IDC_OUTLINESIZE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,85,89,42,9 + CONTROL "Plain",IDC_PLAIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,5,62,29,10 + CONTROL "Outlined",IDC_OUTLINE,"Button",BS_AUTORADIOBUTTON,37,62, + 39,10 + CONTROL "Shadowed",IDC_SHADOW,"Button",BS_AUTORADIOBUTTON,81,62, + 46,10 + CONTROL "random ordering",IDC_RANDWORD,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,98,191,67,10 + EDITTEXT IDC_EDIT,0,202,233,12,ES_AUTOHSCROLL + GROUPBOX "Horizontal",IDC_STATIC,6,124,56,55,WS_GROUP + LTEXT "Fast",IDC_STATIC,61,11,14,8 + LTEXT "Slow",IDC_STATIC,140,11,16,8 + GROUPBOX "Vertical",IDC_STATIC,65,124,61,55,WS_GROUP + LTEXT "Text to display (';' separated) :",IDC_STATIC,0,191,94, + 8 + GROUPBOX "Text positioning",IDC_STATIC,0,103,138,83 + GROUPBOX "Text style",IDC_STATIC,0,34,138,68 + LTEXT "Outline/Shadow amount:",IDC_STATIC,5,89,80,8 + LTEXT "In the text, one can use $(title) to get the current track title, $(title:n) to get the title with playlist entry number, $(title:32) to get the first 32 characters of the title, $(title:n32) to get the first 32 characters of the title+track number. ", + IDC_STATIC,142,38,86,72 + LTEXT "Also of use, $(reg00) or $(reg00:1.3) (formats like 2.000), and $(playpos) and $(playlen) and $(playpos.1) and $(playpos.3). Ok so this needs better explanation, but that'll come later.", + IDC_STATIC,142,115,86,64 +END + +IDD_CFG_BUMP DIALOG 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Enable Bump",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,56,10 + CONTROL "Invert depth",IDC_INVERTDEPTH,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,10,54,10 + CONTROL "Slider1",IDC_DEPTH,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,58,11,79,11 + CONTROL "Show Dot",IDC_DOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,20,47,10 + LTEXT "Flat",IDC_STATIC,61,22,12,8 + LTEXT "Bumpy",IDC_STATIC,115,22,22,8 + LTEXT "Light position:",IDC_STATIC,0,38,44,8 + LTEXT "init",IDC_STATIC,0,63,10,8 + EDITTEXT IDC_CODE3,24,52,209,33,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + PUSHBUTTON "expression help",IDC_HELPBTN,52,36,71,12 + EDITTEXT IDC_CODE1,24,87,209,48,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_CODE2,24,136,209,40,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + COMBOBOX IDC_COMBO1,52,179,85,56,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,148,0,43,10 + CONTROL "OnBeat",IDC_ONBEAT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,198,40,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,148,9,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,148, + 19,55,10 + CONTROL "Slider2",IDC_BEATDUR,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,44,196,67,11 + CONTROL "Slider1",IDC_DEPTH2,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,114,196,67,11 + LTEXT "Bumpy",IDC_STATIC,159,207,22,8 + LTEXT "Flat",IDC_STATIC,117,207,12,8 + LTEXT "Longer",IDC_STATIC,84,207,23,8 + LTEXT "Shorter",IDC_STATIC,44,207,24,8 + LTEXT "frame",IDC_STATIC,0,108,18,8 + LTEXT "beat",IDC_STATIC,1,151,15,8 + LTEXT "Depth buffer :",IDC_STATIC,0,181,44,8 +END + +IDD_CFG_MOSAIC DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Mosaic",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,65,10 + CONTROL "Slider1",IDC_QUALITY,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,13,137,11 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,33,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,43,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,53, + 55,10 + CONTROL "OnBeat",IDC_ONBEAT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,63,40,10 + CONTROL "Slider1",IDC_QUALITY2,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,74,137,11 + CONTROL "Slider2",IDC_BEATDUR,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,93,137,11 + LTEXT "Smaller squares",IDC_STATIC,87,23,50,8 + LTEXT "Bigger squares",IDC_STATIC,0,23,48,8 + LTEXT "Smaller",IDC_STATIC,113,84,24,8 + LTEXT "Bigger",IDC_STATIC,0,84,21,8 + LTEXT "Longer",IDC_STATIC,114,103,23,8 + LTEXT "Shorter",IDC_STATIC,0,103,24,8 +END + +IDD_CFG_WATERBUMP DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Water bump effect",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,99,10 + CONTROL "Slider1",IDC_DAMP,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,5,21,130,12 + CONTROL "Random drop position",IDC_RANDOM_DROP,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,2,51,85,10 + CONTROL "Left",IDC_DROP_LEFT,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,6,72,28,10 + CONTROL "Center",IDC_DROP_CENTER,"Button",BS_AUTORADIOBUTTON,46, + 72,37,10 + CONTROL "Right",IDC_DROP_RIGHT,"Button",BS_AUTORADIOBUTTON,95,72, + 33,10 + CONTROL "Top",IDC_DROP_TOP,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,6,84,29,10 + GROUPBOX "Drop position",-1,0,61,137,36 + CONTROL "Middle",IDC_DROP_MIDDLE,"Button",BS_AUTORADIOBUTTON,46, + 84,37,10 + CONTROL "Bottom",IDC_DROP_BOTTOM,"Button",BS_AUTORADIOBUTTON,95, + 84,38,10 + CONTROL "Slider1",IDC_DEPTH,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,5,108,56,12 + CONTROL "Slider1",IDC_RADIUS,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,74,108,58,12 + LTEXT "Thicker",-1,3,34,25,8 + LTEXT "Fluid",-1,118,34,16,8 + GROUPBOX "Water density",-1,0,11,137,36 + LTEXT "Less",-1,3,120,16,8 + LTEXT "More",-1,44,120,17,8 + GROUPBOX "Drop depth",-1,0,98,67,36 + LTEXT "Small",-1,75,120,18,8 + LTEXT "Big",-1,120,120,11,8 + GROUPBOX "Drop radius",-1,70,98,67,36 +END + +IDD_CFG_AVI DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + COMBOBOX OBJ_COMBO,0,12,233,92,CBS_DROPDOWNLIST | CBS_SORT | + CBS_UPPERCASE | WS_VSCROLL | WS_TABSTOP + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,29,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,39,61,10 + CONTROL "Blend 50/50 + OnBeat Additive",IDC_ADAPT,"Button", + BS_AUTORADIOBUTTON,0,59,115,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,49, + 55,10 + CONTROL "Slider1",IDC_PERSIST,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,6,79,222,19 + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,6,121,222,19 + CONTROL "Enable AVI stream",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,74,10 + GROUPBOX "Beat persistance",IDC_PERSIST_TITLE,0,70,233,31 + GROUPBOX "Speed",IDC_STATIC,0,102,233,43 + LTEXT "Faster",IDC_STATIC,6,112,20,8 + LTEXT "Slower",IDC_STATIC,206,112,22,8 +END + +IDD_CFG_UNKN DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT1,0,0,233,31,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY | NOT WS_TABSTOP +END + +IDD_CFG_BPM DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable BPM Customizer",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,137,10 + CONTROL "Arbitrary",IDC_ARBITRARY,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,14,41,10 + CONTROL "Slider1",IDC_ARBVAL,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,38,14,65,11 + CONTROL "Skip",IDC_SKIP,"Button",BS_AUTORADIOBUTTON,0,24,30,10 + CONTROL "Slider1",IDC_SKIPVAL,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,38,24,65,11 + CONTROL "Reverse",IDC_INVERT,"Button",BS_AUTORADIOBUTTON,0,34,43, + 10 + LTEXT "First skip",IDC_STATIC,0,45,28,8 + CONTROL "Slider1",IDC_SKIPFIRST,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,38,45,65,11 + CONTROL "Slider1",IDC_IN,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,13,56,124,11 + CONTROL "Slider1",IDC_OUT,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,13,66,124,11 + LTEXT "1s",IDC_ARBTXT,103,15,34,8 + LTEXT "1 beat",IDC_SKIPTXT,103,24,34,8 + LTEXT "In",IDC_STATIC,0,57,8,8 + LTEXT "Out",IDC_STATIC,0,67,12,8 + LTEXT "1 beat",IDC_SKIPFIRSTTXT,103,45,34,8 +END + +IDD_GCFG_BPM DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Standard",IDC_BPMSTD,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,4,11,45,10 + CONTROL "Advanced",IDC_BPMADV,"Button",BS_AUTORADIOBUTTON,4,21, + 49,10 + CONTROL "Slider1",IDC_IN,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,55,11,79,11 + CONTROL "Slider1",IDC_OUT,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,55,21,79,11 + LTEXT "Current BPM :",IDC_CURBPM,8,43,45,8 + CONTROL "Auto-keep",IDC_STICKY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,8,61,49,10 + PUSHBUTTON "Reset",IDC_RESET,7,80,23,10 + PUSHBUTTON "Keep",IDC_STICK,34,80,29,10 + PUSHBUTTON "Readapt",IDC_UNSTICK,66,80,29,10 + GROUPBOX "New Song",IDC_STATIC,8,90,121,32 + CONTROL "Adapt from known BPM",IDC_NEWADAPT,"Button", + BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,99,91,10 + CONTROL "Restart learning from scratch",IDC_NEWRESET,"Button", + BS_AUTORADIOBUTTON,13,109,106,10 + GROUPBOX "Advanced status",IDC_STATIC,4,33,128,92 + LTEXT "",IDC_BPM,55,43,70,8 + LTEXT "Confidence :",IDC_CURCONF,8,52,41,8 + LTEXT "",IDC_CONFIDENCE,55,52,71,8 + GROUPBOX "Beat detection settings",IDC_STATIC,0,0,137,130 + CONTROL "Predict only if bpm has been found",IDC_ONLYSTICKY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,121,10 +END + +IDD_CFG_PICTURE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Picture rendering",IDC_ENABLED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,93,10 + COMBOBOX OBJ_COMBO,1,14,232,223,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,30,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,41,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,52, + 55,10 + CONTROL "Blend 50/50 + OnBeat Additive",IDC_ADAPT,"Button", + BS_AUTORADIOBUTTON,0,63,115,10 + CONTROL "Slider1",IDC_PERSIST,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,6,92,125,19 + CONTROL "Keep aspect ratio",IDC_RATIO,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,2,121,71,10 + CONTROL "On X-Axis",IDC_X_RATIO,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,20,136,47,10 + CONTROL "On Y-Axis",IDC_Y_RATIO,"Button",BS_AUTORADIOBUTTON,20, + 147,47,10 + GROUPBOX "Beat persistance",IDC_PERSIST_TITLE,0,73,137,42 + LTEXT "Fast",IDC_PERSIST_TEXT1,4,83,14,8 + LTEXT "Long",IDC_PERSIST_TEXT2,115,83,17,8 +END + +IDD_CFG_TRANS DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LISTBOX IDC_LIST1,101,0,132,142,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_EDIT1,0,144,233,70,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN + CONTROL "Rectangular coordinates for user defined code", + IDC_CHECK3,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | + WS_TABSTOP,0,114,100,15 + CONTROL "Blend",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,18,34,10 + CONTROL "Source map",IDC_CHECK2,"Button",BS_AUTO3STATE | + WS_TABSTOP,0,0,54,10 + CONTROL "Bilinear filtering",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,27,61,10 + CONTROL "Wrap",IDC_WRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0, + 9,33,10 + PUSHBUTTON "expression help",IDC_BUTTON2,0,97,55,15,BS_MULTILINE + LTEXT "User defined code:",IDC_LABEL1,0,134,61,8 +END + +IDD_CFG_DDM DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT4,25,0,208,39,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT2,25,38,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT3,25,91,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT1,25,144,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + CONTROL "Blend",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,204,34,10 + CONTROL "Bilinear filtering",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,38,204,63,10 + PUSHBUTTON "expression help",IDC_BUTTON1,171,200,62,14,BS_MULTILINE + LTEXT "pixel",IDC_STATIC,0,166,15,8 + LTEXT "frame",IDC_STATIC,0,60,18,8 + LTEXT "beat",IDC_STATIC,0,113,15,8 + LTEXT "init",IDC_STATIC,0,14,10,8 +END + +IDD_CFG_SSCOPE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT4,25,0,208,26,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT2,25,26,208,46,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT3,25,72,208,38,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT1,25,110,208,56,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + CONTROL "Waveform",IDC_WAVE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,5,178,49,10 + CONTROL "Spectrum",IDC_SPEC,"Button",BS_AUTORADIOBUTTON,55,178, + 46,10 + CONTROL "Left",IDC_LEFTCH,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,5,189,28,10 + CONTROL "Center",IDC_MIDCH,"Button",BS_AUTORADIOBUTTON,36,189,37, + 10 + CONTROL "Right",IDC_RIGHTCH,"Button",BS_AUTORADIOBUTTON,76,189, + 33,10 + EDITTEXT IDC_NUMCOL,47,202,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,125,202, + 108,11 + PUSHBUTTON "Load example...",IDC_BUTTON1,176,170,57,14 + LTEXT "Cycle through ",IDC_STATIC,0,204,46,8 + LTEXT "point",IDC_STATIC,0,131,16,8 + LTEXT "frame",IDC_STATIC,1,41,18,8 + LTEXT "colors (max 16)",IDC_STATIC,71,204,48,8 + LTEXT "Source data: ",IDC_STATIC,0,168,44,8 + LTEXT "init",IDC_STATIC,0,9,10,8 + CONTROL "Dots",IDC_DOT,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,166,188,31,10 + CONTROL "Lines",IDC_LINES,"Button",BS_AUTORADIOBUTTON,200,188,33, + 10 + LTEXT "Draw as:",IDC_STATIC,132,188,29,8 + PUSHBUTTON "expression help",IDC_BUTTON2,107,170,67,14,BS_MULTILINE + LTEXT "beat",IDC_STATIC,0,87,15,8 +END + +IDD_CFG_INVERT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Invert colors",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,79,10 +END + +IDD_CFG_ONETONE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Unique tone",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,79,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,0,15, + 137,13 + CONTROL "Invert",IDC_INVERT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,30,34,10 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,41,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,51,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,61, + 55,10 +END + +IDD_CFG_TIMESCOPE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Timescope",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,75,10 + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,0,15, + 137,13 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,30,43,10 + CONTROL "Additive blend",IDC_ADDITIVE,"Button", + BS_AUTORADIOBUTTON,0,40,61,10 + CONTROL "Blend 50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,0,50, + 55,10 + CONTROL "Default render blend",IDC_DEFAULTBLEND,"Button", + BS_AUTORADIOBUTTON,0,59,80,10 + CONTROL "Slider1",IDC_BANDS,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,95,137,11 + LTEXT "Draw 16 bands",IDC_BANDTXT,0,84,137,8 + CONTROL "Left channel",IDC_LEFT,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,0,108,55,10 + CONTROL "Right channel",IDC_RIGHT,"Button",BS_AUTORADIOBUTTON,0, + 118,60,10 + CONTROL "Center channel",IDC_CENTER,"Button",BS_AUTORADIOBUTTON, + 0,128,64,10 +END + +IDD_CFG_INTERF DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable Interferences",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,81,10 + CONTROL "Slider1",IDC_NPOINTS,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,13,67,11 + CONTROL "Slider1",IDC_ALPHA,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,70,12,67,11 + CONTROL "Slider1",IDC_ROTATE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,33,67,11 + CONTROL "Slider1",IDC_DISTANCE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,70,33,67,11 + CONTROL "Separate RGB",IDC_RGB,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,2,51,62,10 + LTEXT "Init Rotation",IDC_STATIC,85,62,40,8 + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,4,78,63,11 + CONTROL "Slider1",IDC_ALPHA2,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,70,78,63,11 + CONTROL "Slider1",IDC_ROTATE2,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,4,99,63,11 + CONTROL "Slider1",IDC_DISTANCE2,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,70,99,63,11 + CONTROL "Replace",IDC_REPLACE,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,2,123,43,10 + CONTROL "Additive",IDC_ADDITIVE,"Button",BS_AUTORADIOBUTTON,51, + 123,41,10 + CONTROL "50/50",IDC_5050,"Button",BS_AUTORADIOBUTTON,100,123,35, + 10 + LTEXT "0",IDC_STATIC,4,23,8,8 + LTEXT "8",IDC_STATIC,55,23,8,8 + CONTROL "OnBeat",IDC_ONBEAT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,2,60,40,10 + LTEXT "N",IDC_STATIC,29,23,8,8 + LTEXT "Alpha",IDC_STATIC,96,22,18,8 + LTEXT "-",IDC_STATIC,76,23,8,8 + LTEXT "+",IDC_STATIC,129,23,8,8 + LTEXT "Rotation",IDC_STATIC,19,43,27,8 + LTEXT "-",IDC_STATIC,5,43,8,8 + LTEXT "+",IDC_STATIC,58,43,8,8 + LTEXT "Distance",IDC_STATIC,91,43,28,8 + LTEXT "-",IDC_STATIC,76,43,8,8 + LTEXT "+",IDC_STATIC,129,43,8,8 + LTEXT "-",IDC_STATIC,8,88,8,8 + LTEXT "+",IDC_STATIC,59,88,8,8 + LTEXT "Speed",IDC_STATIC,24,88,21,8 + LTEXT "Alpha",IDC_STATIC,94,88,18,8 + LTEXT "-",IDC_STATIC,76,88,8,8 + LTEXT "+",IDC_STATIC,125,88,8,8 + LTEXT "Rotation",IDC_STATIC,21,109,27,8 + LTEXT "-",IDC_STATIC,5,109,8,8 + LTEXT "+",IDC_STATIC,58,109,8,8 + LTEXT "Distance",IDC_STATIC,89,109,28,8 + LTEXT "-",IDC_STATIC,76,109,8,8 + LTEXT "+",IDC_STATIC,125,109,8,8 + GROUPBOX "OnBeat",IDC_STATIC,0,70,137,51 + CONTROL "Slider1",IDC_INITROT,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,70,52,67,11 + LTEXT "-",IDC_STATIC,76,62,8,8 + LTEXT "+",IDC_STATIC,129,62,8,8 +END + +IDD_CFG_LIST DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enabled",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,2,56,10 + CONTROL "Clear every frame",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,13,71,10 + COMBOBOX IDC_COMBO2,5,37,101,184,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Slider2",IDC_INSLIDE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,1,51,106,11 + COMBOBOX IDC_COMBO1,121,37,101,168,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Slider2",IDC_OUTSLIDE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,117,51,106,11 + GROUPBOX "Output blending",IDC_FR2,115,27,111,39 + GROUPBOX "Input blending",IDC_FR1,0,27,111,39 + COMBOBOX IDC_CBBUF2,121,50,62,64,CBS_DROPDOWNLIST | CBS_SORT | + NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP + CONTROL "Invert",IDC_INVERT2,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,187,52,34,10 + COMBOBOX IDC_CBBUF1,5,50,62,67,CBS_DROPDOWNLIST | CBS_SORT | NOT + WS_VISIBLE | WS_VSCROLL | WS_TABSTOP + CONTROL "Invert",IDC_INVERT1,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,72,51,34,10 + CONTROL "Enabled OnBeat for",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,89,3,78,9 + EDITTEXT IDC_EDIT1,167,1,19,12,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "frames",IDC_STATIC,190,3,22,8 + CONTROL "Use evaluation override (can change enabled, clear, etc):", + IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,78, + 197,10 + EDITTEXT IDC_EDIT4,25,93,208,26,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT5,25,119,208,71,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + LTEXT "frame",IDC_STATIC,0,148,18,8 + LTEXT "init",IDC_STATIC,0,102,10,8 + PUSHBUTTON "expression help",IDC_BUTTON2,25,193,67,14,BS_MULTILINE +END + +IDD_CFG_LISTROOT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Clear every frame",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,0,71,10 +END + +IDD_CFG_LINEMODE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable mode change",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,2,83,10 + COMBOBOX IDC_COMBO1,5,25,128,184,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + CONTROL "Slider2",IDC_ALPHASLIDE,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,1,39,132,11 + EDITTEXT IDC_EDIT1,58,53,20,12,ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Set blend mode to",IDC_STATIC,0,15,136,37 + LTEXT "Line width (pixels)",IDC_STATIC,0,55,56,8 +END + +IDD_GCFG_TRANSITIONS DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Enable pre-init on random",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,0,96,10 + CONTROL "Enable pre-init on next/prev",IDC_CHECK11,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,10,103,10 + CONTROL "Enable pre-init on load preset",IDC_CHECK10,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,20,107,10 + CONTROL "Low priority pre-init",IDC_CHECK4,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,31,74,10 + CONTROL "Enable transition on random",IDC_CHECK8,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,79,137,10 + CONTROL "Enable transition on next/prev",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,89,137,10 + CONTROL "Enable transition on load preset",IDC_CHECK2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,99,126,10 + CONTROL "Keep rendering old effect",IDC_CHECK9,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,111,126,10 + COMBOBOX IDC_TRANSITION,0,133,137,392,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + CONTROL "Slider1",IDC_SPEED,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,0,149,137,11 + LTEXT "Transition :",IDC_STATIC,0,123,36,8 + LTEXT "Speed",IDC_STATIC,57,160,22,8 + LTEXT "250ms",IDC_STATIC,4,160,30,8 + LTEXT "8s",IDC_STATIC,125,160,9,8 + CONTROL "Only pre-init when in fullscreen",IDC_CHECK5,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,41,111,10 +END + +#if defined(APSTUDIO_INVOKED) || defined(LASER) +#if defined(APSTUDIO_INVOKED) +IDD_CFG_LASER_CONE$(LASER) DIALOGEX 0, 0, 137, 155 +#else +IDD_CFG_LASER_CONE DIALOGEX 0, 0, 137, 155 +#endif +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,11,8,125,11 + CONTROL "Slider1",IDC_SLIDER7,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,11,19,125,11 + CONTROL "Slider1",IDC_SLIDER3,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,44,130,16 + CONTROL "Slider1",IDC_SLIDER4,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,73,130,16 + EDITTEXT IDC_EDIT1,78,98,24,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Dots",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | + WS_TABSTOP,9,110,31,10 + CONTROL "Lines",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,41,110,33, + 10 + EDITTEXT IDC_NUMCOL,53,125,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,6,140, + 127,11 + GROUPBOX "Distance from center",IDC_STATIC,0,0,137,36 + GROUPBOX "Cone size",IDC_STATIC,0,37,137,30 + GROUPBOX "Cone size on beat",IDC_STATIC,0,62,137,35 + LTEXT "Number of segments:",IDC_STATIC,7,100,68,8 + GROUPBOX "Colors",IDC_STATIC,0,119,137,36 + LTEXT "Cycle through ",IDC_STATIC,7,127,46,8 + LTEXT "colors (max 16)",IDC_STATIC,77,127,48,8 + RTEXT "x",IDC_STATIC,3,12,8,8 + RTEXT "y",IDC_STATIC,3,22,8,8 +END +#endif + +#if defined(APSTUDIO_INVOKED) || defined(LASER) +#if defined(APSTUDIO_INVOKED) +IDD_CFG_LASER_BEATHOLD$(LASER) DIALOGEX 0, 0, 245, 214 +#else +IDD_CFG_LASER_BEATHOLD DIALOGEX 0, 0, 245, 214 +#endif +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + GROUPBOX "Hold for (ms)",-1,0,0,137,32 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,8,130,16 + GROUPBOX "Hold on the nth beat",-1,0,39,137,30 + CONTROL "Slider1",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,46,130,16 +END +#endif + +#if defined(APSTUDIO_INVOKED) || defined(LASER) +#if defined(APSTUDIO_INVOKED) +IDD_CFG_LASER_LINE$(LASER) DIALOGEX 0, 0, 137, 137 +#else +IDD_CFG_LASER_LINE DIALOGEX 0, 0, 137, 137 +#endif +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,8,130,16 + CONTROL "Slider1",IDC_SLIDER3,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,34,130,16 + CONTROL "Slider1",IDC_SLIDER4,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,5,63,130,16 + EDITTEXT IDC_EDIT1,103,87,26,12,ES_AUTOHSCROLL + EDITTEXT IDC_NUMCOL,53,107,19,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEFCOL,"Button",BS_OWNERDRAW | WS_TABSTOP,6,122, + 127,11 + GROUPBOX "Colors",IDC_STATIC,0,101,137,36 + LTEXT "Cycle through ",IDC_STATIC,7,109,46,8 + LTEXT "colors (max 16)",IDC_STATIC,77,109,48,8 + GROUPBOX "Distance from center",IDC_STATIC,0,0,137,32 + GROUPBOX "Line size",IDC_STATIC,0,27,137,30 + GROUPBOX "Line size on beat",IDC_STATIC,0,52,137,35 + LTEXT "Beat count for rotation switch: ",IDC_STATIC,3,89,97,8 +END +#endif + +IDD_GCFG_FS DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Use fullscreen overlay mode (current bpp is used)", + IDC_USE_OVERLAY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | + WS_TABSTOP,0,0,214,10 + COMBOBOX IDC_COMBO1,2,42,199,180,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "go",IDC_BUTTON1,2,57,23,13 + EDITTEXT IDC_EDIT1,134,72,20,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Keep fullscreen when deactivated (overlay mode only)", + IDC_CHECK8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,155, + 186,10 + CONTROL "Pixel doubling",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,84,59,10 + CONTROL "Wait for retrace",IDC_CHECK7,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,0,94,65,10 + CONTROL "Page flipping (slower, smoother)",IDC_CHECK4,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,104,115,10 + CONTROL "Fast software bpp conversion",IDC_BPP_CONV,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,114,105,10 + CONTROL "Display framerate counter",IDC_CHECK2,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,125,96,10 + CONTROL "Suppress status text in fullscreen",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,135,119,10 + CONTROL "Suppress title text in fullscreen",IDC_CHECK5,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,145,111,10 + LTEXT "Rendering performance:",IDC_STATIC,0,168,77,8 + CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS | + TBS_TOP | WS_TABSTOP,0,177,137,14 + CONTROL "Doubleclick in main window goes fullscreen (instead of config )", + IDC_CHECK6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,204, + 213,10 + LTEXT "Vertical screen height to render (percent): ", + IDC_STATIC,0,73,133,8 + LTEXT "Higher framerate",IDC_STATIC,0,193,54,9 + LTEXT "Lower framerate",IDC_STATIC,84,194,53,8 + LTEXT "Fullscreen video mode:",IDC_STATIC,0,33,74,8 + LTEXT "Note: fullscreen overlay mode is experimental, and most fullscreen options don't work with it. Expect more soon.", + IDC_STATIC,0,10,234,18 +END + +IDD_CFG_SHIFT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT1,29,0,204,52,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT2,29,52,204,70,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT3,29,123,204,63,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + LTEXT "frame",IDC_STATIC,0,83,18,8 + LTEXT "beat",IDC_STATIC,0,150,15,8 + LTEXT "init",IDC_STATIC,0,20,10,8 + CONTROL "Blend",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,194,34,10 + CONTROL "Bilinear filtering",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,35,194,63,10 + PUSHBUTTON "expression help",IDC_HELPBTN,162,196,71,12 +END + +#if defined(APSTUDIO_INVOKED) || defined(LASER) +#if defined(APSTUDIO_INVOKED) +IDD_CFG_LASER_TRANSFORM$(LASER) DIALOGEX 0, 0, 245, 214 +#else +IDD_CFG_LASER_TRANSFORM DIALOGEX 0, 0, 245, 214 +#endif +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT1,0,161,233,41,ES_MULTILINE | ES_AUTOHSCROLL | + ES_WANTRETURN + CONTROL "Rectangular coordinates",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,204,93,10 + LTEXT "Point:",IDC_STATIC,0,151,19,8 + EDITTEXT IDC_EDIT2,0,10,233,41,ES_MULTILINE | ES_AUTOHSCROLL | + ES_WANTRETURN + LTEXT "Init:",IDC_STATIC,0,0,12,8 + EDITTEXT IDC_EDIT3,0,65,233,41,ES_MULTILINE | ES_AUTOHSCROLL | + ES_WANTRETURN + LTEXT "Frame:",IDC_STATIC,0,52,22,8 + EDITTEXT IDC_EDIT4,0,119,233,28,ES_MULTILINE | ES_AUTOHSCROLL | + ES_WANTRETURN + LTEXT "Beat:",IDC_STATIC,0,108,18,8 +END +#endif + +IDD_CFG_DMOVE DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT4,25,0,208,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT2,25,14,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT3,25,67,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT1,25,120,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT5,108,190,18,12,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_EDIT6,136,190,18,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "Rectangular coordinates",IDC_CHECK3,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,0,204,90,10 + CONTROL "Bilinear filtering",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,94,204,63,10 + PUSHBUTTON "expression help",IDC_BUTTON1,158,200,73,13,BS_MULTILINE + LTEXT "pixel",IDC_STATIC,0,142,15,8 + LTEXT "frame",IDC_STATIC,0,36,18,8 + LTEXT "beat",IDC_STATIC,0,89,15,8 + LTEXT "init",IDC_STATIC,0,3,10,8 + LTEXT "Grid size:",IDC_STATIC,78,192,30,8 + LTEXT "x",IDC_STATIC,128,191,8,8 + CONTROL "Blend",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 0,190,34,10 + CONTROL "Wrap",IDC_WRAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35, + 190,33,10 + COMBOBOX IDC_COMBO1,25,175,85,56,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP + LTEXT "source",IDC_STATIC,0,177,22,8 + CONTROL "No movement (just blend)",IDC_NOMOVEMENT,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,113,176,100,10 + PUSHBUTTON "Load example...",IDC_BUTTON4,158,186,73,13,BS_MULTILINE +END + +IDD_CFG_FASTBRIGHT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Brighten by 2x",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,2,1,61,10 + CONTROL "Darken by 0.5x",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON, + 2,12,64,10 + CONTROL "Do nothing",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,2,23, + 51,10 +END + +IDD_CFG_COLORMOD DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT4,25,0,208,29,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT2,25,29,208,44,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT3,25,73,208,53,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_EDIT1,25,126,208,69,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL + PUSHBUTTON "expression help",IDC_BUTTON1,164,200,69,14,BS_MULTILINE + LTEXT "level",IDC_STATIC,0,156,16,8 + LTEXT "frame",IDC_STATIC,0,45,18,8 + LTEXT "beat",IDC_STATIC,0,93,15,8 + LTEXT "init",IDC_STATIC,0,9,10,8 + PUSHBUTTON "Load example...",IDC_BUTTON4,97,200,63,14 + CONTROL "Recompute every frame",IDC_CHECK1,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,2,199,91,10 +END + +IDD_EVAL_HELP DIALOGEX 0, 0, 311, 228 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "AVS Expression Help" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Close",IDOK,7,210,50,14 + EDITTEXT IDC_EDIT1,12,25,286,177,ES_MULTILINE | ES_READONLY | + WS_VSCROLL + CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,7,7,297,200 +END + +IDD_DEBUG DIALOGEX 0, 0, 360, 185 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "AVS Debug Information" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Close",IDOK,7,162,50,14 + GROUPBOX "Global register (reg00-99) watch",IDC_STATIC,7,7,111, + 130 + LTEXT "Register",IDC_STATIC,13,19,27,8 + LTEXT "Value",IDC_STATIC,47,19,19,8 + EDITTEXT IDC_DEBUGREG_1,13,29,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_2,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | + WS_GROUP,45,29,68,12 + EDITTEXT IDC_DEBUGREG_3,13,42,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_4,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | + WS_GROUP,45,42,68,12 + EDITTEXT IDC_DEBUGREG_5,13,55,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_6,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | + WS_GROUP,45,55,68,12 + EDITTEXT IDC_DEBUGREG_7,13,68,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_8,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | + WS_GROUP,45,68,68,12 + EDITTEXT IDC_DEBUGREG_9,13,81,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_10,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,45,81,68,12 + EDITTEXT IDC_DEBUGREG_11,13,94,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_12,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,45,94,68,12 + EDITTEXT IDC_DEBUGREG_13,13,108,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_14,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,45,108,68,12 + EDITTEXT IDC_DEBUGREG_15,13,121,27,12,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_DEBUGREG_16,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,45,121,68,12 + GROUPBOX "Recent eval code errors:",IDC_STATIC,123,7,230,129 + EDITTEXT IDC_EDIT1,133,19,211,98,ES_MULTILINE | ES_AUTOVSCROLL | + ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL + PUSHBUTTON "clear",IDC_BUTTON1,133,119,31,14 + CONTROL "Log compile errors (use only when developing)", + IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,169,120, + 161,10 + CONTROL "Clear all local variables on all code recompiles (disabling can be useful for development)", + IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,151, + 291,9 + CONTROL "Disable SEH for effects (for APE developers who want to debug their APEs)", + IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,166, + 253,10 + EDITTEXT IDC_EDIT2,7,137,346,12,ES_AUTOHSCROLL | ES_READONLY +END + +IDD_CFG_CHANSHIFT DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + GROUPBOX "Order",-1,5,5,85,135 + CONTROL "GBR",IDC_GBR,"Button",BS_AUTORADIOBUTTON,15,81,35,10 + CONTROL "BRG",IDC_BRG,"Button",BS_AUTORADIOBUTTON,15,50,35,10 + CONTROL "RBG",IDC_RBG,"Button",BS_AUTORADIOBUTTON,15,36,35,10 + CONTROL "BGR",IDC_BGR,"Button",BS_AUTORADIOBUTTON,15,65,35,10 + CONTROL "GRB",IDC_GRB,"Button",BS_AUTORADIOBUTTON,15,95,35,10 + CONTROL "RGB",1023,"Button",BS_AUTORADIOBUTTON,15,20,31,10 + CONTROL "OnBeat Random",IDC_ONBEAT,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,120,65,10 +END + +IDD_CFG_COLORREDUCTION DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + GROUPBOX "Color levels",-1,5,5,220,35 + CONTROL "Slider1",IDC_LEVELS,"msctls_trackbar32",TBS_AUTOTICKS | + WS_TABSTOP,10,15,185,20 + LTEXT "Static",IDC_LEVELTEXT,200,17,20,10 +END + +IDD_CFG_MULT DIALOGEX 0, 0, 231, 216 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + GROUPBOX "Multiplier",-1,5,5,70,117 + CONTROL "Color x 8",IDC_X8,"Button",BS_AUTORADIOBUTTON,10,29,60, + 10 + CONTROL "Color x 4",IDC_X4,"Button",BS_AUTORADIOBUTTON,10,42,60, + 10 + CONTROL "Color x 2",IDC_X2,"Button",BS_AUTORADIOBUTTON,10,55,60, + 10 + CONTROL "Color x 0.5",IDC_X05,"Button",BS_AUTORADIOBUTTON,10,68, + 60,10 + CONTROL "Color x 0.25",IDC_X025,"Button",BS_AUTORADIOBUTTON,10, + 81,60,10 + CONTROL "Color x 0.125",IDC_X0125,"Button",BS_AUTORADIOBUTTON,10, + 94,60,10 + CONTROL "Infinite root",IDC_XI,"Button",BS_AUTORADIOBUTTON,10,16, + 60,10 + CONTROL "Infinite square",IDC_XS,"Button",BS_AUTORADIOBUTTON,10, + 107,60,10 +END + +IDD_CFG_MULTIDELAY DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Beats",1020,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12, + 102,42,12 + CONTROL "Frames",1030,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12, + 114,42,12 + EDITTEXT 1010,12,90,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer A",IDC_STATIC,6,78,54,54 + CONTROL "Beats",1021,"Button",BS_AUTORADIOBUTTON | WS_GROUP,72, + 102,42,12 + CONTROL "Frames",1031,"Button",BS_AUTORADIOBUTTON | WS_GROUP,72, + 114,42,12 + EDITTEXT 1011,72,90,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer B",IDC_STATIC,66,78,54,54 + CONTROL "Beats",1022,"Button",BS_AUTORADIOBUTTON | WS_GROUP,132, + 102,42,12 + CONTROL "Frames",1032,"Button",BS_AUTORADIOBUTTON | WS_GROUP,132, + 114,42,12 + EDITTEXT 1012,132,90,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer C",IDC_STATIC,126,78,54,54 + CONTROL "Beats",1023,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12, + 156,42,12 + CONTROL "Frames",1033,"Button",BS_AUTORADIOBUTTON | WS_GROUP,12, + 168,42,12 + EDITTEXT 1013,12,144,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer D",IDC_STATIC,6,132,54,54 + CONTROL "Beats",1024,"Button",BS_AUTORADIOBUTTON | WS_GROUP,72, + 156,42,12 + CONTROL "Frames",1034,"Button",BS_AUTORADIOBUTTON | WS_GROUP,72, + 168,42,12 + EDITTEXT 1014,72,144,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer E",IDC_STATIC,66,132,54,54 + CONTROL "Beats",1025,"Button",BS_AUTORADIOBUTTON | WS_GROUP,132, + 156,42,12 + CONTROL "Frames",1035,"Button",BS_AUTORADIOBUTTON | WS_GROUP,132, + 168,42,12 + EDITTEXT 1015,132,144,42,12,ES_AUTOHSCROLL + GROUPBOX "Buffer F",IDC_STATIC,126,132,54,54 + CONTROL "Input",1101,"Button",BS_AUTORADIOBUTTON | WS_GROUP,72, + 18,30,12 + CONTROL "Output",1102,"Button",BS_AUTORADIOBUTTON | WS_GROUP,132, + 18,36,12 + CONTROL "Buffer A",1000,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 12,48,48,12 + CONTROL "Buffer B",1001,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 72,48,48,12 + CONTROL "Buffer C",1002,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 132,48,42,12 + CONTROL "Buffer D",1003,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 12,60,48,12 + CONTROL "Buffer E",1004,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 72,60,48,12 + CONTROL "Buffer F",1005,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 132,60,42,12 + GROUPBOX "Active Buffer",IDC_STATIC,6,36,174,42 + GROUPBOX "Mode",IDC_STATIC,6,6,174,30 + CONTROL "Disabled",1100,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 12,18,48,12 + CTEXT "(c) Tom Holden, 2002",IDC_STATIC,6,192,174,12 +END + +IDD_CFG_VIDEODELAY DIALOGEX 0, 0, 245, 214 +STYLE DS_SETFONT | DS_CONTROL | WS_CHILD +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Beats",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,54,18,36, + 12 + CONTROL "Frames",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,90,18,36, + 12 + CONTROL "Enabled",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,6,7,42,8 + EDITTEXT IDC_EDIT1,6,18,43,12,ES_AUTOHSCROLL + CTEXT "(c) Tom Holden, 2002",IDC_STATIC,6,36,120,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DIALOG1, DIALOG + BEGIN + LEFTMARGIN, 2 + RIGHTMARGIN, 376 + BOTTOMMARGIN, 177 + END + + IDD_CFG_BLUR, DIALOG + BEGIN + TOPMARGIN, 1 + END + + IDD_CFG_COLORFADE, DIALOG + BEGIN + BOTTOMMARGIN, 137 + END + + IDD_GCFG_PRESET, DIALOG + BEGIN + BOTTOMMARGIN, 214 + END + + IDD_DIALOG2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 198 + TOPMARGIN, 7 + BOTTOMMARGIN, 143 + END + + IDD_CFG_AVI, DIALOG + BEGIN + RIGHTMARGIN, 137 + BOTTOMMARGIN, 157 + END + + IDD_GCFG_BPM, DIALOG + BEGIN + BOTTOMMARGIN, 136 + END + + IDD_GCFG_TRANSITIONS, DIALOG + BEGIN + RIGHTMARGIN, 137 + BOTTOMMARGIN, 176 + END + + "IDD_CFG_LASER_CONE$(LASER)", DIALOG + BEGIN + BOTTOMMARGIN, 137 + END + + IDD_GCFG_FS, DIALOG + BEGIN + BOTTOMMARGIN, 214 + END + + IDD_EVAL_HELP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 7 + BOTTOMMARGIN, 224 + END + + IDD_DEBUG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 353 + TOPMARGIN, 7 + BOTTOMMARGIN, 176 + END + + IDD_CFG_CHANSHIFT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 224 + TOPMARGIN, 7 + BOTTOMMARGIN, 209 + END + + IDD_CFG_COLORREDUCTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 224 + TOPMARGIN, 7 + BOTTOMMARGIN, 209 + END + + IDD_CFG_MULT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 224 + TOPMARGIN, 7 + BOTTOMMARGIN, 209 + END + + IDD_CFG_MULTIDELAY, DIALOG + BEGIN + RIGHTMARGIN, 180 + BOTTOMMARGIN, 203 + END + + IDD_CFG_VIDEODELAY, DIALOG + BEGIN + RIGHTMARGIN, 216 + BOTTOMMARGIN, 191 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU1 MENUEX +BEGIN + POPUP "&Preset", 65535,MFT_STRING,MFS_ENABLED + BEGIN + MENUITEM "Load...", 1028,MFT_STRING,MFS_ENABLED + MENUITEM "&Save...", 1035,MFT_STRING,MFS_ENABLED + MENUITEM MFT_SEPARATOR + MENUITEM "&New", 1041,MFT_STRING,MFS_ENABLED + END + POPUP "&Edit", 65535,MFT_STRING,MFS_ENABLED + BEGIN + MENUITEM "&Undo", 40009,MFT_STRING,MFS_ENABLED + MENUITEM "&Redo", 40010,MFT_STRING,MFS_ENABLED + END + POPUP "&Settings", 65535,MFT_STRING,MFS_ENABLED + BEGIN + MENUITEM "&Display", 40001,MFT_STRING,MFS_ENABLED + MENUITEM "&Fullscreen", 40007,MFT_STRING,MFS_ENABLED + MENUITEM "&Presets/Hotkeys", 40002,MFT_STRING,MFS_ENABLED + MENUITEM "&Beat Detection", 40005,MFT_STRING,MFS_ENABLED + MENUITEM "Transitio&ns", 40006,MFT_STRING,MFS_ENABLED + MENUITEM MFT_SEPARATOR + MENUITEM "Debug Window...", 40008,MFT_STRING,MFS_ENABLED + END + POPUP "&Help", 65535,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED + BEGIN + MENUITEM "&About...", 40004,MFT_STRING,MFS_ENABLED + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// TEXT +// + +IDR_BUMP_LIGHT_POSITION TEXT "bump_lig.bin" +IDR_COLOR_MODIFIER TEXT "color_mo.bin" +IDR_DYNAMIC_DISTANCE_MODIFIER TEXT "dyn_dist.bin" +IDR_DYNAMIC_MOVEMENT TEXT "dyn_move.bin" +IDR_DYNAMIC_SHIFT TEXT "dyn_shift.bin" +IDR_SUPERSCOPE TEXT "supersco.bin" +IDR_MOVEMENT TEXT "movement.bin" +IDR_EFFECT_LIST TEXT "effect_l.bin" +IDR_HELP_1 TEXT "help_1.bin" +IDR_HELP_2 TEXT "help_2.bin" +IDR_HELP_3 TEXT "help_3.bin" +IDR_HELP_4 TEXT "help_4.bin" + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + + IDS_AVS "Advanced Visualization Studio" + IDS_AVS_EDITOR "AVS Editor" + IDS_DOCK_IN_AVS_EDITOR "Dock in AVS Editor" + IDS_LEARNING "Learning..." + IDS_GOT_IT " Got it!" + IDS_NO_EFFECT_SETTING_SELECTED "No Effect/Setting Selected" + IDS_SHIFT_X "Shift+%d" + IDS_ALL "All" + IDS_SAME_AS_WINAMP "Same as Winamp" + IDS_IDLE "Idle" + IDS_LOWEST "Lowest" + IDS_NORMAL "Normal" + IDS_HIGHEST "Highest" + IDS_NO_SUITABLE_MODES_FOUND "No suitable modes found" +END + +STRINGTABLE +BEGIN + IDS_CHOOSE_A_VIDEO_MODE "Choose a video mode" + IDS_FULLSCREEN "Fullscreen" + IDS_AVS_FILTER_STRING "AVS presets|*.avs|All files|*.*|" + IDS_SAVE_PRESET "Save Preset" + IDS_ERROR_SAVING_PRESET "Error saving preset" + IDS_PRESET_TOO_LARGE "Preset too large" + IDS_OUT_OF_MEMORY "Out of memory" + IDS_EVAL_CODE_STATS_ETC "Eval code stats: %d segments, %d bytes source, %d+%d bytes code, %d bytes data" + IDS_MOVE_HERE "<move here>" + IDS_ERROR_TREE_INCONSISTANCY + "Error: Inconsistency in tree. this should never happen. ACK!" + IDS_CRITICAL_ERROR_OCCURRED "Critical Error Occurred" + IDS_DISPLAY "Display" + IDS_FULLSCREEN_SETTINGS "Fullscreen Settings" + IDS_PRESET_HOTKEYS "Presets / Hotkeys" + IDS_BEAT_DETECTION "Beat Detection" + IDS_TRANSITIONS "Transitions" +END + +STRINGTABLE +BEGIN + IDS_EFFECT_LIST "Effect List" + IDS_PRESETS "Presets" + IDS_LOAD_PRESET "Load Preset" + IDS_STILL_INITIALIZING_PREVIOUS_PRESET + "Still initializing previous preset" + IDS_MAIN "Main" + IDS_ERROR_CREATING_DDRAW_OBJECT "Error creating ddraw object" + IDS_ABOUT_STRING "\t%s\n\tCopyright (C) 1998-2023 Winamp SA\nPortions Copyright (C) 2010 Cockos Incorporated\r\r\nThis software is BSD-licensed open source.\n\nYou are welcome to use\nAVS at parties, clubs, concerts and whatnot.\nJust give credit where credit is due.\n\nLove,\n Justin Frankel, Francis Gastellu, Christophe Thibault,\n Brennan Underwood & mig\n\nSpecial thanks to Steven Wittens and Tom Holden." + IDS_ABOUT_AVS "About AVS" + IDS_REQUIRES_2_9_PLUS "This version of AVS requires Winamp 2.9+" + IDS_AVS_ERROR "AVS Error" + IDS_NO_MMX_SUPPORT "No MMX support found - cannot run AVS!\nGet the non-MMX version." + IDS_SHIFT_ "shift-" + IDS_AVS_CRITICAL_ERROR "AVS Critical Error" +END + +STRINGTABLE +BEGIN + IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_LOAD + "Current preset may have been edited. Save preset before loading?" + IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_NEW + "Current preset may have been edited. Save preset before creating new?" + IDS_AVS_PRESET_MODIFIED "AVS Preset Modified" + IDS_ERROR_CREATING_WINDOW "Error creating window" + IDS_CANNOT_GO_FULLSCREEN_WHEN_VIDEO_PLAYING + "Cannot go fullscreen when video is playing" + IDS_AVS_FULLSCREEN "AVS Fullscreen" + IDS_FULLSCREEN_FPS_ON "fullscreen fps on" + IDS_FULLSCREEN_FPS_OFF "fullscreen fps off" + IDS_RANDOM_PRESETS_ON "random presets on" + IDS_RANDOM_PRESETS_OFF "random presets off" + IDS_SAVED_TO "saved to" + IDS_LOADED_FROM "loaded from" + IDS_ERROR_LOADING_FROM "error loading from" + IDS_BEAT "beat" +END + +STRINGTABLE +BEGIN + IDS_CURRENT "Current" + IDS_BUFFER_X "Buffer %d" + IDS_BUMP_LIGHT_POSITION "Bump Light Position" + IDS_4X_RED_BRIGHTNESS_2X_GREEN_1X_BLUE + "4x Red Brightness, 2x Green, 1x Blue" + IDS_SOLARIZATION "Solarization" + IDS_DOUBLE_SOLARIZATION "Double Solarization" + IDS_INVERSE_SOLARIZATION_SOFT "Inverse Solarization (Soft)" + IDS_BIG_BRIGHTNESS_ON_BEAT "Big Brightness on Beat" + IDS_BIG_BRIGHTNESS_ON_BEAT_INTERPOLATIVE + "Big Brightness on Beat (Interpolative)" + IDS_PULSING_BRIGHTNESS_BEAT_INTERPOLATIVE + "Pulsing Brightness (Beat Interpolative)" + IDS_ROLLING_SOLARIZATION_BEAT_INTERPOLATIVE + "Rolling Solarization (Beat Interpolative)" + IDS_ROLLING_TONE_BEAT_INTERPOLATIVE "Rolling Tone (Beat Interpolative)" + IDS_RANDOM_INVERSE_TONE_SWITCH_ON_BEAT + "Random Inverse Tone (Switch on Beat)" + IDS_COLOR_MODIFIER "Color Modifier" + IDS_DYNAMIC_DISTANCE_MODIFIER "Dynamic Distance Modifier" + IDS_RANDOM_ROTATE "Random Rotate" +END + +STRINGTABLE +BEGIN + IDS_RANDOM_DIRECTION "Random Direction" + IDS_IN_AND_OUT "In and Out" + IDS_UNSPUN_KALEIDA "Unspun Kaleida" + IDS_ROLLING_GRIDLEY "Roiling Gridley" + IDS_6_WAY_OUTSWIRL "6-Way Outswirl" + IDS_WAVY "Wavy" + IDS_SMOOTH_ROTOBLITTER "Smooth Rotoblitter" + IDS_DYNAMIC_MOVEMENT "Dynamic Movement" + IDS_REPLACE "Replace" + IDS_ADDITIVE "Additive" + IDS_MAXIMUM_BLEND "Maximum Blend" + IDS_50_50_BLEND "50/50 Blend" + IDS_SUBTRACTIVE_BLEND_1 "Subtractive Blend 1" + IDS_SUBTRACTIVE_BLEND_2 "Subtractive Blend 2" + IDS_MULTIPLY_BLEND "Multiply Blend" + IDS_ADJUSTABLE_BLEND "Adjustable Blend" +END + +STRINGTABLE +BEGIN + IDS_XOR "XOR" + IDS_MINIMUM_BLEND "Minimum Blend" + IDS_DYNAMIC_SHIFT "Dynamic Shift" + IDS_SPIRAL "Spiral" + IDS_3D_SCOPE_DISH "3D Scope Dish" + IDS_ROTATING_BOW_THING "Rotating Bow Thing" + IDS_VERTICAL_BOUNCING_SCOPE "Vertical Bouncing Scope" + IDS_SPIRAL_GRAPH_FUN "Spiral Graph Fun" + IDS_ALTERNATING_DIAGONAL_SCOPE "Alternating Diagonal Scope" + IDS_VIBRATING_WORM "Vibrating Worm" + IDS_WANDERING_SIMPLE "Wandering Simple" + IDS_FLITTERBUG "Flitterbug" + IDS_SPIROSTAR "Spirostar" + IDS_EXPLODING_DAISY "Exploding Daisy" + IDS_SWIRLIE_DOTS "Swirlie Dots" + IDS_SWEEP "Sweep" +END + +STRINGTABLE +BEGIN + IDS_WHIPLASH_SPIRAL "Whiplash Spiral" + IDS_SUPERSCOPE "Superscope" + IDS_DRAW_X_BANDS "Draw %d bands" + IDS_NONE "none" + IDS_SLIGHT_FUZZIFY "slight fuzzify" + IDS_SHIFT_ROTATE_LEFT "shift rotate left" + IDS_BIG_SWIRL_OUT "big swirl out" + IDS_MEDIUM_SWIRL "medium swirl" + IDS_SUNBURSTER "sunburster" + IDS_SWIRL_TO_CENTER "swirl to center" + IDS_BLOCKY_PARTIAL_OUT "blocky partial out" + IDS_SWIRLING_AROUND_BOTH_WAYS "swirling around both ways at once" + IDS_BUBBLING_OUTWARD "bubbling outward" + IDS_BUBBLING_OUTWARD_WITH_SWIRL "bubbling outward with swirl" + IDS_5_POINTED_DISTRO "5 pointed distro" + IDS_TUNNELING "tunneling" +END + +STRINGTABLE +BEGIN + IDS_BLEEDIN "bleedin'" + IDS_SHIFTED_BIG_SWIRL_OUT "shifted big swirl out" + IDS_PSYCHOTIC_BEAMING_OUTWARD "psychotic beaming outward" + IDS_COSINE_RADIAL_3_WAY "cosine radial 3-way" + IDS_SPINNY_TUBE "spinny tube" + IDS_RADIAL_SWIRLIES "radial swirlies" + IDS_SWILL "swill" + IDS_GRIDLEY "gridley" + IDS_GRAPEVINE "grapevine" + IDS_QUADRANT "quadrant" + IDS_6_WAY_KALAEIDA "6-way kaleida (use wrap!)" + IDS_USER_DEFINED "(user defined)" + IDS_MOVEMENT "Movement" + IDS_IGNORE "Ignore" + IDS_MAXIMUM "Maximum" + IDS_50_50 "50/50" +END + +STRINGTABLE +BEGIN + IDS_EVERY_OTHER_LINE "Every other line" + IDS_EVERY_OTHER_PIXEL "Every other pixel" + IDS_ADJUSTABLE "Adjustable" + IDS_MULTIPLY "Multiply" + IDS_BUFFER "Buffer" + IDS_MINIMUM "Minimum" + IDS_CROSS_DISSOLVE "Cross dissolve" + IDS_RANDOM "Random" + IDS_L_R_PUSH "L/R Push" + IDS_R_L_PUSH "R/L Push" + IDS_T_B_PUSH "T/B Push" + IDS_B_T_PUSH "B/T Push" + IDS_9_RANDOM_BLOCKS "9 Random Blocks" + IDS_SPLIT_L_R_PUSH "Split L/R Push" + IDS_L_R_CENTER_PUSH "L/R to Center Push" + IDS_L_R_CENTER_SQUEEZE "L/R to Center Squeeze" +END + +STRINGTABLE +BEGIN + IDS_L_R_WIPE "L/R Wipe" + IDS_R_L_WIPE "R/L Wipe" + IDS_T_B_WIPE "T/B Wipe" + IDS_B_T_WIPE "B/T Wipe" + IDS_DOT_DISSOLVE "Dot Dissolve" + IDS_LOADING_WAIT "loading [wait]..." + IDS_LOADING "loading..." + IDS_ERROR_LOADING_X "error loading: %s" + IDS_BUILTIN_ID "Built-in ID: %d\r\n" + IDS_CONFIG_SIZE "Config size: %d\r\n" + IDS_GENERAL "General" + IDS_OPERATORS "Operators" + IDS_FUNCTIONS "Functions" + IDS_CONSTANTS "Constants" + IDS_BEATS "beats" + IDS_SUBTRACTIVE_1 "Subtractive 1" +END + +STRINGTABLE +BEGIN + IDS_SUBTRACTIVE_2 "Subtractive 2" + IDS_RENDER_AVI "Render / AVI" + IDS_TRANS_BLITTER_FEEDBACK "Trans / Blitter Feedback" + IDS_TRANS_BLUR "Trans / Blur" + IDS_MISC_CUSTOM_BPM "Misc / Custom BPM" + IDS_TRANS_BRIGHTNESS "Trans / Brightness" + IDS_RENDER_BASS_SPIN "Render / Bass Spin" + IDS_TRANS_BUMP "Trans / Bump" + IDS_TRANS_CHANNEL_SHIFT "Trans / Channel Shift" + IDS_RENDER_CLEAR_SCREEN "Render / Clear Screen" + IDS_TRANS_COLORFADE "Trans / Colorfade" + IDS_TRANS_COLOR_REDUCTION "Trans / Color Reduction" + IDS_TRANS_COLOR_CLIP "Trans / Color Clip" + IDS_MISC_COMMENT "Misc / Comment" + IDS_TRANS_COLOR_MODIFIER "Trans / Color Modifier" + IDS_TRANS_DYNAMIC_DISTANCE_MODIFIER "Trans / Dynamic Distance Modifier" +END + +STRINGTABLE +BEGIN + IDS_TRANS_DYNAMIC_MOVEMENT "Trans / Dynamic Movement" + IDS_RENDER_DOT_FOUNTAIN "Render / Dot Fountain" + IDS_RENDER_DOT_GRID "Render / Dot Grid" + IDS_RENDER_DOT_PLANE "Render / Dot Plane" + IDS_TRANS_FADEOUT "Trans / Fadeout" + IDS_TRANS_FAST_BRIGHTNESS "Trans / Fast Brightness" + IDS_TRANS_GRAIN "Trans / Grain" + IDS_TRANS_INTERFERENCES "Trans / Interferences" + IDS_TRANS_INTERLEAVE "Trans / Interleave" + IDS_TRANS_INVERT "Trans / Invert" + IDS_MISC_SET_RENDER_MODE "Misc / Set render mode" + IDS_TRANS_MIRROR "Trans / Mirror" + IDS_TRANS_MOSAIC "Trans / Mosaic" + IDS_TRANS_MULTI_DELAY "Trans / Multi Delay" + IDS_TRANS_MULTIPLIER "Trans / Multiplier" + IDS_RENDER_ONBEAT_CLEAR "Render / OnBeat Clear" +END + +STRINGTABLE +BEGIN + IDS_TRANS_UNIQUE_TONE "Trans / Unique Tone" + IDS_RENDER_RING "Render / Ring" + IDS_RENDER_OSCILLOSCOPE_STAR "Render / Oscilliscope Star" + IDS_RENDER_MOVING_PARTICLE "Render / Moving Particle" + IDS_RENDER_PICTURE "Render / Picture" + IDS_TRANS_ROTO_BLITTER "Trans / Roto Blitter" + IDS_RENDER_ROTATING_STARS "Render / Rotating Stars" + IDS_TRANS_SCATTER "Trans / Scatter" + IDS_TRANS_DYNAMIC_SHIFT "Trans / Dynamic Shift" + IDS_RENDER_SIMPLE "Render / Simple" + IDS_RENDER_SUPERSCOPE "Render / SuperScope" + IDS_MISC_BUFFER_SAVE "Misc / Buffer Save" + IDS_RENDER_STARFIELD "Render / Starfield" + IDS_RENDER_SVP_LOADER "Render / SVP Loader" + IDS_RENDER_TEXT "Render / Text" + IDS_RENDER_TIMESCOPE "Render / Timescope" +END + +STRINGTABLE +BEGIN + IDS_TRANS_MOVEMENT "Trans / Movement" + IDS_UNKNOWN_RENDER_OBJECT "Unknown Render Object" + IDS_TRANS_VIDEO_DELAY "Trans / Video Delay" + IDS_TRANS_WATER "Trans / Water" + IDS_TRANS_WATER_BUMP "Trans / Water Bump" + IDS_OVERLAY_MODE "Overlay Mode" +END + +STRINGTABLE +BEGIN + 65535 "{BE608673-B723-4a59-9EBA-52DC77109E10}" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/Visualization/vis_avs/resource.h b/Src/Plugins/Visualization/vis_avs/resource.h new file mode 100644 index 00000000..41944089 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/resource.h @@ -0,0 +1,665 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by res.rc +// +#define IDS_AVS 0 +#define IDS_WINAMP_AVS_DISPLAY 1 +#define IDS_AVS_EDITOR 2 +#define IDS_DOCK_IN_AVS_EDITOR 3 +#define IDS_LEARNING 5 +#define IDS_GOT_IT 6 +#define IDS_NO_EFFECT_SETTING_SELECTED 7 +#define IDS_SHIFT_X 8 +#define IDS_ALL 9 +#define IDS_SAME_AS_WINAMP 10 +#define IDS_IDLE 11 +#define IDS_LOWEST 12 +#define IDS_NORMAL 13 +#define IDS_HIGHEST 14 +#define IDS_NO_SUITABLE_MODES_FOUND 15 +#define IDS_CHOOSE_A_VIDEO_MODE 16 +#define IDS_FULLSCREEN 17 +#define IDS_AVS_FILTER_STRING 18 +#define IDS_SAVE_PRESET 19 +#define IDS_ERROR_SAVING_PRESET 20 +#define IDS_PRESET_TOO_LARGE 21 +#define IDS_OUT_OF_MEMORY 22 +#define IDS_EVAL_CODE_STATS_ETC 23 +#define IDS_MOVE_HERE 24 +#define IDS_ERROR_TREE_INCONSISTANCY 25 +#define IDS_CRITICAL_ERROR_OCCURRED 26 +#define IDS_DISPLAY 27 +#define IDS_FULLSCREEN_SETTINGS 28 +#define IDS_PRESET_HOTKEYS 29 +#define IDS_BEAT_DETECTION 30 +#define IDS_TRANSITIONS 31 +#define IDS_EFFECT_LIST 32 +#define IDS_PRESETS 33 +#define IDS_LOAD_PRESET 34 +#define IDS_STILL_INITIALIZING_PREVIOUS_PRESET 35 +#define IDS_MAIN 36 +#define IDS_ERROR_CREATING_DDRAW_OBJECT 37 +#define IDS_ABOUT_STRING 38 +#define IDS_ABOUT_AVS 39 +#define IDS_REQUIRES_2_9_PLUS 40 +#define IDS_AVS_ERROR 41 +#define IDS_NO_MMX_SUPPORT 42 +#define IDS_STRING43 43 +#define IDS_SHIFT_ 43 +#define IDS_AVS_CRITICAL_ERROR 44 +#define IDS_CHANNEL_SHIFT 45 +#define IDS_COLOR_REDUCTION 46 +#define IDS_MULTIPLIER 47 +#define IDS_HOLDEN04_VIDEO_DELAY 48 +#define IDS_HOLDEN05_MULTI_DELAY 49 +#define IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_LOAD 50 +#define IDS_STRING51IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_NEW 51 +#define IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_NEW 51 +#define IDS_AVS_PRESET_MODIFIED 52 +#define IDS_ERROR_CREATING_WINDOW 53 +#define IDS_CANNOT_GO_FULLSCREEN_WHEN_VIDEO_PLAYING 54 +#define IDS_AVS_FULLSCREEN 55 +#define IDS_FULLSCREEN_FPS_ON 56 +#define IDS_FULLSCREEN_FPS_OFF 57 +#define IDS_RANDOM_PRESETS_ON 58 +#define IDS_RANDOM_PRESETS_OFF 59 +#define IDS_SAVED_TO 60 +#define IDS_LOADED_FROM 61 +#define IDS_ERROR_LOADING_FROM 62 +#define IDS_X_BEATX 63 +#define IDS_BEAT 63 +#define IDS_CURRENT 64 +#define IDS_BUFFER_X 65 +#define IDS_BUMP_LIGHT_POSITION 66 +#define IDS_4X_RED_BRIGHTNESS_2X_GREEN_1X_BLUE 67 +#define IDS_SOLARIZATION 68 +#define IDS_DOUBLE_SOLARIZATION 69 +#define IDS_INVERSE_SOLARIZATION_SOFT 70 +#define IDS_BIG_BRIGHTNESS_ON_BEAT 71 +#define IDS_BIG_BRIGHTNESS_ON_BEAT_INTERPOLATIVE 72 +#define IDS_PULSING_BRIGHTNESS_BEAT_INTERPOLATIVE 73 +#define IDS_ROLLING_SOLARIZATION_BEAT_INTERPOLATIVE 74 +#define IDS_ROLLING_TONE_BEAT_INTERPOLATIVE 75 +#define IDS_RANDOM_INVERSE_TONE_SWITCH_ON_BEAT 76 +#define IDS_COLOR_MODIFIER 77 +#define IDS_DYNAMIC_DISTANCE_MODIFIER 78 +#define IDS_RANDOM_ROTATE 79 +#define IDS_RANDOM_DIRECTION 80 +#define IDS_IN_AND_OUT 81 +#define IDS_UNSPUN_KALEIDA 82 +#define IDS_ROLLING_GRIDLEY 83 +#define IDS_6_WAY_OUTSWIRL 84 +#define IDS_WAVY 85 +#define IDS_SMOOTH_ROTOBLITTER 86 +#define IDS_DYNAMIC_MOVEMENT 87 +#define IDS_REPLACE 88 +#define IDS_ADDITIVE 89 +#define IDS_MAXIMUM_BLEND 90 +#define IDS_50_50_BLEND 91 +#define IDS_SUBTRACTIVE_BLEND_1 92 +#define IDS_SUBTRACTIVE_BLEND_2 93 +#define IDS_MULTIPLY_BLEND 94 +#define IDS_ADJUSTABLE_BLEND 95 +#define IDS_XOR 96 +#define IDS_MINIMUM_BLEND 97 +#define IDS_DYNAMIC_SHIFT 98 +#define IDS_SPIRAL 99 +#define IDS_3D_SCOPE_DISH 100 +#define IDD_DIALOG1 101 +#define IDS_ROTATING_BOW_THING 101 +#define IDB_TAB_NORMAL 102 +#define IDS_VERTICAL_BOUNCING_SCOPE 102 +#define IDB_TAB_SELECTED 103 +#define IDD_CFG_SIMPLE 103 +#define IDS_SPIRAL_GRAPH_FUN 103 +#define IDB_TAB_HILITED 104 +#define IDD_CFG_FADE 104 +#define IDS_ALTERNATING_DIAGONAL_SCOPE 104 +#define IDD_CFG_BLT 105 +#define IDS_VIBRATING_WORM 105 +#define IDD_CFG_DOTPLANE 106 +#define IDS_WANDERING_SIMPLE 106 +#define IDD_CFG_OSCSTAR 107 +#define IDS_FLITTERBUG 107 +#define IDD_CFG_NFC 108 +#define IDS_SPIROSTAR 108 +#define IDD_CFG_BLUR 109 +#define IDS_EXPLODING_DAISY 109 +#define IDD_CFG_BSPIN 110 +#define IDS_SWIRLIE_DOTS 110 +#define IDD_GCFG_BEAT 111 +#define IDS_SWEEP 111 +#define IDD_GCFG_DISP 112 +#define IDS_WHIPLASH_SPIRAL 112 +#define IDD_CFG_PARTS 113 +#define IDS_SUPERSCOPE 113 +#define IDD_GCFG_ABOUT 114 +#define IDS_DRAW_X_BANDS 114 +#define IDD_CFG_FILTER 115 +#define IDS_NONE 115 +#define IDD_CFG_ROTBLT 116 +#define IDS_SLIGHT_FUZZIFY 116 +#define IDC_CFG_SVP 117 +#define IDS_SHIFT_ROTATE_LEFT 117 +#define IDD_CFG_COLORFADE 118 +#define IDS_BIG_SWIRL_OUT 118 +#define IDD_CFG_CONTRASTENHANCE 119 +#define IDS_MEDIUM_SWIRL 119 +#define IDD_CFG_ROTSTAR 120 +#define IDS_SUNBURSTER 120 +#define IDD_CFG_OSCRING 121 +#define IDS_SWIRL_TO_CENTER 121 +#define IDD_CFG_TRANS 122 +#define IDB_BITMAP1 122 +#define IDS_BLOCKY_PARTIAL_OUT 122 +#define IDD_GCFG_PRESET 123 +#define IDS_SWIRLING_AROUND_BOTH_WAYS 123 +#define IDD_CFG_SCAT 124 +#define IDS_BUBBLING_OUTWARD 124 +#define IDD_CFG_DOTGRID 125 +#define IDS_BUBBLING_OUTWARD_WITH_SWIRL 125 +#define IDD_CFG_STACK 126 +#define IDS_5_POINTED_DISTRO 126 +#define IDS_TUNNELING 127 +#define IDD_DIALOG2 127 +#define IDD_CFG_WATER 128 +#define IDS_BLEEDIN 128 +#define IDD_CFG_COMMENT 129 +#define IDS_SHIFTED_BIG_SWIRL_OUT 129 +#define IDD_CFG_BRIGHTNESS 130 +#define IDS_PSYCHOTIC_BEAMING_OUTWARD 130 +#define IDD_CFG_INTERLEAVE 131 +#define IDS_COSINE_RADIAL_3_WAY 131 +#define IDD_CFG_GRAIN 132 +#define IDS_SPINNY_TUBE 132 +#define IDD_CFG_CLEAR 133 +#define IDS_RADIAL_SWIRLIES 133 +#define IDD_CFG_BUMP 134 +#define IDS_SWILL 134 +#define IDD_CFG_MIRROR 135 +#define IDS_GRIDLEY 135 +#define IDD_CFG_STARFIELD 136 +#define IDS_GRAPEVINE 136 +#define IDD_CFG_TEXT 137 +#define IDS_QUADRANT 137 +#define IDD_BUMP_HELP 138 +#define IDS_6_WAY_KALAEIDA 138 +#define IDD_CFG_MOSAIC 139 +#define IDS_USER_DEFINED 139 +#define IDD_CFG_WATERBUMP 140 +#define IDR_MENU1 140 +#define IDS_MOVEMENT 140 +#define IDD_CFG_AVI 141 +#define IDS_IGNORE 141 +#define IDD_CFG_UNKN 142 +#define IDS_MAXIMUM 142 +#define IDD_GCFG_TRANS 143 +#define IDS_50_50 143 +#define IDD_CFG_BPM 144 +#define IDS_EVERY_OTHER_LINE 144 +#define IDD_GCFG_BPM 145 +#define IDS_EVERY_OTHER_PIXEL 145 +#define IDD_CFG_PICTURE 146 +#define IDS_ADJUSTABLE 146 +#define IDD_CFG_DDM 147 +#define IDS_MULTIPLY 147 +#define IDD_CFG_SSCOPE 148 +#define IDS_BUFFER 148 +#define IDD_CFG_INVERT 149 +#define IDS_MINIMUM 149 +#define IDD_CFG_ONETONE 150 +#define IDS_CROSS_DISSOLVE 150 +#define IDD_CFG_TIMESCOPE 151 +#define IDS_RANDOM 151 +#define IDD_CFG_LIST 152 +#define IDS_L_R_PUSH 152 +#define IDD_CFG_LISTROOT 153 +#define IDS_R_L_PUSH 153 +#define IDD_CFG_LINEMODE 154 +#define IDS_T_B_PUSH 154 +#define IDD_GCFG_TRANSITIONS 155 +#define IDS_B_T_PUSH 155 +#define IDD_CFG_LASER_CONE 156 +#define IDS_9_RANDOM_BLOCKS 156 +#define IDD_CFG_LASER_BEATHOLD 157 +#define IDS_SPLIT_L_R_PUSH 157 +#define IDD_CFG_LASER_LINE 158 +#define IDS_L_R_CENTER_PUSH 158 +#define IDD_GCFG_FS 159 +#define IDS_L_R_CENTER_SQUEEZE 159 +#define IDD_CFG_INTERF 160 +#define IDS_L_R_WIPE 160 +#define IDD_CFG_SHIFT 161 +#define IDS_R_L_WIPE 161 +#define IDD_CFG_LASER_TRANSFORM 162 +#define IDS_T_B_WIPE 162 +#define IDD_CFG_DMOVE 163 +#define IDS_B_T_WIPE 163 +#define IDD_CFG_FASTBRIGHT 164 +#define IDS_DOT_DISSOLVE 164 +#define IDD_CFG_COLORMOD 165 +#define IDS_LOADING_WAIT 165 +#define IDD_EVAL_HELP 166 +#define IDS_LOADING 166 +#define IDD_DEBUG 167 +#define IDS_ERROR_LOADING_X 167 +#define IDD_CFG_CHANSHIFT 168 +#define IDS_BUILTIN_ID 168 +#define IDD_CFG_COLORREDUCTION 169 +#define IDS_CONFIG_SIZE 169 +#define IDD_CFG_MULT 170 +#define IDS_GENERAL 170 +#define IDD_CFG_MULTIDELAY 171 +#define IDS_OPERATORS 171 +#define IDD_CFG_VIDEODELAY 172 +#define IDS_FUNCTIONS 172 +#define IDS_STRING173 173 +#define IDS_CONSTANTS 173 +#define IDR_BUMP_LIGHT_POSITION 174 +#define IDS_BEAT2 174 +#define IDS_BEATS 174 +#define IDR_COLOR_MODIFIER 175 +#define IDS_SUBTRACTIVE_1 175 +#define IDR_DYNAMIC_DISTANCE_MODIFIER 176 +#define IDS_SUBTRACTIVE_2 176 +#define IDR_DYNAMIC_MOVEMENT 177 +#define IDS_STRING177 177 +#define IDS_RENDER_AVI 177 +#define IDR_DYNAMIC_SHIFT 178 +#define IDS_TRANS_BLITTER_FEEDBACK 178 +#define IDR_SUPERSCOPE 179 +#define IDS_TRANS_BLUR 179 +#define IDR_MOVEMENT 180 +#define IDS_MISC_CUSTOM_BPM 180 +#define IDR_EFFECT_LIST 181 +#define IDS_TRANS_BRIGHTNESS 181 +#define IDR_HELP_1 182 +#define IDS_RENDER_BASS_SPIN 182 +#define IDR_HELP_2 183 +#define IDS_TRANS_BUMP 183 +#define IDR_HELP_3 184 +#define IDS_TRANS_CHANNEL_SHIFT 184 +#define IDR_HELP_4 185 +#define IDS_RENDER_CLEAR_SCREEN 185 +#define IDS_TRANS_COLORFADE 186 +#define IDS_TRANS_COLOR_REDUCTION 187 +#define IDS_TRANS_COLOR_CLIP 188 +#define IDS_MISC_COMMENT 189 +#define IDS_TRANS_COLOR_MODIFIER 190 +#define IDS_TRANS_DYNAMIC_DISTANCE_MODIFIER 191 +#define IDS_TRANS_DYNAMIC_MOVEMENT 192 +#define IDS_RENDER_DOT_FOUNTAIN 193 +#define IDS_RENDER_DOT_GRID 194 +#define IDS_RENDER_DOT_PLANE 195 +#define IDS_TRANS_FADEOUT 196 +#define IDS_TRANS_FAST_BRIGHTNESS 197 +#define IDS_TRANS_GRAIN 198 +#define IDS_TRANS_INTERFERENCES 199 +#define IDS_TRANS_INTERLEAVE 200 +#define IDS_TRANS_INVERT 201 +#define IDS_MISC_SET_RENDER_MODE 202 +#define IDS_TRANS_MIRROR 203 +#define IDS_TRANS_MOSAIC 204 +#define IDS_TRANS_MULTI_DELAY 205 +#define IDS_TRANS_MULTIPLIER 206 +#define IDS_RENDER_ONBEAT_CLEAR 207 +#define IDS_TRANS_UNIQUE_TONE 208 +#define IDS_RENDER_RING 209 +#define IDS_RENDER_OSCILLOSCOPE_STAR 210 +#define IDS_RENDER_MOVING_PARTICLE 211 +#define IDS_RENDER_PICTURE 212 +#define IDS_TRANS_ROTO_BLITTER 213 +#define IDS_RENDER_ROTATING_STARS 214 +#define IDS_TRANS_SCATTER 215 +#define IDS_TRANS_DYNAMIC_SHIFT 216 +#define IDS_RENDER_SIMPLE 217 +#define IDS_RENDER_SUPERSCOPE 218 +#define IDS_MISC_BUFFER_SAVE 219 +#define IDS_RENDER_STARFIELD 220 +#define IDS_RENDER_SVP_LOADER 221 +#define IDS_RENDER_TEXT 222 +#define IDS_RENDER_TIMESCOPE 223 +#define IDS_TRANS_MOVEMENT 224 +#define IDS_UNKNOWN_RENDER_OBJECT 225 +#define IDS_TRANS_VIDEO_DELAY 226 +#define IDS_TRANS_WATER 227 +#define IDS_TRANS_WATER_BUMP 228 +#define IDS_OVERLAY_MODE 229 +#define IDC_EFFECTS 1000 +#define IDC_ENABLED 1001 +#define IDC_FBCLEAR 1002 +#define IDC_DISSOC 1003 +#define IDC_DAMP 1004 +#define OBJ_COMBO 1005 +#define IDC_EFFECTRECT 1006 +#define IDC_BIN 1007 +#define IDC_RRECT 1007 +#define IDC_ADDITIVE 1008 +#define IDC_RADIUS 1009 +#define IDC_REMSEL 1010 +#define IDC_5050 1011 +#define IDC_LIB 1012 +#define IDC_DEFRENDBLEND 1012 +#define IDC_REPLACE 1013 +#define IDC_RANDOM_DROP 1014 +#define IDC_ADD 1015 +#define IDC_LEVELS 1015 +#define IDC_DROP_LEFT 1016 +#define IDC_LEVELTEXT 1016 +#define IDC_ADAPT 1017 +#define IDC_MOVEUP 1018 +#define IDC_GBR 1018 +#define IDC_X8 1018 +#define IDC_RED 1019 +#define IDC_BRG 1019 +#define IDC_X4 1019 +#define IDC_HORIZONTAL1 1020 +#define IDC_RBG 1020 +#define IDC_DROP_CENTER 1021 +#define IDC_BGR 1021 +#define IDC_X05 1021 +#define IDC_PERSIST 1022 +#define IDC_GRB 1022 +#define IDC_X025 1022 +#define IDC_MOVEDOWN 1023 +#define IDC_X0125 1023 +#define IDC_GREEN 1024 +#define IDC_XI 1024 +#define IDC_HORIZONTAL2 1025 +#define IDC_XS 1025 +#define IDC_DROP_RIGHT 1026 +#define IDC_PERSIST_TITLE 1027 +#define IDC_LOAD 1028 +#define IDC_LEFT 1029 +#define IDC_BLUE 1030 +#define IDC_X 1031 +#define IDC_MAX 1032 +#define IDC_X2 1032 +#define IDC_VERTICAL1 1033 +#define IDC_X3 1033 +#define IDC_DROP_TOP 1034 +#define IDC_SAVE 1035 +#define IDC_RIGHT 1036 +#define IDC_BRED 1037 +#define IDC_Y 1038 +#define IDC_VERTICAL2 1039 +#define IDC_Y2 1039 +#define IDC_DROP_MIDDLE 1040 +#define IDC_CLEAR 1041 +#define IDC_LC 1042 +#define IDC_BGREEN 1043 +#define IDC_LC2 1043 +#define IDC_DROP_BOTTOM 1044 +#define IDC_RC 1045 +#define IDC_CLONESEL 1046 +#define IDC_BBLUE 1047 +#define IDC_SPEED 1048 +#define IDC_DOTS 1049 +#define IDC_SA 1050 +#define IDC_DISTANCE 1051 +#define IDC_METHOD_SLUDGE 1052 +#define IDC_PERSIST_TEXT1 1053 +#define IDC_LINES 1054 +#define IDC_SLIDER1 1055 +#define IDC_EXCLUDE 1056 +#define IDC_SLIDER7 1056 +#define IDC_STAT 1057 +#define IDC_PERSIST_TEXT2 1058 +#define IDC_LINES2 1059 +#define IDC_BLEND 1060 +#define IDC_SLIDER3 1061 +#define IDC_SMOOTH 1062 +#define IDC_BUTTON1 1063 +#define IDC_LINES3 1064 +#define IDC_BUTTON4 1064 +#define IDC_SLIDER4 1065 +#define IDC_SOLID 1066 +#define IDC_SLOWER 1067 +#define IDC_ONBEAT2 1068 +#define IDC_RATIO 1069 +#define IDC_SLIDER2 1070 +#define IDC_RSTACK_BLEND1 1070 +#define IDC_X_RATIO 1071 +#define IDC_RSTACK_BLEND2 1071 +#define IDC_CHECK1 1072 +#define IDC_RSTACK_BLEND3 1072 +#define IDC_RSTACK_BLEND4 1073 +#define IDC_BUTTON3 1073 +#define IDC_CHECK8 1073 +#define IDC_Y_RATIO 1074 +#define IDC_NEWADAPT 1074 +#define IDC_RSTACK_BLEND5 1074 +#define IDC_C1 1075 +#define IDC_RSTACK_BLEND6 1075 +#define IDC_INVERTDEPTH 1075 +#define IDC_SLIDER5 1076 +#define IDC_C2 1076 +#define IDC_RSTACK_BLEND7 1076 +#define IDC_OFF 1076 +#define IDC_C3 1077 +#define IDC_RSTACK_BLEND8 1077 +#define IDC_BANDS 1077 +#define IDC_C4 1078 +#define IDC_FPS 1078 +#define IDC_BANDTXT 1078 +#define IDC_RSTACK_BLEND9 1078 +#define IDC_C5 1079 +#define IDC_SLIDER6 1079 +#define IDC_TREE1 1079 +#define IDC_RSTACK_BLEND10 1079 +#define IDC_INSLIDE 1080 +#define IDC_RSTACK_BLEND11 1080 +#define IDC_TRI 1081 +#define IDC_OUTSLIDE 1081 +#define IDC_ALPHASLIDE 1081 +#define IDC_RSTACK_BLEND12 1081 +#define IDC_HLEFT 1082 +#define IDC_CBBUF2 1082 +#define IDC_BLENDSLIDE 1082 +#define IDC_CHECK6 1083 +#define IDC_CBBUF1 1083 +#define IDC_CHECK7 1084 +#define IDC_INVERT2 1084 +#define IDC_EFNAME 1085 +#define IDC_DEFAULTBLEND 1085 +#define IDC_HCENTER 1086 +#define IDC_BPP_CONV 1086 +#define IDC_TRANSITION 1087 +#define IDC_WRAP 1087 +#define IDC_HRIGHT 1088 +#define IDC_L_FRAME 1088 +#define IDC_EDIT1 1089 +#define IDC_L_TEXT1 1089 +#define IDC_VTOP 1090 +#define IDC_EDIT2 1090 +#define IDC_VCENTER 1091 +#define IDC_EDIT3 1091 +#define IDC_L_MASK 1091 +#define IDC_VBOTTOM 1092 +#define IDC_EDIT4 1092 +#define IDC_BKGND_RENDER 1092 +#define IDC_COMBO1 1093 +#define IDC_SETDESKTOPCOLOR 1093 +#define IDC_EDIT9 1093 +#define IDC_CHOOSEFONT 1094 +#define IDC_OVERLAYCOLOR 1094 +#define IDC_EDIT66 1094 +#define IDC_T 1095 +#define IDC_COMBO2 1095 +#define IDC_DEFOVERLAYCOLOR 1095 +#define IDC_EDIT7 1095 +#define IDC_EDIT 1096 +#define IDC_EDIT5 1096 +#define IDC_LEFTCH 1097 +#define IDC_EDIT6 1097 +#define IDC_BLANKS 1098 +#define IDC_NOMOVEMENT 1098 +#define IDC_EDIT10 1098 +#define IDC_RIGHTCH 1099 +#define IDC_USE_OVERLAY 1099 +#define IDC_EDIT11 1099 +#define IDC_RANDOMPOS 1100 +#define IDC_THREAD_PRIORITY 1100 +#define IDC_EDIT12 1100 +#define IDC_MIDCH 1101 +#define IDC_L_PROJZONES 1101 +#define IDC_EDIT13 1101 +#define IDC_OUTLINE 1102 +#define IDC_L_SUPPRESS_DIALOGS 1102 +#define IDC_EDIT14 1102 +#define IDC_TOP 1103 +#define IDC_L_ACTIVEOUTPUT 1103 +#define IDC_EDIT15 1103 +#define IDC_HSHIFT 1104 +#define IDC_FR1 1104 +#define IDC_EDIT16 1104 +#define IDC_CENTER 1105 +#define IDC_FR2 1105 +#define IDC_VSHIFT 1106 +#define IDC_L_SUPPRESS_OUTPUT 1106 +#define IDC_BOTTOM 1107 +#define IDC_L_SYNC 1107 +#define IDC_OUTLINESIZE 1108 +#define IDC_EDIT8 1108 +#define IDC_NUMCOL 1109 +#define IDC_RANDWORD 1110 +#define IDC_RADIO1 1111 +#define IDC_DEFOUTCOL 1112 +#define IDC_NEWRESET 1112 +#define IDC_BELOW 1112 +#define IDC_RADIO7 1112 +#define IDC_RADIO2 1113 +#define IDC_ABOVE 1113 +#define IDC_ANGLE 1114 +#define IDC_NEAR 1114 +#define IDC_HRESET 1115 +#define IDC_RADIO3 1116 +#define IDC_CHECK2 1117 +#define IDC_VRESET 1118 +#define IDC_CHECK9 1118 +#define IDC_RADIO4 1119 +#define IDC_PLAIN 1120 +#define IDC_RADIO5 1121 +#define IDC_SAVEFB 1121 +#define IDC_ROUNDDOWN 1121 +#define IDC_CHECK3 1122 +#define IDC_RESTFB 1122 +#define IDC_ROUNDUP 1122 +#define IDC_RADIO6 1123 +#define IDC_INVERT1 1123 +#define IDC_CHECK10 1123 +#define IDC_LIST1 1124 +#define IDC_CHECK11 1124 +#define IDC_CHECK5 1125 +#define IDC_CHECK4 1126 +#define IDC_SHADOW 1127 +#define IDC_CLEAR2 1128 +#define IDC_BUTTON2 1129 +#define IDC_VERSTR 1130 +#define IDC_OSC 1131 +#define IDC_SPEC 1132 +#define IDC_STATGRAIN 1133 +#define IDC_CLEARFIRSTFRAME 1134 +#define IDC_DEPTH 1135 +#define IDC_SETTINGS 1136 +#define IDC_NUMSTARS 1137 +#define IDC_ONBEAT 1138 +#define IDC_SCROLLBAR1 1139 +#define IDC_SPDCHG 1140 +#define IDC_QUALITY2 1141 +#define IDC_TRANS_SLIDER 1142 +#define IDC_DEPTH2 1143 +#define IDC_TRANS_CHECK 1144 +#define IDC_SPDDUR 1145 +#define IDC_AVS_VER 1146 +#define IDC_BEATDUR 1147 +#define IDC_DONT_MIN_AVS 1148 +#define IDC_CODE1 1149 +#define IDC_BPMSTD 1150 +#define IDC_HELPBTN 1151 +#define IDC_BPMADV 1152 +#define IDC_CODE2 1153 +#define IDC_STICKY 1154 +#define IDC_CODE3 1155 +#define IDC_ONLYSTICKY 1155 +#define IDC_MOREADAPT 1156 +#define IDC_DOT 1157 +#define IDC_TEXT 1158 +#define IDC_WAVE 1158 +#define IDC_DEFCOL 1159 +#define IDC_QUALITY 1160 +#define IDC_BPM 1161 +#define IDC_CONFIDENCE 1162 +#define IDC_2X 1163 +#define IDC_DIV2 1164 +#define IDC_ARBVAL 1165 +#define IDC_RESET 1166 +#define IDC_SKIPVAL 1167 +#define IDC_STICK 1167 +#define IDC_INVERT 1168 +#define IDC_UNSTICK 1168 +#define IDC_ARBITRARY 1169 +#define IDC_ARBTXT 1170 +#define IDC_SKIPTXT 1171 +#define IDC_CURBPM 1172 +#define IDC_SKIPFIRST 1172 +#define IDC_CURCONF 1173 +#define IDC_SKIPFIRSTTXT 1173 +#define IDC_SKIP 1174 +#define IDC_IN 1175 +#define IDC_OUT 1176 +#define IDC_NPOINTS 1177 +#define IDC_ROTATE 1178 +#define IDC_ALPHA 1179 +#define IDC_ROTATE2 1180 +#define IDC_DISTANCE2 1181 +#define IDC_ALPHA2 1182 +#define IDC_RGB 1183 +#define IDC_RGB2 1184 +#define IDC_INITROT 1185 +#define IDC_DEBUGREG_1 1186 +#define IDC_DEBUGREG_2 1187 +#define IDC_DEBUGREG_3 1188 +#define IDC_DEBUGREG_4 1189 +#define IDC_DEBUGREG_5 1190 +#define IDC_DEBUGREG_6 1191 +#define IDC_DEBUGREG_7 1192 +#define IDC_DEBUGREG_8 1193 +#define IDC_DEBUGREG_9 1194 +#define IDC_DEBUGREG_10 1195 +#define IDC_DEBUGREG_11 1196 +#define IDC_DEBUGREG_12 1197 +#define IDC_DEBUGREG_13 1198 +#define IDC_DEBUGREG_14 1199 +#define IDC_DEBUGREG_15 1200 +#define IDC_DEBUGREG_16 1201 +#define IDC_TAB1 1203 +#define IDC_LABEL1 1204 +#define IDC_STATIC_ALPHA 1205 +#define IDC_STATIC_TRANS_TOTAL 1206 +#define IDC_STATIC_TRANS_NONE 1207 +#define IDC_THREADS 1208 +#define IDC_THREADSBORDER 1209 +#define IDC_STATIC1 1210 +#define IDC_STATIC2 1211 +#define IDM_DISPLAY 40001 +#define IDM_PRESETS 40002 +#define IDM_TRANS 40003 +#define IDM_ABOUT 40004 +#define IDM_BPM 40005 +#define IDM_TRANSITIONS 40006 +#define IDM_FULLSCREEN 40007 +#define IDM_HELP_DEBUGWND 40008 +#define IDM_UNDO 40009 +#define IDM_REDO 40010 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 230 +#define _APS_NEXT_COMMAND_VALUE 40011 +#define _APS_NEXT_CONTROL_VALUE 1212 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/Visualization/vis_avs/rlib.cpp b/Src/Plugins/Visualization/vis_avs/rlib.cpp new file mode 100644 index 00000000..07c92611 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/rlib.cpp @@ -0,0 +1,458 @@ +/* + 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. + +*/ +#include <windows.h> +#include "r_defs.h" +#include "r_unkn.h" +#include "r_list.h" +#include "rlib.h" + +#include "ape.h" + +#include "avs_eelif.h" +#include "resource.h" +#include "../Agave/Language/api_language.h" + +#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_RBASE::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; + } +} +void C_RBASE::save_string(unsigned char *data, int &pos, RString &text) +{ + if (text.get() && text.get()[0]) + { + char *p=text.get(); + int x=32768; + while (x-- && *p) p++; + if (*p) + { + MessageBox(NULL,"Yo, this is some long ass shit","FUCK!",MB_OK); + //FUCKO + } + 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; + } +} + +void C_RLibrary::add_dofx(void *rf, int has_r2) +{ + if ((NumRetrFuncs&7)==0||!RetrFuncs) + { + void *newdl=(void *)GlobalAlloc(GMEM_FIXED,sizeof(rfStruct)*(NumRetrFuncs+8)); + if (!newdl) + { + char title[64]; + MessageBox(NULL,WASABI_API_LNGSTRING(IDS_OUT_OF_MEMORY), + WASABI_API_LNGSTRING_BUF(IDS_AVS_CRITICAL_ERROR,title,64),MB_OK); + ExitProcess(0); + } + memset(newdl,0,sizeof(rfStruct)*(NumRetrFuncs+8)); + if (RetrFuncs) + { + memcpy(newdl,RetrFuncs,NumRetrFuncs*sizeof(rfStruct)); + GlobalFree(RetrFuncs); + } + RetrFuncs=(rfStruct*)newdl; + } + RetrFuncs[NumRetrFuncs].is_r2=has_r2; + *((void**)&RetrFuncs[NumRetrFuncs].rf) = rf; + NumRetrFuncs++; +} + +// declarations for built-in effects +#define DECLARE_EFFECT(name) extern C_RBASE *(name)(char *desc); add_dofx((void*)name,0); +#define DECLARE_EFFECT2(name) extern C_RBASE *(name)(char *desc); add_dofx((void*)name,1); + +void C_RLibrary::initfx(void) +{ + DECLARE_EFFECT(R_SimpleSpectrum); + DECLARE_EFFECT(R_DotPlane); + DECLARE_EFFECT(R_OscStars); + DECLARE_EFFECT(R_FadeOut); + DECLARE_EFFECT(R_BlitterFB); + DECLARE_EFFECT(R_NFClear); + DECLARE_EFFECT2(R_Blur); + DECLARE_EFFECT(R_BSpin); + DECLARE_EFFECT(R_Parts); + DECLARE_EFFECT(R_RotBlit); + DECLARE_EFFECT(R_SVP); + DECLARE_EFFECT2(R_ColorFade); + DECLARE_EFFECT(R_ContrastEnhance); + DECLARE_EFFECT(R_RotStar); + DECLARE_EFFECT(R_OscRings); + DECLARE_EFFECT2(R_Trans); + DECLARE_EFFECT(R_Scat); + DECLARE_EFFECT(R_DotGrid); + DECLARE_EFFECT(R_Stack); + DECLARE_EFFECT(R_DotFountain); + DECLARE_EFFECT2(R_Water); + DECLARE_EFFECT(R_Comment); + DECLARE_EFFECT2(R_Brightness); + DECLARE_EFFECT(R_Interleave); + DECLARE_EFFECT(R_Grain); + DECLARE_EFFECT(R_Clear); + DECLARE_EFFECT(R_Mirror); + DECLARE_EFFECT(R_StarField); + DECLARE_EFFECT(R_Text); + DECLARE_EFFECT(R_Bump); + DECLARE_EFFECT(R_Mosaic); + DECLARE_EFFECT(R_WaterBump); + DECLARE_EFFECT(R_AVI); + DECLARE_EFFECT(R_Bpm); + DECLARE_EFFECT(R_Picture); + DECLARE_EFFECT(R_DDM); + DECLARE_EFFECT(R_SScope); + DECLARE_EFFECT(R_Invert); + DECLARE_EFFECT(R_Onetone); + DECLARE_EFFECT(R_Timescope); + DECLARE_EFFECT(R_LineMode); + DECLARE_EFFECT(R_Interferences); + DECLARE_EFFECT(R_Shift); + DECLARE_EFFECT2(R_DMove); + DECLARE_EFFECT(R_FastBright); + DECLARE_EFFECT(R_DColorMod); +} + +static const struct +{ + char id[33]; + int newidx; +} NamedApeToBuiltinTrans[] = +{ + {"Winamp Brightness APE v1", 22}, + {"Winamp Interleave APE v1", 23}, + {"Winamp Grain APE v1", 24 }, + {"Winamp ClearScreen APE v1", 25}, + {"Nullsoft MIRROR v1", 26}, + {"Winamp Starfield v1", 27}, + {"Winamp Text v1", 28 }, + {"Winamp Bump v1", 29 }, + {"Winamp Mosaic v1", 30 }, + {"Winamp AVIAPE v1", 32}, + {"Nullsoft Picture Rendering v1", 34}, + {"Winamp Interf APE v1", 41} +}; + +void C_RLibrary::initbuiltinape(void) +{ +#define ADD(sym) extern C_RBASE * sym(char *desc); _add_dll(0,sym,"Builtin_" #sym, 0) +#define ADD2(sym,name) extern C_RBASE * sym(char *desc); _add_dll(0,sym,name, 0) +#ifdef LASER + ADD(RLASER_Cone); + ADD(RLASER_BeatHold); + ADD(RLASER_Line); + ADD(RLASER_Bren); // not including it for now + ADD(RLASER_Transform); +#else + ADD2(R_ChannelShift,"Channel Shift"); + ADD2(R_ColorReduction,"Color Reduction"); + ADD2(R_Multiplier,"Multiplier"); + ADD2(R_VideoDelay,"Holden04: Video Delay"); + ADD2(R_MultiDelay,"Holden05: Multi Delay"); +#endif +#undef ADD +#undef ADD2 +} + + +void C_RLibrary::_add_dll(HINSTANCE hlib,class C_RBASE *(__cdecl *cre)(char *),char *inf, int is_r2) +{ + if ((NumDLLFuncs&7)==0||!DLLFuncs) + { + DLLInfo *newdl=(DLLInfo *)GlobalAlloc(GMEM_FIXED,sizeof(DLLInfo)*(NumDLLFuncs+8)); + if (!newdl) + { + char title[64]; + MessageBox(NULL,WASABI_API_LNGSTRING(IDS_OUT_OF_MEMORY), + WASABI_API_LNGSTRING_BUF(IDS_AVS_CRITICAL_ERROR,title,64),MB_OK); + ExitProcess(0); + } + memset(newdl,0,sizeof(DLLInfo)*(NumDLLFuncs+8)); + if (DLLFuncs) + { + memcpy(newdl,DLLFuncs,NumDLLFuncs*sizeof(DLLInfo)); + GlobalFree(DLLFuncs); + } + DLLFuncs=newdl; + + } + DLLFuncs[NumDLLFuncs].hDllInstance=hlib; + DLLFuncs[NumDLLFuncs].createfunc=cre; + DLLFuncs[NumDLLFuncs].idstring=inf; + DLLFuncs[NumDLLFuncs].is_r2=is_r2; + NumDLLFuncs++; +} + + +static APEinfo ext_info= +{ + 3, + 0, + &g_line_blend_mode, + NSEEL_VM_alloc, + NSEEL_VM_free, + AVS_EEL_IF_resetvars, + NSEEL_VM_regvar, + AVS_EEL_IF_Compile, + AVS_EEL_IF_Execute, + NSEEL_code_free, + compilerfunctionlist, + getGlobalBuffer, +}; + +void C_RLibrary::initdll() +{ + ext_info.global_registers=NSEEL_getglobalregs(); + + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[MAX_PATH*2]; +#ifdef LASER + wsprintf(dirmask,"%s\\*.lpe",g_path); +#else + wsprintf(dirmask,"%s\\*.ape",g_path); +#endif + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do { + char s[MAX_PATH]; + HINSTANCE hlib; + wsprintf(s,"%s\\%s",g_path,d.cFileName); + hlib=LoadLibrary(s); + if (hlib) + { + int cre; + char *inf; + + void (*sei)(HINSTANCE hDllInstance, APEinfo *ptr); + *(void**)&sei = (void *) GetProcAddress(hlib,"_AVS_APE_SetExtInfo"); + if (sei) + sei(hlib,&ext_info); + +#ifdef LASER + int (*retr)(HINSTANCE hDllInstance, char **info, int *create, C_LineListBase *linelist); + retr = (int (*)(HINSTANCE, char ** ,int *, C_LineListBase*)) GetProcAddress(hlib,"_AVS_LPE_RetrFunc"); + if (retr && retr(hlib,&inf,&cre,g_laser_linelist)) + { + _add_dll(hlib,(class C_RBASE *(__cdecl *)(char *))cre,inf,0); + } + else FreeLibrary(hlib); +#else + int (*retr)(HINSTANCE hDllInstance, char **info, int *create); + retr = (int (*)(HINSTANCE, char ** ,int *)) GetProcAddress(hlib,"_AVS_APE_RetrFuncEXT2"); + if (retr && retr(hlib,&inf,&cre)) + { + _add_dll(hlib,(class C_RBASE *(__cdecl *)(char *))cre,inf,1); + } + else + { + retr = (int (*)(HINSTANCE, char ** ,int *)) GetProcAddress(hlib,"_AVS_APE_RetrFunc"); + if (retr && retr(hlib,&inf,&cre)) + { + _add_dll(hlib,(class C_RBASE *(__cdecl *)(char *))cre,inf,0); + } + else FreeLibrary(hlib); + } +#endif + } + } while (FindNextFile(h,&d)); + FindClose(h); + } +} + + +int C_RLibrary::GetRendererDesc(int which, char *str) +{ + *str=0; + if (which >= 0 && which < NumRetrFuncs) + { + RetrFuncs[which].rf(str); + return 1; + } + if (which >= DLLRENDERBASE) + { + which-=DLLRENDERBASE; + if (which < NumDLLFuncs) + { + DLLFuncs[which].createfunc(str); + return (int)DLLFuncs[which].idstring; + } + } + return 0; +} + +C_RBASE *C_RLibrary::CreateRenderer(int *which, int *has_r2) +{ + if (has_r2) *has_r2=0; + + if (*which >= 0 && *which < NumRetrFuncs) + { + if (has_r2) *has_r2 = RetrFuncs[*which].is_r2; + return RetrFuncs[*which].rf(NULL); + } + + if (*which == LIST_ID) + return (C_RBASE *) new C_RenderListClass(); + + if (*which >= DLLRENDERBASE) + { + int x; + char *p=(char *)*which; + for (x = 0; x < NumDLLFuncs; x ++) + { + if (!DLLFuncs[x].createfunc) break; + if (DLLFuncs[x].idstring) + { + if (!strncmp(p,DLLFuncs[x].idstring,32)) + { + *which=(int)DLLFuncs[x].idstring; + return DLLFuncs[x].createfunc(NULL); + } + } + } + for (x = 0; x < sizeof(NamedApeToBuiltinTrans)/sizeof(NamedApeToBuiltinTrans[0]); x ++) + { + if (!strncmp(p,NamedApeToBuiltinTrans[x].id,32)) + { + *which=NamedApeToBuiltinTrans[x].newidx; + if (has_r2) *has_r2 = RetrFuncs[*which].is_r2; + return RetrFuncs[*which].rf(NULL); + } + } + } + int r=*which; + *which=UNKN_ID; + C_UnknClass *p=new C_UnknClass(); + p->SetID(r,(r >= DLLRENDERBASE)?(char*)r:""); + return (C_RBASE *)p; +} + +C_RLibrary::C_RLibrary() +{ + DLLFuncs=NULL; + NumDLLFuncs=0; + RetrFuncs=0; + NumRetrFuncs=0; + + initfx(); + initdll(); + initbuiltinape(); + +} + +C_RLibrary::~C_RLibrary() +{ + if (RetrFuncs) GlobalFree(RetrFuncs); + RetrFuncs=0; + NumRetrFuncs=0; + + if (DLLFuncs) + { + int x; + for (x = 0; x < NumDLLFuncs; x ++) + { + if (DLLFuncs[x].hDllInstance) + FreeLibrary(DLLFuncs[x].hDllInstance); + } + GlobalFree(DLLFuncs); + } + DLLFuncs=NULL; + NumDLLFuncs=0; +} + +HINSTANCE C_RLibrary::GetRendererInstance(int which, HINSTANCE hThisInstance) +{ + if (which < DLLRENDERBASE || which == UNKN_ID || which == LIST_ID) return hThisInstance; + int x; + char *p=(char *)which; + for (x = 0; x < NumDLLFuncs; x ++) + { + if (DLLFuncs[x].idstring) + { + if (!strncmp(p,DLLFuncs[x].idstring,32)) + { + if (DLLFuncs[x].hDllInstance) + return DLLFuncs[x].hDllInstance; + break; + } + } + } + return hThisInstance; +} + + +void *g_n_buffers[NBUF]; +int g_n_buffers_w[NBUF],g_n_buffers_h[NBUF]; + + +void *getGlobalBuffer(int w, int h, int n, int do_alloc) +{ + if (n < 0 || n >= NBUF) return 0; + + if (!g_n_buffers[n] || g_n_buffers_w[n] != w || g_n_buffers_h[n] != h) + { + if (g_n_buffers[n]) GlobalFree(g_n_buffers[n]); + if (do_alloc) + { + g_n_buffers_w[n]=w; + g_n_buffers_h[n]=h; + return g_n_buffers[n]=GlobalAlloc(GPTR,sizeof(int)*w*h); + } + + g_n_buffers[n]=NULL; + g_n_buffers_w[n]=0; + g_n_buffers_h[n]=0; + + return 0; + } + return g_n_buffers[n]; +} + diff --git a/Src/Plugins/Visualization/vis_avs/rlib.h b/Src/Plugins/Visualization/vis_avs/rlib.h new file mode 100644 index 00000000..76365d41 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/rlib.h @@ -0,0 +1,74 @@ +/* + 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. + +*/ +#ifndef _RLIB_H_ +#define _RLIB_H_ + +#define DLLRENDERBASE 16384 + +class C_RLibrary { + protected: + typedef struct + { + C_RBASE *(*rf)(char *desc); + int is_r2; + } rfStruct; + rfStruct *RetrFuncs; + + int NumRetrFuncs; + + typedef struct + { + HINSTANCE hDllInstance; + char *idstring; + C_RBASE *(*createfunc)(char *desc); + int is_r2; + + } DLLInfo; + + DLLInfo *DLLFuncs; + int NumDLLFuncs; + + void add_dofx(void *rf, int has_r2); + void initfx(void); + void initdll(void); + void initbuiltinape(void); + void _add_dll(HINSTANCE,class C_RBASE *(__cdecl *)(char *),char *, int); + public: + C_RLibrary(); + ~C_RLibrary(); + C_RBASE *CreateRenderer(int *which, int *has_r2); + HINSTANCE GetRendererInstance(int which,HINSTANCE hThisInstance); + int GetRendererDesc(int which, char *str); + // if which is >= DLLRENDERBASE + // returns "id" of DLL. which is used to enumerate. str is desc + // otherwise, returns 1 on success, 0 on error +}; + +#endif // _RLIB_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/supersco.bin b/Src/Plugins/Visualization/vis_avs/supersco.bin new file mode 100644 index 00000000..636391b5 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/supersco.bin @@ -0,0 +1,18 @@ +Superscope tutorial goes here +But for now, here is the old text: + +You can specify expressions that run on Init, Frame, and on Beat. + 'n' specifies the number of points to render (set this in Init, Beat, or Frame). + +For the 'Per Point' expression (which happens 'n' times per frame), use: + 'x' and 'y' are the coordinates to draw to (-1..1) + 'i' is the position of the scope (0..1) + 'v' is the value at that point (-1..1). + 'b' is 1 if beat, 0 if not. + 'red', 'green' and 'blue' are all (0..1) and can be modified + 'linesize' can be set from 1.0 to 255.0 + 'skip' can be set to >0 to skip drawing the current item + 'drawmode' can be set to > 0 for lines, <= 0 for points + 'w' and 'h' are the width and height of the screen, in pixels. + +Anybody want to send me better text to put here? Please :)
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/svp_vis.h b/Src/Plugins/Visualization/vis_avs/svp_vis.h new file mode 100644 index 00000000..f4bb785b --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/svp_vis.h @@ -0,0 +1,136 @@ +/* + 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. + +*/ + +// Note! +// *Video points to memory in 32bit video memory, ie, the following can be used +// for your utility and to help your understanding of the pixel format used. + +// In Visual C, you should start a DLL project, under code generation set it to +// use the DLL libraries, and most likely for release you will want to turn +// optimisation for speed on. Include this .h file in your project, then create +// or add your main C/C++ file and #include "vis.h" + +// To start off, fill in the VisInfo structure. Render should draw a whole frame +// into the 32 bit ABGR buffer (for blur, smoke and zoom to work it should, rather +// than replacing the video data, add to it using bitwise or, saturated add, or +// alpha blend). Make sure not to exceed the boundaries given. 'Pitch' specifies +// the distance, in pixels, between the start of each line. If you have a pointer +// at the start of a line, Pointer+Pitch is the start of the next line and +// Pointer-Pitch is the start of the previous. +// Make sure that QueryModule is defined exactly as at the end of this file, +// including the extern "C" keyword if you're using C++. It should return a +// pointer to this structure. All routines that are pointed to by the structure +// must be filled in even if they don't do anything. Render is the only function +// that is required to have a body. + + + +#define ALPHA_MASK 0xFF000000 +#define RED_MASK 0x00FF0000 +#define GREEN_MASK 0x0000FF00 +#define BLUE_MASK 0x000000FF + +#define ALPHA_SHIFT 24 +#define RED_SHIFT 16 +#define GREEN_SHIFT 8 +#define BLUE_SHIFT 0 + +#define AlphaByte(x) (((x))>>ALPHA_SHIFT) +#define RedByte(x) (((x) & RED_MASK)>>RED_SHIFT) +#define GreenByte(x) (((x) & GREEN_MASK)>>GREEN_SHIFT) +#define BlueByte(x) (((x) & BLUE_MASK)>>BLUE_SHIFT) + + + +// files should be renamed from .DLL to .SVP + +#ifndef DLLEXPORT +#define DLLEXPORT __declspec( dllexport ) +#endif + + +#define VI_WAVEFORM 0x0001 // set if you need the waveform +#define VI_SPECTRUM 0x0002 // set if you need the FFT values +#define SONIQUEVISPROC 0x0004 // set if you want to allow Soniques user pref vis to affect your vis + // for example - blur, smoke and zoom + +#pragma pack (push, 8) + +typedef struct +{ + unsigned long MillSec; // Sonique sets this to the time stamp of end this block of data + unsigned char Waveform[2][512]; // Sonique sets this to the PCM data being outputted at this time + unsigned char Spectrum[2][256]; // Sonique sets this to a lowfidely version of the spectrum data + // being outputted at this time +} VisData; + +typedef struct _VisInfo +{ + unsigned long Reserved; // Reserved + + char *PluginName; // Set to the name of the plugin + long lRequired; // Which vis data this plugin requires (set to a combination of + // the VI_WAVEFORM, VI_SPECTRUM and SONIQEUVISPROC flags) + + void (*Initialize)(void); // Called some time before your plugin is asked to render for + // the first time + BOOL (*Render)( unsigned long *Video, int width, int height, int pitch, VisData* pVD); + // Called for each frame. Pitch is in pixels and can be negative. + // Render like this: + // for (y = 0; y < height; y++) + // { + // for (x = 0; x < width; x++) + // Video[x] = <pixel value>; + // Video += pitch; + // } + // OR + // void PutPixel(int x, int y, unsigned long Pixel) + // { + // _ASSERT( x >= 0 && x < width && y >= 0 && y < height ); + // Video[y*pitch+x] = Pixel; + // } + BOOL (*SaveSettings)( char* FileName ); + // Use WritePrivateProfileString to save settings when this is called + // Example: + // WritePrivateProfileString("my plugin", "brightness", "3", FileName); + BOOL (*OpenSettings)( char* FileName ); + // Use GetPrivateProfileString similarly: + // char BrightnessBuffer[256]; + // GetPrivateProfileString("my plugin", "brightness", "3", BrightnessBuffer, sizeof(BrightnessBuffer), FileName); +} VisInfo; + +#pragma pack (pop, 8) + + +// DLL exports this function - it should return a pointer to a static structure +// as above. +extern "C" +DLLEXPORT VisInfo* QueryModule(void); + diff --git a/Src/Plugins/Visualization/vis_avs/undo.cpp b/Src/Plugins/Visualization/vis_avs/undo.cpp new file mode 100644 index 00000000..0010dcf1 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/undo.cpp @@ -0,0 +1,177 @@ +/* + 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. + +*/ +#include <windows.h> +#include "undo.h" +#include "render.h" + +int C_UndoStack::list_pos; +C_UndoItem *C_UndoStack::list[256]; + +C_UndoItem::C_UndoItem() : data(NULL), length(0), isdirty(true) +{ +} + +C_UndoItem::C_UndoItem(const C_UndoItem& T) : data(NULL), length(0), isdirty(true) +{ + *this = T; +} + +C_UndoItem::C_UndoItem(void *_data, int _length, bool _isdirty) : data(NULL), length(length), isdirty(_isdirty) +{ + data = GlobalAlloc(GPTR, length); + memcpy(data, _data, length); +} + +C_UndoItem::~C_UndoItem() +{ + if (data) + { + GlobalFree(data); + } +} + +C_UndoItem & C_UndoItem::operator = (const C_UndoItem& T) +{ + length = T.length; + isdirty = T.isdirty; + if (data) + { + GlobalFree(data); + } + data = GlobalAlloc(GPTR, length); + memcpy(data, T.data, length); + return *this; +} + +bool C_UndoItem::operator == (const C_UndoItem& T) const +{ + bool retval = false; + if (length == T.length) + { + retval = (memcmp(data, T.data, length) == 0); + } + return retval; +} + +void C_UndoItem::set(void *_data, int _length, bool _isdirty) +{ + length = _length; + isdirty = _isdirty; + if (data) + { + GlobalFree(data); + } + data = GlobalAlloc(GPTR, length); + memcpy(data, _data, length); +} + + +void C_UndoStack::saveundo(int is2) +{ + // Save to the undo buffer (sets the dirty bit for this item) + C_UndoItem *item = new C_UndoItem; + C_UndoItem *old = list[list_pos]; + + if (is2) + { + g_render_effects2->__SavePresetToUndo(*item); + } + else + { + g_render_effects->__SavePresetToUndo(*item); + } + + // Only add it to the stack if it has changed. + if (!old || !(*old == *item)) + { + if (list_pos == sizeof(list)/sizeof(list[0])-1) + { + delete list[0]; + memcpy(list,list+1,sizeof(list)/sizeof(list[0])-1); + list_pos--; + } + list[++list_pos]=item; + } + else delete item; +} + +void C_UndoStack::cleardirty() +{ + // If we're clearing the dirty bit, we only clear it on the current item. + if (list_pos >= 0 && list_pos < sizeof(list)/sizeof(list[0]) && list[list_pos]) + { + list[list_pos]->isdirty = 0; + } +} + +bool C_UndoStack::isdirty() +{ + if (list_pos >= 0 && list_pos < sizeof(list)/sizeof(list[0]) && list[list_pos]) + return list[list_pos]->isdirty; + return false; +} + +int C_UndoStack::can_undo() +{ + return (list_pos>0 && list[list_pos-1]); +} + +int C_UndoStack::can_redo() +{ + return list_pos < sizeof(list)/sizeof(list[0])-1 && list[list_pos+1]; +} + + +void C_UndoStack::undo() +{ + if (list_pos>0 && list[list_pos-1]) + { + g_render_transition->LoadPreset(NULL,0,list[--list_pos]); + } +} + +void C_UndoStack::redo() +{ + if (list_pos < sizeof(list)/sizeof(list[0])-1 && list[list_pos+1]) + { + g_render_transition->LoadPreset(NULL,0,list[++list_pos]); + } +} + +void C_UndoStack::clear() +{ + list_pos=0; + int x; + for (x = 0; x < sizeof(list)/sizeof(list[0]); x ++) + { + delete list[x]; + list[x]=0; + } +} diff --git a/Src/Plugins/Visualization/vis_avs/undo.h b/Src/Plugins/Visualization/vis_avs/undo.h new file mode 100644 index 00000000..92bdb695 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/undo.h @@ -0,0 +1,81 @@ +/* + 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. + +*/ +#ifndef _UNDO_H_ +#define _UNDO_H_ + +class C_UndoStack; + +class C_UndoItem +{ + friend C_UndoStack; + public: + C_UndoItem(); + ~C_UndoItem(); + C_UndoItem(const C_UndoItem& T); + C_UndoItem(void *data, int length, bool isdirty); + + C_UndoItem & operator = (const C_UndoItem& T); + bool operator == (const C_UndoItem& T) const; + + void set(void *data, int length, bool isdirty); + void *get() const { return data; } + int size() const { return length; } + + private: + void *data; + int length; + bool isdirty; +}; + +class C_UndoStack +{ + public: + static void saveundo(int is2=0); + static void cleardirty(); + static bool isdirty(); + + static void undo(); + static void redo(); + + static int can_undo(); + static int can_redo(); + + static void clear(); + + private: + + // sorry to do this mig, but that doubly linked lists made me scared. I think it + // wasn't actually the source of my bug (I later fixed it), but doubly linked lists + // are just plain hard to get right. :) + static int list_pos; + static C_UndoItem *list[256]; // only keep 256 elements in list at a time +}; + +#endif//_UNDO_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/util.cpp b/Src/Plugins/Visualization/vis_avs/util.cpp new file mode 100644 index 00000000..03ffc769 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/util.cpp @@ -0,0 +1,536 @@ +/* + 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. + +*/ +#include <windows.h> +#include <commctrl.h> +#include "r_defs.h" +#include "resource.h" +#include "../Agave/Language/api_language.h" +#if 0//syntax highlighting +#include "compiler.h" +#include "richedit.h" +#endif + +char* GetTextResource(UINT id){ + void* data = 0; + HRSRC rsrc = FindResource(WASABI_API_LNG_HINST,MAKEINTRESOURCE(id),"TEXT"); + if(rsrc){ + HGLOBAL resourceHandle = LoadResource(WASABI_API_LNG_HINST,rsrc); + data = LockResource(resourceHandle); + } + return (char*)data; +} + +void loadComboBox(HWND dlg, char *ext, char *selectedName) +{ + char path[MAX_PATH]; + int a; + HANDLE ff; + WIN32_FIND_DATA fd; + + wsprintf(path,"%s\\%s",g_path,ext); + + ff=FindFirstFile(path, &fd); + if (ff == INVALID_HANDLE_VALUE) return; + + do + { + SendMessage(dlg, CB_ADDSTRING, 0, (LPARAM)(fd.cFileName)); + } while (FindNextFile(ff, &fd)); + FindClose(ff); + + a = SendMessage(dlg, CB_FINDSTRINGEXACT, 0, (LPARAM)(selectedName)); + if (a != CB_ERR) SendMessage(dlg, CB_SETCURSEL, (WPARAM) a, 0); +} + +void GR_SelectColor(HWND hwnd, int *a) +{ + static COLORREF custcolors[16]; + CHOOSECOLOR cs; + cs.lStructSize = sizeof(cs); + cs.hwndOwner = hwnd; + cs.hInstance = 0; + cs.rgbResult=((*a>>16)&0xff)|(*a&0xff00)|((*a<<16)&0xff0000); + cs.lpCustColors = custcolors; + cs.Flags = CC_RGBINIT|CC_FULLOPEN; + if (ChooseColor(&cs)) + { + *a = ((cs.rgbResult>>16)&0xff)|(cs.rgbResult&0xff00)|((cs.rgbResult<<16)&0xff0000); + } +} + +void GR_DrawColoredButton(DRAWITEMSTRUCT *di, COLORREF color) +{ + color = ((color>>16)&0xff)|(color&0xff00)|((color<<16)&0xff0000); + + char wt[123]; + HPEN hPen,hOldPen; + HBRUSH hBrush,hOldBrush; + hPen = (HPEN)GetStockObject(BLACK_PEN); + LOGBRUSH lb={BS_SOLID,color,0}; + hBrush = CreateBrushIndirect(&lb); + hOldPen=(HPEN)SelectObject(di->hDC,hPen); + hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush); + + Rectangle(di->hDC,di->rcItem.left,di->rcItem.top,di->rcItem.right,di->rcItem.bottom); + + GetWindowText(di->hwndItem,wt,sizeof(wt)); + SetBkColor(di->hDC,color); + SetTextColor(di->hDC,~color & 0xffffff); + DrawText(di->hDC,wt,-1,&di->rcItem,DT_CENTER|DT_VCENTER|DT_SINGLELINE); + + DeleteObject(hBrush); + SelectObject(di->hDC,hOldPen); + SelectObject(di->hDC,hOldBrush); +} + +static int m_help_lastpage=4; +static char *m_localtext; +static void _dosetsel(HWND hwndDlg) +{ + HWND tabwnd=GetDlgItem(hwndDlg,IDC_TAB1); + int sel=TabCtrl_GetCurSel(tabwnd); + char *text=""; + + m_help_lastpage=sel; + + if (sel == 0) + +/* + text="Many AVS effects allow you to write simple expressions to control\r\n" + "visualization. Here is a brief summary of how to write AVS code.\r\n" + "\r\n" + "Many aspects of AVS code are similar to C (including comments). " + "\r\n" + "You can create new variables just by using them, and you can read\r\n" + "and write predefined variables (of which each effect has its own)\r\n" + "to interact with the effect. Note that variables are all floating\r\n" + "point numbers (no strings), and the maximum length of a variable's\r\n" + "name is 8 characters (anything longer will be ignored.\r\n" + "\r\n" + "So, to create a variable, you can simply use it, for example:\r\n" + " x = 5;\r\n" + "\r\n" + "You can also use a variety of operators and math functions to\r\n" + "modify variables, see the Operators and Functions tabs above.\r\n" + "\r\n" + "Code can include C and C++ style comments:\r\n" + "\r\n" + "You can combine operators and functions into expressions, such\r\n" + "as:\r\n" + " x = 5 * cos(y) / 32.0; // this does some leetness right here\r\n" + "\r\n" + "You can use multiple expressions by seperating them with one or\r\n" + "more semicolons, for example:\r\n" + " x = x * 17.0; x = x / 5; y = pow(x,3.0);\r\n" + "\r\n" + "It is worth noting that extra whitespace (spaces, newlines) is\r\n" + "ignored, so if you need to space things out for clarity, you can.\r\n" + ; + else if (sel == 1) + text="The following operators are available:\r\n" + "=\r\n" + " assigns a value to a variable. \r\n" + " example: var=5;\r\n" + "\r\n" + "+\r\n" + " adds two values, returns the sum. \r\n" + " example: var=5+var2;\r\n" + "\r\n" + "-\r\n" + " subtracts two values, returns the difference. \r\n" + " example: var=5-var2;\r\n" + "\r\n" + "*\r\n" + " multiplies two values, returns the product. \r\n" + " example: var=5*var2;\r\n" + "\r\n" + "/\r\n" + " divides two values, returns the quotient. \r\n" + " example: var=5/var2;\r\n" + "\r\n" + "%\r\n" + " converts two values to integer, performs division, returns remainder\r\n" + " example: var=var2%5;\r\n" + "\r\n" + "|\r\n" + " converts two values to integer, returns bitwise OR of both values\r\n" + " example: var=var2|31;\r\n" + "\r\n" + "&\r\n" + " converts two values to integer, returns bitwise AND of both values\r\n" + " example: var=var2&31;\r\n" + "\r\n" + ; + else if (sel == 2) + text="Functions available from code:\r\n" + "abs(value)\r\n" + " = returns the absolute value of 'value'\r\n" + "\r\n" + "sin(value)\r\n" + " = returns the sine of the radian angle 'value'\r\n" + "\r\n" + "cos(value)\r\n" + " = returns the cosine of the radian angle 'value'\r\n" + "\r\n" + "tan(value)\r\n" + " = returns the tangent of the radian angle 'value'\r\n" + "\r\n" + "asin(value)\r\n" + " = returns the arcsine (in radians) of 'value'\r\n" + "\r\n" + "acos(value)\r\n" + " = returns the arccosine (in radians) of 'value'\r\n" + "\r\n" + "atan(value)\r\n" + " = returns the arctangent (in radians) of 'value'\r\n" + "\r\n" + "atan2(value,value2)\r\n" + " = returns the arctangent (in radians) of 'value'/'value2'\r\n" + "\r\n" + "sqr(value)\r\n" + " = returns the square of 'value'\r\n" + "\r\n" + "sqrt(value)\r\n" + " = returns the square root of 'value'\r\n" + "\r\n" + "invsqrt(value)\r\n" + " = returns the reciprocal of the square root of 'value' (1/sqrt(value))\r\n" + " (uses a fast approximation, may not always = 1/sqrt(value) :)\r\n" + "\r\n" + "pow(value,value2)\r\n" + " = returns 'value' to the power of 'value2'\r\n" + "\r\n" + "exp(value)\r\n" + " = returns e to the power of 'value'\r\n" + "\r\n" + "log(value)\r\n" + " = returns the log in base e of 'value'\r\n" + "\r\n" + "log10(value)\r\n" + " = returns the log in base 10 of 'value'\r\n" + "\r\n" + "floor(value)\r\n" + " = returns the largest integer less than or equal to 'value'\r\n" + "\r\n" + "ceil(value)\r\n" + " = returns the smallest integer greater than or equal to 'value'\r\n" + "\r\n" + "sign(value)\r\n" + " = returns the sign of 'value' (-1.0 or 1.0, or 0.0 or -0.0 for 0.0 or -0.0)\r\n" + "\r\n" + "min(value,value2)\r\n" + " = returns the smallest of 'value' and 'value2'\r\n" + "\r\n" + "max(var,var2)\r\n" + " = returns the greatest of 'value' and 'value2'\r\n" + "\r\n" + "sigmoid(value,value2)\r\n" + " = returns sigmoid function value of x='value' ('value2'=constraint)\r\n" + "\r\n" + "rand(value)\r\n" + " = returns a random integer between 0 and 'value'\r\n" + "\r\n" + "band(value,value2)\r\n" + " = returns a boolean AND of 'value' and 'value2'\r\n" + "\r\n" + "bor(value,value2)\r\n" + " = returns a boolean OR of 'value' and 'value2'\r\n" + "\r\n" + "bnot(value)\r\n" + " = returns a boolean NOT of 'value'\r\n" + "\r\n" + "if(condition,valtrue,valfalse)\r\n" + " = returns 'valtrue' if 'condition' is nonzero, returns 'valfalse' otherwise.\r\n" + " new in AVS 2.8+: only one of valtrue/valfalse is evaluated, depending on condition\r\n" + "\r\n" + "assign(dest, source)\r\n" + " = if 'dest' is a variable, assigns the value of 'source' to it. returns the value of 'source'.\r\n" + " a little trick: assign(if(v,a,b),1.0); is like if V is true, a=1.0, otherwise b=1.0. :)\r\n" + "\r\n" + "exec2(parm1, parm2)\r\n" + " = evaluates parm1, then parm2, and returns the value of parm2.\r\n" + "\r\n" + "equal(value,value2)\r\n" + " = returns 1.0 if 'value' is equal to 'value2', otherwise returns 0.0\r\n" + "\r\n" + "above(value,value2)\r\n" + " = returns 1.0 if 'value' is greater than 'value2', otherwise returns 0.0\r\n" + "\r\n" + "below(value,value2)\r\n" + " = returns 1.0 if 'value' is less than 'value2', otherwise returns 0.0\r\n" + "\r\n" + "getosc(band,width,channel)\r\n" + " = returns waveform data centered at 'band', (0..1), sampled 'width' (0..1) wide.\r\n" + " 'channel' can be: 0=center, 1=left, 2=right. return value is (-1..1)\r\n" + "\r\n" + "getspec(band,width,channel)\r\n" + " = returns spectrum data centered at 'band', (0..1), sampled 'width' (0..1) wide.\r\n" + " 'channel' can be: 0=center, 1=left, 2=right. return value is (0..1)\r\n" + "\r\n" + "gettime(start_time)\r\n" + " = returns time in seconds since start_time (start_time can be 0 for time since boot)\r\n" + " (start_time can be -1.0 for current play time in seconds\r\n" + " (start_time can be -2.0 for current play length in seconds\r\n" + "\r\n" + "getkbmouse(which_parm)\r\n" + " = returns information about the location and state of the keyboard or mouse\r\n" + " which_parm = 1: mouse X position (-1..1 is onscreen)\r\n" + " which_parm = 2: mouse Y position (-1..1 is onscreen)\r\n" + " which_parm = 3: mouse left button state (0 up, 1 down)\r\n" + " which_parm = 4: mouse right button state (0 up, 1 down)\r\n" + " which_parm = 5: mouse middle button state (0 up, 1 down)\r\n" + " which_parm > 5: (GetAsyncKeyState(which_parm)&0x8000)?1:0\r\n" + "\r\n" + "megabuf(index)\r\n" + " = can be used to get or set an item from the 1 million item temp buffer\r\n" + " to get, use: val=megabuf(index);\r\n" + " to set, use: assign(megabuf(index),val);\r\n" + "gmegabuf(index)\r\n" + " = can be used to get or set an item from the global 1 million item buffer\r\n" + " to get, use: val=gmegabuf(index);\r\n" + " to set, use: assign(gmegabuf(index),val);\r\n" + "\r\n" + "loop(count, statement)\r\n" + " = executes <statement> <count> times. count is evaluated once and clamped\r\n" + " to 0..4096. best used with exec2() and exec3() and assign(). Note that\r\n" + " the return value of loop() is undefined and should not be used.\r\n" + "\r\n" + ; + else if (sel == 3) + text="Constants\r\n" + " '$PI' can be used in place of '3.14159'\r\n" + " '$E' can be used in place of '2.71828'\r\n" + " '$PHI' can be used in place of '1.618033'\r\n" + " Numbers can be specified as integers or as floating point\r\n" + " (i.e. '5' or '5.0' or '5.00001')\r\n" + + ; +*/ + + text=GetTextResource(IDR_HELP_1); + else if (sel == 1) + text=GetTextResource(IDR_HELP_2); + else if (sel == 2) + text=GetTextResource(IDR_HELP_3); + else if (sel == 3) + text=GetTextResource(IDR_HELP_4); + else if (sel == 4 && m_localtext) + text=m_localtext; + + SetDlgItemText(hwndDlg,IDC_EDIT1,text); +} + +static BOOL CALLBACK evalHelpDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + TCITEM item; + HWND tabwnd=GetDlgItem(hwndDlg,IDC_TAB1); + item.mask=TCIF_TEXT; + item.pszText=WASABI_API_LNGSTRING(IDS_GENERAL); + TabCtrl_InsertItem(tabwnd,0,&item); + item.pszText=WASABI_API_LNGSTRING(IDS_OPERATORS); + TabCtrl_InsertItem(tabwnd,1,&item); + item.pszText=WASABI_API_LNGSTRING(IDS_FUNCTIONS); + TabCtrl_InsertItem(tabwnd,2,&item); + item.pszText=WASABI_API_LNGSTRING(IDS_CONSTANTS); + TabCtrl_InsertItem(tabwnd,3,&item); + // fucko: context specific stuff + m_localtext=0; + if (lParam) + { + item.pszText=(char *)lParam; + m_localtext=item.pszText + strlen(item.pszText)+1; + TabCtrl_InsertItem(tabwnd,4,&item); + } + else if (m_help_lastpage > 3) m_help_lastpage=0; + + TabCtrl_SetCurSel(tabwnd,m_help_lastpage); + _dosetsel(hwndDlg); + } + return 0; + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + EndDialog(hwndDlg,1); + return 0; + case WM_NOTIFY: + { + LPNMHDR p=(LPNMHDR) lParam; + if (p->idFrom == IDC_TAB1 && p->code == TCN_SELCHANGE) _dosetsel(hwndDlg); + } + return 0; + } + return 0; +} + +void compilerfunctionlist(HWND hwndDlg, char *localinfo) +{ + WASABI_API_DIALOGBOXPARAM(IDD_EVAL_HELP,hwndDlg,evalHelpDlgProc, (LONG)localinfo); +} + + + +#if 0//syntax highlighting +// If you include richedit boxes, you need to load the richlib at the beginning: +// HANDLE hRichLib = LoadLibrary("RICHED32.DLL"); +// When quitting: +// FreeLibrary(hRichLib); + + +#define M_WORD 1 +#define M_NUM 2 +#define M_COMM 3 + +#define is_alpha(a) ((((a) >= 'A') && ((a) <= 'Z')) || (((a) >= 'a') && ((a) <= 'z'))) +#define is_num(a) (((a) >= '0') && ((a) <= '9')) + +#define is_op(a) (((a) == '=') || ((a) == '+') || ((a) == '-') || ((a) == '*') || ((a) == '/') || ((a) == '%')) + + +// Colors for bracket pairs (loops around, ugly colors for now), can be any number of colors +static int bcol[] = { RGB(192, 0, 0), RGB(64, 128, 128), RGB(128, 0, 255), RGB(128, 128, 255) }; + +#define COLOR_COMMENT RGB(0, 128, 0) +#define COLOR_FUNC RGB(0, 0, 192) +#define COLOR_VAR RGB(96, 96, 96) +#define COLOR_OP RGB(0, 0, 0) +#define COLOR_NUMBER RGB(0, 0, 128) + +// Actual syntax highlighting +// 'hwnd' is a richedit box, 'data' is the code of 'size' characters +void doAVSEvalHighLight(HWND hwndDlg, UINT sub, char *data) { + int size=strlen(data); + HWND hwnd=GetDlgItem(hwndDlg,sub); + CHARRANGE cr, cro; + + CHARFORMAT cf; + cf.cbSize = sizeof(CHARFORMAT); + cf.dwMask = CFM_COLOR; + cf.dwEffects = 0; + + SendMessage(hwnd, WM_SETREDRAW, false, 0); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&cro); + int mode = 0; + int pos = 0; + int brackets = 0; + for (int i = 0; i < size; ++i) { + if (mode == M_COMM) { + // We're inside a comment, check for its end + if ((data[i] == ';') || ((data[i] == '*') && ((i+1) < size) && (data[++i] == '/'))) { + mode = 0; + cf.crTextColor = COLOR_COMMENT; + cr.cpMin = pos; + cr.cpMax = i+1; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr); + SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + } else if (is_alpha(data[i]) || ((mode == M_WORD) && is_num(data[i]))) { + // Letter tokens (func calls, vars) + if (mode != M_WORD) { + // Enter word-mode if we haven't yet + mode = M_WORD; + pos = i; + } + // Stop condition + bool valid = (i != (size-1)); // Check if this isn't the last character + if (valid) { + valid = is_num(data[i+1]) || is_alpha(data[i+1]); + } + if (!valid) { + // We have reached the end of this word + cr.cpMin = pos; + cr.cpMax = i+1; + // Check if its a function + bool func = false; + for (int j = 0; j < (sizeof(fnTable) / sizeof(fnTable[0])); ++j) { + if ((i - pos + 1) == (signed)strlen(fnTable[j].name)) { + if (strnicmp(fnTable[j].name, &data[pos], strlen(fnTable[j].name)) == 0) { + func = true; + break; + } + } + } + cf.crTextColor = func ? COLOR_FUNC : COLOR_VAR; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr); + SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + } else if (is_op(data[i])) { + // This is an operator + mode = 0; + cf.crTextColor = COLOR_OP; + cr.cpMin = i; + cr.cpMax = i+1; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr); + SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } else if ((data[i] & 0x80) || ((data[i] == '/') && ((i+1) < size) && (data[++i] == '*'))) { + // This is a comment marker, enter comment mode + mode = M_COMM; + pos = i; + } else if ((data[i] == '(') || (data[i] == ')') || (data[i] == ',')) { + // Reached brackets: we count them and color them in pairs + mode = 0; + if (data[i] == '(') ++brackets; + cf.crTextColor = bcol[brackets % (sizeof(bcol) / sizeof(bcol[0]))]; + if (data[i] == ')') --brackets; + cr.cpMin = i; + cr.cpMax = i+1; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr); + SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } else if (is_num(data[i]) || (data[i] == '.')) { + // constants + if (mode != M_NUM) { + pos = i; + mode = M_NUM; + } + // Stop condition + bool valid = (i != (size-1)); + if (valid) { + valid = is_num(data[i+1]) || (data[i+1] == '.'); + } + if (!valid) { + cf.crTextColor = COLOR_NUMBER; + cr.cpMin = pos; + cr.cpMax = i+1; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cr); + SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); + } + } else if (data[i] == ';') { + // Reset bracket count and mode for every statement. + mode = 0; + brackets = 0; + } + } + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&cro); + SendMessage(hwnd, WM_SETREDRAW, true, 0); + InvalidateRect(hwnd, 0, true); +} +#endif
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/version.rc2 b/Src/Plugins/Visualization/vis_avs/version.rc2 new file mode 100644 index 00000000..bedc24d5 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/version.rc2 @@ -0,0 +1,40 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../../../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,9,3,0 + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Advanced Visualization Studio" + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Visualization Plug-in" + VALUE "FileVersion", "2,9,3,0" + VALUE "InternalName", "Advanced Visualization Studio" + VALUE "LegalCopyright", "Copyright © 2001-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "vis_avs.dll" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/Plugins/Visualization/vis_avs/vis_Avs.dsw b/Src/Plugins/Visualization/vis_avs/vis_Avs.dsw new file mode 100644 index 00000000..b469ac5f --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_Avs.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "vis_avs"=.\vis_avs.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Src/Plugins/Visualization/vis_avs/vis_avs.dsp b/Src/Plugins/Visualization/vis_avs/vis_avs.dsp new file mode 100644 index 00000000..a4f0d111 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_avs.dsp @@ -0,0 +1,722 @@ +# Microsoft Developer Studio Project File - Name="vis_avs" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=vis_avs - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "vis_avs.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "vis_avs.mak" CFG="vis_avs - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "vis_avs - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "vis_avs - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "vis_avs - Win32 Laser Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "vis_avs - Win32 NoMMX Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/vis_avs", RDAAAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "vis_avs - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /G6 /MD /W3 /O2 /Ob2 /I "evallib/" /I "../Wasabi" /D "NDEBUG" /D "WA2_EMBED" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /FD /c +# SUBTRACT CPP /Z<none> /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"c:\progra~1\winamp\plugins\vis_avs.dll" +# SUBTRACT LINK32 /debug + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "evallib/" /D "_DEBUG" /D "WA2_EMBED" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /debug /machine:I386 /out:"c:\progra~1\winamp\plugins\vis_avs.dll" /pdbtype:sept + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Laser Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vis_avs___Win32_Laser_Release" +# PROP BASE Intermediate_Dir "vis_avs___Win32_Laser_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vis_avs___Win32_Laser_Release" +# PROP Intermediate_Dir "vis_avs___Win32_Laser_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "NDEBUG" /D "LASER" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "LASER" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /machine:I386 /out:"c:\program files\winamp\plugins\vis_avs.dll" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /machine:I386 /out:"c:\program files\winamp\plugins\vis_avs_laser.dll" +# SUBTRACT LINK32 /debug + +!ELSEIF "$(CFG)" == "vis_avs - Win32 NoMMX Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vis_avs___Win32_NoMMX_Release" +# PROP BASE Intermediate_Dir "vis_avs___Win32_NoMMX_Release" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vis_avs___Win32_NoMMX_Release" +# PROP Intermediate_Dir "vis_avs___Win32_NoMMX_Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /Ob2 /I "evallib/" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /FD /c +# SUBTRACT BASE CPP /YX +# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /Ob2 /I "evallib/" /D "NDEBUG" /D "NO_MMX" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VIS_PL_EXPORTS" /D "NSEEL_LOOPFUNC_SUPPORT" /D "AVS_MEGABUF_SUPPORT" /FD /c +# SUBTRACT CPP /YX +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"c:\progra~1\winamp\plugins\vis_avs.dll" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib vfw32.lib /nologo /dll /map /machine:I386 /out:"c:\progra~1\winamp\plugins\vis_avs.dll" +# SUBTRACT LINK32 /debug + +!ENDIF + +# Begin Target + +# Name "vis_avs - Win32 Release" +# Name "vis_avs - Win32 Debug" +# Name "vis_avs - Win32 Laser Release" +# Name "vis_avs - Win32 NoMMX Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Renders" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\r_avi.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_blit.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_blur.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bpm.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bright.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bspin.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_bump.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_chanshift.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_clear.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_colorfade.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_colorreduction.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_comment.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_contrast.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dcolormod.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_ddm.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dmove.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotfnt.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotgrid.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_dotpln.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_fadeout.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_fastbright.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_grain.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_interf.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_interleave.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_invert.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_linemode.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_mirror.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_mosaic.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_multidelay.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_multiplier.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_nfclr.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_onetone.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_oscring.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_oscstar.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_parts.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_picture.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_rotblit.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_rotstar.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_scat.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_shift.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_simple.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_sscope.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_stack.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_stars.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_svp.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_text.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_timescope.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_trans.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_videodelay.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_water.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_waterbump.cpp +# End Source File +# End Group +# Begin Group "EvalLib" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\avs_eelif.cpp + +!IF "$(CFG)" == "vis_avs - Win32 Release" + +# ADD CPP /O1 + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Debug" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Laser Release" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 NoMMX Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\avs_eelif.h +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\megabuf.c" + +!IF "$(CFG)" == "vis_avs - Win32 Release" + +# ADD CPP /O1 + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Debug" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Laser Release" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 NoMMX Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\ns-eel-addfuncs.h" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\ns-eel-int.h" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\ns-eel.h" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-caltab.c" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-cfunc.c" + +!IF "$(CFG)" == "vis_avs - Win32 Release" + +# ADD CPP /O1 + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Debug" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 Laser Release" + +!ELSEIF "$(CFG)" == "vis_avs - Win32 NoMMX Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-compiler.c" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-eval.c" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-lextab.c" +# End Source File +# Begin Source File + +SOURCE="..\ns-eel\nseel-yylex.c" +# End Source File +# End Group +# Begin Group "Render utils" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\linedraw.cpp +# End Source File +# Begin Source File + +SOURCE=.\matrix.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_defs.h +# End Source File +# Begin Source File + +SOURCE=.\r_list.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_list.h +# End Source File +# Begin Source File + +SOURCE=.\r_transition.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_transition.h +# End Source File +# Begin Source File + +SOURCE=.\r_unkn.cpp +# End Source File +# Begin Source File + +SOURCE=.\r_unkn.h +# End Source File +# Begin Source File + +SOURCE=.\util.cpp +# End Source File +# End Group +# Begin Group "laser" + +# PROP Default_Filter "" +# Begin Group "laser renders" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\laser\rl_beathold.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_bren.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_cones.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_line.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\rl_trans.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\laser\laser.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\laserline.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\laserline.h +# End Source File +# Begin Source File + +SOURCE=.\laser\ld32.c +# End Source File +# Begin Source File + +SOURCE=.\laser\Ld32.h +# End Source File +# Begin Source File + +SOURCE=.\laser\linelist.cpp +# End Source File +# Begin Source File + +SOURCE=.\laser\linelist.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\bpm.cpp +# End Source File +# Begin Source File + +SOURCE=.\cfgwin.cpp +# End Source File +# Begin Source File + +SOURCE=.\draw.cpp +# End Source File +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# Begin Source File + +SOURCE=.\render.cpp +# End Source File +# Begin Source File + +SOURCE=.\res.rc +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\rlib.cpp +# End Source File +# Begin Source File + +SOURCE=.\TIMING.C +# End Source File +# Begin Source File + +SOURCE=.\TIMING.H +# End Source File +# Begin Source File + +SOURCE=.\undo.cpp +# End Source File +# Begin Source File + +SOURCE=.\wnd.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ape.h +# End Source File +# Begin Source File + +SOURCE=.\bpm.h +# End Source File +# Begin Source File + +SOURCE=.\cfgwnd.h +# End Source File +# Begin Source File + +SOURCE=.\draw.h +# End Source File +# Begin Source File + +SOURCE=.\render.h +# End Source File +# Begin Source File + +SOURCE=.\rlib.h +# End Source File +# Begin Source File + +SOURCE=.\undo.h +# End Source File +# Begin Source File + +SOURCE=.\wnd.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=".\avs-hilited.png" +# End Source File +# Begin Source File + +SOURCE=".\avs-normal.png" +# End Source File +# Begin Source File + +SOURCE=".\avs-selected.png" +# End Source File +# Begin Source File + +SOURCE=.\bump_lig.bin +# End Source File +# Begin Source File + +SOURCE=.\color_mo.bin +# End Source File +# Begin Source File + +SOURCE=.\dyn_dist.bin +# End Source File +# Begin Source File + +SOURCE=.\dyn_move.bin +# End Source File +# Begin Source File + +SOURCE=.\dyn_shift.bin +# End Source File +# Begin Source File + +SOURCE=.\effect_l.bin +# End Source File +# Begin Source File + +SOURCE=.\help_1.bin +# End Source File +# Begin Source File + +SOURCE=.\help_2.bin +# End Source File +# Begin Source File + +SOURCE=.\help_3.bin +# End Source File +# Begin Source File + +SOURCE=.\help_4.bin +# End Source File +# Begin Source File + +SOURCE=.\movement.bin +# End Source File +# Begin Source File + +SOURCE=.\supersco.bin +# End Source File +# End Group +# Begin Group "Text files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\vis_avs.txt +# End Source File +# Begin Source File + +SOURCE=.\whatsnew.txt +# End Source File +# End Group +# End Target +# End Project diff --git a/Src/Plugins/Visualization/vis_avs/vis_avs.sln b/Src/Plugins/Visualization/vis_avs/vis_avs.sln new file mode 100644 index 00000000..d174dab0 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_avs.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29509.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vis_avs", "vis_avs.vcxproj", "{8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}.Debug|Win32.Build.0 = Debug|Win32 + {8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}.Release|Win32.ActiveCfg = Release|Win32 + {8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3490B70A-188B-4E5D-8B96-500B330A05DF} + EndGlobalSection +EndGlobal diff --git a/Src/Plugins/Visualization/vis_avs/vis_avs.txt b/Src/Plugins/Visualization/vis_avs/vis_avs.txt new file mode 100644 index 00000000..2aed6cc4 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_avs.txt @@ -0,0 +1,228 @@ +
+ 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.
+
+
+
+Nullsoft Advanced Visualization Studio (AVS) v2.0a4 README
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+TODO: write readme here :)
+
+Thanks to Paul Holden for the FunkyFX Firewurx APE
+
+Once you install this baby, fire up Winamp, open up the preferences
+(CTRL+P), go to the Plugins/Visualization section, and select
+Nullsoft AVS as the visualization plug-in. Hit start.
+
+Once the AVS opens, it will probably be showing a nice black output.
+To get AVS to display something more interesting, hit space, or right
+click in the black area and select a preset to load.
+
+If you want to create your own presets, click the left mouse button in
+the black area of the window to bring up the AVS Editor window.
+
+The editor lets you create new visuals by adding effects from your Effect
+Library (in the upper right) to the Active Effect list (on the left side).
+Once you've added effects, you can configure each effect by selecting them
+from the Active Effect list. You can also clear the list, or load or save
+the list to be loaded later as a preset.
+
+You can also configure some of AVS's settings by selecting items from the
+Settings section of the Editor.
+
+Hotkeys for main window:
+ * Any winamp key
+ * R toggles randomswitching
+ * F toggles fullscreen framerate counter
+ * Y and U cycle through presets in order
+ * Space goes to random preset
+ * Enter toggles fullscreen
+ * 0,1-9, F1-F10 load presets
+ * Ctrl+above save presets
+
+That's it for now, and enjoy!
+
+
+Version history:
+2.0a4:
+- auto fullscreen window resizing
+2.0a3:
+- updated fullscreen vis code to handle leaving fullscreen
+ unexpectedly better
+- made configwnd repopulation more robust
+- made transitions work when preinit is disabled and you just
+ started up
+2.0a2:
+- updated options of display/fullscreen/trans
+- added doublesize for windowed
+- added seperate opts for windowed/fullscreen for text
+- fixed bug in mosaic.
+2.0a1:
+- preinit of presets for better transitions
+- integrated laser support (built-time option)
+- changed name to 'Winamp AVS'
+- Improved SVP/UVS loading
+- Made superscope support 'red' 'green' and 'blue'
+
+1.5a6:
+- preset transitions, woohoo
+- yay
+
+1.5a4:
+- presets for superscope
+- more superscope options
+- made random preset loading on beat
+- bugfixes
+
+1.5a3:
+- line width option
+- ability to use buffer as alpha channel for blending sub-effects back in
+- tons more
+
+1.5a2:
+- deadbeef: cleanups
+- lone: adjustable blend for sub-effects
+
+1.5a1:
+- deadbeef: made new effect system completely hiererchical and scaleable.
+ reorganized code a lot. cleaned things up. made it nice.
+
+1.0a53:
+- deadbeef: superscope effect
+ made it save to plugins\vis_avs.dat, instead.
+
+a52:
+- deadbeef: optimized/simplified evallib. made it limited to 8 char variable names,
+ 32 variables max.
+ improved ddm effect.
+ improved color clip effect
+
+a51:
+- deadbeef: optimized mosaic, grain, brightness, and bump effects
+ optimized and added more functionality to interleave effect
+- lone : clear - fixed 'first frame only'
+ eval - added sigmoid, sign, max, min, rand, band, bor, bnot, if, equal, above, below
+ ddm - added code for init and beat
+ bump - added 'bi' var to control bump intensity thru exps.
+ - added depth source
+ clear - fixed 'first frame only' (again)
+ onbeat clear - fixed 'skip n beats' which was not saved
+- ron : picture - fixed picture border bugs when aspect ratio was on
+
+a50:
+- deadbeef: added subtractive blend, every other line blend to stack
+ fixed window-no-erase bug.
+ added new dynamic distance modifier effect
+ added 'go' button to fullscreen options
+ added wait for retrace options
+ revised logarithmic spectrum scaling table
+- ron: better no-minimize-on-winamp (now displays a separate window in taskman)
+- lone : bpm - better out of range detection in average calculation
+ - better confidence calculation
+ - added option to predict beats only if bpm has been found
+ - fixed relearn/adapt on new song option
+ - fixed unwanted resets when using 'don't minimize avs when minimizing winamp' option
+ brightness - now works actually like a brightness filter (bit slower tho)
+ text - fixed crash when window is smaller than width/height of text and random mode was checked
+ bump - added invert depth
+ - fixed exclusive use of eval lib, was choking with misc trans/custom
+ or additional bump effects, now saves/restores vars in a clean way.
+ - changed 0-100 range to 0-1 which is much easier to use with math exps
+ (for backward compatibility, old settings are still using the old range)
+
+a49:
+
+- ron: added transparency settings (win2k only).
+ added AVI and Water Bump effects.
+ settings are now drageable (fixed).
+ deleting a setting now doesn't loose selection.
+ evallib now works when AVS is compiled in debug mode.
+ added "don't minimize avs with winamp" setting in Display tab.
+ added BMP Picture rendering.
+- lone: disabled resize in fullscreen mode, fixes directx lockups
+ added Custom BPM filter
+ fixed stuck moving particles when no beat occurs for a long time
+ fixed random word option in text renderer
+ added beat learning - fixed broken version, now better than ever :>
+ added option to dock AVS into litestep's wharfamp window :)
+- deadbeef: restyled editor.
+ made rotation switching variable in rotoblitter, and onbeat zoom changes
+ made loading/saving of unsupported effects/ape's better
+ fixed text drawing bugs.
+ fixed fullscreen-when-no-mode-selected, and made it verify video modes
+ made skin change detection
+ added vertical blank wait options
+ fixed rotoblitter crashing effect
+ tons of other stuff.
+
+
+
+a46: more effects, etc from lone/ron. Improved main interface.
+ a few small bugfixes.
+a44: crashing bugfixes. border drawing bugfixes.
+a43: skinnability. Put the avs.bmp in the skin directory.
+ avs.bmp.
+a42: improved mirror effect. Misc trans now has mixed mapping mode
+ (onbeat changes). should either have fixed or broken coming out
+ of fullscreen modes. Fixed a few cosmetic bugs.
+a41: added lone's mirror effect.
+a40: comment bugfix, lone's effects, MUCH better beat detection
+a39: source mapping translation mode. Fadeto has color to fade to.
+a38: clone button. One level of presets directories allowed. Lets
+ you select a preset directory to pull random/cycles from.
+ Neato.
+a37: comment thingy. Status line. More improvements. No more keyboard
+ controls for config, though :(
+a36: optimized colorfade, moving particle is nicer circle, water effect,
+ little cleanups, AVS editor now in own thread, keyboard controls
+ work better, etc etc .
+a35: more blur options, more presets, new APE module (FyreWurx)
+a33: ultra-fast expression eval. test those custom trantabs to make sure they didn't break.
+a32: unfucks blur for older presets
+a31: dot fountain, baby.
+a30: made effects alpha-channel-safe, made random switching adjustable,
+ a lot of little tastey cleanups, etc.
+a29: nifty-ass framebuffer saving/restoring effect
+a28: adjustable CPU usage. better beat detection stuff. etc.
+a26: new effect (dot grid), widescreen fullscreen modes, etc.
+a25: bugfixes, you can now drop .avs's into the window, etc.
+a24: much better custom transtab stuff (thanks, LONE, not lore. no
+ offense, lore, though :)
+a23: custom transtabs much faster. buggier, though. will be fixed soon.
+ lone owns. :)
+a22: higher framerate, custom transtabs, more effects, etc.
+a21 adds new "Scatter" effect
+a20 adds DLL effect loading (APE)
+a18 fixes close-winamp die bug.
+a18 speeds up colorfade (all table driven)
+a17 fixes win2k fullscreen issues (afaik)
+a16 adds some fixes, and new winamp styled window
+
+and before:
+
+Started out as wVis 5.0. Started out pretty lame.
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj b/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj new file mode 100644 index 00000000..356ca61e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj @@ -0,0 +1,814 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{8105B192-3D54-4D0F-A5CD-4EEFC869C4EF}</ProjectGuid> + <RootNamespace>vis_avs</RootNamespace> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>false</VcpkgEnableManifest> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>true</VcpkgUseStatic> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>true</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>true</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>true</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;evallib;..\..\..\Wasabi;..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;UNICODE;WA2_EMBED;WIN32;_WINDOWS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;_CRT_SECURE_NO_WARNINGS;NO_X86ASM;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4302;4799;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <BufferSecurityCheck>true</BufferSecurityCheck> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>odbc32.lib;odbccp32.lib;ddraw.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <MapFileName>$(IntDir)$(TargetName).map</MapFileName> + <GenerateMapFile>true</GenerateMapFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;evallib;..\..\..\Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;UNICODE;WA2_EMBED;WIN32;_WINDOWS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;_CRT_SECURE_NO_WARNINGS;NO_X86ASM;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4302;4799;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <BufferSecurityCheck>true</BufferSecurityCheck> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>odbc32.lib;odbccp32.lib;ddraw.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <SuppressStartupBanner>true</SuppressStartupBanner> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <MapFileName>$(IntDir)$(TargetName).map</MapFileName> + <GenerateMapFile>true</GenerateMapFile> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <AdditionalIncludeDirectories>.;evallib;..\..\..\Wasabi;..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;UNICODE;WA2_EMBED;WIN32;_WINDOWS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;_CRT_SECURE_NO_WARNINGS;NO_X86ASM;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>true</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <DisableSpecificWarnings>4302;4799;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>odbc32.lib;odbccp32.lib;ddraw.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <GenerateMapFile>true</GenerateMapFile> + <MapFileName>$(IntDir)$(TargetName).map</MapFileName> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <GenerateDebugInformation>false</GenerateDebugInformation> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <AdditionalIncludeDirectories>.;evallib;../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;UNICODE;WA2_EMBED;WIN32;_WINDOWS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;_CRT_SECURE_NO_WARNINGS;NO_X86ASM;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>true</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>None</DebugInformationFormat> + <CompileAs>Default</CompileAs> + <DisableSpecificWarnings>4302;4799;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>odbc32.lib;odbccp32.lib;ddraw.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <GenerateMapFile>true</GenerateMapFile> + <MapFileName>$(IntDir)$(TargetName).map</MapFileName> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <GenerateDebugInformation>false</GenerateDebugInformation> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ </Command> + <Message>Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\ns-eel2\y.tab.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-caltab.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-cfunc.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-compiler.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-eval.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-lextab.c" /> + <ClCompile Include="..\..\..\ns-eel2\nseel-ram.c" /> + <ClCompile Include="avs_eelif.cpp" /> + <ClCompile Include="bpm.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="cfgwin.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="draw.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;NO_X86ASM;</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;NO_X86ASM;</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;NO_X86ASM;</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT;NO_X86ASM;</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\laser.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\laserline.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\ld32.c"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\linelist.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\rl_beathold.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\rl_bren.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\rl_cones.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\rl_line.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="laser\rl_trans.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="linedraw.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="main.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="matrix.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="render.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="rlib.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_avi.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_blit.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_blur.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_bpm.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_bright.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_bspin.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_bump.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_chanshift.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_clear.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_colorfade.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_colorreduction.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_comment.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_contrast.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_dcolormod.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_ddm.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_dmove.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_dotfnt.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_dotgrid.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_dotpln.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_fadeout.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_fastbright.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_grain.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_interf.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_interleave.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_invert.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_linemode.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_list.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_mirror.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_mosaic.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_multidelay.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_multiplier.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_nfclr.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_onetone.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_oscring.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_oscstar.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_parts.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_picture.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_rotblit.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_rotstar.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_scat.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_shift.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_simple.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_sscope.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_stack.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_stars.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_svp.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_text.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_timescope.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_trans.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_transition.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_unkn.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_videodelay.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_water.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="r_waterbump.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="TIMING.C"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="undo.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="util.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + <ClCompile Include="wnd.cpp"> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">WA2_EMBED;WIN32;_WINDOWS;_MBCS;_USRDLL;VIS_PL_EXPORTS;NSEEL_LOOPFUNC_SUPPORT;AVS_MEGABUF_SUPPORT</PreprocessorDefinitions> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="res.rc" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\ns-eel2\ns-eel-addfuncs.h" /> + <ClInclude Include="..\..\..\ns-eel2\ns-eel-int.h" /> + <ClInclude Include="..\..\..\ns-eel2\ns-eel.h" /> + <ClInclude Include="..\..\..\ns-eel2\glue_x86.h" /> + <ClInclude Include="ape.h" /> + <ClInclude Include="avs_eelif.h" /> + <ClInclude Include="bpm.h" /> + <ClInclude Include="cfgwnd.h" /> + <ClInclude Include="draw.h" /> + <ClInclude Include="laser\laserline.h" /> + <ClInclude Include="laser\Ld32.h" /> + <ClInclude Include="laser\linelist.h" /> + <ClInclude Include="render.h" /> + <ClInclude Include="resource.h" /> + <ClInclude Include="rlib.h" /> + <ClInclude Include="r_defs.h" /> + <ClInclude Include="r_list.h" /> + <ClInclude Include="r_transition.h" /> + <ClInclude Include="r_unkn.h" /> + <ClInclude Include="TIMING.H" /> + <ClInclude Include="undo.h" /> + <ClInclude Include="wnd.h" /> + </ItemGroup> + <ItemGroup> + <Text Include="vis_avs.txt" /> + <Text Include="whatsnew.txt" /> + </ItemGroup> + <ItemGroup> + <None Include="bump_lig.bin" /> + <None Include="color_mo.bin" /> + <None Include="dyn_dist.bin" /> + <None Include="dyn_move.bin" /> + <None Include="dyn_shift.bin" /> + <None Include="effect_l.bin" /> + <None Include="help_1.bin" /> + <None Include="help_2.bin" /> + <None Include="help_3.bin" /> + <None Include="help_4.bin" /> + <None Include="movement.bin" /> + <None Include="supersco.bin" /> + </ItemGroup> + <ItemGroup> + <Image Include="avs-hilited.png" /> + <Image Include="avs-normal.png" /> + <Image Include="avs-selected.png" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\tataki\tataki.vcxproj"> + <Project>{255b68b5-7ef8-45ef-a675-2d6b88147909}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj"> + <Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\WAT\WAT.vcxproj"> + <Project>{c5714908-a71f-4644-bd95-aad8ee7914da}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj.filters b/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj.filters new file mode 100644 index 00000000..1d5d93a5 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/vis_avs.vcxproj.filters @@ -0,0 +1,397 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="avs_eelif.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bpm.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="cfgwin.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="draw.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\laser.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\laserline.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\ld32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="linedraw.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\linelist.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="main.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="matrix.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_avi.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_blit.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_blur.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_bpm.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_bright.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_bspin.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_bump.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_chanshift.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_clear.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_colorfade.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_colorreduction.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_comment.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_contrast.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_dcolormod.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_ddm.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_dmove.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_dotfnt.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_dotgrid.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_dotpln.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_fadeout.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_fastbright.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_grain.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_interf.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_interleave.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_invert.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_linemode.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_list.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_mirror.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_mosaic.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_multidelay.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_multiplier.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_nfclr.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_onetone.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_oscring.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_oscstar.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_parts.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_picture.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_rotblit.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_rotstar.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_scat.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_shift.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_simple.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_sscope.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_stack.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_stars.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_svp.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_text.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_timescope.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_trans.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_transition.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_videodelay.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_unkn.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_water.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="r_waterbump.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="render.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\rl_beathold.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\rl_bren.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\rl_cones.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\rl_line.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="laser\rl_trans.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="rlib.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="TIMING.C"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="undo.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="util.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="wnd.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-caltab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-cfunc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-compiler.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-eval.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-lextab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\nseel-ram.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\ns-eel2\y.tab.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ape.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="avs_eelif.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="bpm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="cfgwnd.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="draw.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="laser\laserline.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="laser\Ld32.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="laser\linelist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="r_defs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="r_list.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="r_transition.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="r_unkn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="render.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="rlib.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="TIMING.H"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="undo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="wnd.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\ns-eel2\glue_x86.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\ns-eel2\ns-eel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\ns-eel2\ns-eel-addfuncs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\ns-eel2\ns-eel-int.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Image Include="avs-hilited.png"> + <Filter>Image Files</Filter> + </Image> + <Image Include="avs-normal.png"> + <Filter>Image Files</Filter> + </Image> + <Image Include="avs-selected.png"> + <Filter>Image Files</Filter> + </Image> + </ItemGroup> + <ItemGroup> + <None Include="bump_lig.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="color_mo.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="dyn_dist.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="dyn_move.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="dyn_shift.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="effect_l.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="help_1.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="help_2.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="help_3.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="help_4.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="movement.bin"> + <Filter>Bin Files</Filter> + </None> + <None Include="supersco.bin"> + <Filter>Bin Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <Text Include="vis_avs.txt" /> + <Text Include="whatsnew.txt" /> + </ItemGroup> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{0c48c00b-88c3-4d28-8885-18c16c3cd71f}</UniqueIdentifier> + </Filter> + <Filter Include="Ressource Files"> + <UniqueIdentifier>{0602e4a3-e8f4-495f-baaa-fa3612b2a340}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{ac7b0822-e89e-4c0c-b819-1bac21bf5c49}</UniqueIdentifier> + </Filter> + <Filter Include="Image Files"> + <UniqueIdentifier>{e7728cec-04d3-427a-bad9-aa1be3e625c9}</UniqueIdentifier> + </Filter> + <Filter Include="Bin Files"> + <UniqueIdentifier>{1a8c5984-38ed-45af-9ff5-e097cc54fd83}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="res.rc"> + <Filter>Ressource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/wa_ipc.h b/Src/Plugins/Visualization/vis_avs/wa_ipc.h new file mode 100644 index 00000000..1efc7950 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/wa_ipc.h @@ -0,0 +1,1127 @@ +/* + 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. + +*/ + +#ifndef _WA_IPC_H_ +#define _WA_IPC_H_ + +/* +** This is the modern replacement for the classic 'frontend.h'. Most of these +** updates are designed for in-process use, i.e. from a plugin. +** +*/ + +/* message used to sent many messages to winamp's main window. +** most all of the IPC_* messages involve sending the message in the form of: +** result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*); +*/ +#define WM_WA_IPC WM_USER +/* but some of them use WM_COPYDATA. be afraid. +*/ + +#define IPC_GETVERSION 0 +/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); +** +** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0 +** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know. +*/ + +#define IPC_GETREGISTEREDVERSION 770 + + +typedef struct { + char *filename; + char *title; + int length; +} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA, +// and you get the nice desired result. if title is NULL, it is treated as a "thing", +// otherwise it's assumed to be a file (for speed) + +#define IPC_PLAYFILE 100 // dont be fooled, this is really the same as enqueufile +#define IPC_ENQUEUEFILE 100 +/* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play +** as the lpData. Just enqueues, does not clear the playlist or change the playback +** state. +*/ + + +#define IPC_DELETE 101 +#define IPC_DELETE_INT 1101 // don't use this, it's used internally by winamp when + // dealing with some lame explorer issues. +/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); +** Use IPC_DELETE to clear Winamp's internal playlist. +*/ + + +#define IPC_STARTPLAY 102 // starts playback. almost like hitting play in Winamp. +#define IPC_STARTPLAY_INT 1102 // used internally, don't bother using it (won't be any fun) + + +#define IPC_CHDIR 103 +/* sent as a WM_COPYDATA, with IPC_CHDIR as the dwData, and the directory to change to +** as the lpData. +*/ + + +#define IPC_ISPLAYING 104 +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); +** If it returns 1, it is playing. if it returns 3, it is paused, +** if it returns 0, it is not playing. +*/ + + +#define IPC_GETOUTPUTTIME 105 +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); +** returns the position in milliseconds of the current track (mode = 0), +** or the track length, in seconds (mode = 1). Returns -1 if not playing or error. +*/ + + +#define IPC_JUMPTOTIME 106 +/* (requires Winamp 1.60+) +** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME); +** IPC_JUMPTOTIME sets the position in milliseconds of the +** current song (approximately). +** Returns -1 if not playing, 1 on eof, or 0 if successful +*/ + +#define IPC_GETMODULENAME 109 +#define IPC_EX_ISRIGHTEXE 666 +/* usually shouldnt bother using these, but here goes: +** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal +** flag gets set, which if you send a normal WM_WA_IPC message with +** IPC_EX_ISRIGHTEXE, it returns whether or not that filename +** matches. lame, I know. +*/ + +#define IPC_WRITEPLAYLIST 120 +/* (requires Winamp 1.666+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST); +** +** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u, +** and returns the current playlist position. +** Kinda obsoleted by some of the 2.x new stuff, but still good for when +** using a front-end (instead of a plug-in) +*/ + + +#define IPC_SETPLAYLISTPOS 121 +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS) +** IPC_SETPLAYLISTPOS sets the playlist position to 'position'. It +** does not change playback or anything, it just sets position, and +** updates the view if necessary +*/ + + +#define IPC_SETVOLUME 122 +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME); +** IPC_SETVOLUME sets the volume of Winamp (from 0-255). +*/ + + +#define IPC_SETPANNING 123 +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING); +** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)). +*/ + + +#define IPC_GETLISTLENGTH 124 +/* (requires Winamp 2.0+) +** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); +** IPC_GETLISTLENGTH returns the length of the current playlist, in +** tracks. +*/ + + +#define IPC_GETLISTPOS 125 +/* (requires Winamp 2.05+) +** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); +** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST +** only faster since it doesn't have to write out the list. Heh, silly me. +*/ + + +#define IPC_GETINFO 126 +/* (requires Winamp 2.05+) +** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO); +** IPC_GETINFO returns info about the current playing song. The value +** it returns depends on the value of 'mode'. +** Mode Meaning +** ------------------ +** 0 Samplerate (i.e. 44100) +** 1 Bitrate (i.e. 128) +** 2 Channels (i.e. 2) +** 3 (5+) Video LOWORD=w HIWORD=h +** 4 (5+) > 65536, string (video description) +*/ + + +#define IPC_GETEQDATA 127 +/* (requires Winamp 2.05+) +** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); +** IPC_GETEQDATA queries the status of the EQ. +** The value returned depends on what 'pos' is set to: +** Value Meaning +** ------------------ +** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db) +** 10 The preamp value. 0-63 (+20db - -20db) +** 11 Enabled. zero if disabled, nonzero if enabled. +** 12 Autoload. zero if disabled, nonzero if enabled. +*/ + + +#define IPC_SETEQDATA 128 +/* (requires Winamp 2.05+) +** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA); +** IPC_SETEQDATA sets the value of the last position retrieved +** by IPC_GETEQDATA. This is pretty lame, and we should provide +** an extended version that lets you do a MAKELPARAM(pos,value). +** someday... + + new (2.92+): + if the high byte is set to 0xDB, then the third byte specifies + which band, and the bottom word specifies the value. +*/ + +#define IPC_ADDBOOKMARK 129 +/* (requires Winamp 2.4+) +** Sent as a WM_COPYDATA, using IPC_ADDBOOKMARK, adds the specified +** file/url to the Winamp bookmark list. +*/ +/* +In winamp 5+, we use this as a normal WM_WA_IPC and the string: + + "filename\0title\0" + + to notify the library/bookmark editor that a bookmark +was added. Note that using this message in this context does not +actually add the bookmark. +do not use :) +*/ + + +#define IPC_INSTALLPLUGIN 130 +/* not implemented, but if it was you could do a WM_COPYDATA with +** a path to a .wpz, and it would install it. +*/ + + +#define IPC_RESTARTWINAMP 135 +/* (requires Winamp 2.2+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP); +** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :) +*/ + + +#define IPC_ISFULLSTOP 400 +/* (requires winamp 2.7+ I think) +** ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP); +** useful for when you're an output plugin, and you want to see +** if the stop/close is a full stop, or just between tracks. +** returns nonzero if it's full, zero if it's just a new track. +*/ + + +#define IPC_INETAVAILABLE 242 +/* (requires Winamp 2.05+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE); +** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp. +*/ + + +#define IPC_UPDTITLE 243 +/* (requires Winamp 2.2+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE); +** IPC_UPDTITLE will ask Winamp to update the informations about the current title. +*/ + + +#define IPC_REFRESHPLCACHE 247 +/* (requires Winamp 2.2+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE); +** IPC_REFRESHPLCACHE will flush the playlist cache buffer. +** (send this if you want it to go refetch titles for tracks) +*/ + + +#define IPC_GET_SHUFFLE 250 +/* (requires Winamp 2.4+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); +** +** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set) +*/ + + +#define IPC_GET_REPEAT 251 +/* (requires Winamp 2.4+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); +** +** IPC_GET_REPEAT returns the status of the Repeat option (1 if set) +*/ + + +#define IPC_SET_SHUFFLE 252 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE); +** +** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on) +*/ + + +#define IPC_SET_REPEAT 253 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT); +** +** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on) +*/ + + +#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable +/* (requires Winamp 2.9+) +** SendMessage(hwnd_winamp,WM_WA_IPC,enable?0:0xdeadbeef,IPC_MBOPENREAL); +** sending with 0xdeadbeef as the param disables all winamp windows, +** any other values will enable all winamp windows. +*/ + + +#define IPC_GETWND 260 +/* (requires Winamp 2.9+) +** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND); +** returns the HWND of the window specified. +*/ + #define IPC_GETWND_EQ 0 // use one of these for the param + #define IPC_GETWND_PE 1 + #define IPC_GETWND_MB 2 + #define IPC_GETWND_VIDEO 3 +#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND + + + + +/************************************************************************ +***************** in-process only (WE LOVE PLUGINS) +************************************************************************/ + + +#define IPC_SETSKIN 200 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN); +** IPC_SETSKIN sets the current skin to "skinname". Note that skinname +** can be the name of a skin, a skin .zip file, with or without path. +** If path isn't specified, the default search path is the winamp skins +** directory. +*/ + + +#define IPC_GETSKIN 201 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN); +** IPC_GETSKIN puts the directory where skin bitmaps can be found +** into skinname_buffer. +** skinname_buffer must be MAX_PATH characters in length. +** When using a .zip'd skin file, it'll return a temporary directory +** where the ZIP was decompressed. +*/ + + +#define IPC_EXECPLUG 202 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG); +** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM. +** the format of this string can be: +** "vis_whatever.dll" +** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir) +** "C:\\dir\\vis_whatever.dll,1" +*/ + + +#define IPC_GETPLAYLISTFILE 211 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE); +** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETPLAYLISTTITLE 212 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE); +** +** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETHTTPGETTER 240 +/* retrieves a function pointer to a HTTP retrieval function. +** if this is unsupported, returns 1 or 0. +** the function should be: +** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle); +** if you call this function, with a parent window, a URL, an output file, and a dialog title, +** it will return 0 on successful download, 1 on error. +*/ + + +#define IPC_MBOPEN 241 +/* (requires Winamp 2.05+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN); +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN); +** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window. +*/ + + + +#define IPC_CHANGECURRENTFILE 245 +/* (requires Winamp 2.05+) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE); +** IPC_CHANGECURRENTFILE will set the current playlist item. +*/ + + +#define IPC_GETMBURL 246 +/* (requires Winamp 2.2+) +** char buffer[4096]; // Urls can be VERY long +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL); +** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer. +** buffer must be at least 4096 bytes long. +*/ + + +#define IPC_MBBLOCK 248 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK); +** +** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1 +*/ + +#define IPC_MBOPENREAL 249 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL); +** +** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if +** IPC_MBBLOCK has been set to 1 +*/ + +#define IPC_ADJUST_OPTIONSMENUPOS 280 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS); +** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a +** menu item above the options/skins/vis menus. +*/ + +#define IPC_GET_HMENU 281 +/* (requires Winamp 2.9+) +** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_GET_HMENU); +** values for data: +** 0 : main popup menu +** 1 : main menubar file menu +** 2 : main menubar options menu +** 3 : main menubar windows menu +** 4 : main menubar help menu +** other values will return NULL. +*/ + +#define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam +#define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296 +/* (requires Winamp 2.9+) +** to use, create an extendedFileInfoStruct, point the values filename and metadata to the +** filename and metadata field you wish to query, and ret to a buffer, with retlen to the +** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO); +** the results should be in the buffer pointed to by ret. +** returns 1 if the decoder supports a getExtendedFileInfo method +*/ +typedef struct { + char *filename; + char *metadata; + char *ret; + int retlen; +} extendedFileInfoStruct; + +#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam +typedef struct { + char *filename; + + int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used) + + // filled in by winamp + int length; + char *title; + int titlelen; +} basicFileInfoStruct; + +#define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename + +#define IPC_INFOBOX 293 +typedef struct { + HWND parent; + char *filename; +} infoBoxParam; + +#define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam +/* (requires Winamp 2.9+) +** to use, create an extendedFileInfoStruct, point the values filename and metadata to the +** filename and metadata field you wish to write in ret. (retlen is not used). and then +** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO); +** returns 1 if the metadata is supported +** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update +*/ + +#define IPC_WRITE_EXTENDED_FILE_INFO 295 +/* (requires Winamp 2.9+) +** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file +** returns 1 if the file has been successfully updated, 0 if error +*/ + +#define IPC_FORMAT_TITLE 297 +typedef struct +{ + char *spec; // NULL=default winamp spec + void *p; + + char *out; + int out_len; + + char * (*TAGFUNC)(char * tag, void * p); //return 0 if not found + void (*TAGFREEFUNC)(char * tag,void * p); +} waFormatTitle; + +#define IPC_GETUNCOMPRESSINTERFACE 331 +/* returns a function pointer to uncompress(). +** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen); +** right out of zlib, useful for decompressing zlibbed data. +** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API. +*/ + +typedef struct { + int (*inflateReset)(void *strm); + int (*inflateInit_)(void *strm,const char *version, int stream_size); + int (*inflate)(void *strm, int flush); + int (*inflateEnd)(void *strm); + unsigned long (*crc32)(unsigned long crc, const unsigned char *buf, unsigned int len); +} wa_inflate_struct; + + +#define IPC_ADD_PREFS_DLG 332 +#define IPC_REMOVE_PREFS_DLG 333 +/* (requires Winamp 2.9+) +** to use, allocate a prefsDlgRec structure (either on the heap or some global +** data, but NOT on the stack), initialze the members: +** hInst to the DLL instance where the resource is located +** dlgID to the ID of the dialog, +** proc to the window procedure for the dialog +** name to the name of the prefs page in the prefs. +** where to 0 (eventually we may add more options) +** then, SendMessage(hwnd_winamp,WM_WA_IPC,&prefsRec,IPC_ADD_PREFS_DLG); +** +** you can also IPC_REMOVE_PREFS_DLG with the address of the same prefsRec, +** but you shouldn't really ever have to. +** +*/ +#define IPC_OPENPREFSTOPAGE 380 // pass an id of a builtin page, or a &prefsDlgRec of prefs page to open + +typedef struct _prefsDlgRec { + HINSTANCE hInst; + int dlgID; + void *proc; + + char *name; + int where; // 0 for options, 1 for plugins, 2 for skins, 3 for bookmarks, 4 for prefs + + + int _id; + struct _prefsDlgRec *next; +} prefsDlgRec; + + +#define IPC_GETINIFILE 334 // returns a pointer to winamp.ini +#define IPC_GETINIDIRECTORY 335 // returns a pointer to the directory to put config files in (if you dont want to use winamp.ini) + +#define IPC_SPAWNBUTTONPOPUP 361 // param = +// 0 = eject +// 1 = previous +// 2 = next +// 3 = pause +// 4 = play +// 5 = stop + +#define IPC_OPENURLBOX 360 // pass a HWND to a parent, returns a HGLOBAL that needs to be freed with GlobalFree(), if successful +#define IPC_OPENFILEBOX 362 // pass a HWND to a parent +#define IPC_OPENDIRBOX 363 // pass a HWND to a parent + +// pass an HWND to a parent. call this if you take over the whole UI so that the dialogs are not appearing on the +// bottom right of the screen since the main winamp window is at 3000x3000, call again with NULL to reset +#define IPC_SETDIALOGBOXPARENT 364 + + + +// pass 0 for a copy of the skin HBITMAP +// pass 1 for name of font to use for playlist editor likeness +// pass 2 for font charset +// pass 3 for font size +#define IPC_GET_GENSKINBITMAP 503 + + +#define IPC_GET_EMBEDIF 505 // pass an embedWindowState +// returns an HWND embedWindow(embedWindowState *); if the data is NULL, otherwise returns the HWND directly +typedef struct +{ + HWND me; //hwnd of the window + + int flags; + + RECT r; + + void *user_ptr; // for application use + + int extra_data[64]; // for internal winamp use +} embedWindowState; + +#define EMBED_FLAGS_NORESIZE 1 // set this bit in embedWindowState.flags to keep window from being resizable +#define EMBED_FLAGS_NOTRANSPARENCY 2 // set this bit in embedWindowState.flags to make gen_ff turn transparency off for this wnd + + +#define IPC_EMBED_ENUM 532 +typedef struct embedEnumStruct +{ + int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort + int user_data; // or more :) +} embedEnumStruct; + // pass + +#define IPC_EMBED_ISVALID 533 + +#define IPC_CONVERTFILE 506 +/* (requires Winamp 2.92+) +** Converts a given file to a different format (PCM, MP3, etc...) +** To use, pass a pointer to a waFileConvertStruct struct +** This struct can be either on the heap or some global +** data, but NOT on the stack. At least, until the conversion is done. +** +** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE); +** +** Return value: +** 0: Can't start the conversion. Look at myConvertStruct->error for details. +** 1: Conversion started. Status messages will be sent to the specified callbackhwnd. +** Be sure to call IPC_CONVERTFILE_END when your callback window receives the +** IPC_CB_CONVERT_DONE message. +*/ +typedef struct +{ + char *sourcefile; // "c:\\source.mp3" + char *destfile; // "c:\\dest.pcm" + int destformat[8]; // like 'PCM ',srate,nch,bps + HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages + + //filled in by winamp.exe + char *error; //if IPC_CONVERTFILE returns 0, the reason will be here + + int bytes_done; //you can look at both of these values for speed statistics + int bytes_total; + int bytes_out; + + int killswitch; // don't set it manually, use IPC_CONVERTFILE_END + int extra_data[64]; // for internal winamp use +} convertFileStruct; + +#define IPC_CONVERTFILE_END 507 +/* (requires Winamp 2.92+) +** Stop/ends a convert process started from IPC_CONVERTFILE +** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you +** want to abort a conversion process +** +** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END); +** +** No return value +*/ + +typedef struct { + HWND hwndParent; + int format; + + //filled in by winamp.exe + HWND hwndConfig; + int extra_data[8]; +} convertConfigStruct; +#define IPC_CONVERT_CONFIG 508 +#define IPC_CONVERT_CONFIG_END 509 + +typedef struct +{ + void (*enumProc)(int user_data, const char *desc, int fourcc); + int user_data; +} converterEnumFmtStruct; +#define IPC_CONVERT_CONFIG_ENUMFMTS 510 +/* (requires Winamp 2.92+) +*/ + + +typedef struct +{ + char cdletter; + char *playlist_file; + HWND callback_hwnd; + + //filled in by winamp.exe + char *error; +} burnCDStruct; +#define IPC_BURN_CD 511 +/* (requires Winamp 5.0+) +*/ + +typedef struct +{ + convertFileStruct *cfs; + int priority; +} convertSetPriority; +#define IPC_CONVERT_SET_PRIORITY 512 + +typedef struct +{ + char *filename; + char *title; // 2048 bytes + int length; + int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit +} waHookTitleStruct; +// return TRUE if you hook this +#define IPC_HOOK_TITLES 850 + +#define IPC_GETSADATAFUNC 800 +// 0: returns a char *export_sa_get() that returns 150 bytes of data +// 1: returns a export_sa_setreq(int want); + +#define IPC_ISMAINWNDVISIBLE 900 + + +#define IPC_SETPLEDITCOLORS 920 +typedef struct +{ + int numElems; + int *elems; + HBITMAP bm; // set if you want to override +} waSetPlColorsStruct; + + +// the following IPC use waSpawnMenuParms as parameter +#define IPC_SPAWNEQPRESETMENU 933 +#define IPC_SPAWNFILEMENU 934 //menubar +#define IPC_SPAWNOPTIONSMENU 935 //menubar +#define IPC_SPAWNWINDOWSMENU 936 //menubar +#define IPC_SPAWNHELPMENU 937 //menubar +#define IPC_SPAWNPLAYMENU 938 //menubar +#define IPC_SPAWNPEFILEMENU 939 //menubar +#define IPC_SPAWNPEPLAYLISTMENU 940 //menubar +#define IPC_SPAWNPESORTMENU 941 //menubar +#define IPC_SPAWNPEHELPMENU 942 //menubar +#define IPC_SPAWNMLFILEMENU 943 //menubar +#define IPC_SPAWNMLVIEWMENU 944 //menubar +#define IPC_SPAWNMLHELPMENU 945 //menubar +#define IPC_SPAWNPELISTOFPLAYLISTS 946 + +typedef struct +{ + HWND wnd; + int xpos; // in screen coordinates + int ypos; +} waSpawnMenuParms; + +// waSpawnMenuParms2 is used by the menubar submenus +typedef struct +{ + HWND wnd; + int xpos; // in screen coordinates + int ypos; + int width; + int height; +} waSpawnMenuParms2; + + +// system tray sends this (you might want to simulate it) +#define WM_WA_SYSTRAY WM_USER+1 + +// input plugins send this when they are done playing back +#define WM_WA_MPEG_EOF WM_USER+2 + + + +//// video stuff + +#define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):) +#define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface +#define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24)) +#define VIDUSER_SET_INFOSTRING 0x1000 +#define VIDUSER_GET_VIDEOHWND 0x1001 +#define VIDUSER_SET_VFLIP 0x1002 +#define VIDUSER_SET_TRACKSELINTERFACE 0x1003 // give your ITrackSelector interface as param2 + +#ifndef NO_IVIDEO_DECLARE +#ifdef __cplusplus + +class VideoOutput; +class SubsItem; + +typedef struct { + unsigned char* baseAddr; + long rowBytes; +} YV12_PLANE; + +typedef struct { + YV12_PLANE y; + YV12_PLANE u; + YV12_PLANE v; +} YV12_PLANES; + +class IVideoOutput +{ + public: + virtual ~IVideoOutput() { } + virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0; + virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { } + virtual void close()=0; + virtual void draw(void *frame)=0; + virtual void drawSubtitle(SubsItem *item) { } + virtual void showStatusMsg(const char *text) { } + virtual int get_latency() { return 0; } + virtual void notifyBufferState(int bufferstate) { } /* 0-255*/ + + virtual int extended(int param1, int param2, int param3) { return 0; } // Dispatchable, eat this! +}; + +class ITrackSelector +{ + public: + virtual int getNumAudioTracks()=0; + virtual void enumAudioTrackName(int n, const char *buf, int size)=0; + virtual int getCurAudioTrack()=0; + virtual int getNumVideoTracks()=0; + virtual void enumVideoTrackName(int n, const char *buf, int size)=0; + virtual int getCurVideoTrack()=0; + + virtual void setAudioTrack(int n)=0; + virtual void setVideoTrack(int n)=0; +}; + +#endif //cplusplus +#endif//NO_IVIDEO_DECLARE + +// these messages are callbacks that you can grab by subclassing the winamp window + +// wParam = +#define IPC_CB_WND_EQ 0 // use one of these for the param +#define IPC_CB_WND_PE 1 +#define IPC_CB_WND_MB 2 +#define IPC_CB_WND_VIDEO 3 +#define IPC_CB_WND_MAIN 4 + +#define IPC_CB_ONSHOWWND 600 +#define IPC_CB_ONHIDEWND 601 + +#define IPC_CB_GETTOOLTIP 602 + +#define IPC_CB_MISC 603 + #define IPC_CB_MISC_TITLE 0 + #define IPC_CB_MISC_VOLUME 1 // volume/pan + #define IPC_CB_MISC_STATUS 2 + #define IPC_CB_MISC_EQ 3 + #define IPC_CB_MISC_INFO 4 + #define IPC_CB_MISC_VIDEOINFO 5 + +#define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent) +#define IPC_CB_CONVERT_DONE 605 + +#define IPC_ADJUST_FFWINDOWSMENUPOS 606 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS); +** moves where winamp expects the freeform windows in the menubar windows main menu. Useful if you wish to insert a +** menu item above extra freeform windows. +*/ + +#define IPC_ISDOUBLESIZE 608 + +#define IPC_ADJUST_FFOPTIONSMENUPOS 609 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS); +** moves where winamp expects the freeform preferences item in the menubar windows main menu. Useful if you wish to insert a +** menu item above preferences item. +*/ + +#define IPC_GETTIMEDISPLAYMODE 610 // returns 0 if displaying elapsed time or 1 if displaying remaining time + +#define IPC_SETVISWND 611 // param is hwnd, setting this allows you to receive ID_VIS_NEXT/PREVOUS/RANDOM/FS wm_commands +#define ID_VIS_NEXT 40382 +#define ID_VIS_PREV 40383 +#define ID_VIS_RANDOM 40384 +#define ID_VIS_FS 40389 +#define ID_VIS_CFG 40390 +#define ID_VIS_MENU 40391 + +#define IPC_GETVISWND 612 // returns the vis cmd handler hwnd +#define IPC_ISVISRUNNING 613 +#define IPC_CB_VISRANDOM 628 // param is status of random + +#define IPC_SETIDEALVIDEOSIZE 614 // sent by winamp to winamp, trap it if you need it. width=HIWORD(param), height=LOWORD(param) + +#define IPC_GETSTOPONVIDEOCLOSE 615 +#define IPC_SETSTOPONVIDEOCLOSE 616 + +typedef struct { + HWND hwnd; + int uMsg; + int wParam; + int lParam; +} transAccelStruct; + +#define IPC_TRANSLATEACCELERATOR 617 + +typedef struct { + int cmd; + int x; + int y; + int align; +} windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD + +#define IPC_CB_ONTOGGLEAOT 618 + +#define IPC_GETPREFSWND 619 + +#define IPC_SET_PE_WIDTHHEIGHT 620 // data is a pointer to a POINT structure that holds width & height + +#define IPC_GETLANGUAGEPACKINSTANCE 621 + +#define IPC_CB_PEINFOTEXT 622 // data is a string, ie: "04:21/45:02" + +#define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config + +#define IPC_GETOUTPUTPLUGIN 625 + +#define IPC_SETDRAWBORDERS 626 +#define IPC_DISABLESKINCURSORS 627 +#define IPC_CB_RESETFONT 629 + +#define IPC_IS_FULLSCREEN 630 // returns 1 if video or vis is in fullscreen mode +#define IPC_SET_VIS_FS_FLAG 631 // a vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode + +#define IPC_SHOW_NOTIFICATION 632 + +#define IPC_GETSKININFO 633 + +#define IPC_GET_MANUALPLADVANCE 634 +/* (requires Winamp 5.03+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_MANUALPLADVANCE); +** +** IPC_GET_MANUALPLADVANCE returns the status of the Manual Playlist Advance (1 if set) +*/ + +#define IPC_SET_MANUALPLADVANCE 635 +/* (requires Winamp 5.03+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_MANUALPLADVANCE); +** +** IPC_SET_MANUALPLADVANCE sets the status of the Manual Playlist Advance option (1 to turn it on) +*/ + +#define IPC_GET_NEXT_PLITEM 636 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_NEXT_PLITEM); +** +** Sent to Winamp's main window when an item has just finished playback or the next button has been pressed and +** requesting the new playlist item number to go to. +** Mainly used by gen_jumpex. Subclass this message in your application to return the new item number. +** -1 for normal winamp operation (default) or the new item number in the playlist to play. +*/ + +#define IPC_GET_PREVIOUS_PLITEM 637 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_PREVIOUS_PLITEM); +** +** Sent to Winamp's main window when the previous button has been pressed and Winamp is requesting the new playlist item number to go to. +** Mainly used by gen_jumpex. Subclass this message in your application to return the new item number. +** -1 for normal winamp operation (default) or the new item number in the playlist to play. +*/ + +#define IPC_IS_WNDSHADE 638 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,wnd,IPC_IS_WNDSHADE); +** +** 'wnd' is window id as defined for IPC_GETWND, or -1 for main window +** Returns 1 if wnd is set to winshade mode, or 0 if it is not +*/ + +#define IPC_SETRATING 639 +/* (requires Winamp 5.04+ with ML) +** SendMessage(hwnd_winamp,WM_WA_IPC,rating,IPC_SETRATING); +** 'rating' is an int value from 0 (no rating) to 5 +*/ + +#define IPC_GETRATING 640 +/* (requires Winamp 5.04+ with ML) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING); +** returns the current item's rating +*/ + +#define IPC_GETNUMAUDIOTRACKS 641 +/* (requires Winamp 5.04+) +** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMAUDIOTRACKS); +** returns the number of audio tracks for the currently playing item +*/ + +#define IPC_GETNUMVIDEOTRACKS 642 +/* (requires Winamp 5.04+) +** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMVIDEOTRACKS); +** returns the number of video tracks for the currently playing item +*/ + +#define IPC_GETAUDIOTRACK 643 +/* (requires Winamp 5.04+) +** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETAUDIOTRACK); +** returns the id of the current audio track for the currently playing item +*/ + +#define IPC_GETVIDEOTRACK 644 +/* (requires Winamp 5.04+) +** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVIDEOTRACK); +** returns the id of the current video track for the currently playing item +*/ + +#define IPC_SETAUDIOTRACK 645 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETAUDIOTRACK); +** switch the currently playing item to a new audio track +*/ + +#define IPC_SETVIDEOTRACK 646 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETVIDEOTRACK); +** switch the currently playing item to a new video track +*/ + +#define IPC_PUSH_DISABLE_EXIT 647 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PUSH_DISABLE_EXIT ); +** lets you disable or re-enable the UI exit functions (close button, +** context menu, alt-f4). +** call IPC_POP_DISABLE_EXIT when you are done doing whatever required +** preventing exit +*/ + +#define IPC_POP_DISABLE_EXIT 648 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_POP_DISABLE_EXIT ); +** see IPC_PUSH_DISABLE_EXIT +*/ + +#define IPC_IS_EXIT_ENABLED 649 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_EXIT_ENABLED); +** returns 0 if exit is disabled, 1 otherwise +*/ + +#define IPC_IS_AOT 650 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_AOT); +** returns status of always on top flag. note: this may not match the actual +** TOPMOST window flag while another fullscreen application is focused +*/ + +#define IPC_USES_RECYCLEBIN 651 +/* +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN); +** returns 1 if deleted files should be sent to the recycle bin. +** returns 0 if deleted files should be deleted permanently. +** +** You should check for this option if your plugin deletes files +** so that your setting matches the winamp setting +*/ +// >>>>>>>>>>> Next is 652 + +#define IPC_PLCMD 1000 + +#define PLCMD_ADD 0 +#define PLCMD_REM 1 +#define PLCMD_SEL 2 +#define PLCMD_MISC 3 +#define PLCMD_LIST 4 + +#define IPC_MBCMD 1001 + +#define MBCMD_BACK 0 +#define MBCMD_FORWARD 1 +#define MBCMD_STOP 2 +#define MBCMD_RELOAD 3 +#define MBCMD_MISC 4 + +#define IPC_VIDCMD 1002 + +#define VIDCMD_FULLSCREEN 0 +#define VIDCMD_1X 1 +#define VIDCMD_2X 2 +#define VIDCMD_LIB 3 +#define VIDPOPUP_MISC 4 + +#define IPC_MBURL 1003 //sets the URL +#define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready) +#define IPC_MBGETDESC 1005 //copies the current URL description into wParam (have a 4096 buffer ready) +#define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND +#define IPC_MBREFRESH 1007 //refreshes the "now playing" view in the library +#define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready) + +#define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status + +// IPC 2000-3000 reserved for freeform messages, see gen_ff/ff_ipc.h +#define IPC_FF_FIRST 2000 +#define IPC_FF_LAST 3000 + +#define IPC_GETDROPTARGET 3001 + +#define IPC_PLAYLIST_MODIFIED 3002 // sent to main wnd whenever the playlist is modified + +#define IPC_PLAYING_FILE 3003 // sent to main wnd with the file as parm whenever a file is played +#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004 // sent to main wnd with the file as parm whenever a file tag might be updated + + +#define IPC_ALLOW_PLAYTRACKING 3007 +// send nonzero to allow, zero to disallow + +#define IPC_HOOK_OKTOQUIT 3010 // return 0 to abort a quit, nonzero if quit is OK + +#define IPC_WRITECONFIG 3011 // pass 2 to write all, 1 to write playlist + common, 0 to write common+less common + +#define IPC_TOGGLE_RESIZE 3012 // USE THIS TO TOGGLE RESIZING OFF/ON BP. +// USE THIS TO PASS A URL TO AD WINDOW bp +#define IPC_SHOW_AD_URL 3013 // pass the URL (char *) in lparam +#define IPC_SHOW_HWND 3014 // HWND of AdBox is in lparam +// pass a string to be the name to register, and returns a value > 65536, which is a unique value you can use +// for custom WM_WA_IPC messages. +#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536 + + + +#endif//_WA_IPC_H_
\ No newline at end of file diff --git a/Src/Plugins/Visualization/vis_avs/whatsnew.txt b/Src/Plugins/Visualization/vis_avs/whatsnew.txt new file mode 100644 index 00000000..12601f16 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/whatsnew.txt @@ -0,0 +1,233 @@ +-francis:
+added floor(), ceil() and $Phi
+added "cancel fullscreen on deactivation" toggle option
+
+-mig:
+added example infrastructure to dmove. :)
+now there are 8 examples in dmove. also tuned up my beat-interpolation algos! woo!
+
+-justin
+added blend modes to misc / buffer save
+made config expand trees by default
+
+-mig:
+started work on undo/redo system.
+infrastructure seems to work, but I can't figure out the magical
+ incantation to make the UI reflect the newly altered render list
+ although it seems to actually go back to the last values in the renderer.
+"Do you want to save?" dirty flag now contained (mostly) in the undo object.
+(In fact, it saves a dirty bit for every undo state, so you can undo twice,
+ save, then redo and you should have your dirty bit still set. If you then
+ undo yet again, you're back to what you saved and you have no dirty bit)
+added more examples to SuperScope
+
+-justin:
+fixed memory leak in evallib stuff I made a bit back
+added debug window, moved register watch to it, added error listing
+added option for clear variables on recompile in debug window
+fixed bugs, too.
+
+-justin:
+started adding setting for reinit on edit for evallib stuff
+made config change detection a little more accurate
+made superscope/dmove/shift/etc reinit on edit work right
+made trans / movement only replace usereval with preseteval if editted
+fyi: trans / movement also provides 'sw' and 'sh' for screen width and height,
+ so things like 'd=d*0.93 + (((x*sw/2)&(y*sh/2)&1)*-0.3);' are fun :)
+fixed trans / movement backwards compatible stuff (no crashy at least)
+updated eval documentation stuff, need people to write docs for it, too.. heheh
+lots of ui cleanups (more edit room!)
+fixed some fullscreen new fbresize bugs
+updated fullscreen overlay mode some
+updated maximum local variables to 256 from 64
+added global registers [reg00,reg01,... reg99] for debug
+ and effect synchronization (or inter-preset communication)
+added global register watch in root list window (for debugging)
+added comments for eval code. // and /* bla */
+updated eval documentation
+added gettime() function to eval
+made annoying grey rectangle below tree go away when you aren't docked
+added new color modifier effect, which can be used to replace
+ (with script) a lot of different effects (and be faster and more flexible).
+added 'minimum blend' mode for effect lists/line drawing
+added 'round up' option for Blur.
+made a generic avs directory scanner routine for subdirs (yay!)
+ made it only generate menus when opened, for speed
+made effects that use evallib reset variables to empty on recompile
+made avs track dirtiness of presets, and (optionally) prompt to save etc
+made avs resize images when resizing (optionally)
+added extended APE interface, that lets you access evallib, global registers,
+ line blend/width modes. (see apesdk.zip)
+
+
+
+
+- mig: made most of the presets in Trans/Movement show their algos in the edit field (so you can tune them yourself)
+ added multiple new algos to the preset list
+
+- mig: removed ability to RMB in fullscreen mode. Bug 331 from the database. want make new gui. want make now.
+- basu: added 'onbeat enabled' option to lists
+- christophe: added thread priority settings (so you can set avs in idle prority while keeping winamp in
+ high prio.)
+2.0a7:
+- made better multimonitor support -- still needs more work (making it able to go fullscreen and you do other things
+2.0a6:
+- added 'skip first' in misc/custom bpm
+- added interferences effect
+2.0a4:
+- auto fullscreen window resizing
+2.0a3:
+- updated fullscreen vis code to handle leaving fullscreen
+ unexpectedly better
+- made configwnd repopulation more robust
+- made transitions work when preinit is disabled and you just
+ started up
+2.0a2:
+- updated options of display/fullscreen/trans
+- added doublesize for windowed
+- added seperate opts for windowed/fullscreen for text
+- fixed bug in mosaic.
+
+2.0a1:
+- preinit of presets for better transitions
+- integrated laser support (built-time option)
+- changed name to 'Winamp AVS'
+- Improved SVP/UVS loading
+- Made superscope support 'red' 'green' and 'blue'
+
+1.5a6:
+- preset transitions, woohoo
+- yay
+
+1.5a4:
+- presets for superscope
+- more superscope options
+- made random preset loading on beat
+- bugfixes
+
+1.5a3:
+- line width option
+- ability to use buffer as alpha channel for blending sub-effects back in
+- tons more
+
+1.5a2:
+- deadbeef: cleanups
+- lone: adjustable blend for sub-effects
+
+1.5a1:
+- deadbeef: made new effect system completely hiererchical and scaleable.
+ reorganized code a lot. cleaned things up. made it nice.
+
+1.0a53:
+- deadbeef: superscope effect
+ made it save to plugins\vis_avs.dat, instead.
+-lone : added Trans / Invert
+ added Trans / Unique tone
+ added Render / Timescope
+
+a52:
+- deadbeef: optimized/simplified evallib. made it limited to 8 char variable names,
+ 32 variables max.
+ improved ddm effect.
+ improved color clip effect
+
+a51:
+- deadbeef: optimized mosaic, grain, brightness, and bump effects
+ optimized and added more functionality to interleave effect
+- lone : clear - fixed 'first frame only'
+ eval - added sigmoid, sign, max, min, rand, band, bor, bnot, if, equal, above, below
+ ddm - added code for init and beat
+ bump - added 'bi' var to control bump intensity thru exps.
+ - added depth source
+ clear - fixed 'first frame only' (again)
+ onbeat clear - fixed 'skip n beats' which was not saved
+- ron : picture - fixed picture border bugs when aspect ratio was on
+
+a50:
+- deadbeef: added subtractive blend, every other line blend to stack
+ fixed window-no-erase bug.
+ added new dynamic distance modifier effect
+ added 'go' button to fullscreen options
+ added wait for retrace options
+ revised logarithmic spectrum scaling table
+- ron: better no-minimize-on-winamp (now displays a separate window in taskman)
+- lone : bpm - better out of range detection in average calculation
+ - better confidence calculation
+ - added option to predict beats only if bpm has been found
+ - fixed relearn/adapt on new song option
+ - fixed unwanted resets when using 'don't minimize avs when minimizing winamp' option
+ brightness - now works actually like a brightness filter (bit slower tho)
+ text - fixed crash when window is smaller than width/height of text and random mode was checked
+ bump - added invert depth
+ - fixed exclusive use of eval lib, was choking with misc trans/custom
+ or additional bump effects, now saves/restores vars in a clean way.
+ - changed 0-100 range to 0-1 which is much easier to use with math exps
+ (for backward compatibility, old settings are still using the old range)
+
+a49:
+
+- ron: added transparency settings (win2k only).
+ added AVI and Water Bump effects.
+ settings are now drageable (fixed).
+ deleting a setting now doesn't loose selection.
+ evallib now works when AVS is compiled in debug mode.
+ added "don't minimize avs with winamp" setting in Display tab.
+ added BMP Picture rendering.
+- lone: disabled resize in fullscreen mode, fixes directx lockups
+ added Custom BPM filter
+ fixed stuck moving particles when no beat occurs for a long time
+ fixed random word option in text renderer
+ added beat learning - fixed broken version, now better than ever :>
+ added option to dock AVS into litestep's wharfamp window :)
+- deadbeef: restyled editor.
+ made rotation switching variable in rotoblitter, and onbeat zoom changes
+ made loading/saving of unsupported effects/ape's better
+ fixed text drawing bugs.
+ fixed fullscreen-when-no-mode-selected, and made it verify video modes
+ made skin change detection
+ added vertical blank wait options
+ fixed rotoblitter crashing effect
+ tons of other stuff.
+
+
+
+a46: more effects, etc from lone/ron. Improved main interface.
+ a few small bugfixes.
+a44: crashing bugfixes. border drawing bugfixes.
+a43: skinnability. Put the avs.bmp in the skin directory.
+ avs.bmp.
+a42: improved mirror effect. Misc trans now has mixed mapping mode
+ (onbeat changes). should either have fixed or broken coming out
+ of fullscreen modes. Fixed a few cosmetic bugs.
+a41: added lone's mirror effect.
+a40: comment bugfix, lone's effects, MUCH better beat detection
+a39: source mapping translation mode. Fadeto has color to fade to.
+a38: clone button. One level of presets directories allowed. Lets
+ you select a preset directory to pull random/cycles from.
+ Neato.
+a37: comment thingy. Status line. More improvements. No more keyboard
+ controls for config, though :(
+a36: optimized colorfade, moving particle is nicer circle, water effect,
+ little cleanups, AVS editor now in own thread, keyboard controls
+ work better, etc etc .
+a35: more blur options, more presets, new APE module (FyreWurx)
+a33: ultra-fast expression eval. test those custom trantabs to make sure they didn't break.
+a32: unfucks blur for older presets
+a31: dot fountain, baby.
+a30: made effects alpha-channel-safe, made random switching adjustable,
+ a lot of little tastey cleanups, etc.
+a29: nifty-ass framebuffer saving/restoring effect
+a28: adjustable CPU usage. better beat detection stuff. etc.
+a26: new effect (dot grid), widescreen fullscreen modes, etc.
+a25: bugfixes, you can now drop .avs's into the window, etc.
+a24: much better custom transtab stuff (thanks, LONE, not lore. no
+ offense, lore, though :)
+a23: custom transtabs much faster. buggier, though. will be fixed soon.
+ lone owns. :)
+a22: higher framerate, custom transtabs, more effects, etc.
+a21 adds new "Scatter" effect
+a20 adds DLL effect loading (APE)
+a18 fixes close-winamp die bug.
+a18 speeds up colorfade (all table driven)
+a17 fixes win2k fullscreen issues (afaik)
+a16 adds some fixes, and new winamp styled window
diff --git a/Src/Plugins/Visualization/vis_avs/wnd.cpp b/Src/Plugins/Visualization/vis_avs/wnd.cpp new file mode 100644 index 00000000..7b920059 --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/wnd.cpp @@ -0,0 +1,1749 @@ +/* + 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. + +*/ +#include <stdio.h> +#include <windows.h> +#include <windowsx.h> +#include "vis.h" +#include "draw.h" +#include "wnd.h" +#include "cfgwnd.h" +#include "r_defs.h" +#include "resource.h" +#include "render.h" +#include "undo.h" +#include <multimon.h> + +#include "avs_eelif.h" + +#define WINAMP_NEXT_WINDOW 40063 +#include "wa_ipc.h" +#include "ff_ipc.h" +#include "../Agave/Language/api_language.h" + +#ifndef WS_EX_LAYERED +#define WS_EX_LAYERED 0x80000 +#endif + +#ifndef LWA_ALPHA +#define LWA_ALPHA 2 +#endif + +#define ID_VIS_NEXT 40382 +#define ID_VIS_PREV 40383 +#define ID_VIS_RANDOM 40384 + +struct winampVisModule *g_mod; +extern volatile int g_ThreadQuit; +extern int /*g_preset_dirty,*/ config_prompt_save_preset, config_reuseonresize; +int g_saved_preset_dirty; +extern int cfg_cancelfs_on_deactivate; + +extern char g_noeffectstr[]; +#ifndef WA2_EMBED +static int cfg_x=100, cfg_y=100, cfg_w=400, cfg_h=300; +#endif + +#ifndef WA2_EMBED +static HDC hFrameDC; +static HBITMAP hFrameBitmap, hFrameBitmap_old; +#else +embedWindowState myWindowState; +HWND g_hWA2ParentWindow; +#endif + +int g_reset_vars_on_recompile=1; // fucko: add config for this + + +// Wharf integration +int inWharf=0; +int need_redock=0; + +extern int cfg_fs_use_overlay; +extern int g_config_seh; + + +void toggleWharfAmpDock(HWND hwnd); + +//- + +int g_in_destroy=0,g_minimized=0,g_fakeinit=0; + +int g_rnd_cnt; +char g_skin_name[MAX_PATH]; + +int debug_reg[8]; + +void GetClientRect_adj(HWND hwnd, RECT *r) +{ + GetClientRect(hwnd,r); +#ifndef WA2_EMBED + if (!inWharf) + { + r->right-=7+6; + r->bottom-=15+5; + } +#endif +} + +HWND g_hwnd; + +HWND hwnd_WinampParent; +extern HWND g_hwndDlg; +extern char last_preset[2048]; +char *scanstr_back(char *str, char *toscan, char *defval) +{ + char *s=str+strlen(str)-1; + if (strlen(str) < 1) return defval; + if (strlen(toscan) < 1) return defval; + while (1) + { + char *t=toscan; + while (*t) + if (*t++ == *s) return s; + t=CharPrev(str,s); + if (t==s) return defval; + s=t; + } +} + +int LoadPreset(int preset) +{ + char temp[MAX_PATH]; + wsprintf(temp,"%s\\PRESET%02d.APH",g_path,preset); + if (g_render_transition->LoadPreset(temp,1)) + return 0; + if (preset < 12) wsprintf(last_preset,"\\F%d.aph",preset+1); + else if (preset < 22) wsprintf(last_preset,"\\%d.aph",preset-12); + else if (preset < 32) wsprintf(last_preset,"\\Shift-%d.aph",preset-22); + return 1; +} + +void WritePreset(int preset) +{ + char temp[MAX_PATH]; + wsprintf(temp,"%s\\PRESET%02d.APH",g_path,preset); + g_render_effects->__SavePreset(temp); +} + +void my_getViewport( RECT *r, RECT *sr ) +{ + if ( sr ) + { + HINSTANCE h = LoadLibraryW( L"user32.dll" ); + if ( h ) + { + HMONITOR( WINAPI * Mfr )( LPCRECT lpcr, DWORD dwFlags ) = ( HMONITOR( WINAPI * )( LPCRECT, DWORD ) ) GetProcAddress( h, "MonitorFromRect" ); + BOOL( WINAPI * Gmi )( HMONITOR mon, LPMONITORINFO lpmi ) = ( BOOL( WINAPI * )( HMONITOR, LPMONITORINFO ) ) GetProcAddress( h, "GetMonitorInfoW" ); + if ( Mfr && Gmi ) + { + HMONITOR hm; + hm = Mfr( sr, MONITOR_DEFAULTTONULL ); + if ( hm ) + { + MONITORINFOEXW mi; + memset( &mi, 0, sizeof( mi ) ); + mi.cbSize = sizeof( mi ); + + if ( Gmi( hm, &mi ) ) + { + *r = mi.rcWork; + return; + } + } + } + FreeLibrary( h ); + } + } + SystemParametersInfoW( SPI_GETWORKAREA, 0, r, 0 ); +} + + +void SetTransparency(HWND hWnd, int enable, int amount) +{ +#ifdef WA2_EMBED + // disable transparency if hosted in gen_ff + HWND w = myWindowState.me; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) w = GetParent(w); + char classname[256]; + GetClassName(w, classname, 255); classname[255] = 0; + if (!stricmp(classname, "BaseWindow_RootWnd")) return; + // -- +#endif + + DWORD dwLong; + HINSTANCE h; + void (__stdcall *a)(HWND h, int a, int b, int c); + + hWnd=GetParent(hWnd); + + dwLong = GetWindowLong(hWnd, GWL_EXSTYLE); + if(amount==255||!enable) { + if(dwLong&WS_EX_LAYERED) + SetWindowLong(hWnd, GWL_EXSTYLE, dwLong & ~WS_EX_LAYERED); + } else { + if(!(dwLong&WS_EX_LAYERED)) + SetWindowLong(hWnd, GWL_EXSTYLE, dwLong | WS_EX_LAYERED); + h=LoadLibrary("USER32.DLL"); + if(h!=NULL) { + a=(void (__stdcall *)(HWND,int,int,int))GetProcAddress(h,"SetLayeredWindowAttributes"); + if(a!=NULL) + a(hWnd, RGB(0,0,0), amount, LWA_ALPHA); + FreeLibrary(h); + } + } +} + +int readyToLoadPreset(HWND parent, int isnew) +{ + if (config_prompt_save_preset && C_UndoStack::isdirty()) + { + static int here; + if (here) return 0; + here=1; + + // strange bugfix, ick + void Wnd_GoWindowed(HWND hwnd); + if (DDraw_IsFullScreen()) Wnd_GoWindowed(g_hwnd); + + char title[48]; + int ret=MessageBox(parent, + WASABI_API_LNGSTRING(!isnew?IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_LOAD: + IDS_CURRENT_PRESET_EDITED_SAVE_BEFORE_NEW), + WASABI_API_LNGSTRING_BUF(IDS_AVS_PRESET_MODIFIED,title,48),MB_YESNOCANCEL); + here=0; + + if (ret == IDCANCEL) + { + return 0; + } + if (ret == IDYES) + { + int dosavePreset(HWND hwndDlg); + int r=1; +// if (last_preset[0]) + // r=g_render_effects->SavePreset(last_preset); + + if (r) + { + if (dosavePreset(parent)) return 0; + } + } + } + //C_UndoStack::clear(); + // g_preset_dirty=0; + return 1; +} + +char *extension(char *fn) +{ + char *s = fn + strlen(fn); + while (s >= fn && *s != '.' && *s != '\\') s--; + if (s < fn) return fn; + if (*s == '\\') return fn; + return (s+1); +} + +static int last_windowed_w, last_windowed_h; +void Wnd_GoWindowed(HWND hwnd) +{ + if (DDraw_IsFullScreen()) + { +#ifdef WA2_EMBED + SendMessage(g_mod->hwndParent,WM_WA_IPC,0,IPC_SET_VIS_FS_FLAG); +#endif +#if !defined(WA2_EMBED) + DDraw_SetFullScreen(0,cfg_w-7-6,cfg_h-15-5,cfg_fs_d&2,0); +#else + SetParent(hwnd,myWindowState.me); + SetWindowLong(hwnd,GWL_STYLE,WS_VISIBLE|WS_CHILDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_OVERLAPPED); + DDraw_SetFullScreen(0,last_windowed_w,last_windowed_h,cfg_fs_d&2,0); + HWND w = myWindowState.me; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) w = GetParent(w); + ShowWindow(w,SW_SHOWNA); +#endif + + if (cfg_cancelfs_on_deactivate) ShowCursor(TRUE); + int tm=(GetWindowLong(g_mod->hwndParent,GWL_EXSTYLE)&WS_EX_TOPMOST)==WS_EX_TOPMOST; + +#if !defined(WA2_EMBED) + SetWindowPos(hwnd,tm?HWND_TOPMOST:HWND_NOTOPMOST,cfg_x,cfg_y,cfg_w,cfg_h,SWP_NOACTIVATE); +#else + PostMessage(GetParent(hwnd),WM_SIZE,0,0); +#endif + + SetTransparency(hwnd,cfg_trans,cfg_trans_amount); + + SetTimer(hwnd,88,100,NULL); + } +} + +void Wnd_GoFullScreen(HWND hwnd) +{ + if (!DDraw_IsFullScreen()) + { + +#if 1 +#ifdef WA2_EMBED + if (SendMessage(g_mod->hwndParent,WM_WA_IPC,0,IPC_IS_PLAYING_VIDEO)>1) + { + PostMessage(hwnd,WM_USER+1667,1,2); + return; + } +#endif +#endif + + extern int cfg_fs_use_overlay; +#ifdef WA2_EMBED + RECT r; + GetClientRect(hwnd,&r); + last_windowed_w=r.right; + last_windowed_h=r.bottom; +#endif + + if (!DDraw_IsMode(cfg_fs_w,cfg_fs_h,cfg_fs_bpp)) + { + int DDraw_PickMode(int *w, int *h, int *bpp); + if (!DDraw_PickMode(&cfg_fs_w,&cfg_fs_h,&cfg_fs_bpp)) + return; + } + + { +#ifdef WA2_EMBED + SendMessage(g_mod->hwndParent,WM_WA_IPC,1,IPC_SET_VIS_FS_FLAG); +#endif + RECT tr; + if (inWharf) + { + need_redock=1; + toggleWharfAmpDock(hwnd); + } + SetTransparency(hwnd,0,0); + if (cfg_cancelfs_on_deactivate) ShowCursor(FALSE); + GetWindowRect(hwnd,&tr); + if (cfg_cfgwnd_open) ShowWindow(g_hwndDlg,SW_HIDE); + if (!cfg_fs_use_overlay) + { +#if defined(WA2_EMBED) + SetWindowLong(hwnd,GWL_STYLE,WS_VISIBLE); + SetParent(hwnd,NULL); + HWND w = myWindowState.me; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) w = GetParent(w); + ShowWindow(w,SW_HIDE); +#endif + DDraw_SetFullScreen(1,cfg_fs_w,cfg_fs_h,cfg_fs_d&1,cfg_fs_bpp); + RECT r; + my_getViewport(&r,&tr); + SetWindowPos(hwnd,HWND_TOPMOST,r.left,r.top,cfg_fs_w,cfg_fs_h,0); + SetForegroundWindow(hwnd); + } + else + { +#if defined(WA2_EMBED) + SetWindowLong(hwnd,GWL_STYLE,WS_VISIBLE); + SetParent(hwnd,NULL); + HWND w = myWindowState.me; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) w = GetParent(w); + ShowWindow(w,SW_HIDE); +#endif + DDraw_SetFullScreen(1,cfg_fs_w,cfg_fs_h,cfg_fs_d&1,0); + } + } +#if 0 + else + { + if (!cfg_cfgwnd_open) + { + ShowWindow(g_hwndDlg,SW_SHOWNA); + CfgWnd_RePopIfNeeded(); + cfg_cfgwnd_open=1; + } + SendMessage(g_hwndDlg,WM_COMMAND,IDM_FULLSCREEN,0); + } +#endif + } +} + +int g_config_smp_mt=2,g_config_smp=0; +static char *INI_FILE; + +static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +int cfg_fs_dblclk=1; + +int Wnd_Init(struct winampVisModule *this_mod) +{ + WNDCLASS wc={0,}; + g_mod=this_mod; + wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; + wc.lpfnWndProc = WndProc; + wc.hInstance = this_mod->hDllInstance; + wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); + wc.lpszClassName = "avswnd"; + wc.hCursor=LoadCursor(NULL,IDC_ARROW); + + hwnd_WinampParent=this_mod->hwndParent; + + + if (!RegisterClass(&wc)) + { +// MessageBox(this_mod->hwndParent,"Error registering window class","Error",MB_OK); + // return 1; + } + { +#ifndef REAPLAY_PLUGIN + INI_FILE = (char*)SendMessage(this_mod->hwndParent,WM_WA_IPC,0,IPC_GETINIFILE); +#else + extern const char *(*get_ini_file)(); + INI_FILE = (char *)get_ini_file(); +#endif +#define AVS_SECTION "AVS" +#ifdef LASER +#undef AVS_SECTION +#define AVS_SECTION "AVS_L" + extern int g_laser_nomessage,g_laser_zones; + g_laser_nomessage=GetPrivateProfileInt(AVS_SECTION,"laser_nomessage",0,INI_FILE); + g_laser_zones=GetPrivateProfileInt(AVS_SECTION,"laser_zones",1,INI_FILE); +#else + g_config_smp=GetPrivateProfileInt(AVS_SECTION,"smp",0,INI_FILE); + g_config_smp_mt=GetPrivateProfileInt(AVS_SECTION,"smp_mt",2,INI_FILE); +#endif + need_redock=GetPrivateProfileInt(AVS_SECTION,"cfg_docked",0,INI_FILE); + cfg_cfgwnd_x=GetPrivateProfileInt(AVS_SECTION,"cfg_cfgwnd_x",cfg_cfgwnd_x,INI_FILE); + cfg_cfgwnd_y=GetPrivateProfileInt(AVS_SECTION,"cfg_cfgwnd_y",cfg_cfgwnd_y,INI_FILE); + cfg_cfgwnd_open=GetPrivateProfileInt(AVS_SECTION,"cfg_cfgwnd_open",cfg_cfgwnd_open,INI_FILE); + cfg_fs_w=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_w",cfg_fs_w,INI_FILE); + cfg_fs_h=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_h",cfg_fs_h,INI_FILE); + cfg_fs_bpp=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_bpp",cfg_fs_bpp,INI_FILE); + cfg_fs_d=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_d",cfg_fs_d,INI_FILE); + cfg_fs_fps=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_fps",6,INI_FILE); + cfg_fs_rnd=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_rnd",cfg_fs_rnd,INI_FILE); + cfg_fs_rnd_time=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_rnd_time",cfg_fs_rnd_time,INI_FILE); + cfg_fs_dblclk=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_dblclk",cfg_fs_dblclk,INI_FILE); + cfg_fs_flip=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_flip",cfg_fs_flip,INI_FILE); + cfg_fs_height=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_height",cfg_fs_height,INI_FILE); + cfg_fs_use_overlay=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_use_overlay",cfg_fs_use_overlay,INI_FILE); + cfg_cancelfs_on_deactivate=GetPrivateProfileInt(AVS_SECTION,"cfg_fs_cancelondeactivate",cfg_cancelfs_on_deactivate,INI_FILE); + cfg_speed=GetPrivateProfileInt(AVS_SECTION,"cfg_speed",cfg_speed,INI_FILE); + cfg_trans=GetPrivateProfileInt(AVS_SECTION,"cfg_trans",cfg_trans,INI_FILE); + cfg_dont_min_avs=GetPrivateProfileInt(AVS_SECTION,"cfg_dont_min_avs",cfg_dont_min_avs,INI_FILE); + cfg_smartbeat=GetPrivateProfileInt(AVS_SECTION,"cfg_smartbeat",cfg_smartbeat,INI_FILE); + cfg_smartbeatsticky=GetPrivateProfileInt(AVS_SECTION,"cfg_smartbeatsticky",cfg_smartbeatsticky,INI_FILE); + cfg_smartbeatresetnewsong=GetPrivateProfileInt(AVS_SECTION,"cfg_smartbeatresetnewsong",cfg_smartbeatresetnewsong,INI_FILE); + cfg_smartbeatonlysticky=GetPrivateProfileInt(AVS_SECTION,"cfg_smartbeatonlysticky",cfg_smartbeatonlysticky,INI_FILE); + GetPrivateProfileString( AVS_SECTION,"config_pres_subdir","",config_pres_subdir,sizeof(config_pres_subdir),INI_FILE); + GetPrivateProfileString( AVS_SECTION,"last_preset_name","",last_preset,sizeof(last_preset),INI_FILE); + cfg_transitions=GetPrivateProfileInt(AVS_SECTION,"cfg_transitions_en",cfg_transitions,INI_FILE); + cfg_transitions2=GetPrivateProfileInt(AVS_SECTION,"cfg_transitions_preinit",cfg_transitions2,INI_FILE); + cfg_transitions_speed=GetPrivateProfileInt(AVS_SECTION,"cfg_transitions_speed",cfg_transitions_speed,INI_FILE); + cfg_transition_mode=GetPrivateProfileInt(AVS_SECTION,"cfg_transitions_mode",cfg_transition_mode,INI_FILE); + cfg_bkgnd_render=GetPrivateProfileInt(AVS_SECTION,"cfg_bkgnd_render",cfg_bkgnd_render,INI_FILE); + cfg_bkgnd_render_color=GetPrivateProfileInt(AVS_SECTION,"cfg_bkgnd_render_color",cfg_bkgnd_render_color,INI_FILE); + cfg_render_prio=GetPrivateProfileInt(AVS_SECTION,"cfg_render_prio",cfg_render_prio,INI_FILE); + g_saved_preset_dirty=GetPrivateProfileInt(AVS_SECTION,"g_preset_dirty",C_UndoStack::isdirty(),INI_FILE); + config_prompt_save_preset=GetPrivateProfileInt(AVS_SECTION,"cfg_prompt_save_preset",config_prompt_save_preset,INI_FILE); + config_reuseonresize=GetPrivateProfileInt(AVS_SECTION,"cfg_reuseonresize",config_reuseonresize,INI_FILE); + g_log_errors=GetPrivateProfileInt(AVS_SECTION,"cfg_log_errors",g_log_errors,INI_FILE); + g_reset_vars_on_recompile=GetPrivateProfileInt(AVS_SECTION,"cfg_reset_vars",g_reset_vars_on_recompile,INI_FILE); + g_config_seh=GetPrivateProfileInt(AVS_SECTION,"cfg_seh",g_config_seh,INI_FILE); + + +#ifdef WA2_EMBED + memset(&myWindowState,0,sizeof(myWindowState)); + myWindowState.r.left=GetPrivateProfileInt(AVS_SECTION,"wx",32,INI_FILE); + myWindowState.r.top=GetPrivateProfileInt(AVS_SECTION,"wy",32,INI_FILE); + myWindowState.r.right = GetPrivateProfileInt(AVS_SECTION,"ww",320,INI_FILE)+myWindowState.r.left; + myWindowState.r.bottom = GetPrivateProfileInt(AVS_SECTION,"wh",240,INI_FILE)+myWindowState.r.top; +#else + cfg_x=GetPrivateProfileInt(AVS_SECTION,"cfg_x",cfg_x,INI_FILE); + cfg_y=GetPrivateProfileInt(AVS_SECTION,"cfg_y",cfg_y,INI_FILE); + cfg_w=GetPrivateProfileInt(AVS_SECTION,"cfg_w",cfg_w,INI_FILE); + cfg_h=GetPrivateProfileInt(AVS_SECTION,"cfg_h",cfg_h,INI_FILE); +#endif + + int x; + for (x = 0; x < 8; x ++) + { + char debugreg[32]; + wsprintf(debugreg,"debugreg_%d",x); + debug_reg[x]=GetPrivateProfileInt(AVS_SECTION,debugreg,x,INI_FILE); + } + + } +#ifdef LASER + cfg_transitions=0; + cfg_transition_mode=0; + cfg_transitions2=0; +#endif + + g_in_destroy=0; +#ifndef WA2_EMBED + { + RECT ir={cfg_x,cfg_y,cfg_w+cfg_x,cfg_y+cfg_h}; + RECT or; + my_getViewport(&or,&ir); + if (cfg_x < or.left) cfg_x=or.left; + if (cfg_y < or.top) cfg_y=or.top; + if (cfg_x > or.right-16) cfg_x=or.right-16; + if (cfg_y > or.bottom-16) cfg_y=or.bottom-16; + // determine bounding rectangle for window + } +#endif +#ifndef WA2_EMBED + int styles=WS_VISIBLE; + HWND par = g_minimized?NULL:this_mod->hwndParent; +#else + int styles=WS_CHILDWINDOW|WS_OVERLAPPED|WS_CLIPCHILDREN|WS_CLIPSIBLINGS; + HWND (*e)(embedWindowState *v) = NULL; +#ifndef REAPLAY_PLUGIN + *(void**)&e = (void *)SendMessage(this_mod->hwndParent,WM_WA_IPC,(LPARAM)0,IPC_GET_EMBEDIF); + HWND par=0; + if (e) par=e(&myWindowState); + if (par) SetWindowText(par,"AVS"); +#else + HWND par = this_mod->hwndParent; +#endif + g_hWA2ParentWindow=par; +#endif + +#ifndef WA2_EMBED + + CreateWindowEx(WS_EX_ACCEPTFILES,"avswnd","Winamp AVS Display", + styles,cfg_x,cfg_y,cfg_w,cfg_h,par,NULL, + this_mod->hDllInstance,0); +#else + CreateWindowEx(WS_EX_ACCEPTFILES,"avswnd","avs", + styles,0,0,100,100,par,NULL, this_mod->hDllInstance,0); + SendMessage(this_mod->hwndParent, WM_WA_IPC, (int)g_hwnd, IPC_SETVISWND); +#endif + if (!g_hwnd) + { + char title[32]; + MessageBox(this_mod->hwndParent,WASABI_API_LNGSTRING(IDS_ERROR_CREATING_WINDOW), + WASABI_API_LNGSTRING_BUF(IDS_AVS_ERROR,title,32),MB_OK); + return 1; + } +#ifndef REAPLAY_PLUGIN +#ifdef WA2_EMBED + ShowWindow(g_hwnd,SW_SHOWNA); + ShowWindow(par,SW_SHOWNA); +#endif +#endif + SetTransparency(g_hwnd,cfg_trans,cfg_trans_amount); + return 0; +} + +static void WriteInt(char *name, int value) +{ + char str[128]; + wsprintf(str,"%d",value); + WritePrivateProfileString(AVS_SECTION,name,str,INI_FILE); +} + +void Wnd_Quit(void) +{ + extern HWND g_hwndDlg; + g_in_destroy=1; +#ifdef WA2_EMBED + SendMessage(g_mod->hwndParent, WM_WA_IPC, 0, IPC_SETVISWND); + if (myWindowState.me) + { + SetForegroundWindow(g_mod->hwndParent); + DestroyWindow(myWindowState.me); + } + else +#endif + if (g_hwnd && IsWindow(g_hwnd)) DestroyWindow(g_hwnd); + g_hwnd=NULL; + UnregisterClass("avswnd",g_mod->hDllInstance); + { +#ifdef LASER + extern int g_laser_zones,g_laser_nomessage; + wsprintf(str,"%d",g_laser_zones); + WriteInt("laser_zones",g_laser_zones); + WriteInt("laser_nomessage",g_laser_nomessage); +#else + WriteInt("smp",g_config_smp); + WriteInt("smp_mt",g_config_smp_mt); +#endif +#ifdef WA2_EMBED + WriteInt("wx",myWindowState.r.left); + WriteInt("wy",myWindowState.r.top); + WriteInt("ww",myWindowState.r.right-myWindowState.r.left); + WriteInt("wh",myWindowState.r.bottom-myWindowState.r.top); +#else + WriteInt("cfg_x",cfg_x); + WriteInt("cfg_y",cfg_y); + WriteInt("cfg_w",cfg_w); + WriteInt("cfg_h",cfg_h); +#endif + WritePrivateProfileString(AVS_SECTION,"config_pres_subdir",config_pres_subdir,INI_FILE); + + WriteInt("cfg_docked",inWharf?1:0); + WriteInt("cfg_cfgwnd_open",cfg_cfgwnd_open); + WriteInt("cfg_cfgwnd_x",cfg_cfgwnd_x); + WriteInt("cfg_cfgwnd_y",cfg_cfgwnd_y); + WriteInt("cfg_fs_w",cfg_fs_w); + WriteInt("cfg_fs_h",cfg_fs_h); + WriteInt("cfg_fs_d",cfg_fs_d); + WriteInt("cfg_fs_bpp",cfg_fs_bpp); + WriteInt("cfg_fs_fps",cfg_fs_fps); + WriteInt("cfg_fs_rnd",cfg_fs_rnd); + WriteInt("cfg_fs_rnd_time",cfg_fs_rnd_time); + WriteInt("cfg_fs_dblclk",cfg_fs_dblclk); + WriteInt("cfg_fs_flip",cfg_fs_flip); + WriteInt("cfg_fs_height",cfg_fs_height); + WriteInt("cfg_fs_use_overlay",cfg_fs_use_overlay); + WriteInt("cfg_fs_cancelondeactivate",cfg_cancelfs_on_deactivate); + WriteInt("cfg_speed",cfg_speed); + WriteInt("cfg_trans",cfg_trans); + WriteInt("cfg_dont_min_avs",cfg_dont_min_avs); + WriteInt("cfg_smartbeat",cfg_smartbeat); + WriteInt("cfg_smartbeatsticky",cfg_smartbeatsticky); + WriteInt("cfg_smartbeatresetnewsong",cfg_smartbeatresetnewsong); + WriteInt("cfg_smartbeatonlysticky",cfg_smartbeatonlysticky); + WriteInt("cfg_transitions_en",cfg_transitions); + WriteInt("cfg_transitions_preinit",cfg_transitions2); + WriteInt("cfg_transitions_speed",cfg_transitions_speed); + WriteInt("cfg_transitions_mode",cfg_transition_mode); + WriteInt("cfg_bkgnd_render",cfg_bkgnd_render); + WriteInt("cfg_bkgnd_render_color",cfg_bkgnd_render_color); + WriteInt("cfg_render_prio",cfg_render_prio); + WriteInt("g_preset_dirty",C_UndoStack::isdirty()); + WriteInt("cfg_prompt_save_preset",config_prompt_save_preset); + WritePrivateProfileString(AVS_SECTION,"last_preset_name",last_preset,INI_FILE); + WriteInt("cfg_reuseonresize",config_reuseonresize); + WriteInt("cfg_log_errors",g_log_errors); + WriteInt("cfg_reset_vars",g_reset_vars_on_recompile); + WriteInt("cfg_seh",g_config_seh); + + int x; + for (x = 0; x < 8; x ++) + { + char debugreg[32]; + wsprintf(debugreg,"debugreg_%d",x); + WriteInt(debugreg,debug_reg[x]); + } + } +} + + +void toggleWharfAmpDock(HWND hwnd) +{ + if (DDraw_IsFullScreen()) return; + HWND Wharf=g_hwndDlg?GetDlgItem(g_hwndDlg,IDC_RRECT):NULL; + if (!Wharf) return; + + if (!inWharf) + { + RECT r,r2; + + // show IDC_RRECT, resize IDC_TREE1 down + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_RRECT),&r); + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_TREE1),&r2); + SetWindowPos(GetDlgItem(g_hwndDlg,IDC_TREE1),NULL,0,0,r2.right-r2.left,r.top - 4 - r2.top,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); + ShowWindow(GetDlgItem(g_hwndDlg,IDC_RRECT),SW_SHOWNA); + +#ifdef WA2_EMBED + GetClientRect(hwnd,&r); + last_windowed_w=r.right; + last_windowed_h=r.bottom; +#endif + inWharf=1; + GetWindowRect(Wharf, &r); + SetParent(hwnd, Wharf); +#ifndef WA2_EMBED + SetWindowLong(hwnd, GWL_STYLE, (GetWindowLong(hwnd,GWL_STYLE)&(~WS_POPUP))|WS_CHILD); +#else + HWND w = g_hWA2ParentWindow; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) + { + w = GetParent(w); + } + if (!SendMessage(g_mod->hwndParent, WM_WA_IPC, (int)w, IPC_FF_ISMAINWND)) ShowWindow(w,SW_HIDE); + else ShowWindow(g_hWA2ParentWindow,SW_HIDE); +#endif + SetWindowPos(hwnd, NULL, 0, 0, r.right-r.left, r.bottom-r.top, SWP_NOZORDER|SWP_NOACTIVATE); + DDraw_Resize(r.right-r.left, r.bottom-r.top,cfg_fs_d&2); + } + else + { + + RECT r,r2; + // hide IDC_RRECT, resize IDC_TREE1 up + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_RRECT),&r); + GetWindowRect(GetDlgItem(g_hwndDlg,IDC_TREE1),&r2); + ShowWindow(GetDlgItem(g_hwndDlg,IDC_RRECT),SW_HIDE); + SetWindowPos(GetDlgItem(g_hwndDlg,IDC_TREE1),NULL,0,0,r2.right-r2.left,r.bottom - r2.top - 2,SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); + +#ifndef WA2_EMBED + SetWindowLong(hwnd, GWL_STYLE, (GetWindowLong(hwnd,GWL_STYLE)&(~(WS_CHILD|WS_VISIBLE)))|WS_POPUP); + SetParent(hwnd, NULL); + SetWindowPos(hwnd, NULL, cfg_x, cfg_y, cfg_w,cfg_h, SWP_NOZORDER|SWP_NOACTIVATE); + DDraw_Resize(cfg_w-7-6,cfg_h-15-5,cfg_fs_d&2); + ShowWindow(hwnd,SW_SHOWNA); +#else + SetParent(hwnd, g_hWA2ParentWindow); + DDraw_Resize(last_windowed_w,last_windowed_h,cfg_fs_d&2); + + HWND w = g_hWA2ParentWindow; + while (GetWindowLong(w, GWL_STYLE) & WS_CHILD) + { + w = GetParent(w); + } + if (SendMessage(g_mod->hwndParent, WM_WA_IPC, (int)w, IPC_FF_ISMAINWND)) + w=g_hWA2ParentWindow; + + PostMessage(GetParent(hwnd),WM_SIZE,0,0); + + ShowWindow(w,SW_SHOWNA); + + //SetWindowPos(hwnd,0,0,0,cfg_w,cfg_h,SWP_NOACTIVATE|SWP_NOZORDER); + //SetTimer(hwnd,66,500,NULL); +#endif + InvalidateRect(Wharf,NULL,TRUE); + inWharf=0; + } +} + +int findInMenu(HMENU parent, HMENU sub, UINT id, char *buf, int buf_len) +{ + int x,l=GetMenuItemCount(parent); + char *bufadd=buf+strlen(buf); + bufadd[0]='\\'; + for (x = 0; x < l; x ++) + { + MENUITEMINFO mi={sizeof(mi),MIIM_SUBMENU|MIIM_TYPE|MIIM_ID,}; + mi.dwTypeData=bufadd+1; + mi.cch=buf_len - (bufadd-buf+2); + GetMenuItemInfo(parent,x,TRUE,&mi); + if (mi.hSubMenu) + { + if (sub && mi.hSubMenu == sub) + return 1; + if (findInMenu(mi.hSubMenu,sub,id,buf,buf_len)) + return 1; + } + else + { + if (!sub && id && mi.wID == id) + return 1; + } + } + bufadd[0]=0; + return 0; +} + +static int find_preset(char *parent_path, int dir, char *lastpreset, char *newpreset, int *state) +{ + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[4096]; + wsprintf(dirmask,"%s\\*.avs",parent_path); + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (!(d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + wsprintf(dirmask,"%s\\%s",parent_path,d.cFileName); + + if (lastpreset) + { + if (*state) + { + strcpy(newpreset,dirmask); + FindClose(h); + return 1; + } + if (dir > 0) + { + if (!newpreset[0]) // save the first one we find, in case we fail (wrap) + strcpy(newpreset,dirmask); + + if (!stricmp(dirmask,lastpreset)) *state=1; + } + if (dir < 0) + { + if (!stricmp(dirmask,lastpreset)) + { + if (newpreset[0]) { // if we find it first, skip it so we can go to the end :) + FindClose(h); + return 1; + } + } + strcpy(newpreset,dirmask); + } + + } + else + { + int cnt=++(*state); + if (cnt < 1) cnt=1; + int r=((rand()&1023)<<10)|(rand()&1023); + if (r < (1024*1024)/cnt) + { + strcpy(newpreset,dirmask); + } + } + } + } while (FindNextFile(h,&d)); + FindClose(h); + } + wsprintf(dirmask,"%s\\*.*",parent_path); + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[0] != '.') + { + wsprintf(dirmask,"%s\\%s",parent_path,d.cFileName); + if (find_preset(dirmask,dir,lastpreset,newpreset,state)) { + FindClose(h); + return 1; + } + } + } while (FindNextFile(h,&d)); + FindClose(h); + } + return 0; +} + +void next_preset(HWND hwnd) { + g_rnd_cnt=0; + + if (readyToLoadPreset(hwnd,0)) + { + char dirmask[2048]; + char i_path[1024]; + if (config_pres_subdir[0]) wsprintf(i_path,"%s\\%s",g_path,config_pres_subdir); + else strcpy(i_path,g_path); + + dirmask[0]=0; + + int state=0; + find_preset(i_path,1,last_preset,dirmask,&state); + + if (dirmask[0] && stricmp(last_preset,dirmask)) + { + if (g_render_transition->LoadPreset(dirmask,2) != 2) + lstrcpyn(last_preset,dirmask,sizeof(last_preset)); + } + } +} + +void random_preset(HWND hwnd) { + g_rnd_cnt=0; + if (readyToLoadPreset(hwnd,0)) + { + char dirmask[2048]; + char i_path[1024]; + if (config_pres_subdir[0]) wsprintf(i_path,"%s\\%s",g_path,config_pres_subdir); + else strcpy(i_path,g_path); + + dirmask[0]=0; + + int state=0; + find_preset(i_path,0,NULL,dirmask,&state); + + if (dirmask[0]) + { + if (g_render_transition->LoadPreset(dirmask,4) != 2) + lstrcpyn(last_preset,dirmask,sizeof(last_preset)); + } + } +} + +void previous_preset(HWND hwnd) { + g_rnd_cnt=0; + if (readyToLoadPreset(hwnd,0)) + { + char dirmask[2048]; + char i_path[1024]; + if (config_pres_subdir[0]) wsprintf(i_path,"%s\\%s",g_path,config_pres_subdir); + else strcpy(i_path,g_path); + + dirmask[0]=0; + + int state=0; + find_preset(i_path,-1,last_preset,dirmask,&state); + + if (dirmask[0] && stricmp(last_preset,dirmask)) + { + if (g_render_transition->LoadPreset(dirmask,2) != 2) + lstrcpyn(last_preset,dirmask,sizeof(last_preset)); + } + } +} + +static HMENU presetTreeMenu; +static int presetTreeCount; + +void DoPopupMenu() { + // Winamp3 Bug#331: Don't let the popupmenu pop when in fullscreen. + if (!DDraw_IsFullScreen()) + { + void DDraw_NoUpdateScreen(int r); + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[1024]; + + if (presetTreeMenu) DestroyMenu(presetTreeMenu); + + POINT p; + int x; + int insert_pos=0, directory_pos=0; + presetTreeMenu=CreatePopupMenu(); + + { + MENUITEMINFO i={sizeof(i),}; + i.fMask=MIIM_TYPE|MIIM_DATA|MIIM_ID; + i.fType=MFT_STRING; + i.dwItemData=0; + + i.wID = 1024; + i.dwTypeData=WASABI_API_LNGSTRING(IDS_FULLSCREEN); + i.cch=strlen(i.dwTypeData); + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + + if (!inWharf) + { + i.wID = 256; + i.dwTypeData=WASABI_API_LNGSTRING(IDS_AVS_EDITOR); + i.cch=strlen(i.dwTypeData); + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + } + + if (!DDraw_IsFullScreen()) + { + i.wID = 512; + i.dwTypeData=WASABI_API_LNGSTRING(IDS_DOCK_IN_AVS_EDITOR); + i.cch=strlen(i.dwTypeData); + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + } + + i.wID=0; + i.fType=MFT_SEPARATOR; + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + } + + GetCursorPos(&p); + if (DDraw_IsFullScreen()) + { + CheckMenuItem(presetTreeMenu,1024,MF_CHECKED); + } + if (IsWindowVisible(g_hwndDlg)) CheckMenuItem(presetTreeMenu,256,MF_CHECKED); + if (inWharf) CheckMenuItem(presetTreeMenu,512,MF_CHECKED); + + wsprintf(dirmask,"%s\\*.*",g_path); + + directory_pos=insert_pos; + + presetTreeCount=1025; + h = FindFirstFile(dirmask,&d); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[0] != '.') + { + MENUITEMINFO mi={sizeof(mi),MIIM_SUBMENU|MIIM_TYPE,MFT_STRING,MFS_DEFAULT + }; + mi.hSubMenu=CreatePopupMenu(); + mi.dwTypeData=d.cFileName; + mi.cch = strlen(d.cFileName); + InsertMenuItem(presetTreeMenu,directory_pos++,TRUE,&mi); + insert_pos++; + } + else if (!stricmp(extension(d.cFileName),"avs")) + { + extension(d.cFileName)[-1]=0; + MENUITEMINFO i={sizeof(i),MIIM_TYPE|MIIM_ID,MFT_STRING,MFS_DEFAULT }; + i.dwTypeData = d.cFileName; + i.cch = strlen(d.cFileName); + i.wID=presetTreeCount++; + InsertMenuItem(presetTreeMenu,insert_pos++,TRUE,&i); + } + } while (FindNextFile(h,&d)); + FindClose(h); + } + + x=TrackPopupMenu(presetTreeMenu,TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,p.x,p.y,0,g_hwnd,NULL); + if (x == 1024) + { + if (DDraw_IsFullScreen()) + { + if (!cfg_fs_use_overlay) Wnd_GoWindowed(g_hwnd); + } + else + Wnd_GoFullScreen(g_hwnd); + } + else if (x == 512) + { + if (!inWharf && !cfg_cfgwnd_open) + { + cfg_cfgwnd_open=1; + ShowWindow(g_hwndDlg,SW_SHOWNA); + CfgWnd_RePopIfNeeded(); + } + toggleWharfAmpDock(g_hwnd); + } + else if (x == 256) + { + SendMessage(g_hwnd,WM_USER+33,0,0); + } + else if (x >= 1025) + { + char buf[2048]; + buf[0]=0; + if (readyToLoadPreset(g_hwnd,0)) + { + if (findInMenu(presetTreeMenu,0,x,buf,2048)) + { + char temp[4096]; + wsprintf(temp,"%s%s.avs",g_path,buf); + if (g_render_transition->LoadPreset(temp,1) != 2) + lstrcpyn(last_preset,temp,sizeof(last_preset)); + } + else + { +// g_render_transition->LoadPreset +// wsprintf(temp,"%s\\%s",g_path,curfilename); + } + } + } + + DestroyMenu(presetTreeMenu); + presetTreeMenu=0; + + } +} + +static LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + if ( DDraw_IsFullScreen() && + !cfg_fs_use_overlay && + ( ( message == WM_KEYDOWN && wParam == VK_ESCAPE ) || + message == WM_LBUTTONUP || + ( message == WM_NCACTIVATE && !wParam ) || + message == WM_KILLFOCUS + ) + ) + { + Wnd_GoWindowed( hwnd ); + return 0; + } + else if ( message == WM_LBUTTONUP ) + { + if ( !DDraw_IsFullScreen() ) + { +#ifndef WA2_EMBED + int x = GET_X_LPARAM( lParam ); + int y = GET_Y_LPARAM( lParam ); + RECT r; + GetClientRect( hwnd, &r ); + if ( x > r.right - 12 && x < r.right - 3 && y > r.top + 3 && y < r.top + 13 ) + { + g_in_destroy = 1; + DestroyWindow( hwnd ); + } +#endif + /* + else + { + static int lastdblclk; + if (lastdblclk && GetTickCount()-lastdblclk > 1000 && !inWharf) + DDraw_SetStatusText("double-click for configuration",600); + lastdblclk=GetTickCount(); + } + */ + } + } + if ( message == WM_LBUTTONDOWN ) + { + SetFocus( g_hwnd ); + if ( inWharf ) SetFocus( hwnd ); + SetCapture( hwnd ); + return 0; + } + if ( message == WM_LBUTTONUP ) + { + POINT p; + RECT r; + p.x = GET_X_LPARAM( lParam ); + p.y = GET_Y_LPARAM( lParam ); + ClientToScreen( hwnd, &p ); + if ( inWharf ) + { + GetWindowRect( g_hwndDlg, &r ); + if ( !PtInRect( &r, p ) ) + { + toggleWharfAmpDock( hwnd ); + } + } + else + { + RECT r2; + GetWindowRect( GetDlgItem( g_hwndDlg, IDC_TREE1 ), &r ); + GetWindowRect( hwnd, &r2 ); + if ( PtInRect( &r, p ) && cfg_cfgwnd_open && !PtInRect( &r2, p ) ) + { + toggleWharfAmpDock( hwnd ); + } + } + ReleaseCapture(); + return 0; + } + if ( message == WM_LBUTTONDBLCLK && !DDraw_IsFullScreen() ) + { + if ( cfg_fs_dblclk ) + { + if ( DDraw_IsFullScreen() ) + { + if ( !cfg_fs_use_overlay ) Wnd_GoWindowed( hwnd ); + } + else + Wnd_GoFullScreen( hwnd ); + } + else + { + if ( inWharf ) + { + toggleWharfAmpDock( hwnd ); + } + else if ( IsWindowVisible( g_hwndDlg ) ) + { + cfg_cfgwnd_open = 0; + ShowWindow( g_hwndDlg, SW_HIDE ); + } + else + { + cfg_cfgwnd_open = 1; + ShowWindow( g_hwndDlg, SW_SHOWNA ); + CfgWnd_RePopIfNeeded(); + } + } + return 0; + } + + switch ( message ) + { + case WM_USER + 1667: + if ( wParam == 1 && lParam == 2 ) + { + char title[ 32 ]; + MessageBox( hwnd, WASABI_API_LNGSTRING( IDS_CANNOT_GO_FULLSCREEN_WHEN_VIDEO_PLAYING ), + WASABI_API_LNGSTRING_BUF( IDS_AVS_FULLSCREEN, title, 32 ), + MB_OK | MB_ICONINFORMATION ); + } + return 0; + case WM_USER + 1666: + if ( wParam == 1 && lParam == 15 ) + { + if ( DDraw_IsFullScreen() ) + { + if ( cfg_fs_use_overlay ) SetFocus( hwnd ); // kill overlay window + else Wnd_GoWindowed( hwnd ); + } + } + return 0; + case WM_INITMENUPOPUP: + if ( HIWORD( lParam ) == 0 && presetTreeMenu && !GetMenuItemCount( (HMENU) wParam ) ) + { + char buf[ 2048 ]; + buf[ 0 ] = 0; + if ( findInMenu( presetTreeMenu, (HMENU) wParam, 0, buf, 2048 ) ) + { + HANDLE h; + WIN32_FIND_DATA d; + char dirmask[ 4096 ]; + wsprintf( dirmask, "%s%s\\*.*", g_path, buf ); + int directory_pos = 0, insert_pos = 0; + // build menu + h = FindFirstFile( dirmask, &d ); + if ( h != INVALID_HANDLE_VALUE ) + { + do + { + if ( d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && d.cFileName[ 0 ] != '.' ) + { + MENUITEMINFO mi = { sizeof( mi ),MIIM_SUBMENU | MIIM_TYPE,MFT_STRING,MFS_DEFAULT }; + mi.hSubMenu = CreatePopupMenu(); + mi.dwTypeData = d.cFileName; + mi.cch = strlen( d.cFileName ); + InsertMenuItem( (HMENU) wParam, directory_pos++, TRUE, &mi ); + insert_pos++; + } + else if ( !stricmp( extension( d.cFileName ), "avs" ) ) + { + extension( d.cFileName )[ -1 ] = 0; + MENUITEMINFO i = { sizeof( i ),MIIM_TYPE | MIIM_ID,MFT_STRING,MFS_DEFAULT }; + i.dwTypeData = d.cFileName; + i.cch = strlen( d.cFileName ); + i.wID = presetTreeCount++; + InsertMenuItem( (HMENU) wParam, insert_pos++, TRUE, &i ); + } + } while ( FindNextFile( h, &d ) ); + FindClose( h ); + } + } + } + return 0; + case WM_RBUTTONUP: + DoPopupMenu(); + return 0; + case WM_USER + 33: + DDraw_SetStatusText( "", 100 ); + if ( inWharf ) + { + toggleWharfAmpDock( hwnd ); + } + else if ( IsWindowVisible( g_hwndDlg ) ) + { + cfg_cfgwnd_open = 0; + ShowWindow( g_hwndDlg, SW_HIDE ); + } + else + { + cfg_cfgwnd_open = 1; + ShowWindow( g_hwndDlg, SW_SHOWNA ); + CfgWnd_RePopIfNeeded(); + } + return 0; + case WM_USER + 32: + Wnd_GoFullScreen( hwnd ); + return 0; + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + if ( ( GetAsyncKeyState( VK_CONTROL ) & 0x8000 ) && wParam == VK_F4 ) + { + SendMessage( hwnd, WM_CLOSE, 0, 0 ); + return 0; + } + if ( ( GetAsyncKeyState( VK_MENU ) & 0x8000 ) && wParam == VK_F4 ) + { + PostMessage( hwnd_WinampParent, message, wParam, lParam ); + break; + } + + if ( wParam == VK_SPACE ) + { + do_random: + random_preset( hwnd ); + } + else if ( wParam == 0x55 ) + { + next_preset( hwnd ); + } + else if ( wParam == 0x59 ) + { + previous_preset( hwnd ); + } + else if ( wParam == VK_RETURN ) + { + if ( GetAsyncKeyState( VK_MENU ) & 0x8000 ) + { + if ( DDraw_IsFullScreen() ) + { + if ( !cfg_fs_use_overlay ) Wnd_GoWindowed( hwnd ); + } + else + Wnd_GoFullScreen( hwnd ); + } + } + else if ( wParam == /* VK_T */ 0x54 ) + { + extern int draw_title_p; + draw_title_p = 2; + } + else if ( wParam == /* VK_F */ 0x52 + 'F' - 'R' ) + { + cfg_fs_fps ^= 1; + DDraw_SetStatusText( WASABI_API_LNGSTRING( cfg_fs_fps & 1 ? IDS_FULLSCREEN_FPS_ON : IDS_FULLSCREEN_FPS_OFF ) ); + } + else if ( wParam == /* VK_R */ 0x52 ) + { + cfg_fs_rnd = !cfg_fs_rnd; + g_rnd_cnt = 0; + DDraw_SetStatusText( WASABI_API_LNGSTRING( cfg_fs_rnd ? IDS_RANDOM_PRESETS_ON : IDS_RANDOM_PRESETS_OFF ) ); + } + else if ( wParam >= VK_F1 && wParam <= VK_F12 ) + { + char s[ 128 ], *st, stBuf[ 48 ]; + if ( GetAsyncKeyState( VK_CONTROL ) & ( 1 << 15 ) ) + { + st = WASABI_API_LNGSTRING_BUF( IDS_SAVED_TO, stBuf, 48 ); + WritePreset( wParam - VK_F1 ); + } + else + { + if ( !readyToLoadPreset( hwnd, 0 ) ) return 0; + + if ( LoadPreset( wParam - VK_F1 ) ) st = WASABI_API_LNGSTRING_BUF( IDS_LOADED_FROM, stBuf, 48 ); + else st = WASABI_API_LNGSTRING_BUF( IDS_ERROR_LOADING_FROM, stBuf, 48 ); + } + wsprintf( s, "%s F%d", st, wParam - VK_F1 + 1 ); + DDraw_SetStatusText( s ); + } + else if ( wParam >= '0' && wParam <= '9' ) + { + int n = 0; + char s[ 128 ], *st, stBuf[ 48 ]; + if ( GetAsyncKeyState( VK_SHIFT ) & ( 1 << 15 ) ) + n = 10; + if ( GetAsyncKeyState( VK_CONTROL ) & ( 1 << 15 ) ) + { + st = WASABI_API_LNGSTRING_BUF( IDS_SAVED_TO, stBuf, 48 ); + WritePreset( wParam - '0' + 12 + n ); + } + else + { + if ( !readyToLoadPreset( hwnd, 0 ) ) return 0; + if ( LoadPreset( wParam - '0' + 12 + n ) ) st = WASABI_API_LNGSTRING_BUF( IDS_LOADED_FROM, stBuf, 48 ); + else st = WASABI_API_LNGSTRING_BUF( IDS_ERROR_LOADING_FROM, stBuf, 48 ); + } + wsprintf( s, "%s %s%d", st, n ? WASABI_API_LNGSTRING( IDS_SHIFT_ ) : "", wParam - '0' ); + DDraw_SetStatusText( s ); + } + else + { + if ( wParam == 0x4B && DDraw_IsFullScreen() ) + { + if ( !cfg_fs_use_overlay ) Wnd_GoWindowed( hwnd ); + } + else PostMessage( hwnd_WinampParent, message, wParam, lParam ); + } + return 0; + case WM_TIMER: +#ifndef WA2_EMBED + if ( wParam == 66 ) + { + KillTimer( hwnd, 66 ); + SetWindowPos( hwnd, 0, 0, 0, cfg_w, cfg_h, SWP_NOACTIVATE | SWP_NOZORDER ); + } +#endif + if ( wParam == 88 ) + { + KillTimer( hwnd, 88 ); + if ( cfg_cfgwnd_open ) + { + ShowWindow( g_hwndDlg, SW_SHOWNA ); + UpdateWindow( g_hwndDlg ); + CfgWnd_RePopIfNeeded(); + } + + if ( need_redock && g_hwndDlg ) + { + need_redock = 0; + toggleWharfAmpDock( hwnd ); + } + } + if ( wParam == 32 ) + { + DWORD a; + +#ifndef REAPLAY_PLUGIN + if ( SendMessageTimeout( hwnd_WinampParent, WM_USER, (WPARAM) 0, 201, SMTO_BLOCK, 1000, &a ) && a ) + { + if ( strcmp( g_skin_name, (char *) a ) ) + { + lstrcpyn( g_skin_name, (char *) a, sizeof( g_skin_name ) ); + PostMessage( hwnd, WM_DISPLAYCHANGE, 0, 0 ); + } + } +#endif + + if ( g_rnd_cnt >= 0 && g_rnd_cnt++ >= max( cfg_fs_rnd_time, 1 ) ) + { + g_rnd_cnt = 0; + if ( ( !IsWindowVisible( g_hwndDlg ) || DDraw_IsFullScreen() ) && cfg_fs_rnd ) + goto do_random; + } + } + if ( wParam == 30 ) + { + KillTimer( hwnd, 30 ); + if ( !DDraw_IsFullScreen() && !inWharf ) + { + InvalidateRect( hwnd, NULL, FALSE ); + int tm = ( GetWindowLong( g_mod->hwndParent, GWL_EXSTYLE ) & WS_EX_TOPMOST ) == WS_EX_TOPMOST; + SetWindowPos( hwnd, tm ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); + RECT r; + GetClientRect_adj( hwnd, &r ); + DDraw_Resize( r.right - r.left, r.bottom - r.top, cfg_fs_d & 2 ); + } + } +#ifndef WA2_EMBED + if ( wParam == 29 ) + { + if ( !IsIconic( hwnd_WinampParent ) ) + { + KillTimer( hwnd, 29 ); + g_mod->Quit( g_mod ); + g_minimized = 0; + g_fakeinit = 1; + g_mod->Init( g_mod ); + g_fakeinit = 0; + SetActiveWindow( g_mod->hwndParent ); + } + } +#endif + return 0; + case WM_DROPFILES: + { + char temp[ MAX_PATH ]; + HDROP hdrop = (HDROP) wParam; + DragQueryFile( hdrop, 0, temp, sizeof( temp ) ); + if ( readyToLoadPreset( hwnd, 0 ) ) + { + if ( !stricmp( extension( temp ), "avs" ) ) + { + if ( g_render_transition->LoadPreset( temp, 1 ) != 2 ) + lstrcpyn( last_preset, temp, sizeof( last_preset ) ); + } + } + DragFinish( hdrop ); + } + return 0; + case WM_DISPLAYCHANGE: +#ifndef WA2_EMBED + SelectObject( hFrameDC, hFrameBitmap_old ); + DeleteObject( hFrameBitmap ); + hFrameBitmap = NULL; + { + char buf[ MAX_PATH ]; + if ( SendMessage( hwnd_WinampParent, WM_USER, (WPARAM) buf, 201 ) ) + { + strcat( buf, "\\avs.bmp" ); + hFrameBitmap = (HBITMAP) LoadImage( g_hInstance, buf, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); + } + if ( !hFrameBitmap ) + hFrameBitmap = (HBITMAP) LoadImage( g_hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + } + hFrameBitmap_old = (HBITMAP) SelectObject( hFrameDC, hFrameBitmap ); +#endif + InvalidateRect( hwnd, NULL, FALSE ); + return 0; + case WM_CREATE: + g_hwnd = hwnd; + + if ( DDraw_Init() ) + { + return 1; + } + +#ifndef WA2_EMBED + + { + char buf[ MAX_PATH ]; + int a; + if ( ( a = SendMessage( hwnd_WinampParent, WM_USER, (WPARAM) buf, 201 ) ) ) + { + lstrcpyn( g_skin_name, (char *) a, sizeof( g_skin_name ) ); + strcat( buf, "\\avs.bmp" ); + hFrameBitmap = (HBITMAP) LoadImage( g_hInstance, buf, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE ); + } + if ( !hFrameBitmap ) + hFrameBitmap = (HBITMAP) LoadImage( g_hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION ); + } + hFrameDC = (HDC) CreateCompatibleDC( NULL ); + hFrameBitmap_old = (HBITMAP) SelectObject( hFrameDC, hFrameBitmap ); +#endif + //FG> This totally fucks up a child layered window painting in wa3, i'm not even sure that's a good thing for wa2... basically the child window gets excluded from the layered update and ends up updating behind the layer, on top of the desktop +#ifndef WA2_EMBED + SetWindowLong( hwnd, GWL_STYLE, 0 ); + SetWindowPos( hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME | SWP_NOACTIVATE ); +#endif + SetTimer( hwnd, 32, 1000, NULL ); + return 0; +#ifndef WA2_EMBED + case WM_NCHITTEST: + { + int x = GET_X_LPARAM( lParam ); + int y = GET_Y_LPARAM( lParam ); + RECT r; + GetWindowRect( hwnd, &r ); + if ( inWharf ) + return HTCLIENT; + if ( DDraw_IsFullScreen() || ( x > r.right - 12 && x < r.right - 3 && y > r.top + 3 && y < r.top + 13 ) ) + return HTCLIENT; + if ( x < r.left + 6 && y > r.bottom - 6 ) return HTBOTTOMLEFT; + if ( x > r.right - 6 && y > r.bottom - 6 ) return HTBOTTOMRIGHT; + if ( x < r.left + 6 && y < r.top + 6 ) return HTTOPLEFT; + if ( x > r.right - 6 && y < r.top + 6 ) return HTTOPRIGHT; + if ( y < r.top + 6 ) return HTTOP; + if ( y > r.bottom - 6 ) return HTBOTTOM; + if ( x < r.left + 6 ) return HTLEFT; + if ( x > r.right - 6 ) return HTRIGHT; + if ( y < r.top + 15 ) return HTCAPTION; + } + return HTCLIENT; +#endif + case WM_CLOSE: +#ifndef WA2_EMBED + g_in_destroy = 1; + DestroyWindow( hwnd ); +#else + g_in_destroy = 1; + SetForegroundWindow( g_mod->hwndParent ); + DestroyWindow( myWindowState.me ); +#endif + return 0; + case WM_DESTROY: +#ifndef WA2_EMBED + SelectObject( hFrameDC, hFrameBitmap_old ); + DeleteObject( hFrameDC ); + DeleteObject( hFrameBitmap ); +#endif + g_ThreadQuit = 1; + if ( !g_minimized ) + { + PostQuitMessage( 0 ); + } + return 0; + case WM_MOVE: + if ( !DDraw_IsFullScreen() && !inWharf ) + { +#ifndef WA2_EMBED + int w; + RECT r; + RECT r2; + int xPos, yPos, f = 0; + xPos = (int) (short) LOWORD( lParam ); // horizontal position + yPos = (int) (short) HIWORD( lParam ); // vertical position + GetClientRect( hwnd, &r2 ); + + for ( w = 0; w < 5; w++ ) + { + HWND hw; + if ( w == 0 ) + { + RECT r2; + GetWindowRect( hwnd, &r2 ); + my_getViewport( &r, &r2 ); + } + else if ( w == 1 && IsWindowVisible( hwnd_WinampParent ) ) + GetWindowRect( hwnd_WinampParent, &r ); + else if ( w == 2 && ( hw = FindWindowEx( NULL, NULL, "Winamp EQ", NULL ) ) + && IsWindowVisible( hw ) ) + GetWindowRect( hw, &r ); + else if ( w == 3 && ( hw = FindWindowEx( NULL, NULL, "Winamp PE", NULL ) ) + && IsWindowVisible( hw ) ) + GetWindowRect( hw, &r ); + else if ( w == 4 && ( hw = FindWindowEx( NULL, NULL, "Winamp MB", NULL ) ) + && IsWindowVisible( hw ) ) + GetWindowRect( hw, &r ); + else continue; + +#define intersect(x1,x2,y1,y2) \ + (((x1)>(y1)&&(x1)<(y2))||((x2)>(y1)&&(x2)<(y2))||((y1)>(x1)&&(y1)<(x2))||((y2)>(x1)&&(y2)<(x2))) + + if ( xPos > r.left - 10 && xPos < r.left + 10 && intersect( yPos, yPos + r2.bottom, r.top, r.bottom ) ) + { + xPos = r.left; + f++; + } + if ( yPos > r.top - 10 && yPos < r.top + 10 && intersect( xPos, xPos + r2.right, r.left, r.right ) ) + { + yPos = r.top; + f++; + } + if ( xPos + r2.right > r.right - 10 && xPos + r2.right < r.right + 10 && intersect( yPos, yPos + r2.bottom, r.top, r.bottom ) ) + { + xPos = r.right - r2.right; + f++; + } + if ( yPos + r2.bottom > r.bottom - 10 && yPos + r2.bottom < r.bottom + 10 && intersect( xPos, xPos + r2.right, r.left, r.right ) ) + { + yPos = r.bottom - r2.bottom; + f++; + } + + + + if ( xPos + r2.right > r.left - 10 && xPos + r2.right < r.left + 10 && intersect( yPos, yPos + r2.bottom, r.top, r.bottom ) ) + { + xPos = r.left - r2.right; + f++; + } + if ( yPos + r2.bottom > r.top - 10 && yPos + r2.bottom < r.top + 10 && intersect( xPos, xPos + r2.right, r.left, r.right ) ) + { + yPos = r.top - r2.bottom; + f++; + } + if ( xPos > r.right - 10 && xPos < r.right + 10 && intersect( yPos, yPos + r2.bottom, r.top, r.bottom ) ) + { + xPos = r.right; + f++; + } + if ( yPos > r.bottom - 10 && yPos < r.bottom + 10 && intersect( xPos, xPos + r2.right, r.left, r.right ) ) + { + yPos = r.bottom; + f++; + } + } + + if ( f ) + { + SetWindowPos( hwnd, NULL, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE ); + } + { + RECT r; + GetWindowRect( hwnd, &r ); + cfg_x = r.left; + cfg_y = r.top; + cfg_w = r.right - r.left; + cfg_h = r.bottom - r.top; + } +#endif + } + return 0; + case WM_GETMINMAXINFO: + { + LPMINMAXINFO mmi = (LPMINMAXINFO) lParam; + mmi->ptMinTrackSize.x = 80; + mmi->ptMinTrackSize.y = 40; + } + return 0; + case WM_SETCURSOR: + if ( DDraw_IsFullScreen() ) + { + SetCursor( NULL ); + return TRUE; + } + break; + case WM_SIZE: + if ( wParam != SIZE_MINIMIZED ) + { + if ( !DDraw_IsFullScreen() ) + { + if ( !inWharf ) + { +#ifndef WA2_EMBED + RECT r; + GetWindowRect( hwnd, &r ); + cfg_x = r.left; + cfg_y = r.top; + cfg_w = r.right - r.left; + cfg_h = r.bottom - r.top; +#endif + DDraw_BeginResize(); + KillTimer( hwnd, 30 ); + SetTimer( hwnd, 30, 33, NULL ); + } + } + } + break; + case WM_WINDOWPOSCHANGING: + { + LPWINDOWPOS lpwp = (LPWINDOWPOS) lParam; + if ( cfg_dont_min_avs && !g_in_destroy && lpwp->flags & SWP_HIDEWINDOW && !g_minimized && !inWharf ) + { +#ifndef WA2_EMBED + g_minimized = 1; + g_mod->Quit( g_mod ); + g_fakeinit = 1; + g_mod->Init( g_mod ); + g_fakeinit = 0; + if ( ( GetWindowLong( g_mod->hwndParent, GWL_EXSTYLE ) & WS_EX_TOPMOST ) == WS_EX_TOPMOST ) + SetWindowPos( g_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); + SetTimer( g_hwnd, 29, 500, NULL ); +#endif + } + } + return 0; + case WM_PAINT: + if ( !DDraw_IsFullScreen() ) + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint( hwnd, &ps ); +#ifndef WA2_EMBED + RECT r; + HDC tempdc = CreateCompatibleDC( hdc ); + GetClientRect( hwnd, &r ); + HBITMAP oldbm, tempbm = CreateCompatibleBitmap( hdc, 7, r.bottom - 20 ); + oldbm = (HBITMAP) SelectObject( tempdc, tempbm ); + if ( !inWharf ) + { // draw window frame + SetStretchBltMode( hdc, COLORONCOLOR ); + SetStretchBltMode( tempdc, COLORONCOLOR ); + BitBlt( hdc, 0, 0, 50, 15, hFrameDC, 15, 0, SRCCOPY ); // top left + StretchBlt( hdc, 50, 0, r.right - 50 - 16, 15, hFrameDC, 66, 0, 14, 15, SRCCOPY ); // top middle + BitBlt( hdc, r.right - 16, 0, 16, 15, hFrameDC, 81, 0, SRCCOPY ); // top right + + StretchBlt( tempdc, 0, 0, 7, r.bottom - 15 - 5, hFrameDC, 0, 16, 7, 172, SRCCOPY ); // left middle + BitBlt( hdc, 0, 15, 7, r.bottom - 15 - 5, tempdc, 0, 0, SRCCOPY ); + StretchBlt( tempdc, 0, 0, 6, r.bottom - 15 - 5, hFrameDC, 8, 16, 6, 172, SRCCOPY ); // right middle + BitBlt( hdc, r.right - 6, 15, 6, r.bottom - 15 - 5, tempdc, 0, 0, SRCCOPY ); + + BitBlt( hdc, 0, r.bottom - 5, 50, 15, hFrameDC, 15, 16, SRCCOPY ); // bottom left + StretchBlt( hdc, 50, r.bottom - 5, r.right - 50 - 16, 5, hFrameDC, 66, 16, 14, 5, SRCCOPY ); // bottom middle + BitBlt( hdc, r.right - 16, r.bottom - 5, 16, 5, hFrameDC, 81, 16, SRCCOPY ); // bottom right + } + SelectObject( tempdc, oldbm ); + DeleteObject( tempbm ); + DeleteObject( tempdc ); +#endif + EndPaint( hwnd, &ps ); + return 0; + } + break; +#ifdef WA2_EMBED + case WM_COMMAND: + { + int id = LOWORD( wParam ); + switch ( id ) + { + case ID_VIS_NEXT: next_preset( hwnd ); break; + case ID_VIS_PREV: previous_preset( hwnd ); break; + case ID_VIS_RANDOM: + { + int v = HIWORD( wParam ) ? 1 : 0; + if ( wParam >> 16 == 0xFFFF ) + { + SendMessage( g_mod->hwndParent, WM_WA_IPC, cfg_fs_rnd, IPC_CB_VISRANDOM ); + break; + } + cfg_fs_rnd = v; + if ( cfg_fs_rnd ) random_preset( hwnd ); + DDraw_SetStatusText( WASABI_API_LNGSTRING( cfg_fs_rnd ? IDS_RANDOM_PRESETS_ON : IDS_RANDOM_PRESETS_OFF ) ); + break; + } + case ID_VIS_FS: Wnd_GoFullScreen( hwnd ); break; + case ID_VIS_CFG: SendMessage( hwnd, WM_USER + 33, 0, 0 ); break; + case ID_VIS_MENU: DoPopupMenu(); break; + } + break; + } +#endif + } + return DefWindowProc( hwnd, message, wParam, lParam ); +} diff --git a/Src/Plugins/Visualization/vis_avs/wnd.h b/Src/Plugins/Visualization/vis_avs/wnd.h new file mode 100644 index 00000000..9cf4605e --- /dev/null +++ b/Src/Plugins/Visualization/vis_avs/wnd.h @@ -0,0 +1,39 @@ +/* + 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. + +*/ +int Wnd_Init(struct winampVisModule *this_mod); +void Wnd_Quit(void); +void SetTransparency(HWND hWnd, int enable, int amount); +HWND GetWinampHwnd(void); +void about(HWND hwndParent); + +extern HWND g_hwnd; +extern HINSTANCE g_hInstance; +extern int g_in_destroy; +extern int g_rnd_cnt; |