0
0

Hi,

Can someone explain why fmod doesn’t allow you to play multiple instances of a single streaming sound? Are the actual streaming buffers being stored in the sound itself?

In the fmod documentation, i’ve read this:

"FMOD_CREATESTREAM: Decompress at runtime, streaming from the source provided (ie from disk). Overrides FMOD_CREATESAMPLE and FMOD_CREATECOMPRESSEDSAMPLE. Note a stream can only be played once at a time due to a stream only having 1 stream buffer and file handle. Open multiple streams to have them play concurrently."

It seems like a better design would be to put the streaming buffers on the sound channel, and then the sound would just contain a reference (file, memory, etc.) to the location of the data for that sound. Am I missing something? This has confused me since I started working with fmod.

I’ve worked with other sound systems that have used the design approach I described above. I guess I just don’t see the drawbacks of the design I’m suggesting. Why is it better to put the streaming buffers into the sound itself and not on the channel? Is it ‘worth’ the price of only being able to play one instance of the sound?

Hopefully someone can explain this for me… I’m new to fmod, so I’m trying to learn and understand all that I can.

thanks,
sam

  • You must to post comments
0
0

If you want to stream the same sound more than once simultaneously just create more than one stream.

[quote:23dcdy8w]It seems like a better design would be to put the streaming buffers on the sound channel, and then the sound would just contain a reference (file, memory, etc.) to the location of the data for that sound. Am I missing something?[/quote:23dcdy8w]

This is exactly the same as creating multiple streams – you still have multiple stream buffers, multiple file reads etc. At least calling createStream multiple times puts the cost up-front rather than allocating memory each time you call playSound.

  • You must to post comments
0
0

Hmm.. I’m not sure I agree that it’s exactly the same. The implementations are certainly similar, but there is a key difference. I also don’t think it’s a good thing to play for the cost of the stream "up front".

Suppose I have 10 sounds, and I want to be able to play 10 streaming instances of each. Also, suppose that I know that I only ever want to be playing 8 different streams at once, because otherwise my disk can’t keep up. Also suppose that my streaming buffers are 64kb.

Is it a "good thing" for me to pay for 100 streaming buffers for the sounds up front (10 sounds * 10 instances) when all I actually need to use at once would be 8 (one buffer for each channel)? It seems like a huge waste of memory to me… In the current system, it would be 100 streams * 64kb = 6.4 MB of memory vs. 8 streaming channels * 64kb = 512kb. In my opinion, I’d much rather create 10 sounds and reserve special ‘streaming channels’ that hold the streaming buffers.

Now you are probably thinking, "So create the streams when you need them and then release them. That way you only have 8 active at once. Memory is the same." Well, I would do that, but unfortunately it takes fmod about 20 millisecibds to create a new streaming sound, and that will break my frame rate. I have another thread going where I’m trying to figure out why that is so slow, but no luck yet…

-sam

  • You must to post comments
0
0

[quote:2k9pqaab]"So create the streams when you need them and then release them. That way you only have 8 active at once. Memory is the same." Well, I would do that, but unfortunately it takes fmod about 20 millisecibds to create a new streaming sound[/quote:2k9pqaab]

So using your "streaming channel" method there are no streams created up front so that means that streams are created when you call playSound() yeah? How is this different to "creating them as you need them"? It’s doing exactly the same thing and will take the same amount of time. If your real issue is how long it takes to create a stream then let’s discuss that as the way we’ve implemented streams is not going to change.

  • You must to post comments
0
0

[quote:2bo7sxt2]
So using your "streaming channel" method there are no streams created up front so that means that streams are created when you call playSound() yeah? How is this different to "creating them as you need them"? It’s doing exactly the same thing and will take the same amount of time. If your real issue is how long it takes to create a stream then let’s discuss that as the way we’ve implemented streams is not going to change.
[/quote:2bo7sxt2]

No, that’s not the case. When I initialized the system, I told it I wanted 8 streaming channels. They are all created up front, so there is no memory alloc/realloc. This is better than creating/destroying them as I need them since it avoids the malloc.

Anyways, this doesn’t really matter. I was just curious why fmod was designed the way it is. For my usage, the design of this feature is making it harder for me to do what I want and it’s wasting memory. Maybe others aren’t running into these same restrictions..

I’ve posted another thread trying to figure out why it’s taking so long to create a stream. Here’s a link to that thread:

http://52.88.2.202/forum/viewtopic.php?t=6684

thanks,
sam

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.