Advertisement Jump to content


This topic is now archived and is closed to further replies.


Sound Management

This topic is 6384 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to design a system that will let me manage DirectSound buffers and wave files easily. My first thought was to implement an OOP version of Microsoft's DSUtil.h/.c files, which allow the creation of 'SoundObjs' that make the use of duplicate sound buffers easier to manage. However, I recognized a few problems with this. The biggest was that although a game object could play a sound easily, it could not stop it, for example, when the object had been destroyed. To fix this, I considered changing the SoundObj:: Play() method to return an index that could later be used by the Stop() method to stop a specific sound. Under this new system, a game object could keep a list of the indexes returned by Play() and then use them when calling Stop(). The problem with this, obviously, is that the indexes would remain in the game object's list even after they had finished playing or the SoundObj had given them away to some other object. So then I thought of maybe sending a this pointer to the Play() function so that the SoundObj could notify the game object when its index had expired, but this is a very unelegant solution. I've run out of ideas for the time being, so I thought I'd ask how everyone else manages their sounds. What sort of systems do you use, and do you have any suggestions for how I could fix mine? Edited by - TookH on July 21, 2001 4:10:49 AM

Share this post

Link to post
Share on other sites
I decided on a similar approach to my audio manager.

What I have is the audio manager, which has a set of resources management functions (e.g. loaders etc) and it has an array of audio objects, which can be either music files/wave files etc.

This means some simple sound playing can be done like this:

Audio->Load(1, "BOOM.WAV); // 1 is the sound ID.


Or, more complicated usage can be used;

A game with two tanks.
Both use the same fire sound.
But, what if both need to play at the same time?!?!?

AudioObject *ClonedSound;

Audio->Load(1, "BOOM.WAV); // 1 is the sound ID.

Audio->Clone(1, &ClonedSound); // Clone independant sound, but sharing data

Audio->Play(1); // Play Original Sound

ClonedSound->Play(); // Play Cloned Sound

And so on. I hope this gives you a few ideas.
Good luck!


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!