Name: How to make Quake play MP3 files. Author: Rich Whitehouse E-mail: thefatal@telefragged.com Homepage: http://www.telefragged.com/thefatal/ COPYRIGHTS/PERMISSIONS: This source code cannot be used in anyway without giving me (the author) full credit for its use. It can be distributed freely as long as the distribution includes this text file. This source code is distributed under the GPL (gnu public license, see gnu.txt for details) just as the original Quake source code. ---------------------------------------------------------------------- First go to the following URL to get the MP3 support files to add to your project: http://tux.telefragged.com/file.pl?filename=mp3qsrc.zip&dir=telefragged/thefatal/ This tutorial is based on the QuakeWorld client. It can probably be used in WinQuake/GLQuake using a similar or maybe even exact method. You'll need to download the Xaudio SDK (that is the engine I chose to use since it's the only decent free-to-use one I could find). You can get it here, as of this writing: http://www.xaudio.com/developers/ I used the version 3.0.7 for Win95/98/NT package. After you download it, find the xaudio.dll and xa_dsound_output.dll files in the archive and go ahead and stick them in your Quake directory right off, since the executable we'll be building is going to need them both. Now, shove all the header files and such into your QuakeWorld client source code folder, as well as the appropriate xaudio.lib file (you'll need to link it to your project). Now that that's done, open up your QW client project. Go to settings and click the General tab, then select "Use MFC in a Shared DLL" in the list box. Next click "Link" and add xaudio.lib to the list of object/library modules. Click OK, since you're done here. NOTE: You may have to add /nodefaultlib:"libcd.lib" into the linker settings as well if you get linker errors when you compile. Now add the snd_mp3.cpp file that was in mp3qsrc.zip to the project. Make sure it's in your QW client source code folder also, along with the externc.h file that was included in mp3qsrc.zip. Now it's time to put some changes into your existing source code. Here are changes to the existing source that you'll need to make. ------------------------------------------------------------- CL_MAIN.C --------- Above CL_Init, add this: void MP3_Stop(void); void MP3_Start(void); Under the Cvar_RegisterVariable (&noaim); line, add this: Cmd_AddCommand("mp3_start", MP3_Start); Cmd_AddCommand("mp3_stop", MP3_Stop); SND_WIN.C --------- In sndinitstat SNDDMA_InitDirect (void), change this: shm->speed = 11025; to this: shm->speed = 44100; Unless you want the MP3 playing at Quake's inferior default quality. In qboolean SNDDMA_InitWav (void) do the same thing by changing this: shm->speed = 11025; to this: shm->speed = 44100; SND_DMA.C --------- Find the int called desired_speed that is being set to 11025. Change it to 44100 (again for MP3 quality). ------------------------------------------------------------- After you've done all that, save everything and compile. Hopefully it will all compile together ok. Put your new executable in your Quake folder and run it, then try typing mp3_start in the console (where filename would be something like c:\music\mp3\song.mp3) and the MP3 file (providing you typed in the path right) should begin to play. -Rich