Game Development Community

Problem using multiple sounds simultaneously (Very pedagogical)

by Torbjorn Leksell · in Torque Game Engine · 01/18/2006 (5:35 am) · 1 replies

Scenario: The player fires an automatic weapon. Upon firing, the game plays a "firing" sound for each bullet fired. When the projectile hits a surface an explosion defined in the projectile datablock is used, this in turn plays an "explosion" sound.
www.narcissisticstudios.com/misq/scenario1.jpg

Problem 1: This works fine with slower weapons but as soon as the fire rate reaches a certain point the sounds play only sporadically. It seems that the sounds are pilled up and some limit stops new sound from being played unless an old one expires. In my head this looks like this:
www.narcissisticstudios.com/misq/hypotes.jpg

Problem 2: If the scenario is applied to two players in a multiplayer scenario, the time before the sounds are cut is halved, which seems to support my theory of a max limit.
www.narcissisticstudios.com/misq/scenario2.jpg

Question: Does anyone know how to either increase this limit or allow the system to remove the oldest sounds in the list and replace it with a new? At least where to look or any other help? This is simply not a problem we can ignore and it's crucial for our game that this works.

(All this is also confirmed on an untouched version of the 1.4 release where the only change is made in the firing speed of the crossbow, if you want to replicate the problem just boost the fire speed and increase the amount of ammo to the crossbow in the standard 1.4 version)

#1
01/18/2006 (8:09 am)
There are two restrictions that I'm aware of in alxPlay. If an audio handle is already playing, an alxPlay command using that audio handle will not do anything. If your sound lasts 100 ms, for example, you can only play that sound again 100 ms after it was last played. Although I am sure you can get around this by creating another audio handle (by which I mean an AudioProfile object) with the same sound file that you alternate playing.

You are also restricted by the MAX_AUDIOSOURCES variable, which (in my 1.3 version at least) is set to 16. I'm sure that means that you can have up to 16 different audio handles playing at the same time, but as to how many instances of the same handle you can have (I think only one at a time), I'd need someone else to confirm for me.