By Tom Morris
Download the code HERE.
RELEASE NOTES Nov. 5, 1999
This release represents another incremental improvement over previous versions of SoundMgr. Version 1.2 now handles
AreaSound entities. In order to accomodate positional and realtime sound handling, I had to modify the SoundMgr,
Introduction, and the BGSound functions. So, if you have a previous version of SoundMgr in your app, you will have
to upgrade. The places where you have added SoundIndex and bitmap file info are unchanged from versoin 1.1, so
you can just cut and paste that stuff from that previous version. If you are upgrading from the initial version
(un-numbered ver. 1.0), then this version of SoundMgr will be much different and much better.
Next up, weapons and actor sounds. I hope that my future implementation of these sound types won't require yet
another set of architectural changes to SoundMgr.
INSTALLATION INSTRUCTIONS
1. Unzip the SoundMgr_1_2.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:
AreaSound.c
AreaSound.h
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
AreaSound.h
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 AreaSound.h and BGSound.h and read the instructions for setting up gEdit so you will be able to install
AreaSounds and Background sounds into you ProjectX levels.
6. In InitGenesis.c, add the following includes:
#include "SoundMgr.h"
#include "AreaSound.h"
#include "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");
// Create Area Sound Entities
AreaSound_Spawn(Engine, World, SMgr);
if (!AreaSound_Spawn)
GenVS_Error("Area 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 includes:
#include "SoundMgr.h"
#include "AreaSound.h"
Still in ProjectX.c, add the following statement in the MainLoop() fuction.
AreaSound_Modify(World, &ViewXForm); // Make sure it comes AFTER the SetupViewXForm()
call.
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