Working with subsounds / FSB



First of all, I’m on iOS.

I’m trying to understand how to use a FSB with multiple subsounds. I believe that I was able to use the command line to create an FSB containing 4 sounds on windows using fsbankcl with the following command:

“C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\bin\fsbankcl.exe” -recursive -format fadpcm “C:\MyWavs” -o “C:\MyFSBs”

I copy this file into my project. So I then load it in FMOD with this code:

NSString *resourceName = @"test";
FMOD::Sound        *sound[4];
NSString *filePath =[[NSBundle mainBundle ]pathForResource:resourceName ofType: @"fsb"];
int      numsubsounds;
FMOD::Sound      *fsbSound;
result = system->createSound([filePath UTF8String], FMOD_LOOP_NORMAL, 0, &fsbSound);
result = fsbSound->getNumSubSounds(&numsubsounds);

for (int i=0; i < numsubsounds; i++)
    fsbSound->getSubSound(i, &sound[i]);

So I can play the subsounds using my sound array but all I have is an index. How do I know what the original filename was? For instance, if one of my sounds was called ping.wav, how do I know if it’s on index 0, 1 2 or 3? Am I missing something?

Thanks in advance,



You can make FSBank generate a header file that has all the indices of your FSB if you would like a compile time solution.

Otherwise you can call Sound::getName on each subsound to discover the original name at runtime.