<?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/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Benski</id>
		<title>Winamp Developer Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.shoutcast.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Benski"/>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Special:Contributions/Benski"/>
		<updated>2026-05-02T10:30:53Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.22.3</generator>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/AAC_encoder_settings</id>
		<title>AAC encoder settings</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/AAC_encoder_settings"/>
				<updated>2011-07-07T16:10:51Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About AAC ==&lt;br /&gt;
&lt;br /&gt;
== Variable Bitrate ==&lt;br /&gt;
&lt;br /&gt;
== Constant Bitrate ==&lt;br /&gt;
&lt;br /&gt;
== SHOUTcast ==&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/AAC_encoder_settings</id>
		<title>AAC encoder settings</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/AAC_encoder_settings"/>
				<updated>2011-07-07T16:09:18Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Placeholder&lt;br /&gt;
&lt;br /&gt;
== SHOUTcast ==&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/AAC_encoder_settings</id>
		<title>AAC encoder settings</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/AAC_encoder_settings"/>
				<updated>2011-07-07T16:07:52Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Placeholder&lt;br /&gt;
[SHOUTcast AAC encoding]&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/AAC_encoder_settings</id>
		<title>AAC encoder settings</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/AAC_encoder_settings"/>
				<updated>2011-07-07T16:05:47Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Placeholder&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Placeholder&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/File:Skins-logo.png</id>
		<title>File:Skins-logo.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/File:Skins-logo.png"/>
				<updated>2008-10-17T15:30:26Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: Undo revision 1059 by 117.200.160.101 (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Media_Library_Plugin</id>
		<title>Media Library Plugin</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Media_Library_Plugin"/>
				<updated>2008-09-15T16:08:28Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Plugin struct definition&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int version;&lt;br /&gt;
  char *description;&lt;br /&gt;
  int (*init)(); // return 0 on success, non-zero for failure (quit WON'T be called) &lt;br /&gt;
  void (*quit)();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  // return NONZERO if you accept this message as yours, otherwise 0 to pass it &lt;br /&gt;
  // to other plugins&lt;br /&gt;
  INT_PTR (*MessageProc)(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3); &lt;br /&gt;
  //note: INT_PTR becomes 64bit on 64bit compiles...  if you don't like windows types or caps, you can #include &amp;lt;stddef.h&amp;gt; and use intptr_t&lt;br /&gt;
&lt;br /&gt;
  //all the following data is filled in by the library&lt;br /&gt;
  HWND hwndWinampParent;&lt;br /&gt;
  HWND hwndLibraryParent; // send this any of the WM_ML_IPC messages&lt;br /&gt;
  HINSTANCE hDllInstance;&lt;br /&gt;
} winampMediaLibraryPlugin;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Plugins work by defining a struct full of functions for Winamp to call.  For Media Library plugins, there are three functions.&lt;br /&gt;
# Init - called after your plugin is loaded.  We need an Init() function (rather than having the plugin doing init is the winampGetMediaLibraryPlugin function) because Winamp needs to give YOU data before you can really do your initialization stuff&lt;br /&gt;
# Quit - duh&lt;br /&gt;
# MessageProc.  This is a function that the Winamp calls when certain events happen, such as someone activating your treeview node in the media library, or someone invoking the send-to menu&lt;br /&gt;
* You communicate with Winamp one of two basic ones&lt;br /&gt;
# By using SendMessage and sending Winamp or the Media Library window custom messages which are defined in Winamp/wa_ipc.h (for Winamp HWND) and gen_ml/ml.h (for Media Libary HWND).  This is the &amp;quot;old&amp;quot; way of doing things but even some newer APIs are still built on this mechanism.&lt;br /&gt;
# By retrieving pointers to objects from the Wasabi Service Manager.  Winamp has a bunch of APIs that you can grab, and plugins can add additional features that you might want to use.  Examples of useful Wasabi objects are the [[Media Library Database API|Local Media API]] (which lets you query against the media library), the [[Application API]] (let's you get version #, build #, path to winamp settings folder, etc), and the [[Playlist Manager API]] (lets you parse playlists, among other things)&lt;br /&gt;
&lt;br /&gt;
ml_xmlex is probably the most useful example of the bunch.  ml_ stands for media library plugin.  __declspec(dllexport) is a magic keyword for Visual C++ that means that the DLL &amp;quot;exports&amp;quot; this function, meaning that a program that loads the DLL can locate and call this function.  Winamp goes through and loads ml_*.dll plugins, looks for &amp;quot;winampGetMediaLibraryPlugin&amp;quot; and if it it exists it calls it.  From that function you are supposed to return a struct that defines your plugin.  It has the plugin name, some function pointers and some data that winamp will populate with information that'll be helpful to you, like winamp's HWND (window handle).  &lt;br /&gt;
&lt;br /&gt;
winampMediaLibraryPlugin is defined in gen_ml/ml.h which is one ugly beast of a file&lt;br /&gt;
benski&amp;gt; reupload to [[Image:winampMediaLibraryPlugin.png]]&lt;br /&gt;
http://shup.com/Shup/57721/10872016431-ml_xmlex-Microsoft-Visual-C__-%5Bdesign%5D-ml.h.png&lt;br /&gt;
&lt;br /&gt;
So you supply &amp;quot;init&amp;quot;, &amp;quot;quit&amp;quot; and &amp;quot;MessageProc&amp;quot; functions as well as a description.  Winamp calls Init(), at which point ml_xmlex does two things&lt;br /&gt;
# Gets the all-important Wasabi Service Manager object&lt;br /&gt;
# tells the media library to add a node to the treeview for itself [[Image:ml_xmlex_in_ml.png]] http://shup.com/Shup/57726/10872016155-Main-Window.png&lt;br /&gt;
&lt;br /&gt;
Plugins can manifest themselves in many ways (or be completely invisible!), just this media library plugin is a good starting point because you don't have to write too much busy-work GUI code.&lt;br /&gt;
&lt;br /&gt;
For Media Library plugins, when the media library needs your plugin (e.g. when the user clicked on you in the media library) it calls your message procedure.  xmlview.cpp line 147 is the message procedure.  this plugin is only handling one message which is to create a view.  there are other messages like &amp;quot;do you want to be on the send-to menu&amp;quot; but this example is keeping it simple.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Media_Library_API</id>
		<title>Media Library API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Media_Library_API"/>
				<updated>2008-09-15T16:06:57Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Messages sent to your plugin's MessageProc ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)&lt;br /&gt;
// which determine if we can uninstall the plugin immediately or on winamp restart&lt;br /&gt;
//&lt;br /&gt;
// uninstall support was added from 5.0+ and uninstall now support from 5.5+&lt;br /&gt;
// it is down to you to ensure that if uninstall now is returned that it will not cause a crash&lt;br /&gt;
// (ie don't use if you've been subclassing the main window)&lt;br /&gt;
#define ML_PLUGIN_UNINSTALL_NOW    0x1&lt;br /&gt;
#define ML_PLUGIN_UNINSTALL_REBOOT 0x0&lt;br /&gt;
&lt;br /&gt;
// messages your plugin may receive on MessageProc()&lt;br /&gt;
&lt;br /&gt;
#define ML_MSG_TREE_BEGIN 0x100&lt;br /&gt;
  #define ML_MSG_TREE_ONCREATEVIEW 0x100 // param1 = param of tree item, param2 is HWND of parent. return HWND if it is us&lt;br /&gt;
&lt;br /&gt;
  #define ML_MSG_TREE_ONCLICK  0x101 // param1 = param of tree item, param2 = action type (below), param3 = HWND of main window&lt;br /&gt;
    #define ML_ACTION_RCLICK 0    // return value should be nonzero if ours&lt;br /&gt;
    #define ML_ACTION_DBLCLICK 1&lt;br /&gt;
    #define ML_ACTION_ENTER 2&lt;br /&gt;
		#define ML_ACTION_LCLICK 3&lt;br /&gt;
&lt;br /&gt;
  #define ML_MSG_TREE_ONDROPTARGET 0x102 // param1 = param of tree item, param2 = type of drop (ML_TYPE_*), param3 = pointer to data (or NULL if querying).&lt;br /&gt;
                                      // return -1 if not allowed, 1 if allowed, or 0 if not our tree item&lt;br /&gt;
&lt;br /&gt;
  #define ML_MSG_TREE_ONDRAG 0x103 // param1 = param of tree item, param2 = POINT * to the mouse position, and param3 = (int *) to the type&lt;br /&gt;
                                  // set *(int*)param3 to the ML_TYPE you want and return 1, if you support drag&amp;amp;drop, or -1 to prevent d&amp;amp;d.&lt;br /&gt;
&lt;br /&gt;
  #define ML_MSG_TREE_ONDROP 0x104 // param1 = param of tree item, param2 = POINT * to the mouse position&lt;br /&gt;
                                  // if you support dropping, send the appropriate ML_IPC_HANDLEDROP using SendMessage() and return 1, otherwise return -1.&lt;br /&gt;
&lt;br /&gt;
  #define  ML_MSG_TREE_ONKEYDOWN 0x105  // Send when key pressed &lt;br /&gt;
										// param1 = param of tree item;&lt;br /&gt;
										// param2 = pointer to NMTVKEYDOWN&lt;br /&gt;
										// param3 = tree hwnd&lt;br /&gt;
										// return 0 if it's not yours, 1 if it is&lt;br /&gt;
&lt;br /&gt;
#define ML_MSG_TREE_END 0x1FF // end of tree specific messages&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_MSG_ONSENDTOBUILD 0x300 // you get sent this when the sendto menu gets built&lt;br /&gt;
// param1 = type of source, param2 param to pass as context to ML_IPC_ADDTOSENDTO&lt;br /&gt;
// be sure to return 0 to allow other plugins to add their context menus&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// if your sendto item is selected, you will get this with your param3 == your user32 (preferably some&lt;br /&gt;
// unique identifier (like your plugin message proc). See ML_IPC_ADDTOSENDTO&lt;br /&gt;
#define ML_MSG_ONSENDTOSELECT 0x301&lt;br /&gt;
// param1 = type of source, param2 = data, param3 = user32&lt;br /&gt;
&lt;br /&gt;
// return TRUE and do a config dialog using param1 as a HWND parent for this one&lt;br /&gt;
#define ML_MSG_CONFIG 0x400&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Messages you can send to the Media Library HWND ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define ML_TYPE_UNKNOWN			-1&lt;br /&gt;
#define ML_TYPE_ITEMRECORDLIST 0 // if this, cast obj to itemRecordList&lt;br /&gt;
#define ML_TYPE_FILENAMES 1 // double NULL terminated char * to files, URLS, or playlists&lt;br /&gt;
#define ML_TYPE_STREAMNAMES 2 // double NULL terminated char * to URLS, or playlists ( effectively the same as ML_TYPE_FILENAMES, but not for files)&lt;br /&gt;
#define ML_TYPE_CDTRACKS 3 // if this, cast obj to itemRecordList (CD tracks) -- filenames should be cda://&amp;lt;drive letter&amp;gt;,&amp;lt;track index&amp;gt;. artist/album/title might be valid (CDDB)&lt;br /&gt;
#define ML_TYPE_QUERYSTRING 4 // char * to a query string&lt;br /&gt;
#define ML_TYPE_PLAYLIST 5 // mlPlaylist *&lt;br /&gt;
#define ML_TYPE_ITEMRECORDLISTW 6 // if this, cast obj to itemRecordListW&lt;br /&gt;
// added from 5.36+&lt;br /&gt;
#define ML_TYPE_FILENAMESW 7 // double NULL terminated wchar_t * to files, URLS, or playlists&lt;br /&gt;
#define ML_TYPE_STREAMNAMESW 8 // double NULL terminated wchar_t * to URLS, or playlists ( effectively the same as ML_TYPE_FILENAMESW, but not for files)&lt;br /&gt;
#define ML_TYPE_PLAYLISTS 9 // mlPlaylist **, null terminated&lt;br /&gt;
#define ML_TYPE_TREEITEM 69 // uhh?&lt;br /&gt;
&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	const wchar_t *filename;&lt;br /&gt;
	const wchar_t *title;&lt;br /&gt;
	// only fill in the following two if already know.  don't calculate it just for the struct. &lt;br /&gt;
	// put -1 for &amp;quot;don't know&amp;quot;&lt;br /&gt;
	int numItems; &lt;br /&gt;
	int length; // in seconds.  &lt;br /&gt;
} mlPlaylist;&lt;br /&gt;
&lt;br /&gt;
// if you wish to put your tree items under &amp;quot;devices&amp;quot;, use this constant for ML_IPC_ADDTREEITEM&lt;br /&gt;
#define ML_TREEVIEW_ID_DEVICES 10000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// children communicate back to the media library by SendMessage(plugin.hwndLibraryParent,WM_ML_IPC,param,ML_IPC_X);&lt;br /&gt;
#define WM_ML_IPC WM_USER+0x1000&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
#define ML_IPC_GETCURRENTVIEW	0x090 // Returns HWND to the currently selected view or NULL if nothing selected or error. (WA 5.22 and higher)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Old Tree Item API  (deprecated)&lt;br /&gt;
//&lt;br /&gt;
#define ML_IPC_ADDTREEITEM		0x0101 // pass mlAddTreeItemStruct as the param&lt;br /&gt;
#define ML_IPC_SETTREEITEM		0x0102 // pass mlAddTreeItemStruct with id valid&lt;br /&gt;
#define ML_IPC_DELTREEITEM		0x0103 // pass param of tree item to remove&lt;br /&gt;
#define ML_IPC_GETCURTREEITEM	0x0104 // returns current tree item param or 0 if none&lt;br /&gt;
#define ML_IPC_SETCURTREEITEM	0x0105 // selects the tree item passed, returns 1 if found, 0 if not&lt;br /&gt;
#define ML_IPC_GETTREE			0x0106 // returns a HMENU with all the tree items. the caller needs to delete the returned handle! pass mlGetTreeStruct as the param&lt;br /&gt;
&lt;br /&gt;
/* deprecated. Use MLTREEITEM instead */&lt;br /&gt;
typedef struct {&lt;br /&gt;
  INT_PTR parent_id; //0=root, or ML_TREEVIEW_ID_*&lt;br /&gt;
  char *title;&lt;br /&gt;
  int has_children;&lt;br /&gt;
  INT_PTR this_id; //filled in by the library on ML_IPC_ADDTREEITEM&lt;br /&gt;
} mlAddTreeItemStruct;&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int item_start;   // TREE_PLAYLISTS, TREE_DEVICES...&lt;br /&gt;
  int cmd_offset;   // menu command offset if you need to make a command proxy, 0 otherwise&lt;br /&gt;
  int max_numitems; // maximum number of items you wish to insert or -1 for no limit&lt;br /&gt;
} mlGetTreeStruct;&lt;br /&gt;
&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
/// For Predixis, with Love&lt;br /&gt;
/// deprecatded (never use!!!)&lt;br /&gt;
///&lt;br /&gt;
#define ML_IPC_ADDTREEITEM_EX 0x0111 // pass mlAddTreeItemStructEx as the param&lt;br /&gt;
#define ML_IPC_SETTREEITEM_EX 0x0112 // pass mlAddTreeItemStructEx with this_id valid&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  INT_PTR parent_id; //0=root, or ML_TREEVIEW_ID_*&lt;br /&gt;
  char *title;&lt;br /&gt;
  int has_children;&lt;br /&gt;
  INT_PTR this_id; //filled in by the library on ML_IPC_ADDTREEITEM&lt;br /&gt;
  int imageIndex;  // index of the image you want to be associated with your item&lt;br /&gt;
} mlAddTreeItemStructEx;&lt;br /&gt;
&lt;br /&gt;
/// deprecatded (never use!!!)&lt;br /&gt;
#define ML_IPC_ADDTREEIMAGE 0x110 // adds tree image to the ml. Use mlAddTreeImageStruct as the param.&lt;br /&gt;
/// end of predixis special&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Tree Item API  (starting from 5.3)&lt;br /&gt;
//&lt;br /&gt;
#define ML_IPC_TREEITEM_GETHANDLE	0x120 // Gives you HANDLE to the item with specified ID in the param&lt;br /&gt;
#define ML_IPC_TREEITEM_GETCHILD		0x121 // Returns HANDLE to the child item for the item HANDLE specified as a param. &lt;br /&gt;
#define ML_IPC_TREEITEM_GETNEXT		0x122 // Returns HANDLE to the next item for the item HANDLE specified as a param.&lt;br /&gt;
#define ML_IPC_TREEITEM_GETSELECTED	0x123 // Returns HANDLE to selected item.&lt;br /&gt;
#define ML_IPC_TREEITEM_GETINFO		0x124 // Pass MLTREEITEMINFO as a param. return TRUE - if ok&lt;br /&gt;
#define ML_IPC_TREEITEM_SETINFO		0x125 // Pass MLTREEITEMINFO as a param. return TRUE - if ok&lt;br /&gt;
#define ML_IPC_TREEITEM_ADD			0x126 // Adds new item using MLTREEITEM passed as a param&lt;br /&gt;
#define ML_IPC_TREEITEM_DELETE		0x127 // Deletes tree item. Pass HANDLE as a param.&lt;br /&gt;
#define ML_IPC_TREEITEM_SELECT		0x128 // Selects tree item. Pass HANDLE as a param. &lt;br /&gt;
#define ML_IPC_TREEITEM_GETROOT		0x129 // Gets first item.&lt;br /&gt;
#define ML_IPC_TREEITEM_INSERT    0x130 // like ML_IPC_TREEITEM_ADD, but id becomes an &amp;quot;insert after&amp;quot; ID&lt;br /&gt;
#define ML_IPC_TREEITEM_GETCHILD_ID		0x131 // Returns ID to the child item for the item ID specified as a param. &lt;br /&gt;
#define ML_IPC_TREEITEM_GETNEXT_ID		0x132 // Returns ID to the next item for the item ID specified as a param.&lt;br /&gt;
#define ML_IPC_TREEITEM_ADDW			0x133 // Adds new item using MLTREEITEMW passed as a param&lt;br /&gt;
#define ML_IPC_TREEITEM_INSERTW    0x134 // like ML_IPC_TREEITEM_ADDW, but id becomes an &amp;quot;insert after&amp;quot; ID&lt;br /&gt;
#define ML_IPC_TREEITEM_SETINFOW    0x135 // Pass MLTREEITEMINFOW as a param. return TRUE - if ok&lt;br /&gt;
#define ML_IPC_TREEITEM_GETINFOW		0x136 // Pass MLTREEITEMINFO as a param. return TRUE - if ok&lt;br /&gt;
#define MLTI_ROOT			(INT_PTR)TVI_ROOT // can be used in ML_IPC_TREEITEM_GETCHILD&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  size_t	size;			// size of this struct&lt;br /&gt;
  UINT_PTR	id;				// depends on contxext&lt;br /&gt;
  UINT_PTR	parentId;		// 0 = root, or ML_TREEVIEW_ID_*&lt;br /&gt;
  char		*title;			// pointer to the buffer contained item name. &lt;br /&gt;
  size_t	titleLen;		// used for GetInfo &lt;br /&gt;
  BOOL		hasChildren;	// TRUE - has children&lt;br /&gt;
  int		imageIndex;		// index of the associated image&lt;br /&gt;
} MLTREEITEM;&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  MLTREEITEM	item;	// item data&lt;br /&gt;
  UINT			mask;	// one or more of MLTI_* flags&lt;br /&gt;
  UINT_PTR		handle; // Handle to the item. If handle is NULL item-&amp;gt;id will be used&lt;br /&gt;
} MLTREEITEMINFO;&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  size_t	size;			// size of this struct&lt;br /&gt;
  UINT_PTR		id;				// depends on context&lt;br /&gt;
  UINT_PTR		parentId;		// 0 = root, or ML_TREEVIEW_ID_*&lt;br /&gt;
  wchar_t	*title;			// pointer to the buffer contained item name. &lt;br /&gt;
  size_t	titleLen;		// used for GetInfo &lt;br /&gt;
  BOOL		hasChildren;	// TRUE - has children&lt;br /&gt;
  int		imageIndex;		// index of the associated image&lt;br /&gt;
} MLTREEITEMW;&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  MLTREEITEMW	item;	// item data&lt;br /&gt;
  UINT			mask;	// one or more of MLTI_* flags&lt;br /&gt;
  UINT_PTR		handle; // Handle to the item. If handle is NULL item-&amp;gt;id will be used&lt;br /&gt;
} MLTREEITEMINFOW;&lt;br /&gt;
// Flags that used in the MLTREEITEMINFO struct&lt;br /&gt;
#define MLTI_CHILDREN	TVIF_CHILDREN&lt;br /&gt;
#define MLTI_IMAGE		TVIF_IMAGE&lt;br /&gt;
#define MLTI_TEXT		TVIF_TEXT&lt;br /&gt;
#define MLTI_ID			TVIF_PARAM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
// Tree image (starting from 5.3)&lt;br /&gt;
//&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_TREEIMAGE_ADD 0x140 // adds tree image to the ml. Use MLTREEIMAGE as the param.&lt;br /&gt;
&lt;br /&gt;
typedef struct _COLOR24&lt;br /&gt;
{&lt;br /&gt;
	unsigned char rgbBlue;&lt;br /&gt;
	unsigned char rgbGreen;&lt;br /&gt;
	unsigned char rgbRed;&lt;br /&gt;
}COLOR24; // color struct &lt;br /&gt;
&lt;br /&gt;
typedef void (*BMPFILTERPROC)(const COLOR24*, const COLOR24*, COLOR24*); // color filter procedure &lt;br /&gt;
// you got two colors: color1 and color2 (usualy BG and FG colors) also you as a third parameter&lt;br /&gt;
// you get a pixel color value that you need (can) modify  &lt;br /&gt;
&lt;br /&gt;
#define FILTER_NO			((BMPFILTERPROC)NULL)&lt;br /&gt;
#define FILTER_DEFAULT1		((BMPFILTERPROC)1)&lt;br /&gt;
#define FILTER_DEFAULT2		((BMPFILTERPROC)2)&lt;br /&gt;
&lt;br /&gt;
#define MLTREEIMAGE_NONE					0&lt;br /&gt;
#define MLTREEIMAGE_DEFAULT					1&lt;br /&gt;
#define MLTREEIMAGE_BRANCH					2   // calculates at the time 	&lt;br /&gt;
#define MLTREEIMAGE_BRANCH_EXPANDED			3&lt;br /&gt;
#define MLTREEIMAGE_BRANCH_COLLAPSED		4&lt;br /&gt;
#define MLTREEIMAGE_BRANCH_NOCHILD			5&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
	HINSTANCE				hinst;					// hInstance&lt;br /&gt;
	int				resourceId;				// resource id &lt;br /&gt;
	int				imageIndex;				// set image to specified index (specify -1 to get a new index back)&lt;br /&gt;
	BMPFILTERPROC	filterProc;				// pointer to the filter proc to use or one of the FILTER_*&lt;br /&gt;
	int				width;					// reserved&lt;br /&gt;
	int				height;					// reserved&lt;br /&gt;
} MLTREEIMAGE;   // basicly ml will read your reosurce when it will need to create your image&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_NEWPLAYLIST           0x107 // pass hwnd for dialog parent as param&lt;br /&gt;
#define ML_IPC_IMPORTPLAYLIST        0x108 // pass hwnd for dialog parent as param&lt;br /&gt;
#define ML_IPC_IMPORTCURRENTPLAYLIST 0x109&lt;br /&gt;
#define ML_IPC_GETPLAYLISTWND        0x10A&lt;br /&gt;
#define ML_IPC_SAVEPLAYLIST          0x10B // pass hwnd for dialog parent as param&lt;br /&gt;
#define ML_IPC_OPENPREFS             0x10C&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_PLAY_PLAYLIST 0x010D // plays the playlist pointed to by the tree item passed, returns 1 if found, 0 if not&lt;br /&gt;
#define ML_IPC_LOAD_PLAYLIST 0x010E // loads the playlist pointed to by the tree item passed into the playlist editor, returns 1 if found, 0 if not&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_REFRESH_PREFS 0x10F // this doesn't belong in here &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/** ------------------ &lt;br /&gt;
 ** ml_playlists &lt;br /&gt;
 ** ------------------ */&lt;br /&gt;
&lt;br /&gt;
#define PL_FLAG_SHOW 1&lt;br /&gt;
#define PL_FLAG_SWITCH 2&lt;br /&gt;
#define PL_FLAGS_IMPORT 4 // set to have ml_playlists make a copy (only valid for mlAddPlaylist)&lt;br /&gt;
#define PL_FLAG_FILL_FILENAME 8 // only valid for mlMakePlaylist&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  size_t size;  // size of this struct&lt;br /&gt;
	const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name&lt;br /&gt;
  const wchar_t *filename;&lt;br /&gt;
	int flags; // see PL_FLAG_* above&lt;br /&gt;
	// the following two items can be optionally filled in (set to -1 otherwise)&lt;br /&gt;
	// if they aren't set, the playlist file will have to be opened and parsed&lt;br /&gt;
	// so prepopulating is faster (assuming if you already know the data)&lt;br /&gt;
	int numItems; // set to -1 if you don't know. &lt;br /&gt;
	int length; // in seconds, set to -1 if you don't know&lt;br /&gt;
} mlAddPlaylist;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_PLAYLIST_ADD 0x180 // call to add a new playlist file to the Playlists treeview.  pass an mlAddPlaylist *&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
	size_t size;  // size of this struct&lt;br /&gt;
	const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name&lt;br /&gt;
  int type; //ML_TYPE_ITEMRECORDLIST, etc&lt;br /&gt;
  void *data; // object to load&lt;br /&gt;
	int flags; // see PL_FLAG_* above&lt;br /&gt;
	wchar_t filename[MAX_PATH]; // this will get populated if PL_FLAG_FILL_NAME is set&lt;br /&gt;
} mlMakePlaylistV2;&lt;br /&gt;
&lt;br /&gt;
// old structure, here to make it easy to do a sizeof() check&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
	size_t size;  // size of this struct&lt;br /&gt;
	const wchar_t *playlistName; // set to NULL (or empty string) to prompt the user for a name&lt;br /&gt;
  int type; //ML_TYPE_ITEMRECORDLIST, etc&lt;br /&gt;
  void *data; // object to load&lt;br /&gt;
	int flags; // see PL_FLAG_* above&lt;br /&gt;
} mlMakePlaylist;&lt;br /&gt;
&lt;br /&gt;
/* Call to add a new playlist to the Playlists treeview.  &lt;br /&gt;
   It will be automatically created based on the data you pass&lt;br /&gt;
	 type &amp;amp; data follow the same specifications as send-to, drag-and-drop, etc.&lt;br /&gt;
*/&lt;br /&gt;
#define ML_IPC_PLAYLIST_MAKE 0x181  // call to create a new playlist in the treeview based on passed information.  pass an mlMakePlaylist *&lt;br /&gt;
#define ML_IPC_PLAYLIST_COUNT 0x182&lt;br /&gt;
#define ML_IPC_PLAYLIST_INFO 0x183 // pass in the struct below. returns &amp;quot;1&amp;quot; on success and &amp;quot;0&amp;quot; on failure&lt;br /&gt;
&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	// you fill this in&lt;br /&gt;
	size_t size; // size of this struct&lt;br /&gt;
	size_t playlistNum; // number of the playlist you want to retrieve (0 index)&lt;br /&gt;
	// ml_playlists fills these in&lt;br /&gt;
	wchar_t playlistName[128];&lt;br /&gt;
	wchar_t filename[MAX_PATH];&lt;br /&gt;
	int numItems;&lt;br /&gt;
	int length; // in seconds&lt;br /&gt;
} mlPlaylistInfo;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/** ------------------ &lt;br /&gt;
 ** &lt;br /&gt;
 ** ------------------ */&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_GETFILEINFO 0x0200 // pass it a &amp;amp;itemRecord with a valid filename (and all other fields NULL), and it will try to fill in the rest&lt;br /&gt;
#define ML_IPC_FREEFILEINFO 0x0201 // pass it a &amp;amp;itemRecord tha twas filled by getfileinfo, it will free the strings it allocated&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_HANDLEDRAG 0x0300 // pass it a &amp;amp;mlDropItemStruct it will handle cursors etc (unless flags has the lowest bit set), and it will set result appropriately:&lt;br /&gt;
#define ML_IPC_HANDLEDROP 0x0301 // pass it a &amp;amp;mlDropItemStruct with data on drop:&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SENDTOWINAMP 0x302 // send with a mlSendToWinampStruct:&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int type; //ML_TYPE_ITEMRECORDLIST, etc&lt;br /&gt;
  void *data; // object to play&lt;br /&gt;
&lt;br /&gt;
  int enqueue; // low bit set specifies enqueuing, and second bit NOT set specifies that &lt;br /&gt;
               // the media library should use its default behavior as the user configured it (if &lt;br /&gt;
               // enqueue is the default, the low bit will be flipped by the library)&lt;br /&gt;
} mlSendToWinampStruct;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  char *desc; // str&lt;br /&gt;
  intptr_t context; // context passed by ML_MSG_ONSENDTOBUILD&lt;br /&gt;
  intptr_t user32; // use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...&lt;br /&gt;
} mlAddToSendToStruct;&lt;br /&gt;
#define ML_IPC_ADDTOSENDTO 0x0400&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  wchar_t *desc; // str&lt;br /&gt;
  intptr_t context; // context passed by ML_MSG_ONSENDTOBUILD&lt;br /&gt;
  intptr_t user32; // use some unique ptr in memory, you will get it back in ML_MSG_ONSENDTOSELECT...&lt;br /&gt;
} mlAddToSendToStructW;&lt;br /&gt;
#define ML_IPC_ADDTOSENDTOW 0x0401 // pass mlAddToSendToStructW&lt;br /&gt;
&lt;br /&gt;
// used to make a submenu in sendto&lt;br /&gt;
// pass mlAddToSendToStructW, set desc to 0 to start, set valid desc to end&lt;br /&gt;
// user32 is unused &lt;br /&gt;
#define ML_IPC_BRANCHSENDTO 0x0402 &lt;br /&gt;
&lt;br /&gt;
// follow same rules as ML_IPC_ADDTOSENDTOW, but adds to branch instead of main send-to menu&lt;br /&gt;
#define ML_IPC_ADDTOBRANCH 0x403  // pass mlAddToSendToStructW&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_HOOKTITLE 0x0440 // this is like winamp's IPC_HOOK_TITLES... :) param1 is waHookTitleStruct&lt;br /&gt;
#define ML_IPC_HOOKEXTINFO 0x441 // called on IPC_GET_EXTENDED_FILE_INFO_HOOKABLE, param1 is extendedFileInfoStruct&lt;br /&gt;
#define ML_IPC_HOOKEXTINFOW 0x442 // called on IPC_GET_EXTENDED_FILE_INFO_HOOKABLEW, param1 is extendedFileInfoStructW&lt;br /&gt;
#define ML_IPC_HOOKTITLEW 0x0443 // this is like winamp's IPC_HOOK_TITLESW... :) param1 is waHookTitleStructW&lt;br /&gt;
&lt;br /&gt;
#define ML_HANDLEDRAG_FLAG_NOCURSOR 1&lt;br /&gt;
#define ML_HANDLEDRAG_FLAG_NAME 2&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int type; //ML_TYPE_ITEMRECORDLIST, etc&lt;br /&gt;
  void *data; // NULL if just querying&lt;br /&gt;
&lt;br /&gt;
  int result; // filled in by client: -1 if dont allow, 0 if dont know, 1 if allow.&lt;br /&gt;
&lt;br /&gt;
  POINT p; // cursor pos in screen coordinates&lt;br /&gt;
  int flags; &lt;br /&gt;
&lt;br /&gt;
  char *name; // only valid if ML_HANDLEDRAG_FLAG_NAME&lt;br /&gt;
&lt;br /&gt;
} mlDropItemStruct;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SKIN_LISTVIEW   0x0500 // pass the hwnd of your listview. returns a handle to use with ML_IPC_UNSKIN_LISTVIEW&lt;br /&gt;
#define ML_IPC_UNSKIN_LISTVIEW 0x0501 // pass the handle you got from ML_IPC_SKIN_LISTVIEW&lt;br /&gt;
#define ML_IPC_LISTVIEW_UPDATE 0x0502 // pass the handle you got from ML_IPC_SKIN_LISTVIEW&lt;br /&gt;
#define ML_IPC_LISTVIEW_DISABLEHSCROLL 0x0503 // pass the handle you got from ML_IPC_SKIN_LISTVIEW&lt;br /&gt;
#define ML_IPC_LISTVIEW_DISABLEVSCROLL 0x050A // pass the handle you got from ML_IPC_SKIN_LISTVIEW&lt;br /&gt;
#define ML_IPC_LISTVIEW_SHOWSORT		0x0504  // use LV_SKIN_SHOWSORT&lt;br /&gt;
#define ML_IPC_LISTVIEW_SORT			0x0505  // use LV_SKIN_SORT&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
	INT_PTR listView;&lt;br /&gt;
	BOOL	showSort;&lt;br /&gt;
} LV_SKIN_SHOWSORT;&lt;br /&gt;
&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	INT_PTR listView;&lt;br /&gt;
	int		columnIndex;&lt;br /&gt;
	BOOL	ascending;&lt;br /&gt;
} LV_SKIN_SORT;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SKIN_COMBOBOX   0x0508 // pass the hwnd of your combobox to skin, returns a ahndle to use with ML_IPC_UNSKIN_COMBOBOX&lt;br /&gt;
#define ML_IPC_UNSKIN_COMBOBOX 0x0509 // pass the handle from ML_IPC_SKIN_COMBOBOX&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SKIN_WADLG_GETFUNC 0x0600 &lt;br /&gt;
    // 1: return int (*WADlg_getColor)(int idx); // pass this an index, returns a RGB value (passing 0 or &amp;gt; 3 returns NULL)&lt;br /&gt;
    // 2: return int (*WADlg_handleDialogMsgs)(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); &lt;br /&gt;
    // 3: return void (*WADlg_DrawChildWindowBorders)(HWND hwndDlg, int *tab, int tabsize); // each entry in tab would be the id | DCW_*&lt;br /&gt;
    // 32: return void (*childresize_init)(HWND hwndDlg, ChildWndResizeItem *list, int num);&lt;br /&gt;
    // 33: return void (*childresize_resize)(HWND hwndDlg, ChildWndResizeItem *list, int num);&lt;br /&gt;
    // 66: return (HFONT) font to use for dialog elements, if desired (0 otherwise)&lt;br /&gt;
   &lt;br /&gt;
// itemRecord type for use with ML_TYPE_ITEMRECORDLIST, as well as many other functions&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
  char *filename;&lt;br /&gt;
  char *title;&lt;br /&gt;
  char *album;&lt;br /&gt;
  char *artist;&lt;br /&gt;
  char *comment;&lt;br /&gt;
  char *genre;&lt;br /&gt;
  int year;&lt;br /&gt;
  int track;&lt;br /&gt;
  int length;&lt;br /&gt;
  char **extended_info;&lt;br /&gt;
  // currently defined extended columns (while they are stored internally as integers&lt;br /&gt;
  // they are passed using extended_info as strings):&lt;br /&gt;
  // use getRecordExtendedItem and setRecordExtendedItem to get/set.&lt;br /&gt;
  // for your own internal use, you can set other things, but the following values&lt;br /&gt;
  // are what we use at the moment. Note that setting other things will be ignored&lt;br /&gt;
  // by ML_IPC_DB*.&lt;br /&gt;
  // &lt;br /&gt;
  //&amp;quot;RATING&amp;quot; file rating. can be 1-5, or 0 or empty for undefined&lt;br /&gt;
  //&amp;quot;PLAYCOUNT&amp;quot; number of file plays.&lt;br /&gt;
  //&amp;quot;LASTPLAY&amp;quot; last time played, in standard time_t format&lt;br /&gt;
  //&amp;quot;LASTUPD&amp;quot; last time updated in library, in standard time_t format&lt;br /&gt;
  //&amp;quot;FILETIME&amp;quot; last known file time of file, in standard time_t format&lt;br /&gt;
  //&amp;quot;FILESIZE&amp;quot; last known file size, in kilobytes.&lt;br /&gt;
  //&amp;quot;BITRATE&amp;quot; file bitrate, in kbps&lt;br /&gt;
	//&amp;quot;TYPE&amp;quot; - &amp;quot;0&amp;quot; for audio, &amp;quot;1&amp;quot; for video&lt;br /&gt;
&lt;br /&gt;
} itemRecord;&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  itemRecord *Items;&lt;br /&gt;
  int Size;&lt;br /&gt;
  int Alloc;&lt;br /&gt;
} itemRecordList;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;time.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
  wchar_t *filename;&lt;br /&gt;
  wchar_t *title;&lt;br /&gt;
  wchar_t *album;&lt;br /&gt;
  wchar_t *artist;&lt;br /&gt;
  wchar_t *comment;&lt;br /&gt;
  wchar_t *genre;&lt;br /&gt;
	wchar_t *albumartist; &lt;br /&gt;
	wchar_t *replaygain_album_gain; // these are strings rather than float's to differentiate between '0 gain' and 'not defined'&lt;br /&gt;
	wchar_t *replaygain_track_gain; // these are strings rather than float's to differentiate between '0 gain' and 'not defined'&lt;br /&gt;
	wchar_t *publisher;&lt;br /&gt;
	wchar_t *composer;&lt;br /&gt;
  int year;&lt;br /&gt;
  int track;&lt;br /&gt;
	int tracks;&lt;br /&gt;
  int length;&lt;br /&gt;
	int rating; // file rating. can be 1-5, or 0 for undefined&lt;br /&gt;
	int playcount; // number of file plays.&lt;br /&gt;
	__time64_t lastplay; // last time played, in standard time_t format&lt;br /&gt;
	__time64_t lastupd; // last time updated in library, in standard time_t format&lt;br /&gt;
	__time64_t filetime; // last known file time of file, in standard time_t format&lt;br /&gt;
	int filesize; //last known file size, in kilobytes.&lt;br /&gt;
	int bitrate; // file bitrate, in kbps&lt;br /&gt;
	int type; // 0 for audio, 1 for video&lt;br /&gt;
	int disc; // disc number&lt;br /&gt;
	int discs; // number of discs&lt;br /&gt;
	int bpm;&lt;br /&gt;
  wchar_t **extended_info; &lt;br /&gt;
  // currently defined extended columns (while they are stored internally as integers&lt;br /&gt;
  // they are passed using extended_info as strings):&lt;br /&gt;
  // use getRecordExtendedItem and setRecordExtendedItem to get/set.&lt;br /&gt;
  // for your own internal use, you can set other things, but the following values&lt;br /&gt;
  // are what we use at the moment. Note that setting other things will be ignored&lt;br /&gt;
  // by ML_IPC_DB*.&lt;br /&gt;
  // &lt;br /&gt;
&lt;br /&gt;
} itemRecordW;&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  itemRecordW *Items;&lt;br /&gt;
  int Size;&lt;br /&gt;
  int Alloc;&lt;br /&gt;
} itemRecordListW;&lt;br /&gt;
&lt;br /&gt;
//&lt;br /&gt;
// all return 1 on success, -1 on error. or 0 if not supported, maybe?&lt;br /&gt;
&lt;br /&gt;
// pass these a mlQueryStruct&lt;br /&gt;
// results should be zeroed out before running a query, but if you wish you can run multiple queries and &lt;br /&gt;
// have it concatenate the results. tho it would be more efficient to just make one query that contains both,&lt;br /&gt;
// as running multiple queries might have duplicates etc.&lt;br /&gt;
// in general, though, if you need to treat &amp;quot;results&amp;quot; as if they are native, you should use&lt;br /&gt;
// copyRecordList to save a copy, then free the results using ML_IPC_DB_FREEQUERYRESULTS.&lt;br /&gt;
// if you need to keep an exact copy that you will only read (and will not modify), then you can&lt;br /&gt;
// use the one in the mlQueryStruct.&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY 0x0700 &lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_SEARCH 0x0701 // &amp;quot;query&amp;quot; should be interpreted as keyword search instead of query string&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_FILENAME 0x0702 // searches for one exact filename match of &amp;quot;query&amp;quot;&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_INDEX 0x703 // retrieves item #(int)query&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_FREEQUERYRESULTS 0x0705 // frees memory allocated by ML_IPC_RUNQUERY (empties results)&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  char *query;&lt;br /&gt;
  int max_results;      // can be 0 for unlimited&lt;br /&gt;
  itemRecordList results;&lt;br /&gt;
} mlQueryStruct;&lt;br /&gt;
&lt;br /&gt;
/* Unicode versions of the above */&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_RUNQUERYW 0x1700&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_SEARCHW 0x1701 // &amp;quot;query&amp;quot; should be interpreted as keyword search instead of query string&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_FILENAMEW 0x1702 // searches for one exact filename match of &amp;quot;query&amp;quot;&lt;br /&gt;
#define ML_IPC_DB_RUNQUERY_INDEXW 0x1703 // retrieves item #(int)query&lt;br /&gt;
#define ML_IPC_DB_FREEQUERYRESULTSW 0x1705 // frees memory allocated by ML_IPC_RUNQUERYW (empties results)&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  wchar_t *query;&lt;br /&gt;
  int max_results;      // can be 0 for unlimited&lt;br /&gt;
  itemRecordListW results;&lt;br /&gt;
} mlQueryStructW;&lt;br /&gt;
&lt;br /&gt;
/* ----------------------------- */&lt;br /&gt;
&lt;br /&gt;
// pass these an (itemRecord *) to add/update.&lt;br /&gt;
// note that any NULL fields in the itemRecord won't be updated, &lt;br /&gt;
// and year, track, or length of -1 prevents updating as well.&lt;br /&gt;
#define ML_IPC_DB_UPDATEITEM 0x0706    // returns -2 if item not found in db&lt;br /&gt;
#define ML_IPC_DB_ADDORUPDATEITEM 0x0707&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_REMOVEITEM 0x0708 // pass a char * to the filename to remove. returns -2 if file not found in db.&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  char*  fileName;   // file name to add&lt;br /&gt;
  int    meta_mode;  // metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)&lt;br /&gt;
  int    gues_mode;  // metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)&lt;br /&gt;
} LMDB_FILE_ADD_INFO;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_UPDATEFILE 0x0710         // Update File in the Local Media Data Base (return -2 if file record not found)&lt;br /&gt;
#define ML_IPC_DB_ADDORUPDATEFILE 0x0711      // Adds or Updates File in the Local Media Data Base.&lt;br /&gt;
&lt;br /&gt;
/* Unicode versions of the above */&lt;br /&gt;
&lt;br /&gt;
// pass these an (itemRecordW *) to add/update.&lt;br /&gt;
// note that any NULL fields in the itemRecordW won't be updated, &lt;br /&gt;
// and year, track, or length of -1 prevents updating as well.&lt;br /&gt;
#define ML_IPC_DB_UPDATEITEMW 0x1706    // returns -2 if item not found in db&lt;br /&gt;
#define ML_IPC_DB_ADDORUPDATEITEMW 0x1707&lt;br /&gt;
&lt;br /&gt;
typedef struct &lt;br /&gt;
{&lt;br /&gt;
  wchar_t*  fileName;   // file name to add&lt;br /&gt;
  int    meta_mode;  // metadata get mode (0 - don't use metadata, 1 - use metadata; -1 - read from user settings (ini file)&lt;br /&gt;
  int    gues_mode;  // metadata guessing mode (0 - smart, 1 - simple; 2 - no, -1 - read from user settings (ini file)&lt;br /&gt;
} LMDB_FILE_ADD_INFOW;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_UPDATEFILEW 0x1710         // Update File in the Local Media Data Base (return -2 if file record not found) NOTE that this call is broken on 5.33.  Only use on 5.34+&lt;br /&gt;
#define ML_IPC_DB_ADDORUPDATEFILEW 0x1711      // Adds or Updates File in the Local Media Data Base.&lt;br /&gt;
&lt;br /&gt;
/* ----------------------------- */&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_DB_SYNCDB 0x0709 // sync db if dirty flags are set. good to do after a batch of updates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// these return 0 if unsupported, -1 if failed, 1 if succeeded&lt;br /&gt;
&lt;br /&gt;
// pass a winampMediaLibraryPlugin *. Will not call plugin's init() func. &lt;br /&gt;
// YOU MUST set winampMediaLibraryPlugin-&amp;gt;hDllInstance to NULL, and version to MLHDR_VER&lt;br /&gt;
// 5.25+:  You can set hDllInstance to valid value.  &lt;br /&gt;
//         This IPC will return -1 on failure, so a good check against old verions&lt;br /&gt;
//         is to try with hDllInstance set, if it returns -1, try again with hDllInstance=0&lt;br /&gt;
#define ML_IPC_ADD_PLUGIN 0x0750 &lt;br /&gt;
#define ML_IPC_REMOVE_PLUGIN 0x0751 // winampMediaLibraryPlugin * of plugin to remove. Will not call plugin's quit() func&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SEND_PLUGIN_MESSAGE 0x0752 // sends message to plugins (wParam = 0, lParam = pointer to the pluginMessage struct)&lt;br /&gt;
// pluginMessage struct&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int messageType;&lt;br /&gt;
  INT_PTR param1;&lt;br /&gt;
  INT_PTR param2;&lt;br /&gt;
  INT_PTR param3;&lt;br /&gt;
} pluginMessage;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_ENSURE_VISIBLE 0x753 // ensures that the media library is visible&lt;br /&gt;
#define ML_IPC_IS_VISIBLE 0x754 // queries the current visibility status&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_GET_PARENTAL_RATING 0x755 &lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_TOGGLE_VISIBLE 0x756&lt;br /&gt;
&lt;br /&gt;
// this gets sent to any child windows of the library windows, and then (if not&lt;br /&gt;
// handled) the library window itself&lt;br /&gt;
&lt;br /&gt;
#define WM_ML_CHILDIPC WM_APP+0x800 // avoids conflicts with any windows controls&lt;br /&gt;
#define ML_CHILDIPC_DROPITEM 0x100         // lParam = 100, wParam = &amp;amp;mlDropItemStruct&lt;br /&gt;
&lt;br /&gt;
// current item ratings&lt;br /&gt;
#define ML_IPC_SETRATING 0x0900 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet &lt;br /&gt;
#define ML_IPC_GETRATING 0x0901 // return the current track's rating or 0 if not in db/no rating&lt;br /&gt;
&lt;br /&gt;
// playlist entry rating&lt;br /&gt;
typedef struct {&lt;br /&gt;
  int plentry;&lt;br /&gt;
  int rating;&lt;br /&gt;
} pl_set_rating;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_PL_SETRATING 0x0902 // lParam = pointer to pl_set_rating struct&lt;br /&gt;
#define ML_IPC_PL_GETRATING 0x0903 // lParam = playlist entry, returns the rating or 0 if not in db/no rating&lt;br /&gt;
&lt;br /&gt;
typedef struct {&lt;br /&gt;
  HWND dialog_parent;              // Use this window as a parent for the query editor dialog&lt;br /&gt;
  const char *query;               // The query to edit, or &amp;quot;&amp;quot; / null for new query&lt;br /&gt;
} ml_editquery;                 &lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_EDITQUERY    0x904  // lParam = pointer to ml_editquery struct, returns 0 if edition was canceled and 1 on success&lt;br /&gt;
                                   // After returning, and if ok was clicked, the struct contains a pointer to the edited query. this pointer is static : &lt;br /&gt;
                                   // - do *not* free it&lt;br /&gt;
                                   // - if you need to keep it around, strdup it, as it may be changed later by other plugins calling ML_IPC_EDITQUERY.&lt;br /&gt;
&lt;br /&gt;
typedef struct {                &lt;br /&gt;
  HWND dialog_parent;              // Use this window as a parent for the view editor dialog&lt;br /&gt;
  const char *query;               // The query to edit, or &amp;quot;&amp;quot; / null for new views&lt;br /&gt;
  const char *name;                // Name of the view (ignored for new views)&lt;br /&gt;
  int mode;                        // View mode (0=simple view, 1=artist/album view, -1=hide mode radio boxes)&lt;br /&gt;
} ml_editview;                 &lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_EDITVIEW     0x905  // lParam = pointer to ml_editview struct, returns 0 if edition was canceled and 1 on success&lt;br /&gt;
                                   // After returning, and if ok was clicked, the struct contains the edited values. String pointers are static: &lt;br /&gt;
                                   // - do *not* free them &lt;br /&gt;
                                   // - if you need to keep them around, strdup them, as they may be changed later by other plugins calling ML_IPC_EDITQUERY.&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SET_FILE_RATING 0x0906 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet &lt;br /&gt;
#define ML_IPC_GET_FILE_RATING 0x0907 // return the current track's rating or 0 if not in db/no rating&lt;br /&gt;
&lt;br /&gt;
// playlist entry rating&lt;br /&gt;
typedef struct {&lt;br /&gt;
  const char* fileName;&lt;br /&gt;
  int newRating;&lt;br /&gt;
} file_set_rating;&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SMARTVIEW_COUNT 0x0908	// returns the number of smartviews. no parameter required&lt;br /&gt;
#define ML_IPC_SMARTVIEW_INFO 0x0909	// pass a mlSmartViewInfo*. returns 1 on success and 0 on failure&lt;br /&gt;
#define ML_IPC_SMARTVIEW_ADD 0x0910	// pass a mlSmartViewInfo* with filled in size, name, query, mode, iconImgIndex. treeitemid gets filled in. returns 1 on success and 0 on failure&lt;br /&gt;
&lt;br /&gt;
typedef struct&lt;br /&gt;
{&lt;br /&gt;
	// you fill these in&lt;br /&gt;
	size_t size;  // set to sizeof(mlSmartViewInfo)&lt;br /&gt;
	size_t smartViewNum;&lt;br /&gt;
	// ml_local fills these in&lt;br /&gt;
	wchar_t smartViewName[128];&lt;br /&gt;
	wchar_t smartViewQuery[512];&lt;br /&gt;
	int mode;&lt;br /&gt;
	int iconImgIndex;&lt;br /&gt;
	int treeItemId;&lt;br /&gt;
} mlSmartViewInfo;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#define ML_IPC_SET_FILE_RATINGW 0x0911 // lParam = 0 to 5, rates current track -- inserts it in the db if it's not in it yet &lt;br /&gt;
#define ML_IPC_GET_FILE_RATINGW 0x0912 // return the current track's rating or 0 if not in db/no rating&lt;br /&gt;
&lt;br /&gt;
// playlist entry rating&lt;br /&gt;
typedef struct {&lt;br /&gt;
  const wchar_t *fileName;&lt;br /&gt;
  int newRating;&lt;br /&gt;
} file_set_ratingW;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Nullsoft_Database_Engine</id>
		<title>Nullsoft Database Engine</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Nullsoft_Database_Engine"/>
				<updated>2008-09-10T19:51:34Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: The Nullsoft Database Engine powers the local media library, history, and the CD metadata database.  It is relative simple and has a small query language.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Nullsoft Database Engine powers the local media library, history, and the CD metadata database.  It is relative simple and has a small query language.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Tagz_API</id>
		<title>Tagz API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Tagz_API"/>
				<updated>2008-09-10T19:16:02Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tagz is the title formatting engine that powers the playlist titles.  (See Winamp preferences-&amp;gt;Titles-&amp;gt;Advanced Title Formatting for more information).  You can use this title formatting engine for your plugin's needs, optionally providing your own metadata for %artist%, etc.  &lt;br /&gt;
&lt;br /&gt;
Note that although Winamp's Tagz engine and the Tagz engine in Foobar2000 both come from a common source, they have diverged significantly and are not compatible for anything but the simplest of formats.&lt;br /&gt;
&lt;br /&gt;
Interface: api_tagz&lt;br /&gt;
&lt;br /&gt;
Include file: tagz/api_tagz.h&lt;br /&gt;
&lt;br /&gt;
You can also use Tagz via [[SendMessage API|WM_WA_IPC]]:&lt;br /&gt;
&lt;br /&gt;
 #define IPC_FORMAT_TITLE 297&lt;br /&gt;
 #define IPC_FORMAT_TITLE_EXTENDED 298&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Articles</id>
		<title>Articles</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Articles"/>
				<updated>2008-09-10T16:34:37Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: /* Web Development Articles */&lt;/p&gt;
&lt;hr /&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;
&lt;br /&gt;
==Skin Articles==&lt;br /&gt;
&lt;br /&gt;
===Classic Skins===&lt;br /&gt;
*Link to Classic Skin Article 1&lt;br /&gt;
*Link to Classic Skin Article 2&lt;br /&gt;
&lt;br /&gt;
===Modern Skins===&lt;br /&gt;
*[http://dev.aol.com/article/2007/winamp_skins Winamp Skins Development Tutorial]&lt;br /&gt;
*Link to Modern Skin Article 2&lt;br /&gt;
&lt;br /&gt;
==Visualization Articles==&lt;br /&gt;
*[[MilkDrop_Preset_Authoring|MilkDrop Preset Authoring]]&lt;br /&gt;
*Link to vis Article 2&lt;br /&gt;
&lt;br /&gt;
==Plug-in Articles==&lt;br /&gt;
&lt;br /&gt;
*[[Wasabi|Overview of the Wasabi API]]&lt;br /&gt;
*[[Decode File API]]&lt;br /&gt;
*[[Media Library Plugin|How to create a Media Library plugin]]&lt;br /&gt;
*[[Input Plugin|How to create an Input plugin]]&lt;br /&gt;
*[[General Purpose Plugin|General Purpose plugins]]&lt;br /&gt;
*[[Output Plugin|How to create an Output plugin]]&lt;br /&gt;
*[[DSP Plugin|Audio Effects (DSP) plugins]]&lt;br /&gt;
*[[Random API]]&lt;br /&gt;
*[[Language API]]&lt;br /&gt;
*[[Agave Config API]]&lt;br /&gt;
*[[Album Art API]]&lt;br /&gt;
*[[Tagz API]]&lt;br /&gt;
*[[XML Parser Object]]&lt;br /&gt;
*[[System Callbacks API]]&lt;br /&gt;
*[[Skin API]]&lt;br /&gt;
*[[Service Manager API]]&lt;br /&gt;
*[[Memory Manager API]]&lt;br /&gt;
*[[Image Writer Service]]&lt;br /&gt;
*[[Image Loader Service]]&lt;br /&gt;
*[[Text Feed Service]]&lt;br /&gt;
*[[File Reader Service]]&lt;br /&gt;
*[[Application API]]&lt;br /&gt;
*[[Replay Gain API]]&lt;br /&gt;
*[[Podcasts API]]&lt;br /&gt;
*[[Agave Metadata API]]&lt;br /&gt;
*[[System Component Interface]]&lt;br /&gt;
*[[Burner API]]&lt;br /&gt;
*[[Audio Encoder Plugin|Audio encoders (transcoding, CD ripper)]]&lt;br /&gt;
*[[Skinning Plugins|WAC Skinning plugins]]&lt;br /&gt;
*[[Nullsoft Database Engine|Nullsoft Database Engine (NDE)]]&lt;br /&gt;
*[[JNetLib|JNetLib networking library]]&lt;br /&gt;
*[[APE Plugins|AVS Plugins]]&lt;br /&gt;
*[[NSV Plugins|NSV Audio and Video decoders]]&lt;br /&gt;
*[[Playlist API]]&lt;br /&gt;
*[[Media Core API|Media Core API (Freeform skins only!)]]&lt;br /&gt;
*[[SendMessage API|Winamp 2 API]]&lt;br /&gt;
*[[Media Library API|Media Library SendMessage API]]&lt;br /&gt;
*[[Plugin Terminology]]&lt;br /&gt;
&lt;br /&gt;
==Web Development Articles==&lt;br /&gt;
* [[HTTP Example Plugin]]&lt;br /&gt;
* [[Javascript External Interface]]&lt;br /&gt;
* ''(More Coming Soon)''&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Wasabi</id>
		<title>Wasabi</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Wasabi"/>
				<updated>2008-09-10T16:33:45Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''W'''inamp '''S'''ervice '''A'''rchitecture '''B'''inary '''I'''nterface&lt;br /&gt;
== Rationale ==&lt;br /&gt;
&lt;br /&gt;
The plugin struct definition API is effective, but it would be cumbersome to create a new plugin type for every possible scenario.  As a result, a new generic plugin system was created named Wasabi (Winamp Service Architecture Binary Interface).  Instead of hard-coded lists of function pointers to be defined, plugins create C++ objects implementing known interfaces identified with some unique ID (GUID).  Rather than a specific filename having one specific plugin type (in_*.dll for Input plugins), Wasabi components 'register' the services they provide.  This allows one plugin to load provide multiple services, allows for new plugin types to be created without new code, and allows for &amp;quot;specialized&amp;quot; plugin types.  For example, playlist.w5s loads the [[Playlist API|Playlist Manager API]] for loading and analyzing playlist files, as well as individual playlist loading objects for each type (M3U, PLS, B4S), and various helper services involving playlists.&lt;br /&gt;
&lt;br /&gt;
Plugins can communicate with each other by requesting each other's services via the Service Manager.  They can also query for API's that Winamp itself registers such as the [[System Callbacks API]] (generic notification system) and the [[Application API]] (allows plugins to query for version number, settings path, etc)&lt;br /&gt;
&lt;br /&gt;
Wasabi relies on a common base class called &amp;quot;Dispatchable&amp;quot;.  Dispatchable implements a single virtual method which consists of a &amp;quot;function ID&amp;quot; integer value, an array of parameters and a parameter count.  Child class implementations override this function with logic which &amp;quot;dispatches&amp;quot; each ID to the appropriate function.  In some regards, it is similar to the old [[SendMessage API]].  However, a set of inline helper methods defined inside each interface removes the complexity of using Wasabi interfaces, and most of the complexity from implementing Wasabi interfaces.  They can be treated like any other C++ object.&lt;br /&gt;
&lt;br /&gt;
== Components of Wasabi ==&lt;br /&gt;
 &lt;br /&gt;
* api definitions - formalizes the interfaces for various objects, APIs, interfaces and services&lt;br /&gt;
* wasabi helper classes - accesses the service manager to find services to perform required tasks. e.g. FileReaderApi enumerates the available file reader services to find an appropriate one and read from it. Used to hide complexity from the programmer. Some of these exist as shared services, to cut down on duplicate code across plugins.&lt;br /&gt;
* general purposes helper classes / functions - called BFC (brennan foundation class) currently.&lt;br /&gt;
&lt;br /&gt;
What is Wasabi intended to solve?&lt;br /&gt;
&lt;br /&gt;
# C++ does not define a binary interface to share objects between modules&lt;br /&gt;
# The existing [[SendMessage API|winamp 2]] plugin architecture only defines a limited set of interfaces&lt;br /&gt;
# Existing winamp 2 plugins have limited interaction with Winamp.&lt;br /&gt;
&lt;br /&gt;
== Dispatchable ==&lt;br /&gt;
&lt;br /&gt;
The Dispatchable class is the base class for many of the classes within Wasabi. It contains a single virtual method, _dispatch(), which is passed a dispatch ID msg, a pointer to store a return value retval, a pointer to an array of parameters params, and the parameter count nparam.&lt;br /&gt;
&lt;br /&gt;
The class is defined as:&lt;br /&gt;
&lt;br /&gt;
 '''class''' Dispatchable&lt;br /&gt;
 {&lt;br /&gt;
 '''public''':&lt;br /&gt;
  // this is virtual so it is visible across modules&lt;br /&gt;
  '''virtual''' '''int''' _dispatch('''int''' msg, '''void''' *retval, '''void''' **params = NULL, '''int''' nparam = 0)=0;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
In many ways, it is similiar to the Invoke() portion of COM's IDispatch class. It is also conceptually similiar to a Win32 Window Procedure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When classes are used by different plugins, the Dispatchable base class is used instead of abstract classes with pure virtual functions. Why? Because it makes it easier to add additional methods, without requiring &amp;quot;version 2&amp;quot; classes such as those that COM uses. (See for example http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform95/htm/readerobject.asp). And since the handling of an unknown &amp;quot;msg&amp;quot; is uniform, it allows a limited form of forwards compatability as well.&lt;br /&gt;
&lt;br /&gt;
== Interfaces ==&lt;br /&gt;
&lt;br /&gt;
Interfaces that are intended to be shared amongst plugins are defined specially in Wasabi. An interface is derived from Dispatchable and defines a set of dispatch messages which make up the particular interface.  Depending on its use, an interface's classname will be given one of the following prefixes&lt;br /&gt;
&lt;br /&gt;
* api - For singleton APIs.  Examples of APIs are the Service Manager and the System Callbacks API.&lt;br /&gt;
* ifc - For interfaces.  These are given to Dispatchable classes which are not involved with the service manager.  These are typically used for passing objects to other objects or for accepting objects as return values.&lt;br /&gt;
* svc - For collective services.  These are services which are one of many classes which implement an interface.  Examples include image loading services and playlist loading services.&lt;br /&gt;
* obj - For objects.  These are classes which are created by the service factory on getInterface() and destroyed on releaseInterface().  Examples of objects are instances of the XML Parser and the JNetLib http retriever.&lt;br /&gt;
&lt;br /&gt;
=== Example === &lt;br /&gt;
The interface for a &amp;quot;Region&amp;quot; (a shape that defines a portion of a window, usually used for painting)&lt;br /&gt;
&lt;br /&gt;
 class ifc_region : public Dispatchable&lt;br /&gt;
 {&lt;br /&gt;
 public:&lt;br /&gt;
  int _dispatch(int msg, void *retval, void **params=NULL, int nparam=0);&lt;br /&gt;
 &lt;br /&gt;
  enum&lt;br /&gt;
  {&lt;br /&gt;
  REGION_GETOSHANDLE =50,&lt;br /&gt;
  REGION_CLONE =100,&lt;br /&gt;
  REGION_DISPOSECLONE =110,&lt;br /&gt;
  REGION_PTINREGION =120,&lt;br /&gt;
  REGION_OFFSET =130,&lt;br /&gt;
  REGION_GETBOX =140,&lt;br /&gt;
  REGION_SUBTRACTRGN =150,&lt;br /&gt;
  REGION_SUBTRACTRECT =160,&lt;br /&gt;
  REGION_ADDRECT =170,&lt;br /&gt;
  REGION_ADD =180,&lt;br /&gt;
  REGION_AND =190,&lt;br /&gt;
  REGION_SETRECT =200,&lt;br /&gt;
  REGION_EMPTY =210,&lt;br /&gt;
  REGION_ISEMPTY =220,&lt;br /&gt;
  REGION_EQUALS =230,&lt;br /&gt;
  REGION_ENCLOSED =240,&lt;br /&gt;
  REGION_INTERSECTRGN =250,&lt;br /&gt;
  REGION_DOESINTERSECTRGN =251,&lt;br /&gt;
  REGION_INTERSECTRECT =260,&lt;br /&gt;
  REGION_ISRECT =270,&lt;br /&gt;
  REGION_SCALE =280,&lt;br /&gt;
  REGION_DEBUG =290,&lt;br /&gt;
  REGION_MAKEWNDREGION =300,&lt;br /&gt;
  REGION_GETNUMRECTS =310,&lt;br /&gt;
  REGION_ENUMRECT =320,&lt;br /&gt;
  };&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
Typically, the Dispatchable classes define non-virtual methods corresponding to each dispatch message. The implementation of these methods are to simply pack the parameters into an array and call _dispatch.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
 inline void Region::offset(int x,int y)&lt;br /&gt;
 {&lt;br /&gt;
  void *params[2] = {&amp;amp;x, &amp;amp;y};&lt;br /&gt;
  _dispatch(REGION_OFFSET, NULL, params,2);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The purpose of these methods are to allow the interface to be used without having to think about the Dispatchable interface. Once the interface is defined and the helper methods are written you can totally forget about Dispatchable.&lt;br /&gt;
&lt;br /&gt;
Interfaces allow for an object to be shared amongst Winamp and plugins. For example, since api_region is defined, you may call the function api_region *GetUpdateRegion(); and use the returned object safely.&lt;br /&gt;
Services&lt;br /&gt;
&lt;br /&gt;
== Services ==&lt;br /&gt;
&lt;br /&gt;
In Wasabi, a service is an object that implements functionality that Winamp or other plugins may require. For example, the image loader service loaded decompresses an image. The memory manager service acts as a common malloc/free, so that memory allocated in one plugin can be freed safely in another.&lt;br /&gt;
&lt;br /&gt;
Services use Interfaces. The GetUpdateRegion example in the Interfaces section described using interfaces to define an object returned from a function. But how does a plugin call a function in Winamp in the first place? That's where services come in.&lt;br /&gt;
&lt;br /&gt;
Services are retrieved through api_service, an interface which is passed to each plugin as it is loaded. api_service acts as a &amp;quot;global store&amp;quot; of services. Plugins can retrieve other services and register their own services.&lt;br /&gt;
&lt;br /&gt;
There are two basic kinds of services, '''''unique''''' services and '''''collective''''' services.&lt;br /&gt;
&lt;br /&gt;
A collective service is an interface which implements a particular service type. Typically, this is a service that has to be implemented differently depending on use. For example, a PNG loading service would be part of the WaSvc::IMAGELOADER service type, and would be a different object from other WaSvc::IMAGELOADER services (such as a JPG loader). File readers are another example: direct file access could be implemented separately from HTTP access, ZIP file access, etc. Clients (Winamp or plugins) can enumerate through all the services of a particular type, to find one that fits its needs.&lt;br /&gt;
&lt;br /&gt;
Unique services are one-off interfaces. They have a service type of WaSvc::UNIQUE. Rather than checking for a particular service type, a client asks for a particular service by GUID. A memory manager service would be a unique service. Typically, unique services are used to provide some sort of system access, or to perform some sort of very specific task.&lt;br /&gt;
&lt;br /&gt;
== Service Factories ==&lt;br /&gt;
&lt;br /&gt;
Services are retrieved via Service Factories. api_service operates with service factories, and plugins must provide service factories for the services they implement. Service Factories create objects of your service whenever requested by a client.&lt;br /&gt;
&lt;br /&gt;
Although the factory is annoying to deal with (just another layer to get to what you want), it allows for the developer to control object creation. Most unique services (and some collective services) are singletons. That is, there only needs to be one of them in existance at any point in time. The same object pointer may be returned every time from the factory.&lt;br /&gt;
&lt;br /&gt;
Other services might be need to be uniquely created for each client. Each file reader, for example, will need a separate object, since state is stored in the file reader object.&lt;br /&gt;
&lt;br /&gt;
Services are released through the factory that created them, allowing the factory to control destruction as well as construction.&lt;br /&gt;
&lt;br /&gt;
== System Callbacks ==&lt;br /&gt;
Not technically part of the the api/interface/services infrastructure within Wasabi. System Callbacks (api_syscb), is a service which broadcasts messages to any callback receiver (a class dervied from SysCallback) that has registered itself with the System Callbacks service.&lt;br /&gt;
&lt;br /&gt;
Service registration and deregistration messages are broadcasted by api_service, so api_syscb is guaranteed to be an available service (because it must be created for api_service to operate).&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Input_Plugin</id>
		<title>Input Plugin</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Input_Plugin"/>
				<updated>2008-09-10T16:26:42Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Include files: :Winamp/in2.h :Winamp/out.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Include files:&lt;br /&gt;
:Winamp/in2.h&lt;br /&gt;
:Winamp/out.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/JNetLib</id>
		<title>JNetLib</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/JNetLib"/>
				<updated>2008-09-10T16:25:33Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: JNetLib is a simple, cross-platform networking library that powers much of Winamp.  It is available to download from [http://www.nullsoft.com/free/jnetlib].  Within Winamp, there are [[Was...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;JNetLib is a simple, cross-platform networking library that powers much of Winamp.  It is available to download from [http://www.nullsoft.com/free/jnetlib].  Within Winamp, there are [[Wasabi API|Dispatchable interfaces]] to allow active JNetLib objects to be shared amongst plugins.  For example, the [[Download Manager API|Download Manager]] allows you to retrieve the underlying obj_httpreceiver object.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/SendMessage_API</id>
		<title>SendMessage API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/SendMessage_API"/>
				<updated>2008-09-10T16:21:33Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Include files: &lt;br /&gt;
:Winamp/wa_ipc.h&lt;br /&gt;
:Winamp/ipc_pe.h&lt;br /&gt;
&lt;br /&gt;
Although Winamp provides input plugins with a number of function pointers to make calls into Winamp, there are simply too many functions in the Winamp SDK to reasonably provide that for every available function.  The API was expanded by means of special window messages that could be sent to the main winamp window.  Although the API was built this was largely as an historical accident, but this part of API continues to gain new features as it has a number of advantages despite its quirks.&lt;br /&gt;
A plugin can call a &amp;quot;function&amp;quot; in Winamp by passing a message with msg id == WM_WA_IPC (defined in Winamp/wa_ipc.h).  The lParam value determines what function to call and the wParam contains a parameter relevant to the function (often a pointer to a struct in case multiple parameters are needed).  These function calls are referred to as IPC's (inter-plugin communication) Despite the quirkiness and the odd reminiscence to DOS interrupt function calls, it does offer two major advantages:&lt;br /&gt;
&lt;br /&gt;
# Windows automatically runs the SendMessage response on the &amp;quot;main&amp;quot; application thread, allowing plugins to make SendMessage calls on other threads safely.&lt;br /&gt;
# *this is important, this is how a lot of stuff gets done by plugins* - By subclassing the main Winamp window, a plugin can alter Winamp's handling of various API calls.  This has become such a popular method used by plugin developers that Winamp often sends messages to itself as a way to notify plugins about various events.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/File:Plugins-logo.png</id>
		<title>File:Plugins-logo.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/File:Plugins-logo.png"/>
				<updated>2008-08-28T18:11:05Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/File:Skins-logo.png</id>
		<title>File:Skins-logo.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/File:Skins-logo.png"/>
				<updated>2008-08-28T18:10:19Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Plugin_Terminology</id>
		<title>Plugin Terminology</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Plugin_Terminology"/>
				<updated>2008-08-28T17:53:36Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: == winamp plugin filename conventions == Most plugin types are identified by Winamp by the filename * in_*.dll - input plugins * out_*.dll - output plugins * gen_*.dll - general purpose pl...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== winamp plugin filename conventions ==&lt;br /&gt;
Most plugin types are identified by Winamp by the filename&lt;br /&gt;
* in_*.dll - input plugins&lt;br /&gt;
* out_*.dll - output plugins&lt;br /&gt;
* gen_*.dll - general purpose plugins&lt;br /&gt;
* vis_*.dll - visualizer plugins&lt;br /&gt;
* dsp_*.dll - audio effects plugins&lt;br /&gt;
* ml_*.dll - media library plugins (loaded by gen_ml.dll)&lt;br /&gt;
* pmp_*.dll - portable media player plugins (loaded by ml_pmp.dll... a plugin type loaded by a plugin of a plugin. hah!)&lt;br /&gt;
* nsvdec_*.dll - NSV decoder plugins&lt;br /&gt;
* enc_*.dll - audio encoder plugins&lt;br /&gt;
* W5S (Winamp 5 System) plugins located in c:\program files\winamp\system do not have to follow any special filename convention except for the .w5s file extension&lt;br /&gt;
* WAC (Winamp Component) plugins located in c:\program files\winamp\plugins\freeform\wacs do not have to follow any special filename conventions, either, except for the .wac file extension.  WAC files are loaded by gen_ff.dll&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== code naming conventions ==&lt;br /&gt;
* IPC: Inter-Plugin Communications.  The constants which define the old SendMessage API are prefixed with IPC_&lt;br /&gt;
* Wasabi: Winamp Service Architecture Binary Interface.  A system to allow sharing of C++ objects between different plugins and components.  Think of it as a very lightweight version of COM.&lt;br /&gt;
* Agave: project codename for Winamp 5.12 (when the Wasabi service manager was merged into Winamp 5.  It may or may not have involved a lot of tequila).  The name &amp;quot;Agave&amp;quot; is used in the SDK to refer to Wasabi components that are unique to Winamp's media platform.  For example: the Wasabi Language API could be used in other (non-Winamp) Wasabi applications, but the Agave Playlist Manager makes very little sense outside of a media application.&lt;br /&gt;
&lt;br /&gt;
Wasabi interfaces are all built using the Dispatchable base class.  A naming convention has been established to help developers understand the intent of the interface.&lt;br /&gt;
* ifc: interface.  Wasabi interfaces not associated with the service manager are prefixed with this, e.g. ifc_window&lt;br /&gt;
* api: Wasabi interfaces which expose a singleton object meant to be used as a global API.  e.g. api_application&lt;br /&gt;
* svc: service.  Wasabi interfaces which define a service are prefixed with this, e.g. svc_playlisthandler&lt;br /&gt;
* obj: object.  Wasabi interfaces which define an object created by the service manager are prefixed with this.  e.g. obj_xml for an instance of an XML parser.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/MilkDrop_Preset_Authoring</id>
		<title>MilkDrop Preset Authoring</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/MilkDrop_Preset_Authoring"/>
				<updated>2008-08-27T16:53:33Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: /* About Presets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Milkdrop.png|right|320px]]&lt;br /&gt;
== MILKDROP preset authoring guide ==&lt;br /&gt;
&lt;br /&gt;
Note that there is another, quite comprehensive, Preset Authoring Guide available on the web at http://www.milkdrop.co.uk/, which is continually updated and expanded through the hard work of a few dedicated preset authors.  Whereas this guide (the one you are currently viewing) gives the bare technical specifications for writing your own presets, the guide at milkdrop.co.uk 'starts at the beginning' and walks you through all of the mathematics and subtleties of 'rolling your own', explaining things in great detail.  The guide at milkdrop.co.uk is very highly recommended to anyone who wishes to learn more about creating their own presets.&lt;br /&gt;
&lt;br /&gt;
== About Presets ==&lt;br /&gt;
&lt;br /&gt;
When you watch MilkDrop, you are watching a series of Presets.  Each one has its own look and feel, draws the sound waves in a particular way, and has certain motions to it.  After some time, you will see a short blend transition, and then you will be watching a new preset.  &lt;br /&gt;
&lt;br /&gt;
A single 'preset' is a collection of parameters that tell MilkDrop how to draw the wave, how to warp the image around, and so on.  MilkDrop ships with over 100 built-in presets, each one having a distinct look and feel to it.  &lt;br /&gt;
    &lt;br /&gt;
Using MilkDrop's built-in &amp;quot;preset-editing menu&amp;quot; (the M key), you can edit presets on the fly, on-screen, from within the program.  You can make slight adjustments to existing presets, then save over them; or you can change lots of things, so the preset doesn't look anything like the original, and then save it under a new name.  You can even write insane new mathematical equations, of your own imagination, into your preset files and come up with things that MilkDrop has never done before!&lt;br /&gt;
    &lt;br /&gt;
Each preset is saved as a file with the &amp;quot;.milk&amp;quot; extension, so you can easily send them to your friends or post them on the web.  You can also go to http://www.nullsoft.com/free/milkdrop and then jump to the &amp;quot;preset sharing forum&amp;quot; to see what other people have come up with, or post your own cool, new presets.  milkdrop.co.uk/ is another great place to download collections of presets made by others like yourself.&lt;br /&gt;
&lt;br /&gt;
== Preset Authoring - Basic ==&lt;br /&gt;
&lt;br /&gt;
You can edit the properties of the current preset by hitting 'M', which brings up the &amp;quot;preset-editing menu&amp;quot;.  From this menu you can use the up and down arrow keys to select an item.  Press the RIGHT arrow key to move forward through the menu and select the item (note: you can also hit SPACE or RETURN to do this); ***press the LEFT arrow key to go back to the previous menu.***  &lt;br /&gt;
    &lt;br /&gt;
Pressing 'M' while the menu is already showing will hide the menu; pressing ESCAPE will do the same thing.  Press 'M' again to bring the menu back.    &lt;br /&gt;
&lt;br /&gt;
Once you've reached an item on the menu whose value can be edited, use the UP and DOWN arrow keys to increase or decrease its value, respectively.  Changes will register immediately.  Use PAGE UP and PAGE DOWN to increase the value more quickly.  Hold down SHIFT    and use the UP/DOWN arrow keys to change the value very slowly. Hit RETURN To keep the new value, or ESC to abort the change.&lt;br /&gt;
    &lt;br /&gt;
If the item you're editing is a text string, you can use the arrow keys to move around.  The Insert key can be used to toggle between insert and overtype modes.  You can hold shift and use the arrow keys (home, end, left, right) to make a selection, which will be identified by brackets [].  You can then use CTRL-C  or CTRL-X to copy or cut text.  CTRL-P pastes.  When finished editing, hit RETURN To keep the new string, or ESC to abort the change.&lt;br /&gt;
&lt;br /&gt;
You'll want to get into the habit of using SCROLL LOCK whenever you're making changes to a preset that you intend to save; &lt;br /&gt;
otherwise, MilkDrop is sure to move you along to a new (random) preset, over time.  When the menus are showing, the preset is&lt;br /&gt;
automatically temporarily locked, but BE CAREFUL - if you're not also using SCROLL LOCK, then 0.1 seconds after you hide the menu&lt;br /&gt;
to take a look at your new masterpiece, MilkDrop might load a random new preset on you, and you'd lose your changes!  And you &lt;br /&gt;
might then ask me: &amp;quot;how large is large?&amp;quot;  And I will tell you: &amp;quot;thirty.&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    There are also some hotkeys that will allow you to change certain&lt;br /&gt;
    common parameters to the current preset.  These are listed below.&lt;br /&gt;
    &lt;br /&gt;
    MOTION&lt;br /&gt;
        i/I - zoom in/out&lt;br /&gt;
        [ / ] - push motion to the left/right (dx)&lt;br /&gt;
        { / } - push motion up/down (dy)&lt;br /&gt;
        &amp;lt; / &amp;gt; - rotate left/right (rot)&lt;br /&gt;
        o/O - shrink/grow the amplitude of the warp effect&lt;br /&gt;
&lt;br /&gt;
    WAVEFORM&lt;br /&gt;
        W   - cycle through waveforms&lt;br /&gt;
        j/J - scale waveform down/up&lt;br /&gt;
        e/E - make the waveform more transparent/more solid&lt;br /&gt;
&lt;br /&gt;
    BRIGHTNESS **&lt;br /&gt;
        g/G - decrease, increase gamma (brightness) **&lt;br /&gt;
&lt;br /&gt;
    VIDEO ECHO effect **&lt;br /&gt;
        q/Q - scale 2nd graphics layer down/up **&lt;br /&gt;
        F - flip 2nd graphics layer (cycles through 4 fixed orientations) **&lt;br /&gt;
&lt;br /&gt;
    ** these keys only have an effect if you are running a &lt;br /&gt;
       MilkDrop 1-era preset.  In MilkDrop 2-era presets,&lt;br /&gt;
       these values are embedded in the shader, so you need&lt;br /&gt;
       to go into the composite shader and tweak the code.&lt;br /&gt;
&lt;br /&gt;
== Preset Authoring - Advanced ==&lt;br /&gt;
&lt;br /&gt;
This section describes how to use the 'per-frame' and 'per-vertex' equations to develop unique new presets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
=== PER-FRAME EQUATIONS ===&lt;br /&gt;
    &lt;br /&gt;
When you hit 'm' to show the preset-editing menu, several items&lt;br /&gt;
show up.  If you explore the sub-menus, you'll see that&lt;br /&gt;
all of the properties that make up the preset you're currently&lt;br /&gt;
viewing are there.  The values you can specify here (such as&lt;br /&gt;
zoom amount, rotation amount, wave color, etc.) are all static&lt;br /&gt;
values, meaning that they don't change in time.  For example, &lt;br /&gt;
take the 'zoom amount' option under the 'motion' submenu.  &lt;br /&gt;
If this value is 1.0, there is no zoom.  If the value is 1.01, &lt;br /&gt;
the image zooms in 1% every frame.  If the value is 1.10, the &lt;br /&gt;
image zooms in 10% every frame.  If the value is 0.9, the image &lt;br /&gt;
zooms out 10% every frame; and so on.&lt;br /&gt;
&lt;br /&gt;
However, presets get far more interesting if you can take these &lt;br /&gt;
parameters (such as the zoom amount) and animate them (make them &lt;br /&gt;
change over time).  For example, if you could take the 'zoom &lt;br /&gt;
amount' parameter and make it oscillate (vary) between 0.9 and &lt;br /&gt;
1.1 over time, the image would cyclically zoom in and out, in &lt;br /&gt;
time.&lt;br /&gt;
&lt;br /&gt;
You can do this - by writing 'per-frame' and 'per-vertex' &lt;br /&gt;
equations.  Let's start with 'per-frame' equations.  These are&lt;br /&gt;
executed once per frame.  So, if you were to type the following&lt;br /&gt;
equation in:&lt;br /&gt;
        &lt;br /&gt;
 zoom = zoom + 0.1*sin(time);&lt;br /&gt;
    &lt;br /&gt;
...then the zoom amount would oscillate between 0.9 and 1.1&lt;br /&gt;
over time.  (Recall from your geometry classes that sin()&lt;br /&gt;
returns a value between -1 and 1.)  The equation says: &amp;quot;take&lt;br /&gt;
the static value of 'zoom', then replace it with that value,&lt;br /&gt;
plus some variation.&amp;quot;  This particular equation would oscillate &lt;br /&gt;
(cycle) every 6.28 seconds, since the sin() function's &lt;br /&gt;
period is 6.28 (PI*2) seconds.  If you wanted it to make it &lt;br /&gt;
cycle every 2 seconds, you could use: &lt;br /&gt;
    &lt;br /&gt;
 zoom = zoom + 0.1*sin(time*3.14);&lt;br /&gt;
    &lt;br /&gt;
Now, let's say you wanted to make the color of the waveform&lt;br /&gt;
(sound wave) that gets plotted on the screen vary through time.&lt;br /&gt;
The color is defined by three values, one for each of the main&lt;br /&gt;
color components (red, green, and blue), each in the range 0 to 1&lt;br /&gt;
(0 is dark, 1 is full intensity).  You could use something like this:&lt;br /&gt;
    &lt;br /&gt;
 wave_r = wave_r + 0.5*sin(time*1.13);&lt;br /&gt;
 wave_g = wave_g + 0.5*sin(time*1.23);&lt;br /&gt;
 wave_b = wave_b + 0.5*sin(time*1.33);&lt;br /&gt;
    &lt;br /&gt;
It's nice to stagger the frequencies (1.13, 1.23, and 1.33) of&lt;br /&gt;
the sine functions for the red, green, and blue color components&lt;br /&gt;
of the wave so that they cycle at different rates, to avoid them&lt;br /&gt;
always being all the same (which would create a greyscale wave).&lt;br /&gt;
    &lt;br /&gt;
Here is a full list of the variables available for writing per-frame &lt;br /&gt;
equations:&lt;br /&gt;
    &lt;br /&gt;
    NAME       WRITABLE?  RANGE  DESCRIPTION&lt;br /&gt;
    ----       ---------  -----  -----------                                                                   &lt;br /&gt;
    zoom           yes    &amp;gt;0     controls inward/outward motion.  0.9=zoom out 10% per frame, 1.0=no zoom, 1.1=zoom in 10%&lt;br /&gt;
    zoomexp        yes    &amp;gt;0     controls the curvature of the zoom; 1=normal&lt;br /&gt;
    rot            yes           controls the amount of rotation.  0=none, 0.1=slightly right, -0.1=slightly clockwise, 0.1=CCW&lt;br /&gt;
    warp           yes    &amp;gt;0     controls the magnitude of the warping; 0=none, 1=normal, 2=major warping...&lt;br /&gt;
    cx             yes    0..1   controls where the center of rotation and stretching is, horizontally.  0=left, 0.5=center, 1=right&lt;br /&gt;
    cy             yes    0..1   controls where the center of rotation and stretching is, vertically.  0=top, 0.5=center, 1=bottom&lt;br /&gt;
    dx             yes           controls amount of constant horizontal motion; -0.01 = move left 1% per frame, 0=none, 0.01 = move right 1%&lt;br /&gt;
    dy             yes           controls amount of constant vertical motion; -0.01 = move up 1% per frame, 0=none, 0.01 = move down 1%&lt;br /&gt;
    sx             yes    &amp;gt;0     controls amount of constant horizontal stretching; 0.99=shrink 1%, 1=normal, 1.01=stretch 1%           &lt;br /&gt;
    sy             yes    &amp;gt;0     controls amount of constant vertical stretching; 0.99=shrink 1%, 1=normal, 1.01=stretch 1%             &lt;br /&gt;
    wave_mode      yes    0,1,2,3,4,5,6,7  controls which of the 8 types of waveform is drawn&lt;br /&gt;
    wave_x         yes    0..1   position of the waveform: 0 = far left edge of screen, 0.5 = center, 1 = far right&lt;br /&gt;
    wave_y         yes    0..1   position of the waveform: 0 = very bottom of screen, 0.5 = center, 1 = top&lt;br /&gt;
    wave_r         yes    0..1   amount of red color in the wave (0..1),&lt;br /&gt;
    wave_g         yes    0..1   amount of green color in the wave (0..1)    &lt;br /&gt;
    wave_b         yes    0..1   amount of blue color in the wave (0..1)    &lt;br /&gt;
    wave_a         yes    0..1   opacity of the wave (0..1) [0=transparent, 1=opaque]&lt;br /&gt;
    wave_mystery   yes    -1..1  what this parameter does is a mystery.  (honestly, though, this value does different things for each waveform; for example, it could control angle at which the waveform was drawn.)&lt;br /&gt;
    wave_usedots   yes    0/1    if 1, the waveform is drawn as dots (instead of lines)&lt;br /&gt;
    wave_thick     yes    0/1    if 1, the waveform's lines (or dots) are drawn with double thickness&lt;br /&gt;
    wave_additive  yes    0/1    if 1, the wave is drawn additively, saturating the image at white&lt;br /&gt;
    wave_brighten  yes    0/1    if 1, all 3 r/g/b colors will be scaled up until at least one reaches 1.0&lt;br /&gt;
    ob_size        yes    0..0.5 thickness of the outer border drawn at the edges of the screen every frame&lt;br /&gt;
    ob_r           yes    0..1   amount of red color in the outer border&lt;br /&gt;
    ob_g           yes    0..1   amount of green color in the outer border&lt;br /&gt;
    ob_b           yes    0..1   amount of blue color in the outer border&lt;br /&gt;
    ob_a           yes    0..1   opacity of the outer border (0=transparent, 1=opaque)&lt;br /&gt;
    ib_size        yes    0..0.5 thickness of the inner border drawn at the edges of the screen every frame&lt;br /&gt;
    ib_r           yes    0..1   amount of red color in the inner border                                   &lt;br /&gt;
    ib_g           yes    0..1   amount of green color in the inner border                                 &lt;br /&gt;
    ib_b           yes    0..1   amount of blue color in the inner border                                  &lt;br /&gt;
    ib_a           yes    0..1   opacity of the inner border (0=transparent, 1=opaque)                     &lt;br /&gt;
    mv_r           yes    0..1   amount of red color in the motion vectors&lt;br /&gt;
    mv_g           yes    0..1   amount of green color in the motion vectors&lt;br /&gt;
    mv_b           yes    0..1   amount of blue color in the motion vectors&lt;br /&gt;
    mv_a           yes    0..1   opacity of the motion vectors (0=transparent, 1=opaque)                     &lt;br /&gt;
    mv_x           yes    0..64  the number of motion vectors in the X direction&lt;br /&gt;
    mv_y           yes    0..48  the number of motion vectors in the Y direction&lt;br /&gt;
    mv_l           yes    0..5   the length of the motion vectors (0=no trail, 1=normal, 2=double...)&lt;br /&gt;
    mv_dx          yes    -1..1  horizontal placement offset of the motion vectors&lt;br /&gt;
    mv_dy          yes    -1..1  vertical placement offset of the motion vectors&lt;br /&gt;
    decay          yes    0..1   controls the eventual fade to black; 1=no fade, 0.9=strong fade, 0.98=recommended&lt;br /&gt;
    gamma          yes    &amp;gt;0     controls display brightness; 1=normal, 2=double, 3=triple, etc.&lt;br /&gt;
    echo_zoom      yes    &amp;gt;0     controls the size of the second graphics layer&lt;br /&gt;
    echo_alpha     yes    &amp;gt;0     controls the opacity of the second graphics layer; 0=transparent (off), 0.5=half-mix, 1=opaque&lt;br /&gt;
    echo_orient    yes    0,1,2,3 selects an orientation for the second graphics layer.  0=normal, 1=flip on x, 2=flip on y, 3=flip on both&lt;br /&gt;
    darken_center  yes    0/1    if 1, help keeps the image from getting too bright by continually dimming the center point&lt;br /&gt;
    wrap           yes    0/1    sets whether or not screen elements can drift off of one side and onto the other&lt;br /&gt;
    invert         yes    0/1    inverts the colors in the image&lt;br /&gt;
    brighten       yes    0/1    brightens the darker parts of the image (nonlinear; square root filter)&lt;br /&gt;
    darken         yes    0/1    darkens the brighter parts of the image (nonlinear; squaring filter)&lt;br /&gt;
    solarize       yes    0/1    emphasizes mid-range colors&lt;br /&gt;
    monitor        yes    any    set this value for debugging your preset code; if you hit the 'N' key, &lt;br /&gt;
                                    the value of 'monitor' will be posted in the upper-right corner of milkdrop.&lt;br /&gt;
                                    for example, setting &amp;quot;monitor = q3;&amp;quot; would let you keep an eye on q3's value.&lt;br /&gt;
        &lt;br /&gt;
    time           NO     &amp;gt;0     retrieves the current time, in seconds, since MilkDrop started running&lt;br /&gt;
    fps            NO     &amp;gt;0     retrieves the current framerate, in frames per second.&lt;br /&gt;
    frame          NO            retrieves the number of frames of animation elapsed since the program started&lt;br /&gt;
    progress       NO     0..1   progress through the current preset; if preset was just loaded, this is closer to 0; if preset is about to end, this is closer to 1.&lt;br /&gt;
                                   -note that if Scroll Lock is on, 'progress' will freeze!&lt;br /&gt;
                   &lt;br /&gt;
    bass           NO     &amp;gt;0     retrieves the current amount of bass.  1 is normal; below ~0.7 is quiet; above ~1.3 is loud bass&lt;br /&gt;
    mid            NO     &amp;gt;0       -same, but for mids (middle frequencies)&lt;br /&gt;
    treb           NO     &amp;gt;0       -same, but for treble (high) frequencies&lt;br /&gt;
    bass_att       NO     &amp;gt;0     retrieves an attenuated reading on the bass, meaning that it is damped in time and doesn't change so rapidly.&lt;br /&gt;
    mid_att        NO     &amp;gt;0       -same, but for mids (middle frequencies)&lt;br /&gt;
    treb_att       NO     &amp;gt;0       -same, but for treble (high) frequencies&lt;br /&gt;
&lt;br /&gt;
    meshx          NO     8-128  tells you the user's mesh size in the X direction.  always an integer value.&lt;br /&gt;
    meshy          NO     6-96   tells you the user's mesh size in the Y direction.  always an integer value.&lt;br /&gt;
    pixelsx        NO     16-4096 width of the viz window, in pixels.  If Canvas Stretch is on, this is the pre-stretched size.  (same as &amp;quot;texsize.x&amp;quot; for shaders)&lt;br /&gt;
    pixelsy        NO     16-4096 height of the viz window, in pixels.  If Canvas Stretch is on, this is the pre-stretched size.  (same as &amp;quot;texsize.y&amp;quot; for shaders)&lt;br /&gt;
    aspectx        NO     &amp;gt;0     multiply an x-coordinate by this to make the preset look the same at any aspect (window height:width) ratio.&lt;br /&gt;
                                   -value: if widescreen, 1; if window is tall, h/w.&lt;br /&gt;
    aspecty        NO     &amp;gt;0     multiply a y-coordinate by this to make the preset look the same at any aspect (window height:width) ratio.&lt;br /&gt;
                                   -value: if widescreen, w/h; if window is tall, 1.&lt;br /&gt;
    &lt;br /&gt;
    blur1_min      yes    0..1   Normally these are set to 0 (min) and 1 (max).&lt;br /&gt;
    blur2_min      yes    0..1   You can clamp the values in the blur texture to a tighter&lt;br /&gt;
    blur3_min      yes    0..1     range, though.  &lt;br /&gt;
    blur1_max      yes    0..1   This will increase the precision in the blur textures,&lt;br /&gt;
    blur2_max      yes    0..1     but you run the risk of clamping values to your min/max.&lt;br /&gt;
    blur3_max      yes    0..1   If you use the GetBlur1() .. GetBlur3() functions to sample&lt;br /&gt;
    blur1_edge_darken yes 0..1     the blur texture, they will automatically &amp;quot;unpack&amp;quot; the&lt;br /&gt;
                                   values for you in the end!&lt;br /&gt;
    &lt;br /&gt;
    q1             yes    any    } Used to carry values along a chain                                         &lt;br /&gt;
    q2             yes    any    }  from the preset init code,                                                &lt;br /&gt;
    q3             yes    any    }  to the preset per-frame code, then on                                     &lt;br /&gt;
    q4             yes    any    }    to the preset per-vertex code;                                          &lt;br /&gt;
    q5             yes    any    }    or to the custom shape per-frame code,                                  &lt;br /&gt;
    q6             yes    any    }    or to the custom wave per-frame code,                                   &lt;br /&gt;
    q7             yes    any    }      then to the custom wave per-vertex code;                              &lt;br /&gt;
    ...                          }    or to the [pixel] shader code.                                          &lt;br /&gt;
    q31            yes    any    } Click here to see a diagram for the Q vars.&lt;br /&gt;
    q32            yes    any    } &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    Some of the variables are read-only, meaning that you shouldn't change&lt;br /&gt;
    their values them through the equations.  You can; it won't stop you; &lt;br /&gt;
    but the results are unpredictable.&lt;br /&gt;
            &lt;br /&gt;
    You can also make up to 30 of your own variables.  For example:&lt;br /&gt;
    &lt;br /&gt;
        my_volume = (bass + mid + treb)/3;&lt;br /&gt;
        zoom = zoom + 0.1*(my_volume - 1);&lt;br /&gt;
&lt;br /&gt;
    This would make the zoom amount increase when the music is loud,&lt;br /&gt;
    and decrease when the music is quiet.  &lt;br /&gt;
    &lt;br /&gt;
    HOWEVER, custom variables do not carry over from per-frame equations&lt;br /&gt;
    to per-vertex equations; if you set a custom variable's value in the&lt;br /&gt;
    per-frame equations, and try to read it in the per-vertex equations,&lt;br /&gt;
    you will not get the correct value.  Instead, you have to &amp;quot;bridge the&lt;br /&gt;
    gap&amp;quot; using 32 special variables: q1 through q32.  This is usually only&lt;br /&gt;
    used when you want to precompute some custom values in the per-frame &lt;br /&gt;
    equations for later use in the per-vertex equations (or for use in&lt;br /&gt;
    the pixel shaders).  For a good example of this, see the 'dynamic swirls' &lt;br /&gt;
    preset.  See below for more information on q1-q32.&lt;br /&gt;
&lt;br /&gt;
=== PER-VERTEX EQUATIONS ===&lt;br /&gt;
    &lt;br /&gt;
    So far we've discussed only how to change parameters based on&lt;br /&gt;
    time.  What if you wanted to also vary a parameter, such as the&lt;br /&gt;
    zoom amount, in different ways, for different locations on the&lt;br /&gt;
    screen?  For example, normally, the result of the 'zoom' parameter&lt;br /&gt;
    is to just do a flat zoom.  This doesn't look very realistic, &lt;br /&gt;
    because you don't see any perspective in the zoom.  It would be&lt;br /&gt;
    better if we could give a unique zoom amount to each pixel on &lt;br /&gt;
    the screen; we could make the pixels far away from the center&lt;br /&gt;
    zoom more, and this would give it more perspective.  In order&lt;br /&gt;
    to do this, we use &amp;quot;per-vertex&amp;quot; equations, instead of per-frame&lt;br /&gt;
    equations.&lt;br /&gt;
    &lt;br /&gt;
    The code for this per-vertex equation is simple:&lt;br /&gt;
    &lt;br /&gt;
        zoom = zoom + rad*0.1;&lt;br /&gt;
        &lt;br /&gt;
    Where 'rad' is the radius of the pixel if it were cast into&lt;br /&gt;
    polar coordinates; from another perspective, 'rad' is the distance &lt;br /&gt;
    of the pixel from the center of the screen.  'rad is zero at the&lt;br /&gt;
    center, and 1 at the corners.  So if we run the above code,&lt;br /&gt;
    the image will be zoomed into 10% more at the edges of the screen&lt;br /&gt;
    than at the center.&lt;br /&gt;
    &lt;br /&gt;
    The per-vertex equations are really just like the per-frame equations,&lt;br /&gt;
    except for a variables.  The following variables are available&lt;br /&gt;
    exclusively to per-vertex equations (and not to per-frame equations):&lt;br /&gt;
    &lt;br /&gt;
    NAME   WRITEABLE? RANGE    DESCRIPTION&lt;br /&gt;
    ----   ---------- -----    -----------                                                                   &lt;br /&gt;
    x          NO     0..1     retrieves the x-position of the current pixel.  At the very left edge of the screen this would be 0; in the middle, 0.5; and at the right, 1.   &lt;br /&gt;
    y          NO     0..1     retrieves the y-position of the current pixel.  At the very top edge of the screen this would be 0; in the middle, 0.5; and at the bottom, 1.   &lt;br /&gt;
    rad        NO     0..1     retrives the distance of the pixel from the center of the screen.  At the center of the screen this will be zero, and at the corners, 1.  &lt;br /&gt;
                                  (The middle of the edges will be 0.707 (half of the square root of 2).&lt;br /&gt;
    ang        NO     0..6.28  retrieves the angle of the current pixel, with respect to the center of the screen.  &lt;br /&gt;
                                  If the point is to the right of the center, this is zero; above it, it is PI/2 (1.57); to the left, it is PI (3.14); and below, it is 4.71 (PI*3/2).  &lt;br /&gt;
                                  If it is just a dab below being directly to the right of the center of the screen, the value will approach 6.28 (PI*2).  &lt;br /&gt;
                                  (note: this is simply the arctangent of y over x, precomputed for you.)&lt;br /&gt;
    &lt;br /&gt;
    zoom       yes    &amp;gt;0       controls inward/outward motion.  0.9=zoom out 10% per frame, 1.0=no zoom, 1.1=zoom in 10%&lt;br /&gt;
    zoomexp    yes    &amp;gt;0       controls the curvature of the zoom; 1=normal&lt;br /&gt;
    rot        yes             controls the amount of rotation.  0=none, 0.1=slightly right, -0.1=slightly clockwise, 0.1=CCW&lt;br /&gt;
    warp       yes    &amp;gt;0       controls the magnitude of the warping; 0=none, 1=normal, 2=major warping...&lt;br /&gt;
    cx         yes    0..1     controls where the center of rotation and stretching is, horizontally.  0=left, 0.5=center, 1=right&lt;br /&gt;
    cy         yes    0..1     controls where the center of rotation and stretching is, vertically.  0=top, 0.5=center, 1=bottom&lt;br /&gt;
    dx         yes             controls amount of constant horizontal motion; -0.01 = move left 1% per frame, 0=none, 0.01 = move right 1%&lt;br /&gt;
    dy         yes             controls amount of constant vertical motion; -0.01 = move up 1% per frame, 0=none, 0.01 = move down 1%&lt;br /&gt;
    sx         yes    &amp;gt;0       controls amount of constant horizontal stretching; 0.99=shrink 1%, 1=normal, 1.01=stretch 1%           &lt;br /&gt;
    sy         yes    &amp;gt;0       controls amount of constant vertical stretching; 0.99=shrink 1%, 1=normal, 1.01=stretch 1%             &lt;br /&gt;
    &lt;br /&gt;
    time       NO     &amp;gt;0       retrieves the current time, in seconds, since MilkDrop started running&lt;br /&gt;
    fps        NO     &amp;gt;0       retrieves the current framerate, in frames per second.&lt;br /&gt;
    frame      NO              retrieves the number of frames of animation elapsed since the program started&lt;br /&gt;
    progress   NO     0..1     progress through the current preset; if preset was just loaded, this is closer to 0; if preset is about to end, this is closer to 1.&lt;br /&gt;
                                 -note that if Scroll Lock is on, 'progress' will freeze!&lt;br /&gt;
&lt;br /&gt;
    bass       NO     &amp;gt;0       retrieves the current amount of bass.  1 is normal; below ~0.7 is quiet; above ~1.3 is loud bass&lt;br /&gt;
    mid        NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
    treb       NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
    bass_att   NO     &amp;gt;0       retrieves an attenuated reading on the bass, meaning that it is damped in time and doesn't change so rapidly.&lt;br /&gt;
    mid_att    NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
    treb_att   NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
&lt;br /&gt;
    meshx      NO     8-192    tells you the user's mesh size in the X direction.  always an integer value.&lt;br /&gt;
    meshy      NO     6-144    tells you the user's mesh size in the Y direction.  always an integer value.&lt;br /&gt;
    pixelsx    NO     16-4096  width of the viz window, in pixels.  If Canvas Stretch is on, this is the pre-stretched size.  (same as &amp;quot;texsize.x&amp;quot; for shaders)&lt;br /&gt;
    pixelsy    NO     16-4096  height of the viz window, in pixels.  If Canvas Stretch is on, this is the pre-stretched size.  (same as &amp;quot;texsize.y&amp;quot; for shaders)&lt;br /&gt;
    aspectx    NO     &amp;gt;0     multiply an x-coordinate by this to make the preset look the same at any aspect (window height:width) ratio.&lt;br /&gt;
                               -value: if widescreen, 1; if window is tall, h/w.&lt;br /&gt;
    aspecty    NO     &amp;gt;0     multiply a y-coordinate by this to make the preset look the same at any aspect (window height:width) ratio.&lt;br /&gt;
                               -value: if widescreen, w/h; if window is tall, 1.&lt;br /&gt;
            &lt;br /&gt;
    q1         yes    any      } Used to carry values along a chain           &lt;br /&gt;
    q2         yes    any      }  from the preset init code,                        &lt;br /&gt;
    q3         yes    any      }  to the preset per-frame code, then on             &lt;br /&gt;
    q4         yes    any      }    to the preset per-vertex code;            &lt;br /&gt;
    q5         yes    any      }    or to the custom shape per-frame code,          &lt;br /&gt;
    q6         yes    any      }    or to the custom wave per-frame code,      &lt;br /&gt;
    q7         yes    any      }      then to the custom wave per-vertex code;&lt;br /&gt;
    ...                        }    or to the [pixel] shader code.            &lt;br /&gt;
    q31        yes    any      } Click here to see a diagram for the Q vars.&lt;br /&gt;
    q32        yes    any      } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    The main reason for distinction between per-frame and per-vertex equations&lt;br /&gt;
    is simple: SPEED.  If you have a per-vertex equation that doesn't make use&lt;br /&gt;
    of the x, y, rad, or ang variables, then there's no reason for it to be&lt;br /&gt;
    executed per-vertex; it could be executed once per frame, and the result&lt;br /&gt;
    would be the same.  So, here's a maxim to write on the wall:&lt;br /&gt;
    &lt;br /&gt;
        &amp;quot;If a per-vertex equation doesn't use at least one of the variables&lt;br /&gt;
         { x, y, rad, ang }, then it should be actually be a per-frame &lt;br /&gt;
         equation.&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    You might be wondering how on earth all these formulas could be computed&lt;br /&gt;
    for every pixel on the screen, every frame, and still yield a high frame&lt;br /&gt;
    rate.  Well, that's the magic of the hamster.  And the fact that it really&lt;br /&gt;
    does the processing only at certain points on the screen, then interpolates&lt;br /&gt;
    the results across the space between the points.  In the config panel,&lt;br /&gt;
    the &amp;quot;mesh size&amp;quot; option defines how many points (in X and Y) there are at&lt;br /&gt;
    which the per-vertex equations are actually computed.  When you crank this&lt;br /&gt;
    option up, you start eating up CPU cycles rather quickly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
=== VARIABLE POOLS; DECLARING YOUR OWN VARIABLES; PERSISTENCE OF VALUES ===&lt;br /&gt;
    -----------------------&lt;br /&gt;
    Declaring and using your own variables is easy - in some bit of code &lt;br /&gt;
    (init equations, per-frame equations, etc.) you just write something like&lt;br /&gt;
    the following:&lt;br /&gt;
    &lt;br /&gt;
        billy = 5.3;&lt;br /&gt;
    &lt;br /&gt;
    This creates a variable called 'billy' and sets its value to 5.3.  You can&lt;br /&gt;
    then freely read and/or modify the value of 'billy' within that section&lt;br /&gt;
    of code.&lt;br /&gt;
    &lt;br /&gt;
    However, sometimes it is desireable to create (really, initialize) a variable &lt;br /&gt;
    in an &amp;quot;init&amp;quot; equations, then use and/or update it in the &amp;quot;per-frame&amp;quot; equations.&lt;br /&gt;
    You can always do this, because paired init and per-frame equations&lt;br /&gt;
    share the same variable pool.  In addition, the values of user-defined&lt;br /&gt;
    variables will persist from frame to frame.&lt;br /&gt;
    &lt;br /&gt;
    There are three variable &amp;quot;pools&amp;quot; in MilkDrop:&lt;br /&gt;
&lt;br /&gt;
      1. preset init code + preset per-frame code&lt;br /&gt;
      2. custom wave init + custom wave per-frame code&lt;br /&gt;
      3. custom shape init + custom shape per-frame code&lt;br /&gt;
    &lt;br /&gt;
    So, you can probably guess that if you declare a variable in the preset&lt;br /&gt;
    init code, you can then read it in the preset per-frame code.  You can&lt;br /&gt;
    also write to it (update it), and its value will persist to the next&lt;br /&gt;
    frame.  All three pools work this way.&lt;br /&gt;
&lt;br /&gt;
    As explained, though, you can't read the value of 'billy' in when in another &lt;br /&gt;
    variable pool.  (This is intentional, and keeps MilkDrop running nice and &lt;br /&gt;
    fast.)  If you want to pass values around between variable pools, you need &lt;br /&gt;
    to use a set of special variables: q1, q2, q3, etc. on up to q32.  See&lt;br /&gt;
    the next section for details on how they work and how to properly use them.&lt;br /&gt;
    Just remember: the Q variables (and later, the T variables) are the only ones &lt;br /&gt;
    that you can use to &amp;quot;jump&amp;quot; between (carry values between) variable pools.&lt;br /&gt;
    &lt;br /&gt;
    You might notice that there are two other types of equations that weren't &lt;br /&gt;
    listed above.  They are:&lt;br /&gt;
    &lt;br /&gt;
      * preset per-vertex code&lt;br /&gt;
      * custom wave per-point code&lt;br /&gt;
    &lt;br /&gt;
    For these two code sections, persistent values don't really make sense,&lt;br /&gt;
    because there is no way to properly initialize them.  Any user-defined&lt;br /&gt;
    variables in these code sections should just be treated as scratch&lt;br /&gt;
    variables, not persisting from frame to frame, from vertex to vertex,&lt;br /&gt;
    or from point to point (even though technically, they will... but it&lt;br /&gt;
    probably won't be what you want).  The only thing that really makes sense&lt;br /&gt;
    here is when you want to carry values along from point to point as&lt;br /&gt;
    you run the custom wave per-point code; to do this, use q1-q32.  (See&lt;br /&gt;
    the next section for a more detailed explanation.)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
=== PRESET INIT CODE; CARRYING VALUES BETWEEN VARIABLE POOLS, USING q1-q32 ===&lt;br /&gt;
    As we've just seen, you can't normally pass values around between variable &lt;br /&gt;
    pools.  However, there is one mechanism for bridging this gap: the 'Q'&lt;br /&gt;
    variables.  They are named q1, q2, q3, and so on, through q32.  Their&lt;br /&gt;
    main function is to bridge the gap between various variable pools.&lt;br /&gt;
    &lt;br /&gt;
    In MilkDrop 1.03 and later, you can write code that is executed only once,&lt;br /&gt;
    when a preset is loaded (switched to).  This 'preset initialization' code &lt;br /&gt;
    does two useful things:&lt;br /&gt;
      &lt;br /&gt;
      1. It allows you to set the initial value of your own (user-defined) &lt;br /&gt;
         variables (such as 'my_variable'), as just explained.  &lt;br /&gt;
         &lt;br /&gt;
      2. It allows you to write the default (&amp;quot;sticky&amp;quot;) values for q1, q2, q3... &lt;br /&gt;
         through q32.  Whatever these values end up at after the init code, &lt;br /&gt;
         those are the values that q1-q32 will be reset to at the start of &lt;br /&gt;
         each frame (...the input to the per-frame equations).  If the&lt;br /&gt;
         per-frame equations change the values of q1-q32, those new values will&lt;br /&gt;
         propagate on to other variable pools (see the diagram below), but on&lt;br /&gt;
         the next frame, the values will be reset to the original &amp;quot;sticky&amp;quot; &lt;br /&gt;
         defaults.&lt;br /&gt;
         &lt;br /&gt;
    See the flow chart below for a brief, and complete, glance at how the values&lt;br /&gt;
    of the Q variables flow throughout MilkDrop.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    Let's walk through the flow of the chart.  &lt;br /&gt;
    &lt;br /&gt;
    If you write to the values of q1..q32 from the &amp;quot;preset init code&amp;quot;, the values &lt;br /&gt;
    you write will become the new 'base values' to which q1..q32 are initialized &lt;br /&gt;
    at the start of each frame, for the per-frame code.  So when you access (read) &lt;br /&gt;
    q1-q32 in the per-frame code, you'll get the values that were *initially* set -&lt;br /&gt;
    over and over, every frame.  You can then modify them (or not) in the per-frame &lt;br /&gt;
    code, and the (possibly modified values) will then be readable by the per-vertex &lt;br /&gt;
    code - as well as by all pixel shader code, and others.  However, any modified &lt;br /&gt;
    values will not persist to the next frame; they will be reset again, at the &lt;br /&gt;
    start of the next frame, to the values they had at the end of the preset init &lt;br /&gt;
    code.&lt;br /&gt;
&lt;br /&gt;
    In the per-vertex code, the q1-q32 values start (for the first vertex &lt;br /&gt;
    in any frame) as the values they had at the end of the per-frame code.  If you &lt;br /&gt;
    modify q1-q32 in the per-vertex code, those modified values will carry over &lt;br /&gt;
    from vertex to vertex.  (This isn't a very desireable effect; you should avoid &lt;br /&gt;
    writing to the Q variables from the per-vertex equations.)  Next frame, they &lt;br /&gt;
    will be reset to whatever value they had at the end of the [next frame's &lt;br /&gt;
    execution of the] per-frame code.  (It's all in the diagram... look at that, &lt;br /&gt;
    and you'll just get it.)&lt;br /&gt;
&lt;br /&gt;
    There is one trick here.  You might notice that the custom wave/shape&lt;br /&gt;
    init boxes are missing from the diagram.  That's because the q&lt;br /&gt;
    variables coming out of them don't go anywhere.  The Q values that come&lt;br /&gt;
    into the per-frame wave/shape equations come from the preset per-frame&lt;br /&gt;
    equations, as you can see.  But, just to humor you: in the wave/shape init code, &lt;br /&gt;
    the Q values coming in are the results from the preset init code.  Any Q values &lt;br /&gt;
    you write to there (in the wave/shape init code) will be meaningless; although&lt;br /&gt;
    you can write to (initialize) your own custom variables, and read those in &lt;br /&gt;
    later, in the wave/shape per-frame equations!  So, really, you can still route&lt;br /&gt;
    data that way, if you really want to.&lt;br /&gt;
        &lt;br /&gt;
    Side note: when you edit the preset init code and apply it (by hitting &lt;br /&gt;
    CTRL+ENTER), the init code will re-execute immediately.  However, when you &lt;br /&gt;
    edit the regular per-frame/per-vertex code and hit CTRL+ENTER, the preset init &lt;br /&gt;
    code will NOT be re-executed; the results of the last execution will persist.&lt;br /&gt;
    If you change per-frame/per-vertex code and want to re-execute the initialization&lt;br /&gt;
    code (i.e. to randomize it or reset the preset), you'll have to save the preset&lt;br /&gt;
    and then re-load it.&lt;br /&gt;
&lt;br /&gt;
    (Historical note: nothing here has changed since MilkDrop 1; these diagrams were&lt;br /&gt;
    just re-designed to be much simpler to read.  Actually, there was a bug in &lt;br /&gt;
    the old diagrams that is now fixed: on frame 0, they showed the Q values &lt;br /&gt;
    going straight from the (frame 0!?) per-frame code, into the custom &lt;br /&gt;
    wave/shape init code.  On frame 0, those Q values actually come straight from &lt;br /&gt;
    the preset init code.  HOWEVER, they are virtually useless, as discussed above.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
=== CUSTOM SHAPES AND WAVES ===&lt;br /&gt;
    ----------------------&lt;br /&gt;
    As of MilkDrop 1.04, two new features are available: custom shapes, and custom &lt;br /&gt;
    waves.  A preset can have up to 4 of each.  &lt;br /&gt;
    &lt;br /&gt;
    With custom shapes, you can draw an n-sided shape (with 3-100 sides) anywhere &lt;br /&gt;
    on the screen, at any angle and size, in any color, and at any opacity.  You &lt;br /&gt;
    even have the option to map the previous frame's image onto the shape, which &lt;br /&gt;
    makes for some incredible possibilities (such as realtime hardware fractals - &lt;br /&gt;
    see the 'Geiss - Feedback' preset).  You can also write per-frame code to &lt;br /&gt;
    control all of these things about the shape(s).  This way, they can react to&lt;br /&gt;
    the audio or change over time - whatever you can imagine.  You are limited to&lt;br /&gt;
    four custom shapes per preset, however, each one of those can be instanced,&lt;br /&gt;
    which lets you draw a huge number (up to 1024) of them each frame, if you &lt;br /&gt;
    want to, and each one can be totally different (as long as the value of&lt;br /&gt;
    the 'instance' variable ends up influencing the other properties).&lt;br /&gt;
    &lt;br /&gt;
    With custom waves, you can draw the waveform (or the frequency spectrum)&lt;br /&gt;
    wherever, whenever, and however you want; a great addition since MilkDrop &lt;br /&gt;
    1.03, where only the built-in waveforms were possible.  With custom waves&lt;br /&gt;
    you can also write per-frame code to control the waves, and per-point code&lt;br /&gt;
    to place every point (or line segment) on the wave exactly where you want,&lt;br /&gt;
    and in exactly the color you want, and so on.&lt;br /&gt;
&lt;br /&gt;
    Remember those q1-q32 variables that were committed at the end of the preset&lt;br /&gt;
    initialization code, then reset (to those values) at the beginning of each&lt;br /&gt;
    frame, and then (potentially) modified in the preset per-frame code?  Those&lt;br /&gt;
    (potentially modified) values of q1-q32 - as they were at the end of the&lt;br /&gt;
    preset's per-frame code, each frame - are piped into the custom wave &amp;amp; custom &lt;br /&gt;
    shape per-frame code.  So if you read 'q3' in the custom wave per-frame &lt;br /&gt;
    code, what you're really reading is the value of 'q3' as it was left at the &lt;br /&gt;
    end of this frame's per-frame code.  Again, see the q_vars.gif image &lt;br /&gt;
    for a diagram of the flow of the values of the q1-q32 varibles.&lt;br /&gt;
&lt;br /&gt;
    For custom waves and shapes, you can modify q1-q32, if you like, in the per-&lt;br /&gt;
    frame equations.  As usual, the values of the Q variables will not persist &lt;br /&gt;
    from frame to frame, though - they are reset on each new frame, to match&lt;br /&gt;
    the values they had at the end of the *preset's* per-frame code, this frame. &lt;br /&gt;
    &lt;br /&gt;
    For custom waves, you also have one more link in the chain: per-point&lt;br /&gt;
    (aka per-vertex) code.  This code is executed once for each data point in the &lt;br /&gt;
    waveform.  The initial values of q1-q32 coming in (for the first point)&lt;br /&gt;
    are the values that stood at the end of the custom wave per-frame code,&lt;br /&gt;
    this frame.  If you then modify q1-q32 in the per-point code (or even if you&lt;br /&gt;
    don't), the values will pass on to the next point.  You could, for example, &lt;br /&gt;
    smooth out a waveform using this.&lt;br /&gt;
&lt;br /&gt;
    THE 'T' VARIABLES&lt;br /&gt;
    ----------------------&lt;br /&gt;
    There are 8 additional variables available for custom waves and shapes:&lt;br /&gt;
    t1-t8.  These are very similar to the Q variables, but they exist only&lt;br /&gt;
    for custom waves &amp;amp; shapes.  To see how the data flows from variable pool&lt;br /&gt;
    to variable pool for the T vars, take a look at the diagram below.  Like&lt;br /&gt;
    the Q variables, they exist to help you bridge some gaps between variable&lt;br /&gt;
    pools.  However, the T variables are a bit simpler to understand than the &lt;br /&gt;
    Q's.  The diagram below should explain it all.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    CUSTOM SHAPE PER-FRAME VARIABLES&lt;br /&gt;
    ----------------------&lt;br /&gt;
        NAME    WRITABLE? RANGE    DESCRIPTION&lt;br /&gt;
        ----    --------- -----    -----------                                                                   &lt;br /&gt;
        num_inst   no     1-1024   The total # of instances (the number of times to repeat the per-frame equations for, &amp;amp; draw, this shape).&lt;br /&gt;
        instance   no     0..num_inst-1   The current instance number that the equations are being executed for.&lt;br /&gt;
        sides      yes    3-100    the default number of sides that make up the polygonal shape&lt;br /&gt;
        thick      yes    0/1      if ON, the border will be overdrawn 4X to make it thicker, bolder, and more visible&lt;br /&gt;
        additive   yes    0/1      if ON, the shape will add color to sature the image toward white; otherwise, it will replace what's there.&lt;br /&gt;
        x          yes    0..1     default x position of the shape (0..1; 0=left side, 1=right side)&lt;br /&gt;
        y          yes    0..1     default y position of the shape (0..1; 0=bottom, 1=top of screen)&lt;br /&gt;
        rad        yes    0+       default radius of the shape (0+)&lt;br /&gt;
        ang        yes    0..6.28  default rotation angle of the shape (0...2*pi)&lt;br /&gt;
        textured   yes    0/1      if ON, the shape will be textured with the image from the previous frame&lt;br /&gt;
        tex_zoom   yes    &amp;gt;0       the portion of the previous frame's image to use with the shape&lt;br /&gt;
        tex_ang    yes    0..6.28  the angle at which to rotate the previous frame's image before applying it to the shape&lt;br /&gt;
        r          yes    0..1     default amount of red color toward the center of the shape (0..1)&lt;br /&gt;
        g          yes    0..1     default amount of green color toward the center of the shape (0..1)&lt;br /&gt;
        b          yes    0..1     default amount of blue color toward the center of the shape (0..1)&lt;br /&gt;
        a          yes    0..1     default opacity of the center of the shape; 0=transparent, 1=opaque&lt;br /&gt;
        r2         yes    0..1     default amount of red color toward the outer edge of the shape (0..1)&lt;br /&gt;
        g2         yes    0..1     default amount of green color toward the outer edge of the shape (0..1)&lt;br /&gt;
        b2         yes    0..1     default amount of blue color toward the outer edge of the shape (0..1)&lt;br /&gt;
        a2         yes    0..1     default opacity of the outer edge of the shape; 0=transparent, 1=opaque&lt;br /&gt;
        border_r   yes    0..1     default amount of red color in the shape's border (0..1)&lt;br /&gt;
        border_g   yes    0..1     default amount of green color in the shape's border (0..1)&lt;br /&gt;
        border_b   yes    0..1     default amount of blue color in the shape's border (0..1)&lt;br /&gt;
        border_a   yes    0..1     default opacity of the shape's border; 0=transparent, 1=opaque&lt;br /&gt;
&lt;br /&gt;
        time       NO     &amp;gt;0       retrieves the current time, in seconds, since MilkDrop started running&lt;br /&gt;
        fps        NO     &amp;gt;0       retrieves the current framerate, in frames per second.&lt;br /&gt;
        frame      NO              retrieves the number of frames of animation elapsed since the program started&lt;br /&gt;
        progress   NO     0..1     progress through the current preset; if preset was just loaded, this is closer to 0; if preset is about to end, this is closer to 1.&lt;br /&gt;
                                     -note that if Scroll Lock is on, 'progress' will freeze!&lt;br /&gt;
&lt;br /&gt;
        bass       NO     &amp;gt;0       retrieves the current amount of bass.  1 is normal; below ~0.7 is quiet; above ~1.3 is loud bass&lt;br /&gt;
        mid        NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb       NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
        bass_att   NO     &amp;gt;0       retrieves an attenuated reading on the bass, meaning that it is damped in time and doesn't change so rapidly.&lt;br /&gt;
        mid_att    NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb_att   NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
&lt;br /&gt;
        q1         yes    any      } Used to carry values along a chain                                         &lt;br /&gt;
        q2         yes    any      }  from the preset init code,                                                &lt;br /&gt;
        q3         yes    any      }  to the preset per-frame code, then on                                     &lt;br /&gt;
        q4         yes    any      }    to the preset per-vertex code;                                          &lt;br /&gt;
        q5         yes    any      }    or to the custom shape per-frame code,                                  &lt;br /&gt;
        q6         yes    any      }    or to the custom wave per-frame code,                                   &lt;br /&gt;
        q7         yes    any      }      then to the custom wave per-vertex code;                              &lt;br /&gt;
        ...                        }    or to the [pixel] shader code.                                          &lt;br /&gt;
        q31        yes    any      } Click here to see a diagram for the Q vars.&lt;br /&gt;
        q32        yes    any      } &lt;br /&gt;
&lt;br /&gt;
        t1         yes    any      } Used to carry information                                                  &lt;br /&gt;
        t2         yes    any      }  from the custom shape init code                                           &lt;br /&gt;
        t3         yes    any      }    to the custom shape per-frame code.                                       &lt;br /&gt;
        t4         yes    any      } Click here to see a diagram for the T vars.&lt;br /&gt;
        t5         yes    any      } &lt;br /&gt;
        t6         yes    any      } &lt;br /&gt;
        t7         yes    any      } &lt;br /&gt;
        t8         yes    any      } &lt;br /&gt;
                                     &lt;br /&gt;
    &lt;br /&gt;
    CUSTOM WAVE PER-FRAME VARIABLES&lt;br /&gt;
    ---------------------&lt;br /&gt;
        NAME   WRITABLE?  RANGE    DESCRIPTION&lt;br /&gt;
        ----   ---------  -----    -----------                                                                   &lt;br /&gt;
        r          yes    0..1     base amount of red color in the wave (0..1)&lt;br /&gt;
        g          yes    0..1     base amount of green color in the wave (0..1)&lt;br /&gt;
        b          yes    0..1     base amount of blue color in the wave (0..1)&lt;br /&gt;
        a          yes    0..1     base opacity of the waveform; 0=transparent, 1=opaque&lt;br /&gt;
        samples    yes    0-512    read: retrieves the # of samples specified for this custom wave (from the menu).&lt;br /&gt;
                                   write: lets you dynamically change that #, frame to frame.&lt;br /&gt;
&lt;br /&gt;
        time       NO     &amp;gt;0       retrieves the current time, in seconds, since MilkDrop started running&lt;br /&gt;
        fps        NO     &amp;gt;0       retrieves the current framerate, in frames per second.&lt;br /&gt;
        frame      NO              retrieves the number of frames of animation elapsed since the program started&lt;br /&gt;
        progress   NO     0..1     progress through the current preset; if preset was just loaded, this is closer to 0; if preset is about to end, this is closer to 1.&lt;br /&gt;
                                     -note that if Scroll Lock is on, 'progress' will freeze!&lt;br /&gt;
&lt;br /&gt;
        bass       NO     &amp;gt;0       retrieves the current amount of bass.  1 is normal; below ~0.7 is quiet; above ~1.3 is loud bass&lt;br /&gt;
        mid        NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb       NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
        bass_att   NO     &amp;gt;0       retrieves an attenuated reading on the bass, meaning that it is damped in time and doesn't change so rapidly.&lt;br /&gt;
        mid_att    NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb_att   NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
&lt;br /&gt;
        q1         yes    any      } Used to carry values along a chain                                         &lt;br /&gt;
        q2         yes    any      }  from the preset init code,                                                &lt;br /&gt;
        q3         yes    any      }  to the preset per-frame code, then on                                     &lt;br /&gt;
        q4         yes    any      }    to the preset per-vertex code;                                          &lt;br /&gt;
        q5         yes    any      }    or to the custom shape per-frame code,                                  &lt;br /&gt;
        q6         yes    any      }    or to the custom wave per-frame code,                                   &lt;br /&gt;
        q7         yes    any      }      then to the custom wave per-vertex code;                              &lt;br /&gt;
        ...                        }    or to the [pixel] shader code.                                          &lt;br /&gt;
        q31        yes    any      } Click here to see a diagram for the Q vars.&lt;br /&gt;
        q32        yes    any      } &lt;br /&gt;
    &lt;br /&gt;
        t1         yes    any      } Used to carry information                                                  &lt;br /&gt;
        t2         yes    any      }  from the custom wave init code,                                           &lt;br /&gt;
        t3         yes    any      }    to the custom wave per-frame code,                                      &lt;br /&gt;
        t4         yes    any      }      then on to the custom wave per-point code                             &lt;br /&gt;
        t5         yes    any      }      (and from point to point, too, if you write                           &lt;br /&gt;
        t6         yes    any      }      to the values from the per-point equations).                          &lt;br /&gt;
        t7         yes    any      } Click here to see a diagram for the T vars.&lt;br /&gt;
        t8         yes    any      } &lt;br /&gt;
    &lt;br /&gt;
       &lt;br /&gt;
    CUSTOM WAVE PER-POINT (aka PER-VERTEX) VARIABLES&lt;br /&gt;
    ---------------------&lt;br /&gt;
        NAME   WRITABLE?  RANGE    DESCRIPTION&lt;br /&gt;
        ----   ---------  -----    -----------                                                                   &lt;br /&gt;
        x          yes    0..1     the x position of this point that makes up the wave (0=left, 1=right)&lt;br /&gt;
        y          yes    0..1     the y position of this point that makes up the wave (0=bottom, 1=top)&lt;br /&gt;
        sample     no     0..1     how far along we are, through the samples that make up the waveform: 0=first sample, 0.5 = half-way through; 1=last sample.&lt;br /&gt;
        value1     no     any      the value of the Left audio channel sample at this point in the waveform (or freq. spectrum).&lt;br /&gt;
        value2     no     any      the value of the Right audio channel sample at this point in the waveform (or freq. spectrum).&lt;br /&gt;
        r          yes    0..1     amount of red color in this point of the wave (0..1)&lt;br /&gt;
        g          yes    0..1     amount of green color in this point of the wave (0..1)&lt;br /&gt;
        b          yes    0..1     amount of blue color in this point of the wave (0..1)&lt;br /&gt;
        a          yes    0..1     opacity of this point of the waveform; 0=transparent, 1=opaque&lt;br /&gt;
&lt;br /&gt;
        time       NO     &amp;gt;0       retrieves the current time, in seconds, since MilkDrop started running&lt;br /&gt;
        fps        NO     &amp;gt;0       retrieves the current framerate, in frames per second.&lt;br /&gt;
        frame      NO              retrieves the number of frames of animation elapsed since the program started&lt;br /&gt;
        progress   NO     0..1     progress through the current preset; if preset was just loaded, this is closer to 0; if preset is about to end, this is closer to 1.&lt;br /&gt;
                                     -note that if Scroll Lock is on, 'progress' will freeze!&lt;br /&gt;
&lt;br /&gt;
        bass       NO     &amp;gt;0       retrieves the current amount of bass.  1 is normal; below ~0.7 is quiet; above ~1.3 is loud bass&lt;br /&gt;
        mid        NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb       NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
        bass_att   NO     &amp;gt;0       retrieves an attenuated reading on the bass, meaning that it is damped in time and doesn't change so rapidly.&lt;br /&gt;
        mid_att    NO     &amp;gt;0         -same, but for mids (middle frequencies)&lt;br /&gt;
        treb_att   NO     &amp;gt;0         -same, but for treble (high) frequencies&lt;br /&gt;
&lt;br /&gt;
        q1         yes    any      } Used to carry values along a chain                                         &lt;br /&gt;
        q2         yes    any      }  from the preset init code,                                                &lt;br /&gt;
        q3         yes    any      }  to the preset per-frame code, then on                                     &lt;br /&gt;
        q4         yes    any      }    to the preset per-vertex code;                                          &lt;br /&gt;
        q5         yes    any      }    or to the custom shape per-frame code,                                  &lt;br /&gt;
        q6         yes    any      }    or to the custom wave per-frame code,                                   &lt;br /&gt;
        q7         yes    any      }      then to the custom wave per-vertex code;                              &lt;br /&gt;
        ...                        }    or to the [pixel] shader code.                                          &lt;br /&gt;
        q31        yes    any      } Click here to see a diagram for the Q vars.&lt;br /&gt;
        q32        yes    any      } &lt;br /&gt;
&lt;br /&gt;
        t1         yes    any      } Used to carry information                      &lt;br /&gt;
        t2         yes    any      }  from the custom wave init code,               &lt;br /&gt;
        t3         yes    any      }    to the custom wave per-frame code,          &lt;br /&gt;
        t4         yes    any      }      then on to the custom wave per-point code&lt;br /&gt;
        t5         yes    any      }      (and from point to point, too, if you write&lt;br /&gt;
        t6         yes    any      }      to the values from the per-point equations).&lt;br /&gt;
        t7         yes    any      } Click here to see a diagram for the T vars.&lt;br /&gt;
        t8         yes    any      } &lt;br /&gt;
&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
=== PIXEL SHADERS ===&lt;br /&gt;
&lt;br /&gt;
The world of realtime computer graphics made a huge stride around 2002-2003, with the advent of pixel shaders.  Lots of people want to learn how to use pixel shaders; writing presets for MilkDrop is a great way to learn them, because you get to see the effects of your code instantly,on the screen.&lt;br /&gt;
    &lt;br /&gt;
MilkDrop 1 ran on what is called the &amp;quot;fixed function&amp;quot; graphics pipeline. That meant that certain common graphics operations - and very few of them - could be executed for each pixel.  You could do a few things - maybe multiply by a texture or a color, then maybe one more simple operation - but that was about it.  &lt;br /&gt;
    &lt;br /&gt;
Newer presets (MilkDrop 2 and later) can take advantage of programmable pixel shaders.  GPUs (graphics processing units) are now capable of executing dozens, even thousands (on more expensive hardware) of instructions per pixel.  To tell the GPU what to do at each pixel, you write some code called a &amp;quot;pixel shader&amp;quot;.  It looks a lot like C, except you'll see the types float3 (...often representing a color, or maybe a 3D coordinate), as well as float2 and float4, as often as you'll see the simple &amp;quot;float&amp;quot; type.  There is also a lot of emphasis on sampling from textures.&lt;br /&gt;
    Textures can either be procedural (like the image from the previous&lt;br /&gt;
    frame, or a nicely gaussian-blurred version of it, or a procedurally-&lt;br /&gt;
    generated noise texture), or they can be loaded from disk.  To sample&lt;br /&gt;
    from a texture on disk (...but cached in video memory, of course), &lt;br /&gt;
    in the shader, you simply specify the name of the image file you want to load,&lt;br /&gt;
    and how you want to sample it (what kind of filtering &amp;amp; wrapping) as well as&lt;br /&gt;
    where (the UV coordinates, like XY coordinates, always in the [0..1] range).&lt;br /&gt;
    It reads the sample (as a float4 - some image formats have four channels&lt;br /&gt;
    instead of just r/g/b).  You can then do whatever you like (mathematically)&lt;br /&gt;
    with that sample, take other samples, combine them, and so on.  The final&lt;br /&gt;
    output of the shader is always a color value, and it is this color value&lt;br /&gt;
    that is written to the render target (an internal texture, or the screen).&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    SHADER MODELS - 2.0, 3.0, etc.&lt;br /&gt;
    ------------------------------&lt;br /&gt;
    Since pixel shaders were born, there have been a few revisions.  Each new&lt;br /&gt;
    model has more capabilities than the last.  &lt;br /&gt;
    &lt;br /&gt;
    MilkDrop 1 only supports fixed-function graphics - i.e. no pixel shaders.&lt;br /&gt;
    MilkDrop 2 supports shader model 2 at the lowest level.  (If your GPU&lt;br /&gt;
    doesn't support this, MilkDrop 2 should still run - it just won't show&lt;br /&gt;
    you any presets that use pixel shaders.)  Shader model 2 has a limit of&lt;br /&gt;
    64 instructions (per shader), though.  &lt;br /&gt;
    &lt;br /&gt;
    Presets can be authored to use Shader Model 3, however.  This shader&lt;br /&gt;
    model is not as widely supported (...so be careful writing presets for&lt;br /&gt;
    it - half of the GPUs out there don't support it yet, so the preset&lt;br /&gt;
    won't show up in the preset list on those computers).  However, it is&lt;br /&gt;
    much more powerful, with a virtually unlimited number of instructions.&lt;br /&gt;
    (You're just limited by the speed of your GPU and the number of pixels&lt;br /&gt;
    you need to draw each frame!)  On a GeForce 8000-series, believe it&lt;br /&gt;
    or not, you can easily achieve smooth framerates running shaders with &lt;br /&gt;
    THOUSANDS of instructions!&lt;br /&gt;
    &lt;br /&gt;
    Shader Model 4.0 also exists, but only in DirectX 10; and DirectX 10&lt;br /&gt;
    is only available with Windows Vista.  Because not many people have&lt;br /&gt;
    Vista yet, we've decided to wait (a damn long time) until going down&lt;br /&gt;
    that path.  Shader Model 3 has virtually everything we need in it&lt;br /&gt;
    anyway.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    PRESET FILE VERSIONS &amp;amp; COMPATIBILITY&lt;br /&gt;
    ------------------------------------&lt;br /&gt;
    Note that if you load a MilkDrop 1 preset, you can save it back to disk&lt;br /&gt;
    (even after changing code, variables, etc.) and it will still be readable&lt;br /&gt;
    by MilkDrop 1.  Only if you select the menu option to &amp;quot;Upgrade [its] &lt;br /&gt;
    Pixel Shader Version&amp;quot; will you be making it no longer backwards-compatible.&lt;br /&gt;
    Once you've done this, though, you'll notice that the menus look slightly&lt;br /&gt;
    different - some new shader-based options will appear, and some old stuff&lt;br /&gt;
    (video echo, gamma, etc. - all things that are now folded into the &lt;br /&gt;
    composite shader) are all gone.  You'll also notice that two nice little&lt;br /&gt;
    default shaders (warp and composite) have been written for you, and that &lt;br /&gt;
    the relevant values and options from the old preset (gamma, decay, video &lt;br /&gt;
    echo, texture wrap, etc.) have all been set correctly in the new shaders, &lt;br /&gt;
    so that the preset does exactly what it did before.  The only difference &lt;br /&gt;
    is that now, the preset takes advantage of the full programmability of &lt;br /&gt;
    pixel shaders (and you have a lot of freedom to tweak it), instead of &lt;br /&gt;
    being restricted by the highly restrictive DX8 fixed-function graphics &lt;br /&gt;
    pipeline.&lt;br /&gt;
    &lt;br /&gt;
    Some of the mash-up functions (discussed later) will mix old and new&lt;br /&gt;
    presets together.  In this case, the newly-created preset file will only&lt;br /&gt;
    look correct on MilkDrop 1.xx if it uses neither a warp nor composite shader.&lt;br /&gt;
    It will still run in MilkDrop 1, but without shaders, so whatever random &lt;br /&gt;
    values gamma, video echo, etc. were left at, will all kick back in.&lt;br /&gt;
&lt;br /&gt;
    One last note: keep in mind that MilkDrop 2 is smart enough to not show&lt;br /&gt;
    you any presets that your GPU can't support.  MilkDrop 1, though, isn't&lt;br /&gt;
    so smart - it will let you look at MilkDrop 2 presets.  It will &lt;br /&gt;
    ignore all the shader stuff, and probably not display correctly, though.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
==== A PIXEL SHADER - CONCEPTUAL OVERVIEW ====&lt;br /&gt;
&lt;br /&gt;
Games are what have driven the Hardware Graphics revolution, and games work by projecting many thousands of 3D triangles onto your screen and rasterizing (pixelizing) &amp;amp; shading them.  In MilkDrop, also, your graphics processing unit (GPU) is told to draw many triangle onto your screen.  Each is described by three vertices (points).  The interior of the triangle is a bunch of pixels.  The GPU runs your &amp;quot;shader&amp;quot; code on each pixel to determine how to shade the pixel - i.e., light it, or determine its color.  (The terminology is more geared toward the idea that these triangles were originally in 3D and require realistic lighting and shading.)&lt;br /&gt;
    &lt;br /&gt;
In MilkDrop, the shaders are run on a dumb, regular grid of triangles that covers the entire visualizer window.  The results of the preset's per-vertex equations are interpolated across the face of each of these triangles, and your pixel shader will see the interpolated results. They come in in the form of &amp;quot;UV&amp;quot; coordinates - they tell you where to sample (read) the source image, in order to create the desired warping effect each frame - the long-term effect of which is to create perceived motion. &lt;br /&gt;
    &lt;br /&gt;
You can then sample that image (or others), do some math on the result, sample some other textures, do some more math, etc.  By the end of the shader, whatever value is in &amp;quot;ret&amp;quot; (a float3 - three floating-point values) is the color that will be written for that pixel.&lt;br /&gt;
    &lt;br /&gt;
    Each preset in MilkDrop 2 has two pixel shaders: the warp shader,&lt;br /&gt;
    which warps the image from frame to frame, and the composite shader,&lt;br /&gt;
    which draws the frame to the screen (with or without special effects).&lt;br /&gt;
    &lt;br /&gt;
    To edit or experiment with these shaders, while MilkDrop is running, &lt;br /&gt;
    hit 'M' to view the preset editing menu.  The scroll down to either &lt;br /&gt;
        [edit warp shader]&lt;br /&gt;
    or &lt;br /&gt;
        [edit composite shader] &lt;br /&gt;
    and hit ENTER.  If you don't see either of these options, it means &lt;br /&gt;
    the current preset is an old MilkDrop 1 preset; in this case, you can &lt;br /&gt;
    either try a different preset, or you can upgrade the current preset &lt;br /&gt;
    by selecting &lt;br /&gt;
&lt;br /&gt;
        update preset's pixel shader version&lt;br /&gt;
&lt;br /&gt;
    toward the bottom of the menu.  Keep in mind that if you upgrade&lt;br /&gt;
    a preset's pixel shader version and then save it to disk, it might &lt;br /&gt;
    not be usable anymore on other computers with older graphics chips.&lt;br /&gt;
&lt;br /&gt;
    Now go edit one of the two shaders.  Once you're in there, editing,&lt;br /&gt;
    hit F9 - this will toggle the onscreen quick reference for writing&lt;br /&gt;
    shaders.  It's very handy.  Press F9 again to hide it.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
==== WARP SHADER ====&lt;br /&gt;
&lt;br /&gt;
    Here is an example of a simple WARP shader.  It is run over every pixel of&lt;br /&gt;
    the internal canvas, with the output being back to the canvas itself (it's&lt;br /&gt;
    a double-buffered texture).  Any special effects that happen here get &amp;quot;baked&amp;quot; &lt;br /&gt;
    into the image, and will persist into the next frame.&lt;br /&gt;
        &lt;br /&gt;
        shader_body&lt;br /&gt;
        {&lt;br /&gt;
            // sample a pixel from the previous frame.  &lt;br /&gt;
            // uv coord is slightly warped (driven by the per-vertex equations),&lt;br /&gt;
            //   and is what creates the main &amp;quot;movement&amp;quot; in our preset.&lt;br /&gt;
            ret = tex2D( sampler_main, uv ).xyz;&lt;br /&gt;
&lt;br /&gt;
            // darken over time&lt;br /&gt;
            ret *= 0.97;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    There are only two instructions here... sample the old frame, and &lt;br /&gt;
    darken the old color value (color values are always in the 0..1 range)&lt;br /&gt;
    to prevent the screen from turning white over time.&lt;br /&gt;
    &lt;br /&gt;
    This code is run on every pixel on the screen.  If the UV's coming in&lt;br /&gt;
    were just [0..1] on X and Y, corresponding exactly to the location of&lt;br /&gt;
    the pixel on the screen, there would be no movement (or warp).  &lt;br /&gt;
    What creates the warp is that the UV coordinates are slightly &amp;quot;off&amp;quot;.&lt;br /&gt;
    Each frame, MilkDrop executes the per-vertex equations for the current &lt;br /&gt;
    preset at all the vertices on a grid covering the screen.  The resulting&lt;br /&gt;
    UV coordinates are then interpolated (by the GPU) between the vertices,&lt;br /&gt;
    and this shader code is executed at each pixel, with the UV coordinates&lt;br /&gt;
    smoothly interpolated for you to do your sampling.  Note that the &lt;br /&gt;
    original, un-distorted UV coordinates are always available in uv_orig.&lt;br /&gt;
    If the preset had no motion in it, or if we used uv_orig instead of uv, &lt;br /&gt;
    we would just see pixels getting darker over time, with no apparent motion.&lt;br /&gt;
    &lt;br /&gt;
    Note that MilkDrop's internal canvas (texture) can only store colors&lt;br /&gt;
    in the [0..1] range, so if your shader outputs values beyond that range,&lt;br /&gt;
    the values will be clipped to 0 or 1.  Within the body of the shader,&lt;br /&gt;
    you can go nuts, using any number ranges you want; this restriction only&lt;br /&gt;
    applies to the final output.&lt;br /&gt;
    &lt;br /&gt;
    Note that there are several ways to darken pixels over time, and the &lt;br /&gt;
    color precision (8 bits per color channel, or 256 shades, or [0..1] &lt;br /&gt;
    in increments of 0.004) means you have to be careful about darkening &lt;br /&gt;
    the color over time.  If you're going to darken using this:&lt;br /&gt;
&lt;br /&gt;
        ret *= 0.97;&lt;br /&gt;
&lt;br /&gt;
    then you shouldn't use a multiplier above 0.98, because, due to precision,&lt;br /&gt;
    dark-ish pixels will never become fully dark.  Another way to do it&lt;br /&gt;
    is this: &lt;br /&gt;
&lt;br /&gt;
        ret -= 0.004;&lt;br /&gt;
&lt;br /&gt;
    The above darkening method will make the pixels go dark, although, &lt;br /&gt;
    sometimes too quickly.  One way around this is to use error diffusion &lt;br /&gt;
    dithering (discussed later in this guide).  &lt;br /&gt;
    &lt;br /&gt;
    Probably the best thing is to combine the two:&lt;br /&gt;
&lt;br /&gt;
        ret = (ret - 0.002)*0.99;&lt;br /&gt;
&lt;br /&gt;
    This gives you a partially constant, partially linear darkening effect,&lt;br /&gt;
    and it tends to look the best.  Tweak the values as needed.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
==== COMPOSITE SHADER ====&lt;br /&gt;
&lt;br /&gt;
    Here is an example of a simple COMPOSITE shader.  It is run over every&lt;br /&gt;
    pixel in the visualizer window, the output being the actual screen that&lt;br /&gt;
    you see.  Anything you do here will NOT affect the subsequent frame - &lt;br /&gt;
    it will only affect the display of the current frame.&lt;br /&gt;
        &lt;br /&gt;
        shader_body&lt;br /&gt;
        {&lt;br /&gt;
            // sample the corresponding pixel from the internal rendering canvas&lt;br /&gt;
            // note that, here, 'uv' is undistorted.&lt;br /&gt;
            // in the warp shader, 'uv' is warped, and 'uv_orig' is undistorted!&lt;br /&gt;
            ret = tex2D(sampler_main, uv).xyz;&lt;br /&gt;
            &lt;br /&gt;
            // make it a little bit &amp;quot;overbright&amp;quot;&lt;br /&gt;
            ret *= 1.8;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    The composite shader is easy to understand.  We just sample the&lt;br /&gt;
    internal canvas at the uv coords (undistorted here - but we could&lt;br /&gt;
    play with them if we want!), and manipulate the result if we want&lt;br /&gt;
    (here we brighten it a bit).  The &amp;quot;overbrightening&amp;quot; here is nice because &lt;br /&gt;
    pixels in the brighter ranges will (for display to the user only)&lt;br /&gt;
    wash out to a white color; however, they can stay that way&lt;br /&gt;
    for a bit.  If we just displayed the color as-is here, and &lt;br /&gt;
    instead drew our waveforms twice as bright, they would likely&lt;br /&gt;
    start out at white but very quickly fade to shades of grey.&lt;br /&gt;
    &lt;br /&gt;
    Note that we could do other fancy stuff here instead, like:&lt;br /&gt;
            &lt;br /&gt;
            float2 uv_flipped = 1 - uv;    // '1' auto-replicates to float2(1,1)&lt;br /&gt;
            ret = max( tex2D(sampler_main, uv).xyz, &lt;br /&gt;
                       tex2D(sampler_main, uv_flipped).xyz );&lt;br /&gt;
            ret = pow(ret, float3(0.5, 1, 2));&lt;br /&gt;
            &lt;br /&gt;
    This would flip the image about its diagonal, always show you&lt;br /&gt;
    the brighter pixel from the two orientations, and then ramp&lt;br /&gt;
    the R/G/B channels at different exponents to create a bit of &lt;br /&gt;
    a cepia color tone.  Not too tough!&lt;br /&gt;
    &lt;br /&gt;
    Now that you have an understanding of what the two shaders do,&lt;br /&gt;
    let's look at all the intrinsic types and operators you can use&lt;br /&gt;
    in shaders.&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
==== PIXEL SHADER REFERENCE ====&lt;br /&gt;
    ----------------------&lt;br /&gt;
    Here is a list of all the shader functions and operations at your disposal.&lt;br /&gt;
&lt;br /&gt;
    Data types&lt;br /&gt;
    ----------&lt;br /&gt;
      float       1-4 component full-precision floating-point values.&lt;br /&gt;
      float2        Use these for most things except color values.&lt;br /&gt;
      float3        (When working with UV coords, time values, or big ranges &lt;br /&gt;
      float4        of values, for example.)&lt;br /&gt;
      &lt;br /&gt;
      half        1-4 component half-precision floating-point values.&lt;br /&gt;
      half2         Much faster on some older hardware; although drivers usually &lt;br /&gt;
      half3         automatically substitute the 'half' type on you (behind your back) &lt;br /&gt;
      half4         wherever it is prudent.  Use 'half' for color values, or other &lt;br /&gt;
                    computations where precision is largely unimportant.&lt;br /&gt;
      &lt;br /&gt;
      float2x2    2d transformation matrix.  (Rotate and/or scale.)&lt;br /&gt;
      float3x2    2d transformation matrix.  (Rotate, scale, translation.)&lt;br /&gt;
      float3x3    3d transformation matrix.  (Rotate and/or scale.)&lt;br /&gt;
      float4x3    3d transformation matrix.  (Rotate, scale, translation.)&lt;br /&gt;
&lt;br /&gt;
    Operators  &lt;br /&gt;
    ----------&lt;br /&gt;
      + - * /     typical arithmetic operators.&lt;br /&gt;
      &lt;br /&gt;
      a += b      same as &amp;quot;a = a + b&amp;quot;.  Also valid:  -=  *=  /=&lt;br /&gt;
      &lt;br /&gt;
      ==          equality test.&lt;br /&gt;
      &amp;lt;           less than.&lt;br /&gt;
      &amp;lt;=          less than or equal to.&lt;br /&gt;
      &amp;gt;           greater than.&lt;br /&gt;
      &amp;gt;=          your mom is soo fat.&lt;br /&gt;
      &lt;br /&gt;
      var.x       swizzle operators.  You can stick a dot after any variable&lt;br /&gt;
      var.y       and put up to four letters after it.  If the variable is&lt;br /&gt;
      var.z       a float4, you can choose from x, y, z, and w; if it's a float2,&lt;br /&gt;
      var.w       just x and y; and so on.  The data type yielded can be different &lt;br /&gt;
      var.xy      than the input, and is determined by the number of letters after &lt;br /&gt;
      var.wzxy    the dot, and which fields (from the input) you chose.&lt;br /&gt;
      etc.        For example, if you had:&lt;br /&gt;
                    float  alpha = 104.37;&lt;br /&gt;
                    float2 bravo = float2(1,2);&lt;br /&gt;
                    float3 chuck = float3(10,20,30);&lt;br /&gt;
                    float4 delta = float4(5,6,7,8);&lt;br /&gt;
                  Then these swizzles would yield:&lt;br /&gt;
                    alpha.xxx  -&amp;gt;  float3(104.37, 104.37, 104.37)&lt;br /&gt;
                    bravo.yx   -&amp;gt;  float2(2,1)&lt;br /&gt;
                    chuck.z    -&amp;gt;  30&lt;br /&gt;
                    delta.wywy -&amp;gt;  float4(8,6,8,6)&lt;br /&gt;
&lt;br /&gt;
    Preprocessor&lt;br /&gt;
    ------------&lt;br /&gt;
      If you're familiar with C/C++, you can use simple things like&lt;br /&gt;
      #define, #if (condition) / #endif, #if / #elif/#else / #endif, and so on.&lt;br /&gt;
      &lt;br /&gt;
    &lt;br /&gt;
===== Intrinsic Instructions =====&lt;br /&gt;
&lt;br /&gt;
    Unless otherwise noted, these instructions all work on float, float2, float3, &lt;br /&gt;
    or float4 operands.&lt;br /&gt;
    &lt;br /&gt;
    math operations&lt;br /&gt;
    ---------------&lt;br /&gt;
    abs(a)        Absolute value.  Returns max(a, -a).&lt;br /&gt;
    frac(a)       Fractional value.  Returns (a - (int)a).  (the part after the decimal)&lt;br /&gt;
    floor(a)      Floor.  Returns ((int)a).  (the part before the decimal)&lt;br /&gt;
                    Only works on single floats.&lt;br /&gt;
    saturate(a)   Clamps a to the [0..1] range.  Often FREE (costs no extra instructions).&lt;br /&gt;
    max(a,b)      Returns the greater of each component between a and b.&lt;br /&gt;
    min(a,b)      Returns the lesser of each component between a and b.&lt;br /&gt;
    sqrt(a)       Returns square root of input(s).  Input should be &amp;gt;= 0.  Output always positive.&lt;br /&gt;
    pow(a,b)      Returns a^b.  b can be same type as a, or just a scalar (single float).&lt;br /&gt;
    exp(a)        Returns 2^a.&lt;br /&gt;
    log(a)        Returns log2(a).&lt;br /&gt;
    lerp(a,b,c)   Linear interpolate... blends from a to b based on the value of c[0..1].&lt;br /&gt;
                    (Or extrapolates, if c is outside [0..1] range.)&lt;br /&gt;
                    a and b must be same type; can can be that same type, or just float.&lt;br /&gt;
                    Returns a + c*(b-a).  Return type is same as a and b.&lt;br /&gt;
    dot(a,b)      Dot product.  All versions return A SINGLE FLOAT.&lt;br /&gt;
                    dot(float  a, float  b) returns a+b.&lt;br /&gt;
                    dot(float2 a, float2 b) returns a.x*b.x + a.y*b.y.&lt;br /&gt;
                    dot(float3 a, float3 b) returns a.x*b.x + a.y*b.y + a.z*b.z.&lt;br /&gt;
                    dot(float4 a, float4 b) returns a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w.&lt;br /&gt;
    lum(a)        Converts a color (float3) to greyscale, or &amp;quot;luminance&amp;quot;, for the human eye.&lt;br /&gt;
                    Returns dot(a, float3(0.32,0.49,0.29)).&lt;br /&gt;
                    Tip: oversaturate a color using &amp;quot;col = lerp(lum(col), col, 2);&amp;quot;&lt;br /&gt;
    length(a)     Input is float2, float3, or float4 vector; returns the length of the vector.&lt;br /&gt;
                    Returns sqrt(&lt;br /&gt;
    normalize(a)  Input is float2, float3, or float4 vector; normalizes it to unit length (1.0).&lt;br /&gt;
                    Returns a / length(a).&lt;br /&gt;
&lt;br /&gt;
    texture operations&lt;br /&gt;
    ------------------&lt;br /&gt;
    tex2D(sampler_name, uv)  &lt;br /&gt;
                  Samples a 2D texture at the coordinates 'uv', where UV is a float2.&lt;br /&gt;
                    Returns a float4 (r,g,b,alpha).&lt;br /&gt;
    &lt;br /&gt;
    tex3D(sampler_name, uvw)  &lt;br /&gt;
                  Samples a volume (3D) texture at the coordinates 'uvw', where UVW is a float3.&lt;br /&gt;
                  You could use this to sample a built-in &amp;quot;noise volume&amp;quot; or a volume texture &lt;br /&gt;
                    from a .DDS texture (that holds a 3D texture).&lt;br /&gt;
                    Returns a float4 (r,g,b,alpha).&lt;br /&gt;
&lt;br /&gt;
    GetBlur1(uv)  Samples a slightly-blurred version of the main texture &lt;br /&gt;
                    (internal canvas).  Input is float2; outputs (returns) a float3.&lt;br /&gt;
    GetBlur2(uv)  Samples a more-blurred version. &lt;br /&gt;
    GetBlur3(uv)  Samples a very blurry version.&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    mega-slow operations&lt;br /&gt;
    --------------------&lt;br /&gt;
    sin(a)        Returns cos(a), where a is in radians.  Output is in -1..1 range.&lt;br /&gt;
                    SLOW - use with care.&lt;br /&gt;
    cos(a)        Returns sin(a), where a is in radians.  Output is in -1..1 range.&lt;br /&gt;
                    SLOW - use with care.&lt;br /&gt;
    atan2(y,x)    Returns the arctangent of y/x.  In english, this means that if you give&lt;br /&gt;
                    it a Y and X coordinate (with the origin at zero), it will tell you&lt;br /&gt;
                    the angle you are at, with respect to the origin.  The signs of x and y &lt;br /&gt;
                    are used to determine the quadrant of the return values in the range &lt;br /&gt;
                    [-pi, pi].  atan2 is well-defined for every point other than the origin.&lt;br /&gt;
                    You basically always want to use it like this:&lt;br /&gt;
                        float2 uv2 = (uv-0.5)*aspect.xy;  // widescreen- or 4:3-friendly&lt;br /&gt;
                        float ang = atan2(uv2.y,uv2.x);&lt;br /&gt;
                    SLOW - use with care.&lt;br /&gt;
    mul(a,b)      Multiplies a vector and a matrix together.  You can treat the matrix&lt;br /&gt;
                    as row-major or column-major based on whether you do mul(vec,mat) &lt;br /&gt;
                    or mul(mat,vec).&lt;br /&gt;
    cross(a,b)    Cross product.  Returns (a.yzx*b.zxy - a.zxy*b.yzx).  &lt;br /&gt;
                    Input and output must be float3's.&lt;br /&gt;
                    Slow - use with care.&lt;br /&gt;
    if (a == b)   'If' blocks work in pixel shaders, although they can be very slow;&lt;br /&gt;
    {               the full code is always executed, whether the branch is taken or not.&lt;br /&gt;
      ...           You can use the equality operator, == (note the two equals signs! &lt;br /&gt;
    }               very important!) or the &amp;gt;, &amp;gt;=, &amp;lt;, or &amp;lt;= comparators.&lt;br /&gt;
    else &lt;br /&gt;
    { &lt;br /&gt;
      ... &lt;br /&gt;
    }&lt;br /&gt;
         &lt;br /&gt;
    Keep in mind that cos(), sin(), and atan2() are incredibly slow (~8 instructions).  &lt;br /&gt;
    Almost everything else (even divide, taking a reciprocal square root, etc.) is 1 &lt;br /&gt;
    or maybe, at most, 2 instructions.&lt;br /&gt;
              &lt;br /&gt;
    Note that the saturate() instruction, as well as multiplying by 2, 4, or 8, &lt;br /&gt;
    or dividing by 2, 4, or 8, is a free operation on many GPUs.  And the ALUs&lt;br /&gt;
    inside a GPU almost always do a multiply + add (both) in a single instruction.&lt;br /&gt;
    &lt;br /&gt;
    Also, you can divide by an integer constant without suffixing it with &amp;quot;.0&amp;quot;; &lt;br /&gt;
    in C/C++, &amp;quot;float x = 1/5;&amp;quot; will give you ZERO; but in shader language, it&lt;br /&gt;
    will give you what you expect: 0.2.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== PER-VERTEX SHADER INPUTS =====&lt;br /&gt;
    ------------------------&lt;br /&gt;
    &lt;br /&gt;
    Warp shader:&lt;br /&gt;
    &lt;br /&gt;
      float2 uv;          // .xy = warped UV coords, ~[0..1]&lt;br /&gt;
      float2 uv_orig;     // .xy = original (un-warped) UV coords. [0..1]&lt;br /&gt;
      float  rad;         // radius of the current pixel from center of screen [0..1]&lt;br /&gt;
      float  ang;         // angle of the current pixel from center of screen [0..2*PI]&lt;br /&gt;
    &lt;br /&gt;
    Composite shader:&lt;br /&gt;
    &lt;br /&gt;
      float2 uv;          // .xy = [un-warped] UV coords.&lt;br /&gt;
      float  rad;         // radius of the current pixel from center of screen [0..1]&lt;br /&gt;
      float  ang;         // angle of the current pixel from center of screen [0..2*PI]&lt;br /&gt;
      float3 hue_shader;  // .xyz = a color that varies across the screen &lt;br /&gt;
                          //          (the old 'hue shader' effect from MilkDrop 1).&lt;br /&gt;
    &lt;br /&gt;
    Note that for both shaders, the vertex-interpolated angle value (ang) &lt;br /&gt;
    gets a bit wonky near the center of the screen, where it is very difficult to &lt;br /&gt;
    interpolate well (because it wraps suddenly from 0 to PI*2 at 9 o'clock on your &lt;br /&gt;
    screen).  If you see artifacts due to this, just use&lt;br /&gt;
    &lt;br /&gt;
      float better_ang = atan2(uv.y - 0.5, uv.x - 0.5);&lt;br /&gt;
      &lt;br /&gt;
    It's very slow, but will give you perfect results.  Also, if you want a slightly&lt;br /&gt;
    higher-quality value for the radius, use:&lt;br /&gt;
    &lt;br /&gt;
      float better_rad = length(uv - 0.5);&lt;br /&gt;
      &lt;br /&gt;
    The unwarped UV values will always be of impeccable quality, though, &lt;br /&gt;
    because they will be interpolated in the direction that they vary, &lt;br /&gt;
    and the rectilinear mesh is aligned perfectly for this.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== PER-FRAME SHADER INPUTS =====&lt;br /&gt;
&lt;br /&gt;
    MilkDrop feeds lots of data into the the shaders.  Here is a list of everything&lt;br /&gt;
    that the shaders can access.&lt;br /&gt;
    &lt;br /&gt;
      float4 rand_preset;  // 4 random floats [0..1], updated once per preset&lt;br /&gt;
      float4 rand_frame;   // 4 random floats [0..1], updated each frame&lt;br /&gt;
      float  time;         // the time, in seconds, starting at zero when the *preset* starts.  &lt;br /&gt;
                           //   (wraps back to zero after 10,000 seconds locked on a single preset.)&lt;br /&gt;
      float  fps;          // the current framerate (frames per second).&lt;br /&gt;
      float  frame;        // the current frame #.&lt;br /&gt;
      float  progress;     // the progress through the current preset.  [0..1]&lt;br /&gt;
      &lt;br /&gt;
      float  bass;         // immediate info about audio levels,&lt;br /&gt;
      float  mid;          //  just like in the per-frame equations,&lt;br /&gt;
      float  treb;         //   etc.&lt;br /&gt;
      float  vol;          // &lt;br /&gt;
      float  bass_att;     // slightly dampened info about audio levels.&lt;br /&gt;
      float  mid_att;      //  look at bass/bass_att, for example;&lt;br /&gt;
      float  treb_att;     //   if it's &amp;gt;1, then the bass is spiking.&lt;br /&gt;
      float  vol_att;      // &lt;br /&gt;
      &lt;br /&gt;
      float4 aspect        // .xy: multiplier to use on UV's to paste an image fullscreen, *aspect-aware*; .zw = inverse.&lt;br /&gt;
      float4 texsize       // info about the size of the internal canvas, in pixels.&lt;br /&gt;
                           //   .xy = (width,height); .zw = (1/(float)w, 1/(float)h)&lt;br /&gt;
      &lt;br /&gt;
      // here are some values that roam around in the [0..1] range at varying speeds.&lt;br /&gt;
      float4 slow_roam_cos // .xyzw ~= 0.5 + 0.5*cos(time * float4(~0.005, ~0.008, ~0.013, ~0.022))&lt;br /&gt;
      float4 roam_cos      // .xyzw ~= 0.5 + 0.5*cos(time * float4(~0.3, ~1.3, ~5, ~20))           &lt;br /&gt;
      // here are the corresponding sine values, in case you want them.&lt;br /&gt;
      // pick a cos/sin pair and use the same accessor on it (.x, .z, etc.)&lt;br /&gt;
      // to get plot a point making a circle over time.&lt;br /&gt;
      float4 slow_roam_sin // .xyzw ~= same, but using sin()                                       &lt;br /&gt;
      float4 roam_sin      // .xyzw ~= same, but using sin()                                       &lt;br /&gt;
      // of course, if you want anything more complicated, just generate it&lt;br /&gt;
      // yourself in the per-frame equations, save it in q1-q32, and it will&lt;br /&gt;
      // be available to your shaders!&lt;br /&gt;
&lt;br /&gt;
      float  q1;           // The values of the q1-q32 variables, &lt;br /&gt;
      float  q2;           //  as output by the preset's per-frame equations.&lt;br /&gt;
      //...                //&lt;br /&gt;
      float  q31;          //&lt;br /&gt;
      float  q32;          //&lt;br /&gt;
      &lt;br /&gt;
      float4 _qa;          // q1-q4    The values of the q1-q32 variables,&lt;br /&gt;
      float4 _qb;          // q5-q8     grouped into float4's &lt;br /&gt;
      float4 _qc;          // q9-q12     for more convenient access.&lt;br /&gt;
      float4 _qd;          // q13-q16&lt;br /&gt;
      float4 _qe;          // q17-q20&lt;br /&gt;
      float4 _qf;          // q21-q24&lt;br /&gt;
      float4 _qg;          // q25-q28&lt;br /&gt;
      float4 _qh;          // q29-q32&lt;br /&gt;
      &lt;br /&gt;
      float  blur1_min     // these are the values of the min/max&lt;br /&gt;
      float  blur1_max     //  allowable color values for the 3 blur passes,&lt;br /&gt;
      float  blur2_min     //   as set from the onscreen menus.&lt;br /&gt;
      float  blur2_max     //    more info below.&lt;br /&gt;
      float  blur3_min     // &lt;br /&gt;
      float  blur3_max     // &lt;br /&gt;
      &lt;br /&gt;
      // note/warning: in general, don't use the current time value&lt;br /&gt;
      // as an input to the *dynamic* rotations; as time gets large,&lt;br /&gt;
      // the results will become total chaos.&lt;br /&gt;
      float4x3 rot_s1;  // four random, static rotations.  &lt;br /&gt;
      float4x3 rot_s2;  //  randomized @ preset load time.&lt;br /&gt;
      float4x3 rot_s3;  //   minor translation component (&amp;lt;1).&lt;br /&gt;
      float4x3 rot_s4;&lt;br /&gt;
      &lt;br /&gt;
      float4x3 rot_d1;  // four random, slowly changing rotations.&lt;br /&gt;
      float4x3 rot_d2;  &lt;br /&gt;
      float4x3 rot_d3;&lt;br /&gt;
      float4x3 rot_d4;&lt;br /&gt;
      &lt;br /&gt;
      float4x3 rot_f1;  // faster-changing.&lt;br /&gt;
      float4x3 rot_f2;&lt;br /&gt;
      float4x3 rot_f3;&lt;br /&gt;
      float4x3 rot_f4;&lt;br /&gt;
      &lt;br /&gt;
      float4x3 rot_vf1;  // very-fast-changing.&lt;br /&gt;
      float4x3 rot_vf2;&lt;br /&gt;
      float4x3 rot_vf3;&lt;br /&gt;
      float4x3 rot_vf4;&lt;br /&gt;
      &lt;br /&gt;
      float4x3 rot_uf1;  // ultra-fast-changing.&lt;br /&gt;
      float4x3 rot_uf2;&lt;br /&gt;
      float4x3 rot_uf3;&lt;br /&gt;
      float4x3 rot_uf4;&lt;br /&gt;
      &lt;br /&gt;
      float4x3 rot_rand1; // random every frame&lt;br /&gt;
      float4x3 rot_rand2;&lt;br /&gt;
      float4x3 rot_rand3;&lt;br /&gt;
      float4x3 rot_rand4;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
==== TEXTURE SAMPLING ====&lt;br /&gt;
    We've already used one texture: the internal canvas, also called &amp;quot;Main&amp;quot;.&lt;br /&gt;
    Because it's always being used, you don't have to declare it.  You can&lt;br /&gt;
    just sample it.  However, you have some options for how to sample it.&lt;br /&gt;
    There are four samplers tied to the Main canvas:&lt;br /&gt;
      &lt;br /&gt;
                                                 BEHAVIOR OUTSIDE &lt;br /&gt;
        SAMPLER NAME       FILTERING METHOD      [0..1] UV RANGE&lt;br /&gt;
        ------------       ----------------      ----------------&lt;br /&gt;
        sampler_fw_main*   bilinear filtering    wrap&lt;br /&gt;
        sampler_fc_main    bilinear filtering    clamp&lt;br /&gt;
        sampler_pw_main    point sampling        wrap&lt;br /&gt;
        sampler_pc_main    point sampling        clamp&lt;br /&gt;
        &lt;br /&gt;
        * you can also just use &amp;quot;sampler_main&amp;quot; for this one,&lt;br /&gt;
          since it's by far the most common.&lt;br /&gt;
      &lt;br /&gt;
    When you go to sample a texture, the GPU finds the exact spot&lt;br /&gt;
    in the texture that the UV coordinates point to.  The chances&lt;br /&gt;
    are good that it falls in between 4 texels (pixels) rather than&lt;br /&gt;
    perfectly on one of them.  If you use bilinear filtering to &lt;br /&gt;
    sample, it will return a properly-weighted average of the four &lt;br /&gt;
    pixels.  If you use point sampling, it will just return the &lt;br /&gt;
    nearest single pixel (also called &amp;quot;nearest neighbor&amp;quot;).&lt;br /&gt;
    &lt;br /&gt;
    Wrap vs. clamp is also pretty simple: if you specify a UV coord&lt;br /&gt;
    of float2(-0.1, 0.5), the wrap mode would map this to (0.9, 0.5),&lt;br /&gt;
    while the clamp mode would clamp it at (0.0, 0.5).  Wrap mode&lt;br /&gt;
    tends to create tiled images, while clamp mode takes the border&lt;br /&gt;
    color and extends it out infinitely.&lt;br /&gt;
    &lt;br /&gt;
    In general, other textures can be sampled similarly, using these &lt;br /&gt;
    same two-letter prefixes (&amp;quot;_fw&amp;quot;, &amp;quot;_pc&amp;quot;, etc.).  Or, you can &lt;br /&gt;
    always just leave off the prefix, and MilkDrop will assume you &lt;br /&gt;
    want to do &amp;quot;_fw&amp;quot; - bilinear filtering and wrap mode - the defaults.&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== MILKDROP'S BUILT-IN TEXTURES - MAIN, BLUR, and NOISE =====&lt;br /&gt;
    MilkDrop has several built-in textures you can sample from.  &lt;br /&gt;
    &lt;br /&gt;
    MAIN&lt;br /&gt;
    ----&lt;br /&gt;
    First, there is the Main texture (the internal canvas).  As already &lt;br /&gt;
    mentioned, you can sample from it by using sampler_main or one&lt;br /&gt;
    of its variants.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== BLUR1, BLUR2, BLUR3 =====&lt;br /&gt;
&lt;br /&gt;
    Next, there are several blurred versions of the main texture.&lt;br /&gt;
    These are called Blur1, Blur2, and Blur3.  Each one is &lt;br /&gt;
    progressively blurrier.  You can access them using these special&lt;br /&gt;
    functions: &lt;br /&gt;
&lt;br /&gt;
        GetBlur1(uv)     // these take a float2 as input&lt;br /&gt;
        GetBlur2(uv)     // &amp;amp; return a float3 color value&lt;br /&gt;
        GetBlur3(uv)    &lt;br /&gt;
        &lt;br /&gt;
    GetBlur1 returns a slightly blurred image, GetBlur2 a more blurry image, &lt;br /&gt;
    and GetBlur3 an extremely blurry image.  A call to one of the GetBlur &lt;br /&gt;
    functions is very fast, but keep in mind that the blur textures are only &lt;br /&gt;
    generated each frame if the shaders actually use them, and the results&lt;br /&gt;
    find their way into the final output color value of the pixel shader!&lt;br /&gt;
    Blur1 is the fastest to generate; then Blur2 (because it is generated&lt;br /&gt;
    from Blur1); and finally, Blur3 is the slowest (generated from Blur2).    &lt;br /&gt;
    &lt;br /&gt;
    Here is an example of how to use one:&lt;br /&gt;
    &lt;br /&gt;
        float3 blurry = GetBlur2(uv);&lt;br /&gt;
    &lt;br /&gt;
    You could add this to your sample from the Main texture to&lt;br /&gt;
    produce a softer-looking image, for example.  Or, you could&lt;br /&gt;
    do an edge detect in the composite shader, by taking the &lt;br /&gt;
    [absolute value of the] difference between the crisp and blurred&lt;br /&gt;
    main textures:&lt;br /&gt;
    &lt;br /&gt;
        float3 crisp = tex2D(sampler_main, uv).xyz;&lt;br /&gt;
        float3 blurry = GetBlur1(uv);&lt;br /&gt;
        ret = abs( crisp - blurry )*4;&lt;br /&gt;
    &lt;br /&gt;
    The &amp;quot;skin dots&amp;quot; effect in some of the presets (it makes spots &lt;br /&gt;
    and stripes like you might see on fish or leopards, in nature)&lt;br /&gt;
    is based on a very mild edge-detect in the *warp* shader,&lt;br /&gt;
    and uses it to enforce a certain amount of variance in the &lt;br /&gt;
    color values.  It also serves to break up large areas of solid&lt;br /&gt;
    white pixels.&lt;br /&gt;
    &lt;br /&gt;
    Note that you can do some cool glow effects by raising the&lt;br /&gt;
    &amp;quot;min&amp;quot; values above 0.  Say, for example, you set blur1_min&lt;br /&gt;
    to 0.5.  That means that any pixels with color values below &lt;br /&gt;
    0.5 will get clipped to 0.5.  So, when you call GetBlur1(),&lt;br /&gt;
    it's going to give you values in the range [0.5 .. 1.0].  &lt;br /&gt;
    However, because you were only using half the range of possible&lt;br /&gt;
    values, the precision of these values will be twice as good.&lt;br /&gt;
    That's the purpose of the min/max values.  Watch out, though -&lt;br /&gt;
    having your values clipped to a minimum of 0.5 would look bad&lt;br /&gt;
    if you actually had colors that are over 0.5, and you're not &lt;br /&gt;
    subtracting that 0.5 off.&lt;br /&gt;
    &lt;br /&gt;
    However, if you do set a min and then subtract it off, you can &lt;br /&gt;
    also get some great glow effects, where only really&lt;br /&gt;
    bright pixels contribute to the &amp;quot;glow&amp;quot;  If you set the min to &lt;br /&gt;
    0.7, for example, and then sample like this:&lt;br /&gt;
        &lt;br /&gt;
        ret += (GetBlur1(uv) - blur1_min)*2;&lt;br /&gt;
        &lt;br /&gt;
    It will subtract off the 0.7 minimum threshold, but because&lt;br /&gt;
    of the clipping, you will basically just see the bright&lt;br /&gt;
    pixels &amp;quot;glowing&amp;quot;.  The *2 is just for a little extra glow.&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== NOISE TEXTURES =====&lt;br /&gt;
&lt;br /&gt;
    There are also &amp;quot;noise&amp;quot; (random value) textures built in to MilkDrop.  &lt;br /&gt;
    They are generated when MilkDrop starts, but only so the large amount&lt;br /&gt;
    of (random) data wouldn't bloat the size of the MilkDrop download.&lt;br /&gt;
    They vary in the quality (smoothness) of the noise, as well as&lt;br /&gt;
    how often the pattern repeats itself.  Always use the smallest&lt;br /&gt;
    possible noise texture (_lite or _lq versions) when possible.&lt;br /&gt;
    &lt;br /&gt;
    Here are the details on the six textures:&lt;br /&gt;
    &lt;br /&gt;
    NAME           DIMS  PIXELS    QUALITY&lt;br /&gt;
    ----           ----  ------    ---------&lt;br /&gt;
    noise_lq       2D    256x256   low&lt;br /&gt;
    noise_lq_lite  2D    32x32     low&lt;br /&gt;
    noise_mq       2D    64x64     medium&lt;br /&gt;
    noise_hq       2D    32x32     high&lt;br /&gt;
    noisevol_lq    3D    32x32x32  low&lt;br /&gt;
    noisevol_hq    3D    8x8x8     high&lt;br /&gt;
    &lt;br /&gt;
    Notice that four of them are two-dimensional (use tex2D(float2 uv) &lt;br /&gt;
    to sample them), and two of them are three-dimensional (use &lt;br /&gt;
    tex3D(float3 uvw) to sample them).  &lt;br /&gt;
    &lt;br /&gt;
    They come in at various sizes.  You should always use the smallest&lt;br /&gt;
    one necessary, to be video memory cache-friendly!&lt;br /&gt;
    &lt;br /&gt;
    The _lq, _mq, and _hq suffixes denote low, medium, or high quality.&lt;br /&gt;
    The _lq textures have one random value at every texel in the &lt;br /&gt;
    texture.  But the _mq textures have (generally) about four texels&lt;br /&gt;
    per random value, with high-quality [cubic] filtering baked into the &lt;br /&gt;
    texture.  (Sometimes you just want something better than bilinear&lt;br /&gt;
    filtering, you know?)  The high-quality textures usually have about&lt;br /&gt;
    8 texels for every random value.  The sizes given here, in pixels,&lt;br /&gt;
    are actually abstractions - they are the conceptual # of pixels&lt;br /&gt;
    (values) before repetition.  In reality, the textures are bigger &lt;br /&gt;
    (for medium &amp;amp; high quality), and the extra texels are all filled &lt;br /&gt;
    in using high-quality interpolation.  &lt;br /&gt;
    &lt;br /&gt;
    The higher-quality textures aren't any slower to use, as long as&lt;br /&gt;
    you're sampling them at the right frequency.  If you sample any&lt;br /&gt;
    of these at too high a frequency (i.e. tile them like crazy /&lt;br /&gt;
    multiply the UV's by a large number) your video memory texture&lt;br /&gt;
    cache will bring your GPU to a grinding halt.  Don't do it!&lt;br /&gt;
&lt;br /&gt;
    If using Noise textures with the default sampler settings (filtering &lt;br /&gt;
    and wrap), you don't need to declare them above the shader_body; they &lt;br /&gt;
    are always available.  However, if you want to sample them with &lt;br /&gt;
    special options (clamping or point sampling), then you do have to.  &lt;br /&gt;
    (ex: &amp;quot;sampler sampler_fc_noise_lq&amp;quot;, or &amp;quot;sampler_pw_noise_lq&amp;quot;).&lt;br /&gt;
    &lt;br /&gt;
    To sample a color value from a noise texture, add code like this:&lt;br /&gt;
    &lt;br /&gt;
        float4 noiseVal = tex2D(sampler_noise_lq, uv_orig );&lt;br /&gt;
        &lt;br /&gt;
    This returns a float4 of values in the [0..1] range.  However, the noise&lt;br /&gt;
    image will be stretched up so the 64x64 pixels cover the screen.  What we'd &lt;br /&gt;
    really like is to tile it so the noise values map 1:1 to pixels on the&lt;br /&gt;
    screen.  &lt;br /&gt;
    &lt;br /&gt;
    To do this, we need to invoke another handy feature: you can fetch the size &lt;br /&gt;
    of any texture in MilkDrop.  Just declare a float4 (still outside the shader &lt;br /&gt;
    body) with the name of the texture, preceded by &amp;quot;texsize_&amp;quot; - like this:&lt;br /&gt;
    &lt;br /&gt;
        float4  texsize_noise_lq;  // .xy = (w,h); .zw = (1/(float)w, 1/(float)h)&lt;br /&gt;
    &lt;br /&gt;
    Also, recall that the size of the Main canvas is universally available to&lt;br /&gt;
    all shaders, and looks like this: (this is auto-declared for you, by the way)&lt;br /&gt;
      &lt;br /&gt;
        float4 texsize       // .xy = (w,h); .zw = (1/(float)w, 1/(float)h)&lt;br /&gt;
    &lt;br /&gt;
    So, if we change our sampling code to look like this:&lt;br /&gt;
    &lt;br /&gt;
        float4 noiseVal = tex2D(sampler_noise_lq, uv_orig*texsize.xy*texsize_noise_lq.zw );&lt;br /&gt;
    &lt;br /&gt;
    It's going to do exactly that.  This is a very common and useful technique.  &lt;br /&gt;
    uv_orig gives you the original (unwarped)&lt;br /&gt;
    UV coordinates [0..1].  If we then multiply by texsize.xy, we get the &lt;br /&gt;
    pixel number we are on.  For example, if the screen was 1280 x 1024 pixels,&lt;br /&gt;
    we'd get float2 in the range [0..1279, 0..1023].  If we then multiply by&lt;br /&gt;
    texsize_noise_lq.zw, we're dividing by the size of the noise texture,&lt;br /&gt;
    in pixels (this one is 256x256).  So, we'd end up with UV coords roughly &lt;br /&gt;
    in the range [0..5, 0..4] - our image has been perfect tiled onto the&lt;br /&gt;
    screen, with the pixels displaying 1:1.&lt;br /&gt;
    &lt;br /&gt;
    This can be used to mix a bit of random noise into the image each frame, &lt;br /&gt;
    which can increase image quality - it's similar to error diffusion &lt;br /&gt;
    dithering (which is one of the things that set the original Geiss &lt;br /&gt;
    plugin/screensaver apart from the others, image-quality wise!).   You &lt;br /&gt;
    can ponder the reasons why.  Also, further adding &amp;quot;rand_frame.xy&amp;quot; to the &lt;br /&gt;
    UV coords will reposition the noise values every frame, making it seem&lt;br /&gt;
    like truly random [changing] noise:&lt;br /&gt;
    &lt;br /&gt;
        float2 noise_uv = uv_orig*texsize.xy*texsize_noise_lq.zw + rand_frame.xy;&lt;br /&gt;
        float4 noiseVal = tex2D(sampler_noise_lq, noise_uv);&lt;br /&gt;
    &lt;br /&gt;
    To add random dithering (which, statistically, is the same as error-&lt;br /&gt;
    diffusion dithering), try this:&lt;br /&gt;
    &lt;br /&gt;
        float2 uv_noise = uv_orig*texsize.xy*texsize_noise_lq.zw + rand_frame.xy;&lt;br /&gt;
        half4 noiseVal = tex2D(sampler_noise_lq, uv_noise);&lt;br /&gt;
        ret = tex2D(sampler_main, uv);&lt;br /&gt;
        ret += (noiseVal.xyz*2-1) * 0.01;&lt;br /&gt;
        &lt;br /&gt;
    This will add a good deal of noise into the image each frame.  Adding&lt;br /&gt;
    'rand_frame.xy' to the UV coordinate serves to randomly place&lt;br /&gt;
    the noise texture each frame, preventing the noise imprint from being&lt;br /&gt;
    exactly the same each frame, which would cause artifact buildup.&lt;br /&gt;
&lt;br /&gt;
    Important: Note that the medium- and high-quality textures should never be &lt;br /&gt;
    used for 1:1 mapping! - it is a huge waste.  You will only benefit from their&lt;br /&gt;
    higher quality if you are *zoomed in* on these textures, seeing them&lt;br /&gt;
    magnified, sampling them at a low frequency.  If they are minified &lt;br /&gt;
    (sampled at a high frequency / zoomed out of) or even displayed at 1:1, &lt;br /&gt;
    you will thrash your video memory cache and the preset will run very &lt;br /&gt;
    slow.&lt;br /&gt;
        &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
===== READING TEXTURES FROM DISK =====&lt;br /&gt;
&lt;br /&gt;
    Declaring and sampling from your own textures is easy.  First,&lt;br /&gt;
    create your texture.  If you plan on sharing your presets with&lt;br /&gt;
    other people, please make your texture SMALL (256x256 or less)&lt;br /&gt;
    and save it as a JPG file at 95% quality.  The file size should&lt;br /&gt;
    be between 10k and 50k (kilobytes).  Of course, the textures&lt;br /&gt;
    could be huge, crisp photos if you want - they will just be&lt;br /&gt;
    heavy (to send to other people) and will cause a little delay&lt;br /&gt;
    when you switch to a preset that uses them (and loads the texture).  &lt;br /&gt;
    &lt;br /&gt;
    Save the texture to the folder:&lt;br /&gt;
    &lt;br /&gt;
        c:\program files\winamp\plugins\milkdrop2\textures&lt;br /&gt;
        &lt;br /&gt;
    or wherever you installed Winamp and MilkDrop to.  Let's imagine&lt;br /&gt;
    you called your texture billy.jpg.&lt;br /&gt;
    &lt;br /&gt;
    Then, in any shader, above the shader_body section, declare a sampler &lt;br /&gt;
    for the texture:&lt;br /&gt;
    &lt;br /&gt;
        sampler sampler_billy;&lt;br /&gt;
        &lt;br /&gt;
    That's all you have to do.  It will find the file (billy.jpg)&lt;br /&gt;
    and load it.  Note that the sampler name DOES have to start with &lt;br /&gt;
    &amp;quot;sampler_&amp;quot;, and if you want, you could prefix it with &amp;quot;sampler_pc_&amp;quot; &lt;br /&gt;
    or &amp;quot;sampler_fw_&amp;quot; (or whatever) to turn on texture clamp and/or point &lt;br /&gt;
    sampling.  &lt;br /&gt;
    &lt;br /&gt;
    Texture formats supported include: [in order of priority]&lt;br /&gt;
        &lt;br /&gt;
        jpg   (great compression)&lt;br /&gt;
        dds   (a microsoft/directx format - very flexible - can even do 3D)&lt;br /&gt;
        png   (portable network graphics; can give you compress w/an alpha channel)&lt;br /&gt;
        tga   (truevision Targa - 1, 3, or 4 channels)&lt;br /&gt;
        bmp   (puke)&lt;br /&gt;
        dib   (puke)&lt;br /&gt;
        &lt;br /&gt;
    Now that you've declared the texture, you can sample it like this, &lt;br /&gt;
    from within the shader_body section:&lt;br /&gt;
    &lt;br /&gt;
        float3 mypixel = tex2D(sampler_billy, uv2).xyz;&lt;br /&gt;
        &lt;br /&gt;
    So first it will try to find billy.jpg; then billy.dds; and so&lt;br /&gt;
    on, until it finds a valid texture.  If the texture can not be&lt;br /&gt;
    found in the &amp;quot;milkdrop2\textures&amp;quot; directory, it will then also try&lt;br /&gt;
    to find it **in the current preset directory**; this is done so that&lt;br /&gt;
    preset downloaders can be lazy and just put the presets, along&lt;br /&gt;
    with the textures that come with them, into the same directory.&lt;br /&gt;
    &lt;br /&gt;
    If your shader wants to know how big the texture is, declare this&lt;br /&gt;
    (also above the shader_body section):&lt;br /&gt;
    &lt;br /&gt;
        float4 texsize_billy;    // .xy = (w,h); .zw = (1/w, 1/h)&lt;br /&gt;
        &lt;br /&gt;
    MilkDrop will see the &amp;quot;texsize_&amp;quot; prefix and automatically know what&lt;br /&gt;
    to do.  (You don't have to include the //comment, of course.)&lt;br /&gt;
    &lt;br /&gt;
    To stretch this texture to cover the screen, do this (in the shader&lt;br /&gt;
    body):&lt;br /&gt;
&lt;br /&gt;
        ret = tex2D(sampler_billy, uv).xyz;&lt;br /&gt;
    &lt;br /&gt;
    Or to map it fitted to the screen, aspect-aware:&lt;br /&gt;
    &lt;br /&gt;
        ret = tex2D(sampler_billy, uv * aspect.xy).xyz;&lt;br /&gt;
    &lt;br /&gt;
    Or to tile it so the pixels are represented 1:1:&lt;br /&gt;
    &lt;br /&gt;
        ret = tex2D(sampler_billy, uv * texsize.xy * texsize_billy.zw).xyz;&lt;br /&gt;
        &lt;br /&gt;
    Or to map it tiled exactly 5 times:&lt;br /&gt;
&lt;br /&gt;
        ret = tex2D(sampler_billy, uv * 5).xyz;&lt;br /&gt;
&lt;br /&gt;
    Or to zoom into the center 20% of the image:&lt;br /&gt;
&lt;br /&gt;
        ret = tex2D(sampler_billy, (uv-0.5)*0.2 + 0.5 ).xyz;&lt;br /&gt;
        &lt;br /&gt;
    Of course, you could also declare sampler_pw_billy, to do point&lt;br /&gt;
    sampling, or sampler_fc_billy, for clamping, and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
===== RANDOM TEXTURE SELECTION =====&lt;br /&gt;
    ------------------------&lt;br /&gt;
    You can also load in a random texture.  Just use the name &amp;quot;rand00&amp;quot;&lt;br /&gt;
    through &amp;quot;rand15&amp;quot; as the filename, and MilkDrop will pick a random&lt;br /&gt;
    file and do the rest.  The texsize_ parameters work too.  For example:&lt;br /&gt;
    &lt;br /&gt;
        sampler sampler_rand07;&lt;br /&gt;
        float4  texsize_rand07;&lt;br /&gt;
                &lt;br /&gt;
        shader_body &lt;br /&gt;
        {    &lt;br /&gt;
          ...&lt;br /&gt;
          float3 color = tex2D(sampler_rand07, uv);&lt;br /&gt;
          ...&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
    You can also choose from random subsets of textures on disk!  Say you&lt;br /&gt;
    have a whole slew of random textures in your textures\ subdirectory,&lt;br /&gt;
    but you have a subset in there that begin with the word &amp;quot;smalltiled&amp;quot;.&lt;br /&gt;
    If you specify:&lt;br /&gt;
    &lt;br /&gt;
        sampler sampler_rand02_smalltiled;&lt;br /&gt;
        float4  texsize_rand02;    // ...it's smart enough to get it from just this.&lt;br /&gt;
        &lt;br /&gt;
        shader_body &lt;br /&gt;
        {    &lt;br /&gt;
          ...&lt;br /&gt;
          float3 color = tex2D(sampler_rand07_smalltiled, uv);&lt;br /&gt;
          ...&lt;br /&gt;
        }&lt;br /&gt;
    &lt;br /&gt;
    Then every time the preset loads (or the shader is recompiled), it's&lt;br /&gt;
    going to pick a new random texture, but it will choose only from the&lt;br /&gt;
    subset of those textures whose names begin with &amp;quot;smalltiled&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
    One last thing, a tip: if you are working in windowed mode (or multimon)&lt;br /&gt;
    and added textures to the directory and haven't yet exited the plugin, &lt;br /&gt;
    to force the list of textures to update itself, edit one of the shaders &lt;br /&gt;
    (any shader) and then hit CTRL+ENTER (accept).  That will trigger it&lt;br /&gt;
    to rescan the directory (but only if it needs to, because your shaders&lt;br /&gt;
    ask for random textures).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
==== MISC. COOL SHADER TRICKS ====&lt;br /&gt;
    &lt;br /&gt;
AUTO CENTER DARKENING&lt;br /&gt;
&lt;br /&gt;
MilkDrop 1 had a cool feature, &amp;quot;center darken&amp;quot;, that would quickly dampen &lt;br /&gt;
bright pixels placed at the center of the screen, because in &amp;quot;zoomy&amp;quot; &lt;br /&gt;
(forward motion) presets, the screen would quickly become all white&lt;br /&gt;
if you didn't.  As presets get more sophisticated, though, where the&lt;br /&gt;
&amp;quot;center&amp;quot; of the zooming motion is can be very hard to pinpoint.&lt;br /&gt;
        &lt;br /&gt;
You can actually find it algorithmically.  Wherever on the screen you&lt;br /&gt;
have warped UV coordinates that are very close to the original UV&lt;br /&gt;
coordinates, it means there's either no motion there, or it's the&lt;br /&gt;
center of motion - you'll know, based on what kind of preset you're&lt;br /&gt;
writing.  If it's a &amp;quot;zoomy&amp;quot; preset, it's probably the latter.  In this&lt;br /&gt;
case, just use something like this in your warp shader:&lt;br /&gt;
        &lt;br /&gt;
 // this darkens the pixels at the center of the zoom, only&lt;br /&gt;
 ret *= 0.97 + 0.03*saturate( length(uv - uv_orig)*200 );  &lt;br /&gt;
&lt;br /&gt;
RANDOM DIFFUSION DITHER&lt;br /&gt;
&lt;br /&gt;
See above, in the &amp;quot;noise&amp;quot; section.&lt;br /&gt;
&lt;br /&gt;
       &lt;br /&gt;
SOFT MAX&lt;br /&gt;
&lt;br /&gt;
The max(a,b) function returns the max. value for each channel &lt;br /&gt;
of the two inputs, however, this can have a discontinuous&lt;br /&gt;
look sometimes, as it switches from a to b or back suddenly.&lt;br /&gt;
If you want a not-so-accurate, but smoother, max function,&lt;br /&gt;
try this:&lt;br /&gt;
        &lt;br /&gt;
 a + b - a*b&lt;br /&gt;
        &lt;br /&gt;
Note that the inputs must be in the [0..1] range.&lt;br /&gt;
&lt;br /&gt;
==== QUALITY ASSURANCE FOR SHADERS ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*Please*&amp;lt;/nowiki&amp;gt; adhere to these guidelines when writing shaders...&lt;br /&gt;
# use small (256x256 or less) textures; save as jpg 95% so your presets are small to download, and so they load w/o a pause.&lt;br /&gt;
# make sure your shaders are zippy.  &lt;br /&gt;
#* avoid 'if' statements.&lt;br /&gt;
#* avoid &amp;quot;massive zoom-outs&amp;quot; of any texture.  Sampling textures at too high a frequency thrashes your texture cache and will drop your framerate like mad.  Sample things near 1:1, or feel free to zoom in close on them, but avoid extreme zoom-outs.&lt;br /&gt;
#* avoid sin() and cos() functions if you can.  If their inputs don't vary from pixel to pixel, calculate the sin/cos values in the per-frame equations, then store them in q1-q32, and read them into your shader from there.&lt;br /&gt;
#* any calculation that results in the same value for all pixels on the screen should be offloaded into MilkDrop's per-frame equations, then passed to the shader via the q1-q32 variables. These variables are directly accessible from all shaders (q1, q2, etc.) and can also be read in as float4's for convenience (q1-q4 make up a float4 called _qa; q5-q8 come together in _qb; etc.).&lt;br /&gt;
#* also avoid doing motion/warping calculations in the warp shader, that you could do in the per-vertex equations.  Those run on the CPU, which is a huge resource that is almost never completely used; the GPU, although processing 1,000 times as much math because it works per-pixel instead of per-vertex, can use as much of a break as it can get.  Any low-frequency effects (values that vary slowly over the screen) should go in the per-vertex equations, and only the high-frequency component of the motion or warping should come from the pixel shader.&lt;br /&gt;
#* keep in mind that the DirectX shader compiler is superb at optimizing; anything that can be thrown out, will be.  Things like &lt;br /&gt;
 ret *= 1.0;&lt;br /&gt;
 ret += 0;&lt;br /&gt;
 ret += tex2D(mytex, uv).xyz * 0;&lt;br /&gt;
will completely disappear.  If you sample a texture and then the&lt;br /&gt;
sample doesn't end up making it into the final output color value,&lt;br /&gt;
the texture will never even get bound (or loaded from disk), &lt;br /&gt;
let alone sampled.  And so on.&lt;br /&gt;
#* you can use the 'half' type wherever you don't need full 'float' &lt;br /&gt;
precision.  Generally use 'float' for UVs and time values, and &lt;br /&gt;
'half' for almost everything else.  However, don't stress about it &lt;br /&gt;
too much, because most GPUs run&lt;br /&gt;
everything at full-precision &amp;amp; full-speed nowadays - and for the&lt;br /&gt;
older GPUs that don't, the driver is probably very smart (if it's&lt;br /&gt;
an Nvidia or ATI card) about auto-substituting halfs for floats&lt;br /&gt;
wherever possible.            &lt;br /&gt;
# before sharing your presets, please make sure they look good in a &lt;br /&gt;
SQUARE or WIDESCREEN window.  If they don't, scan these guidelines&lt;br /&gt;
and you will probably be able to easily fix it.&lt;br /&gt;
          &lt;br /&gt;
The overall design goal in MilkDrop, concerning aspect ratio, is to &lt;br /&gt;
fit the preset to the long axis of the window, and to crop the rest, &lt;br /&gt;
but to do all of this without any stretching or zooming (so all internal &lt;br /&gt;
canvas pixels map 1:1 to screen pixels).  &lt;br /&gt;
          &lt;br /&gt;
-per-frame/per-vertex equations: &lt;br /&gt;
* multiply XY coords by the values &amp;quot;aspectx&amp;quot; and &amp;quot;aspecty&amp;quot;, respectively.&lt;br /&gt;
          &lt;br /&gt;
-shader code: &lt;br /&gt;
* multiply UV coordinates by 'aspect.xy', prior to using them&lt;br /&gt;
to sample a texture, to make the texture fit on the screen properly.&lt;br /&gt;
(For example, if the screen is wide, the image will be fitted to cover&lt;br /&gt;
the width of the screen, and it will be cropped at the top and bottom.)&lt;br /&gt;
            &lt;br /&gt;
* multiply by 'aspect.zw' to make it fit the other way (it will fit&lt;br /&gt;
the image to be completely visible in one dimension, and tiled in the&lt;br /&gt;
other direction).	 &lt;br /&gt;
            &lt;br /&gt;
* any time you perturb the UV coordinates in the warp shader, prior to&lt;br /&gt;
sampling the Main texture, you should multiply the &amp;quot;delta&amp;quot; you are applying&lt;br /&gt;
by aspect.xy.  Otherwise, in a widescreen window, the &amp;quot;delta&amp;quot; will actually&lt;br /&gt;
be dramatically squished, or in a tall window, the change would be &lt;br /&gt;
elongated very vertically.  &lt;br /&gt;
&lt;br /&gt;
* the 'ang' value is aspect-aware, in the per-vertex equations, as well&lt;br /&gt;
as in the warp and composite shaders.  However, if you generate your own&lt;br /&gt;
high-quality &amp;quot;ang&amp;quot; value using atan2(), beware - you really&lt;br /&gt;
should multiply the UV's by aspect.xy beforehand, like this:&lt;br /&gt;
 float2 uv2 = (uv-0.5)*aspect.xy;&lt;br /&gt;
 float ang = atan2(uv2.y,uv2.x);&lt;br /&gt;
&lt;br /&gt;
=== QUALITY ASSURANCE ===&lt;br /&gt;
When designing presets, please adhere to the pixel shader 'quality assurance'&lt;br /&gt;
guidelines in the above section, as they are very important.  But, in order &lt;br /&gt;
to make sure the presets you create work well on other systems, please&lt;br /&gt;
also keep in mind:&lt;br /&gt;
        &lt;br /&gt;
# Keep your presets fast.  There's nothing to spoil the mood like a preset popping up that chokes at 10 fps.  Since division is 11 times slower than multiplication (or addition/subtraction), if you divide a bunch of values by one other value, pre-divide that value (&amp;quot;inv = 1/myval;&amp;quot;) and then multiply those other values by that inverse.  Also, never put computations in the per-vertex code that are the same for every pixel; move these into the per-frame code, and carry the results to the per-vertex code using the q1-q32 variables.  Remember that maxim: &amp;quot;If a per-vertex equation doesn't use at least one of the variables { x, y, rad, ang }, then it should be actually be a per-frame equation.&amp;quot;&lt;br /&gt;
# Design your presets using the default mesh size option from the config panel, or at least check, before you distribute them, to make sure they look correct at the default mesh size.  If your mesh is too coarse (small), then a viewer with the default mesh size might see unexpected &amp;quot;bonus&amp;quot; effects that you might not have intended, and might mess up your preset.  If your mesh is too fine, then a viewer with the default might not see all the detail you intended, and it might look bad.&lt;br /&gt;
# Try to design your presets in a 32-bit video mode, so that its brightness levels are standard.  The thing to really watch out for is designing your presets in 16-bit color when the &amp;quot;fix pink/white color saturation artifact&amp;quot; checkbox is checked.   checkbox keeps the image extra dark to avoid color saturation, which is only necessary on some cards, in 16-bit color.  If this is the case for you, and you write a preset, then when you run it on another machine, it might appear insanely bright.        &lt;br /&gt;
# Don't underestimate the power of the 'dx' and 'dy' parameters (in the per-vertex equations).  Some of the best presets are based on using these.  If you strip everything out of a preset so that there's no motion at all, then you can use the dx and dy parameters to have precise manual control over the motion.  Basically, all the other effects (zoom, warp, rot, etc.) are just complicated abstractions; they could all be simulated by using only { x, y, rad, ang } and { dx, dy }.        &lt;br /&gt;
# If you use the 'progress' variable in a preset, make sure you try the preset out with several values for 'Time Between Auto Preset Changes'.  The biggest thing to avoid is using something like sin(progress), since the rate at which 'progress' increases can vary drastically from system to system, dependong on the user's setting for 'Time Between Auto Preset Changes'.&lt;br /&gt;
# if writing shaders, please also see the 'Quality Assurance for Shaders' section above.&lt;br /&gt;
&lt;br /&gt;
=== DEBUGGING ===&lt;br /&gt;
One feature that preset authors should definitely be aware of is the variable monitoring feature, which lets you monitor (watch) the value of any per-frame variable you like.  First, hit the 'N' key to show the monitor value, which will probably display zero.  Then all you have to do is add a line like this to the per-frame equations:&lt;br /&gt;
&lt;br /&gt;
        monitor = x;&lt;br /&gt;
&lt;br /&gt;
where 'x' is the variable or expression you want to monitor.  Once you hit CTRL+ENTER to accept the changes, you should see the value of the per-frame variable or expression in the upper-right corner of the screen!&lt;br /&gt;
&lt;br /&gt;
Once again, note that it only works for *per-frame* equations, and NOT for per-vertex equations.&lt;br /&gt;
&lt;br /&gt;
=== FUNCTION REFERENCE ===&lt;br /&gt;
Following is a list of the functions supported by the expression evaluator (for preset init, per-frame, and per-vertex equations; NOT for pixel shaders).  The list was blatently ripped from the help box of Justin Frankel's AVS plug-in, since MilkDrop uses the expression evaluator that he wrote.&lt;br /&gt;
    &lt;br /&gt;
        Format your expressions using a semicolon (;) to delimit between statements.        &lt;br /&gt;
        Use parenthesis ['(' and ')'] to denote precedence if you are unsure.        &lt;br /&gt;
        The following operators are available:        &lt;br /&gt;
            = : assign        &lt;br /&gt;
            +,-,/,* : plus, minus, divide, multiply        &lt;br /&gt;
            | : convert to integer, and do bitwise or        &lt;br /&gt;
            &amp;amp; : convert to integer, and do bitwise and        &lt;br /&gt;
            % : convert to integer, and get remainder        &lt;br /&gt;
        The following functions are available:        &lt;br /&gt;
            int(var)   :  returns the integer value of 'var' (rounds toward zero)&lt;br /&gt;
            abs(var)   :  returns the absolute value of var&lt;br /&gt;
            sin(var)   :  returns the sine of the angle var (expressed in radians)        &lt;br /&gt;
            cos(var)   :  returns the cosine of the angle var        &lt;br /&gt;
            tan(var)   :  returns the tangent of the angle var        &lt;br /&gt;
            asin(var)  :  returns the arcsine of var        &lt;br /&gt;
            acos(var)  :  returns the arccosine of var        &lt;br /&gt;
            atan(var)  :  returns the arctangent of var        &lt;br /&gt;
            sqr(var)   :  returns the square of var        &lt;br /&gt;
            sqrt(var)  :  returns the square root of var        &lt;br /&gt;
            pow(var,var2) : returns var to the power of var2        &lt;br /&gt;
            log(var)      : returns the log base e of var        &lt;br /&gt;
            log10(var)    : returns the log base 10 of var        &lt;br /&gt;
            sign(var)     : returns the sign of var or 0        &lt;br /&gt;
            min(var,var2) : returns the smalest value        &lt;br /&gt;
            max(var,var2) : returns the greatest value        &lt;br /&gt;
            sigmoid(var,var2) : returns sigmoid function value of x=var (var2=constraint)        &lt;br /&gt;
            rand(var)     : returns a random integer modulo 'var'; e.g. rand(4) will return 0, 1, 2, or 3.&lt;br /&gt;
            bor(var,var2) : boolean or, returns 1 if var or var2 is != 0        &lt;br /&gt;
            bnot(var)  : boolean not, returns 1 if var == 0 or 0 if var != 0        &lt;br /&gt;
            if(cond,vartrue,varfalse) : if condition is nonzero, returns valtrue, otherwise returns valfalse        &lt;br /&gt;
            equal(var,var2) : returns 1 if var = var2, else 0        &lt;br /&gt;
            above(var,var2) : returns 1 if var &amp;gt; var2, else 0        &lt;br /&gt;
            below(var,var2) : returns 1 if var &amp;lt; var2, else 0            &lt;br /&gt;
            &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return to top&lt;br /&gt;
return to milkdrop.html&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/File:Milkdrop.png</id>
		<title>File:Milkdrop.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/File:Milkdrop.png"/>
				<updated>2008-08-26T16:24:28Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: uploaded a new version of &amp;quot;Image:Milkdrop.png&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Random_API</id>
		<title>Random API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Random_API"/>
				<updated>2008-08-20T17:01:38Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Agave/Random/api_random.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Agave/Random/api_random.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Language_API</id>
		<title>Language API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Language_API"/>
				<updated>2008-08-20T17:01:13Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Agave/Language/api_language.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Agave/Language/api_language.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Album_Art_API</id>
		<title>Album Art API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Album_Art_API"/>
				<updated>2008-08-20T17:00:30Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Agave/AlbumArt/api_albumart.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Agave/AlbumArt/api_albumart.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/XML_Parser_Object</id>
		<title>XML Parser Object</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/XML_Parser_Object"/>
				<updated>2008-08-20T16:55:09Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: xml/obj_xml.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;xml/obj_xml.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/System_Callbacks_API</id>
		<title>System Callbacks API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/System_Callbacks_API"/>
				<updated>2008-08-20T16:53:29Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: api/syscb/api_syscb.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;api/syscb/api_syscb.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Skin_API</id>
		<title>Skin API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Skin_API"/>
				<updated>2008-08-20T16:53:14Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: api/skin/api_skin.h  Modern Skin API.  Only present when gen_ff is loaded.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;api/skin/api_skin.h&lt;br /&gt;
&lt;br /&gt;
Modern Skin API.  Only present when gen_ff is loaded.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Service_Manager_API</id>
		<title>Service Manager API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Service_Manager_API"/>
				<updated>2008-08-20T16:52:11Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: api/service/api_service.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;api/service/api_service.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Memory_Manager_API</id>
		<title>Memory Manager API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Memory_Manager_API"/>
				<updated>2008-08-20T16:51:18Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;api/memmgr/api_memmgr.h&lt;br /&gt;
&lt;br /&gt;
To make it easier for one plugin to allocate memory that another frees, there is a common memory manager.  It is used mostly by the [[Image Loader Service|image loading services]] and the [[Album Art API]], but is used a few other places also.&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Image_Writer_Service</id>
		<title>Image Writer Service</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Image_Writer_Service"/>
				<updated>2008-08-20T15:35:57Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: api/service/svcs/svc_imgwrite.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;api/service/svcs/svc_imgwrite.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Image_Loader_Service</id>
		<title>Image Loader Service</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Image_Loader_Service"/>
				<updated>2008-08-20T15:35:22Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Include file: api/service/svcs/svc_imgload.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Include file: api/service/svcs/svc_imgload.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Text_Feed_Service</id>
		<title>Text Feed Service</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Text_Feed_Service"/>
				<updated>2008-08-20T15:28:04Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Include file: api/service/svcs/svc_textfeed.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Include file: api/service/svcs/svc_textfeed.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/File_Reader_Service</id>
		<title>File Reader Service</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/File_Reader_Service"/>
				<updated>2008-08-20T15:25:03Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: Include file: api/service/svcs/svc_fileread.h&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Include file: api/service/svcs/svc_fileread.h&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	<entry>
		<id>http://wiki.shoutcast.com/wiki/Application_API</id>
		<title>Application API</title>
		<link rel="alternate" type="text/html" href="http://wiki.shoutcast.com/wiki/Application_API"/>
				<updated>2008-08-20T15:17:31Z</updated>
		
		<summary type="html">&lt;p&gt;Benski: New page: == Application API == Interface name: api_application  Related interfaces: ifc_messageprocessor  Include file: api/application/api_application.h  Related files: api/application/ifc_message...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Application API ==&lt;br /&gt;
Interface name: api_application&lt;br /&gt;
&lt;br /&gt;
Related interfaces: ifc_messageprocessor&lt;br /&gt;
&lt;br /&gt;
Include file: api/application/api_application.h&lt;br /&gt;
&lt;br /&gt;
Related files: api/application/ifc_messageprocessor.h&lt;br /&gt;
&lt;br /&gt;
GUID name: applicationApiServiceGuid&lt;br /&gt;
&lt;br /&gt;
GUID: {23B96771-09D7-46d3-9AE2-20DCEA6C86EA}&lt;/div&gt;</summary>
		<author><name>Benski</name></author>	</entry>

	</feed>