Programming Information

Purpose

To be straight forward and blunt: Winamp visualization plugins are cool. Writing one can be a pain in the butt trying to get the basic stuff off the ground, stuff like creating a window, connecting to Winamp, reading keyboard input and so on. The SDK that Justin provides is great but the leap from a 2D GDI example to 3D is a little frightening. Hopefully by releasing some sample code this will help more people create better and better plug-ins.

If you find this useful please send me email. And if you find bugs or write improvements please send them to me so that I can add them. I want this to evolve into a collaberative effort.

Technology

I had to make some technology decisions when starting out on this project. I choose Direct X, partly because I already know COM and partly because I did not want to be stuck with particular hardware the way that Glide is. I used the DirectX 6 SDK, the latest version at the time I write this. You can order the SDK from Microsoft. You will need that to compile my code.

Direct X 6 isn't available on Windows NT at the time of writing, so you'll need to use Windows 98.

I used Direct 3D Retained Mode. This provides a higher level access to the 3D world than Intermediate Mode. So far I've been able to do everything with that, but if the need arises it will be possible to mix both technologies. Direct Draw would be the way to go for cool tripy 2D graphics, but at the moment I don't deal with that.

I compiled with Microsoft VC 6.0. I was tempted to use MFC to do the configuration dialog, but I'm worried about people not having the latest MFC DLLs on their machine.

Update - July 2000

DirectX 8 is the current release. Unfortunately Direct3D retained mode is no longer an official part Direct3D. I found the following on the internet: "Note: Microsoft is no longer doing development work on Direct3D retained mode; however, it will continue to support this DirectX component in the foreseeable future."

Unfortunately "Immediate Mode" Direct3D is much more low level and harder to program.

Open GL

OpenGL was my other option for writing this plugin, and in the future I might write a plugin using it instead. The amount of code and trouble that I've been through even to get a basic full screen with hardware acceleration going using Direct 3D is reason enough to try other options.

Installation

To play the plugin just use the DLL provided. To compile your own changes you will need to get your build environment set up.

 

Adjusting the code

Resources

If anyone knows of any really good Direct 3D books I'd love to hear from you, I haven't been impressed by anything I've seen so far.

 

 

Debugging

Have fun. Debugging this kind of app is not easy. Firstly you can't use Windows NT yet so you might do some rebooting of Windows 98.

It won't take you long to realize that its a pain to debug full screen Plugins. Recommendation is to develop a windowed version first. I've read that you need to debug full screen Direct Draw by using a remote machine - I'll update this with some info if I get that up and running. Another interesting possibility is trying to get a Dual monitor setup in Windows 98 - you might be able to run the plugin on the primary display and VC on the secondary.

Setting a breakpoint in VC:

I've added optional code to kill the application after a few seconds everytime it runs. This can be useful if your program is locking the screen and then freezing every time it runs! To turn it on find the defines in the main header file and uncomment them. 1