By Tom Morris
Download the code HERE.
RELEASE NOTES Oct. 29, 1999
This version of SoundMgr is much different from the first release of a couple of weeks ago. I have tried to make
the installation more modular so as to minimize the potential for adverse impact on your ProjectX files. The Introduction
function has been moved from the ProjectX.c file into its own Introduction.c file. I have extensively reworked
the SoundMgr function to make it more versatile and more useful for handling Introduction sounds as well as sound
effects from entities in your level. To demonstrate the beginnings of entity functionality, I have included BGSound.c
and h. These files were inspired by Anthony Chetta's Background Sound tutorial. But I had to make extensive modifications
in order to flow sound control through a single pipeline (i.e., SoundMgr_DoSound).
I am not finished with SoundMgr for ProjectX. I still must integrate more dynamic entity sound effects such as
Area Sounds, Actor sounds, Weapons sounds, Door Sounds and more. This will require getting dynamic 3-dimensional
positional data and playing the sounds in relation to the listener's (player's) spatial distance from the sound
source. This will be a little bit harder job.
INSTALLATION INSTRUCTIONS
1. Unzip the SoundMgr_1_1.zip file.
2. Using Windows Explorer or any other file management app, copy the following files to the root directory of your
ProjectX app. Then open up your ProjectX app in MSVC and add them to the appropriate Source File and Header File
locations in your File View window:
BGSound.c
BGSound.h
Introduction.c
Introduction.h
SoundMgr.c
SoundMgr.h
3. You will need to edit or at least open the following files:
SoundMgr.c
BGSound.h
InitGenesis.c
ProjectX.c
The Instructions for these edits are presented below.
4. In SoundMgr.c, do the following:
In the LoadSounds() function, specify the wav files you want. Make sure these files are in the directory you specify
or you'll get bumped back to the desktop at loadtime.
5. Open BGSound.h and read the instructions for setting up gEdit so you will be able to install Background sounds
into you ProjectX levels.
6. In InitGenesis.c, add the following includes:
SoundMgr.h
BGSound.h
7. Still in InitGenesis.c, add the following statements to the InitGenesis() function, like so:
Camera = geCamera_Create(2.0f, &Rect);
if (!Camera)
{
MessageBox(mainwindowhandle,"No Camera","Error", MB_OK);
_exit(-1);
}
//Insert SoundMgr code starting here======================================
//initialize SoundMgr and link it to the the game window
SMgr = SoundMgr_Create(mainwindowhandle);
LoadSounds(SMgr);
// End of this part of code add============================================
//Load up a good starting level
LoadLevel("levels\\professor_winthrop.bsp");
// LoadLevel("levels\\gedit1.bsp");
// LoadLevel("levels\\genvX.bsp");
// Insert SoundMgr code starting here======================================
// Create Background Sound Entity
(BGSound_Spawn(Engine, World, SMgr));
if (!BGSound_Spawn)
GenVS_Error("Background Sound Spawn Failed");
// End of this part of code add============================================
// load a figure model and insert into the game
LoadPlayerActor();
8. In ProjectX.c (or your app's main file), do the following:
Add the following include:
#include "SoundMgr.h"
Still in ProjectX.c, add the following statement to the KillApp() function:
SoundMgr_Destroy(SMgr);
Still in ProjectX.c, add the following statement to the WinMain() function like so:
// initialize the hud
// LoadHUD (Engine, CWidth, CHeight);
// if (!LoadHUD)
// GenVS_Error("Failed to loadHUD");
// Begin code for SoundMgr and Introduction==================================
// play an introduction with sound and pictures
Introduction();
// End of this part of code add============================================
// do everything
MainLoop();
END OF INSTALLATION INSTRUCTIONS