Good sound storage method

This is a discussion on Good sound storage method within the Game Programming forums, part of the General Programming Boards category; I'm looking for a good way to store the sounds that will be used in my engine. I could store ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,597

    Good sound storage method

    I'm looking for a good way to store the sounds that will be used in my engine.

    I could store them in an array of DXSoundSamples, which is my class that handles loading sounds and creating the secondary buffers for them. Problem is that all sounds would have to be loaded into memory at startup. Benefit is that it would be easy to find which sample is to be played -> DXSound->Play(int sound_num).

    Or I could store them as a linked list in memory and load them on demand. Good memory usage but to play a sound I would have to search the linked list, add the sound to the list, retrieve the id, play it, remove from list. Not good in real time.

    Any ideas?

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Maybe try using the STL for this. Look into using a map perhaps? Pretty much you just want to insert all the sounds for a particular level I would imagine. So when you are loading the level data or whatever just load the sounds that will be used for that particular map. You can even sub-divide further but this should be fine. If your not using levels then use some form of partitioning.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 03:53 PM
  2. Help me modify my Sound Server
    By zdude in forum C Programming
    Replies: 1
    Last Post: 05-14-2003, 06:15 PM
  3. ALSA sound problem in Linux
    By MathFan in forum Tech Board
    Replies: 0
    Last Post: 04-24-2003, 11:05 AM
  4. Using PC Speaker and NOT the sound card in a console...
    By Trauts in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 04-09-2003, 09:52 PM
  5. Win2K Sound Issue...
    By civix in forum Tech Board
    Replies: 3
    Last Post: 01-17-2003, 03:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21