0
0

Hi I did a search through the forum and I saw brett posted an reply said it was easy , just use OPENUSER to create the parent sound and then sub sounds with OPENMEMORY and OPENRAW can be set as sub sounds but I can’t get it work:

first create the parent sound:
[code:iza9pot4] memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));

exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM8;
exinfo.defaultfrequency = 8000;
exinfo.numsubsounds = 2;
    gSystem->createSound(NULL, 
                      FMOD_LOOP_NORMAL|FMOD_OPENUSER, 
                     &exinfo, 
                     &gMainSound);

[/code:iza9pot4]

this was fine and the log was :

FMOD: CodecUser::openInternal : Done. format = 1, channels 1, frequency 8000, lengthpcm 0, blockalign 1.
FMOD: SystemI::createSoundInternal : Format has 2 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
FMOD: SystemI::createSoundInternal : Multi-sample sound (2 subsounds), create a sample container.
FMOD: SystemI::createSoundInternal : No name found in file, use filename.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.

then I create sub sound:
[code:iza9pot4]
memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));

exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
exinfo.numchannels      = 1;
exinfo.format           = FMOD_SOUND_FORMAT_PCM8;
exinfo.defaultfrequency = 8000;
exinfo.length           = len;

gSystem->createSound((const char *)data, 
                              FMOD_OPENMEMORY|FMOD_OPENRAW, 
                             &exinfo, 
                             &s);
s->setMode(FMOD_LOOP_OFF);   

[/code:iza9pot4]

this was also ok , and it could be played

then when I do gMainSound->setSubSound(0, s) I got FMOD_ERR_FORMAT error, really don’t know why?

  • You must to post comments
0
0

did you put the new sound into the parent sound with Sound::setSubSound? I doubt it would return err format on getsubsound – maybe invalid param or fmod_err_subsound?

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.