0
0

Hi all,

I am new to FMOD Ex (and to sound API in general) and although the API is pretty easy to use, I have few problems to design the audio engine for the indie game I am working on.

Context:
I would like to use FMOD for a sort of real-time strategy game. I have hundreds of units on the battlefield and each type of unit hold different sounds (user feedbacks, bullet, explosion, etc…).

Problem:
Each type of unit can have many instance of them. For example, 30 units of type medium tank, so I may have to play 30 times the same sound (few may be non audible). Basically, I don’t know what is the good way to use the channel.

Questions:

1) Should I store an instance of each sound (FMOD channel) in each of my UnitType instance ? That mean may be thousands of channels ? Is it the good way ? so basically I call playSound with the paused parameter to true each time I create an instance of a unit ?

2) When I play a sound 1 time, what happen to the channel once the sound has finished ? If I play 1000 sounds, is there 1000 channel created ? after few minutes, is there 100000 channel allocated ?

3) How can I destroy a channel ? (when I not need it anymore)

4) I would like to fade from one music (streamed sound) to another, is there a ready-to-use function ? or should I have to do it myself with a timer and the setVolume function.

Thanks in advance if you can help me to use FMOD like it was designed to be used.

  • You must to post comments
0
0

Thank you for the fast reply brett :)

I understand better how FMOD works, but I am still a bit confused about the (1) and (3). (3) says that when sounds are not playing, the channel can be used again, so I cannot do what I said in (1). That mean “a channel is an instance of a [b:10z4xf9q]playing[/b:10z4xf9q] sound” ?

Q) So it is wrong to call playSound() with paused and to store the channel when a unit is created, and then call channel->play() each time the unit has to play a sound ? (because if I create another unit later, FMOD could returns the channel of another unit which is not playing a sound).

I must store a pointer (or handle) to the sound and call sound->playSound() each time the unit has to play a sound. Here I can get the channel and sets the 3D attributes but I don’t need to store it, right ?

Q) But for looping sounds (ambient sounds like forests, ocean, etc..), I can store the channel and I am sure that it will not be reused by another playSound() call ?

Q) About virtual voices. Do you only compute distances for the ‘playing’ sounds ? Does it help if I do not call playSound() when I am sure that the sound will be non-audible (the sound is far far away).

Thanks again for you help,

  • You must to post comments
0
0

😳 don’t know why I imagined a play() method in Channel 😕

Thanks again for the clarification brett, it is pretty clear now.

Have a nice day.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.