Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@ -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

View File

@ -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;

Binary file not shown.

View File

@ -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!
**/

View File

@ -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

View File

@ -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>
{{{
}}}
###############################################################################

View File

@ -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