0
0

Howdy!

Im pretty n00by at programming, so bare with me.

I wan’t to make a audio handling class that all other classes can include and then call to make a sound, with a string as a parameter for which sound to play.

So I don’t want each class to have their own FSOUND_SAMPLE members, I want to have an audio bank to draw from.

So since I’m a n00b, I’m afraid of singletons, so I just made all the functions and data members of my audio handling class static.

Only one problem left, how do i map from a string to an FSOUND_SAMPLE? I’ve been tipped to use std::map, but I don’t know how it works. I’m guessing somebody here has done this exact thing before, and that’s why I’m asking here and not on a forum for STL.

Cheers! /Joel

  • You must to post comments
0
0

a simple but inneficient way is to create an array of structs, that have char name[256] and FSOUND_SAMPLE *sptr in it. Then all you do is scan your array for the name, and play the corresponding sptr.

To speed it up you can use hash tables, or sorting.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.