2017-12-16 11:20:23

staff, greetings to all.
my question may be kind of silly, but I have the following situation:
one BGT script in which I need to use multiple sound objects without knowing exactly how many.
the problem is that if I use only one sound object, I will not play more than one sound at the same time.
if I declare 10 variables as a sound object, in that case I just go have how to use 10 sounds at the same time, right?
but in the case of having to use an indefinite quantity of objects of sound, what would be the solution?
for example, a bgt script that mimics a piano, where I need to
multiple sound objects to play multiple notes at the same time. It is a type of case where I can not know exactly how many objects sound I'll need to use.
I hope you have understood my doubt.
greetings,
Gabriel

2017-12-16 13:50:56

You could declare multiple sound objects or you could use sound_pool, which I think is a cleaner sollution. As for how many you can have at one time, I think theoretticly as much as your memory can handle.

2017-12-16 17:54:55

Either sound pool or an array of sounds. Maximum memory that bgt can handle is 2 gb, it's a 32 bit app.

Roel
golfing in the kitchen

2017-12-16 18:29:58

The sound_pool is what you want. It defaults to a maximum of 100 sounds, but you can increase that if need be. (If you have more than 100 sounds playing simultaneously, maybe reconsider some aspects of the design? It's doable, yeah, but implies some other issues of concern.)

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2017-12-19 13:32:46

thanks all.
I'll use the sound_pool same.
regards