Thread: Good sound storage method

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    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, 02:53 PM
  2. Help me modify my Sound Server
    By zdude in forum C Programming
    Replies: 1
    Last Post: 05-14-2003, 05:15 PM
  3. ALSA sound problem in Linux
    By MathFan in forum Tech Board
    Replies: 0
    Last Post: 04-24-2003, 10: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, 08:52 PM
  5. Win2K Sound Issue...
    By civix in forum Tech Board
    Replies: 3
    Last Post: 01-17-2003, 03:06 PM