<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.shoutcast.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.shoutcast.com/index.php?action=history&amp;feed=atom&amp;title=Box_source_code_here</id>
		<title>Box source code here - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.shoutcast.com/index.php?action=history&amp;feed=atom&amp;title=Box_source_code_here"/>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;action=history"/>
		<updated>2026-05-17T10:59:11Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.22.3</generator>

	<entry>
		<id>http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=936&amp;oldid=prev</id>
		<title>Tarik: Protected &quot;Box source code here&quot; [edit=autoconfirmed:move=autoconfirmed]</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=936&amp;oldid=prev"/>
				<updated>2008-09-25T13:09:02Z</updated>
		
		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/wiki/Box_source_code_here&quot; title=&quot;Box source code here&quot;&gt;Box source code here&lt;/a&gt;&amp;quot; [edit=autoconfirmed:move=autoconfirmed]&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:09, 25 September 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Tarik</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=876&amp;oldid=prev</id>
		<title>Tarik: Unprotected &quot;Box source code here&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=876&amp;oldid=prev"/>
				<updated>2008-09-24T17:17:59Z</updated>
		
		<summary type="html">&lt;p&gt;Unprotected &amp;quot;&lt;a href=&quot;/wiki/Box_source_code_here&quot; title=&quot;Box source code here&quot;&gt;Box source code here&lt;/a&gt;&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 17:17, 24 September 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Tarik</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=804&amp;oldid=prev</id>
		<title>Tarik: Protected &quot;Box source code here&quot;: All pages locked during Beta except for Article &amp; FAQ page. [edit=sysop:move=sysop]</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/index.php?title=Box_source_code_here&amp;diff=804&amp;oldid=prev"/>
				<updated>2008-09-22T21:34:31Z</updated>
		
		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/wiki/Box_source_code_here&quot; title=&quot;Box source code here&quot;&gt;Box source code here&lt;/a&gt;&amp;quot;: All pages locked during Beta except for Article &amp;amp; FAQ page. [edit=sysop:move=sysop]&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 21:34, 22 September 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Tarik</name></author>	</entry>

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

	</feed>