I need to play sounds one after another without any hiccups. This is on the iphone.
What I do right now is playSound on a channel and setup a callback on that channel. When the callback is hit with …CALLBACKTYPE_END I start the next sound in the queue w/ playSound.
I use a 0.0001 tick value in the timer when doing system updates.
I still hear a slight hiccup when it begins one ends and another begins because I don’t think the callback is called instantly.
So, I am changing this to use streams… is there an example where I could send my data to the stream that’s being played? I don’t quite see how this is done in FMOD.
Or is my previous way of doing it correct?
- webjeff asked 8 years ago
Thanks for the response. I did look and follow it. However, I think there is a flaw in the system….
Since our list is dynamic, we start with one sound. So I stream 1, then when I add another one, I reset the SetSubSoundSentence with 2 sounds (0 and 1), however that seems to cause numerous problems.
if I set SetSubSoundSentence with 2, even though we only have 1 streaming sound, it doesn’t work at all. Is that the case? I basically want to start with 1 and add to it maybe (depending on the user)
If you are using streams could you simply create a sound with two sub sounds, set up a sentence that plays 1 then 2, then have both sub sounds contain the same sound.
So by default it would just play the same sound twice, you could have the sentence loop so in effect you are just playing the same sound over and over until the user clicks a button. When that happens you load the new sound into the non-playing sub sound, so when the playing sound ends the new one plays next.
Is this the kind of behavior you are looking for?
It’s very close.
Basically it’s a non-looping queue that can be added to at any time.
So, I made a stream with 2 sentences. 0 has the first sound, 1 is null and it non-loops. If they want to add another sound into the queue (then I change it from non-looping (0-1) to looping so I can play all the sounds between sentences (0-1). So if they put 10 in really quick, it works great. When my queue plays the last sound I turn off looping and it ends.
Problem is if they add to the queue after the sentence should have changed when there is only 1 in the queue. It fills the empty buffer, but the stream never changes to using that sentence 1, it then loops forever on 0.
I think this is a flaw because if it tries to load from an empty buffer, it may just remove it from the list to not try again. Then I can’t even reload the sentence order or do anything, it seems I’m stuck.
I just don’t think there is a way to do what I want to do dynamically.
Because it’s a dynamic playlist.
I came across subsounds. I think I can manipulate that.
Will it be a problem if I preload all my sounds and just use them in one stream I create and fill subsounds in the right slot?
Does that make sense?
I need to do them as streams. I have it working, but can someone please confirm these 2 things regarding subsounds…
1) Since we have an interface with buttons to add sounds, we cannot guarantee they will play one after another if they click a sound to late? Another words, when the stream is ready to play another sound, if they havent clicked on it yet, it won’t play without a delay.
2) It looks like I need 2 sounds in the queue before it will play. I want to start it with one and set up another one in mid play. Is this not possible?
Please login first to submit.