Jump to content

Building Selection Sound Problem


Katsuyori
 Share

Recommended Posts

I wanted to fix this bug myself, but couldn't find the code. The problem is when you click on a building, a sound related ot that building is played (/binaries/data/mods/public/audio/interface/select/building). When you click on that building multiple times, the sound also is played multiple times over the previous one. I want it to wait until the previous sound is finished, and then play the new one. Could you show me where the code is so I can fix it? I'm new to the project and I want to fix it myself. Thanks. :)

Link to comment
Share on other sites

You could try :

C:\0AD\binaries\data\mods\public\simulation\components\Sound.js // This file reads sounds from XMLsC:\0AD\source\soundmanager\*.*C:\0AD\source\simulation2\components\ //All CPP components are here

When you find the source, make sure your create a ticket on trac : http://trac.wildfiregames.com/

Also make sure you read http://trac.wildfiregames.com/wiki/SubmittingPatches

Regards, and good luck.

Edited by stanislas69
Link to comment
Share on other sites

You could try :

C:\0AD\binaries\data\mods\public\simulation\components\Sound.js // This file reads sounds from XMLsC:\0AD\source\soundmanager\*.*C:\0AD\source\simulation2\components\ //All CPP components are here

When you find the source, make sure your create a ticket on trac : http://trac.wildfiregames.com/

Also make sure you read http://trac.wildfiregames.com/wiki/SubmittingPatches

Regards, and good luck.

Thanks. I also found something else related to GUI in /binaries/data/mods/public/gui/session/selection.js and under the "EntitySelection.prototype.addList" function, there are some lines of code like this:

		// Play the sound if the entity is controllable by us or Gaia-owned.		var owner = GetEntityState(added[0]).player;		if (!quiet && (owner == playerID || owner == 0 || g_DevSettings.controlAll))			_playSound(added[0]);	}

Would it matter if I change the if statement here?

Link to comment
Share on other sites

No like sanderd17 suggested on IRC just add a time check in it. :)

Yea I posted this a little bit before getting the answer on IRC. How can I get the time of the last played sound on that building? I mean I get the whole idea, but I don't know how to get that time.

Edited by Katsuyori
Link to comment
Share on other sites

Hbruno, well I doubted where it should go.

Having it in the selection code may have some advantages for modability. Though indeed, it wouldn't work for battle sounds. Also, the lenghth shouldn't necesarily be the same as the file length. It could be you want a longer silence, or that the second sound can already start on the fade-out of the first one.

Link to comment
Share on other sites

I like the idea of having a configurable "cooldown" period for sounds, a delay before the sound can be played again, that should cover this bug. It's better handled in the engine because it knows how long the sound will play, but exposing an API for that in scripts would be needlessly messy IMO - or a hack to workaround current behavior.

Battle sounds would be more involved, either a limit on how many instances can play simultaneously and/or switching to a different sound set for heated battle (to some extent, playing individual sounds over and over doesn't give the same dramatic impression as well-crafted battle sounds).

  • Like 2
Link to comment
Share on other sites

So @Katsuyori, if you'd like to keep working on it, it would be better to start of in the sound engine instead.

I believe you know C++, so it wouldn't be that hard.

In this case, I would suggest adding parameters to the sound settings (like http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/audio/interface/select/building/sel_barracks.xml), which can be read by the sound engine ( http://trac.wildfiregames.com/browser/ps/trunk/source/soundmanager )

I hope this helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...