0
0

Hello FMOD Community !

I took the stitching example on the wiki and modify it to try to swap the subSoundSentence while the sound is playing.

I have a case where I want to insert something like this:

INTRO, <— Want this to play once
PART 1, <– Want the 1 and 2 to loop
PART 2

Is this possible ? or the setSubSoundSentence Function must be called only at the creation ?

Here a code sample:

result = channel[i]->getPosition(&currentSubSoundIndex[i], (FMOD_TIMEUNIT)(FMOD_TIMEUNIT_SENTENCE_SUBSOUND | FMOD_TIMEUNIT_BUFFERED));
ERRCHECK(result);

                if (currentSubSoundIndex[i] != subSoundIndex[i])
                {
                    bIsStitching= true;

                    //  Release the sound that isn't playing any more. 
                    result = subsound[i][subSoundIndex[i]]-&gt;release();       
                    ERRCHECK(result);

                    //  Replace it with a new sound in our list.
                    //result = system-&gt;createStream(soundname[i][sentenceid[i]], FMOD_DEFAULT, 0, &amp;subsound[i][subsoundid[i]]);
                    result = system-&gt;createSound(soundname[i][sentenceid[i]], FMOD_LOOP_OFF | FMOD_2D | FMOD_SOFTWARE, 0, &amp;subsound[i][subSoundIndex[i]]);
                    ERRCHECK(result);

                    result = sound[i]-&gt;setSubSound(subSoundIndex[i], subsound[i][subSoundIndex[i]]);
                    ERRCHECK(result);

                    sentenceid[i]++;
                    if (sentenceid[i] &gt;= NUMSOUNDS)
                    {
                        sentenceid[i] = 0;

                        //Testing Change SubSeq

                        soundlist[i][0]= 1;
                        soundlist[i][1]= 1;

                        result = sound[i]-&gt;setSubSoundSentence(soundlist[i], NUMSOUNDS);
                        ERRCHECK(result);

                        //Testing Change SubSeq
                    }

                    subSoundIndex[i] = currentSubSoundIndex[i];

The sound is cut in this case.

I know I could play the intro now and set a delay for the PART 1 and 2 but is it the only solution ?

Thanks and have a niiiice day !

Yan

  • You must to post comments
0
0

OK, Let’s simplify all this…. is it possible to swap a subSoundSentence while it’s playing ??

  • You must to post comments
0
0

Yes you can, you just can’t swap the subsound that is playing at the time.

See the realtimestitching example of how it is done, that example just uses 2 subsounds and swaps a bunch of ogg files in and out as the parent sound plays, but only the ‘backbuffer’ which is the subsound that is not playing at the time.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.