Here is my problem:
My sound data comes in chunks a part of a big file and, unfortunately, I don’t know the size of the sound data before this file is completely read. These chunks are parts of one continuous sound and should be smoothly connected together. I need to be able to start playing sound chunks before the file finishes loading.
I was thinking of playing those chunks as separate sounds through a channel with FMOD_CHANNEL_CALLBACK_TYPE_END callback which would start the next sound chunk when the current is finished. But I’m afraid that those transitions would be noticeable.
I also was thinking about using FMOD_SOUND_PCMREADCALLBACK, but it requires for sound data to be in PCM format but my sound can be MP3 data and using this callback will also cause unnecessary data coping.
Could you please give me any suggestion how I can solve this problem in the most efficient way?
- dmax75 asked 9 years ago
I have found my mistake. And you right it was incorrect number of channels. The parent sound was created with the exinfo.numchannels set to 1, but my mp3 files had two channels.
Now stitching works fine. Thank you very much for your help.
One more question: Is there any limitation on the size of a child sound? How small could it be?
no there is no limitation but if you have it too small you want be able to poll fast enough to do the double buffer swap.
If you want to play a predetermined list of sounds in a row, dont use the doublebuffertechnique use a larger list and just call playsound on it, with none of the swapping logic in the main loop. Then your subsounds can be as small as they like.
FMOD calls this "stitching" – essentially playing multiple sounds back to back seamlessly on a single channel. There’s an example in the downloadable SDK examples – look for a sample with "stitching" in the name (I don’t have it in front of me at the moment). It should show you how to accomplish this.
- JamesB answered 9 years ago
[quote="JamesB":bzikqts6]FMOD calls this "stitching" – essentially playing multiple sounds back to back seamlessly on a single channel. There’s an example in the downloadable SDK examples – look for a sample with "stitching" in the name (I don’t have it in front of me at the moment). It should show you how to accomplish this.[/quote:bzikqts6]
- karl answered 9 years ago
Thank you very much guys.
This is exactly what I was looking for. But now I stuck with anther problem:
The original "stitching" example works fine, but when I replaced original OGG files with my MP3 samples Sound::setSubSoundSentence method failed with "FMOD error! (25) Unsupported file or audio format." error message. Those MP3 samples work fine if i play them a loan.
Do you have any idea what could cause this error?
I would like to see this test environment because that’s not how setSubSoundSentence works. It -only- returns FMOD_ERR_FORMAT if one of the following happens.
- format of subsound 2 and above is different to subsound 1.
- channel count of subsound 2 and above is different to subsound 1.
They’re the only 2 checks that ever return that error code in Sound::setSubSoundSentence.
Please login first to submit.