http://wiki.winamp.com/index.php?title=Box_source_code_here&feed=atom&action=history
Box source code here - Revision history
2024-03-28T09:28:15Z
Revision history for this page on the wiki
MediaWiki 1.22.3
http://wiki.winamp.com/index.php?title=Box_source_code_here&diff=936&oldid=prev
Tarik: Protected "Box source code here" [edit=autoconfirmed:move=autoconfirmed]
2008-09-25T13:09:02Z
<p>Protected "<a href="/wiki/Box_source_code_here" title="Box source code here">Box source code here</a>" [edit=autoconfirmed:move=autoconfirmed]</p>
<table class='diff diff-contentalign-left'>
<tr style='vertical-align: top;'>
<td colspan='1' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black; text-align: center;">Revision as of 13:09, 25 September 2008</td>
</tr><tr><td colspan='2' style='text-align: center;'><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Tarik
http://wiki.winamp.com/index.php?title=Box_source_code_here&diff=876&oldid=prev
Tarik: Unprotected "Box source code here"
2008-09-24T17:17:59Z
<p>Unprotected "<a href="/wiki/Box_source_code_here" title="Box source code here">Box source code here</a>"</p>
<table class='diff diff-contentalign-left'>
<tr style='vertical-align: top;'>
<td colspan='1' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black; text-align: center;">Revision as of 17:17, 24 September 2008</td>
</tr><tr><td colspan='2' style='text-align: center;'><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Tarik
http://wiki.winamp.com/index.php?title=Box_source_code_here&diff=804&oldid=prev
Tarik: Protected "Box source code here": All pages locked during Beta except for Article & FAQ page. [edit=sysop:move=sysop]
2008-09-22T21:34:31Z
<p>Protected "<a href="/wiki/Box_source_code_here" title="Box source code here">Box source code here</a>": All pages locked during Beta except for Article & FAQ page. [edit=sysop:move=sysop]</p>
<table class='diff diff-contentalign-left'>
<tr style='vertical-align: top;'>
<td colspan='1' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black; text-align: center;">Revision as of 21:34, 22 September 2008</td>
</tr><tr><td colspan='2' style='text-align: center;'><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Tarik
http://wiki.winamp.com/index.php?title=Box_source_code_here&diff=679&oldid=prev
Ashokbania at 08:44, 2 September 2008
2008-09-02T08:44:58Z
<p></p>
<p><b>New page</b></p><div>'''Breadcrumb''' -- [[Main_Page|Wiki Main]] : [[Skin Developer]] : [[Visual Developer]] : [[Plug-in Developer]] : [[Articles|Articles Page]] : [[Developers FAQ|FAQ]] : [[Main_Page#Glossary_of_Terms|Glossary]]<br />
<br />
<source lang=cpp><br />
#include <windows.h><br />
#include "resource.h"<br />
#include "avs_ape.h"<br />
<br />
// this will be the directory and APE name displayed in<br />
// the AVS Editor<br />
#define MOD_NAME "Tutorials / BOX v1.0"<br />
<br />
// this is how WVS will recognize this APE internally<br />
#define UNIQUEIDSTRING "Nullsoft Tut0: BOX"<br />
class C_THISCLASS : public C_RBASE<br />
{protected:<br />
public:<br />
C_THISCLASS();<br />
virtual ~C_THISCLASS();<br />
virtual int render(char visdata[2][2][576], int isBeat,<br />
int *framebuffer, int *fbout, int w, int h);<br />
virtual HWND conf(HINSTANCE hInstance, HWND hwndParent);<br />
virtual char *get_desc();<br />
virtual void load_config(unsigned char *data, int len);<br />
virtual int save_config(unsigned char *data);<br />
int enabled; // toggles plug-in on and off<br />
// (a good idea for any APE)<br />
int color; // color of rectangle};<br />
<br />
// global configuration dialog pointer<br />
static C_THISCLASS *g_ConfigThis;<br />
// global DLL instance pointer (not needed in this<br />
// example, but is useful)static HINSTANCE g_hDllInstance;<br />
// this is where we deal with the configuration screen<br />
static BOOL CALLBACK g_DlgProc(HWND hwndDlg, UINT uMsg,<br />
WPARAM wParam,LPARAM lParam)<br />
{<br />
switch (uMsg)<br />
{<br />
case WM_INITDIALOG:<br />
if (g_ConfigThis->enabled)<br />
{<br />
CheckDlgButton(hwndDlg,IDC_CHECK1,BST_CHECKED);<br />
}<br />
return 1;<br />
case WM_DRAWITEM:<br />
DRAWITEMSTRUCT *di;<br />
di=(DRAWITEMSTRUCT *)lParam;<br />
if (di->CtlID == IDC_DEFCOL)<br />
{<br />
int w;<br />
int color;<br />
w=di->rcItem.right-di->rcItem.left;<br />
color=g_ConfigThis->color;<br />
color = ( (color>>16)&0xff) |<br />
(color&0xff00) |<br />
((color<<16)&0xff0000);<br />
<br />
// paint nifty color button<br />
HBRUSH hBrush,hOldBrush;<br />
LOGBRUSH lb={BS_SOLID,color,0};<br />
hBrush = CreateBrushIndirect(&lb);<br />
hOldBrush=(HBRUSH)SelectObject(di->hDC,hBrush);<br />
Rectangle(di->hDC,di->rcItem.left,di->rcItem.top,<br />
di->rcItem.right,di->rcItem.bottom);<br />
SelectObject(di->hDC,hOldBrush);<br />
DeleteObject(hBrush);<br />
}<br />
return 0;<br />
case WM_COMMAND:<br />
<br />
// see if enable checkbox is checked<br />
if (LOWORD(wParam) == IDC_CHECK1)<br />
{<br />
g_ConfigThis->enabled=<br />
(IsDlgButtonChecked(hwndDlg,IDC_CHECK1)?1:0);<br />
}<br />
<br />
// is colorbox is selected?<br />
if (LOWORD(wParam) == IDC_DEFCOL)<br />
{<br />
static COLORREF custcolors[16];<br />
int *a;<br />
CHOOSECOLOR cs;<br />
a=&g_ConfigThis->color;<br />
cs.lStructSize = sizeof(cs);<br />
cs.hwndOwner = hwndDlg;<br />
cs.hInstance = 0;<br />
cs.rgbResult = ((*a>>16)&0xff)|<br />
(*a&0xff00)|<br />
((*a<<16)&0xff0000);<br />
cs.lpCustColors = custcolors;<br />
cs.Flags = CC_RGBINIT|CC_FULLOPEN;<br />
<br />
// go to windows color selection screen<br />
if (ChooseColor(&cs))<br />
{<br />
*a = ((cs.rgbResult>>16)&0xff)|<br />
(cs.rgbResult&0xff00)|<br />
((cs.rgbResult<<16)&0xff0000);<br />
}<br />
InvalidateRect(GetDlgItem(hwndDlg,IDC_DEFCOL),<br />
NULL,TRUE);<br />
}<br />
return 0;<br />
}<br />
return 0;<br />
}<br />
<br />
// set up default configuration<br />
C_THISCLASS::C_THISCLASS()<br />
{<br />
//set initial color<br />
color=RGB(255,0,0);<br />
enabled=1;}<br />
<br />
// virtual destructor<br />
C_THISCLASS::~C_THISCLASS()<br />
{<br />
}<br />
<br />
/* RENDER FUNCTION:<br />
render should return 0 if it only used framebuffer,<br />
or 1 if the new output data is in fbout.<br />
this is used when you want to do something that you'd otherwise<br />
need to make a copy of the framebuffer.<br />
w and h are the width and height of the screen, in pixels.<br />
isBeat is 1 if a beat has been detected.<br />
visdata is in the format of [spectrum:0,wave:1][channel][band].<br />
*/<br />
<br />
int C_THISCLASS::render(char visdata[2][2][576], int isBeat,<br />
int *framebuffer, int *fbout, int w, int h)<br />
{<br />
int halfw;<br />
int halfh;<br />
<br />
// is this effect on?<br />
if (!enabled)<br />
{<br />
return 0;<br />
}<br />
<br />
// did we just hit a beat?<br />
if(isBeat)<br />
{<br />
// draw our magic box<br />
halfw=w/2;<br />
halfh=h/2;<br />
framebuffer+=(((halfh/2)*w)+ (halfw/2));<br />
for(int j=0;j<halfh;j++)<br />
{<br />
for(int i=0;i<halfw;i++)<br />
{<br />
framebuffer[i]=color;<br />
}<br />
framebuffer+=w;<br />
}<br />
}<br />
return 0;<br />
}<br />
<br />
HWND C_THISCLASS::conf(HINSTANCE hInstance, HWND hwndParent)<br />
// return NULL if no config dialog possible<br />
{<br />
g_ConfigThis = this;<br />
return CreateDialog(hInstance,MAKEINTRESOURCE(IDD_CONFIG),<br />
hwndParent,g_DlgProc);<br />
}<br />
char *C_THISCLASS::get_desc(void)<br />
{<br />
return MOD_NAME;<br />
}<br />
<br />
// load_/save_config are called when saving and loading<br />
// presets (.avs files)<br />
<br />
#define GET_INT() (data[pos]|(data[pos+1]<<8)|\<br />
(data[pos+2]<<16)|(data[pos+3]<<24))<br />
// read configuration of max length "len" from data.<br />
<br />
void C_THISCLASS::load_config(unsigned char *data, int len)<br />
{<br />
int pos=0;<br />
// always ensure there is data to be loaded<br />
if (len-pos >= 4)<br />
{<br />
// load activation toggle<br />
enabled=GET_INT();<br />
pos+=4;<br />
}<br />
<br />
if (len-pos >= 4)<br />
{<br />
// load the box color<br />
color=GET_INT();<br />
pos+=4;<br />
}<br />
}<br />
<br />
<br />
// write configuration to data, return length.<br />
// config data should not exceed 64k.<br />
#define PUT_INT(y) data[pos]=(y)&255; data[pos+1]=(y>>8)&255;\<br />
data[pos+2]=(y>>16)&255; data[pos+3]=(y>>24)&255<br />
<br />
int C_THISCLASS::save_config(unsigned char *data)<br />
{<br />
int pos=0;<br />
<br />
PUT_INT(enabled);<br />
pos+=4;<br />
<br />
PUT_INT(color);<br />
pos+=4;<br />
<br />
return pos;<br />
}<br />
<br />
/*<br />
export stuff<br />
creates a new effect object if desc is NULL, otherwise<br />
fills in desc with description<br />
*/<br />
C_RBASE *R_RetrFunc(char *desc)<br />
{<br />
if (desc)<br />
{<br />
strcpy(desc,MOD_NAME);<br />
return NULL;<br />
}<br />
return (C_RBASE *) new C_THISCLASS();<br />
}<br />
// allows AVS to retrieve this APE module<br />
extern "C"<br />
{<br />
__declspec (dllexport) int _AVS_APE_RetrFunc(HINSTANCE\<br />
hDllInstance, char **info, int *create)<br />
// return 0 on failure<br />
{<br />
g_hDllInstance=hDllInstance;<br />
*info=UNIQUEIDSTRING;<br />
*create=(int)(void*)R_RetrFunc;<br />
return 1;<br />
}<br />
};<br />
</source></div>
Ashokbania