XNA Creators Club Online
Page 1 of 2 (41 items) 1 2 Next >
Sort Posts: Previous Next

xact: instance limiting of 1 on shot sound slows down game!

Last post 11-12-2008 3:46 PM by Matthew Doucette. 40 replies.
  • 09-04-2008 5:40 PM

    xact: instance limiting of 1 on shot sound slows down game!

    Our game runs choppy when I set our shot sound "Limit Instances" to "1" and "Behavior At Max" to "Replace".  (For those who do not know, this makes the sound restart for each shot, instead of playing two shot sounds at once.)

    Other settings were left as defaults:
    Fade In (sec) = 0.000
    Fade Out (sec) = 0.000
    Replace Instance = Lowest Priority
    Crossfade Type = Linear

    Our game barely uses any resources (CPU or GPU).  Why is this happening?

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-04-2008 5:44 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    I've not seen this and I've used that setting... are you calling the Engine.Update in your update routine... that can have very odd effects if you don't


    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 09-04-2008 11:53 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    We are calling AudioEngine.Update() in Update().  We call it last, after everything else, right before base.Update(gameTime) is called.
    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-04-2008 11:56 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    Seems like time to make a very simple repro and post it here and in connect then.


    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 09-05-2008 12:50 AM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    You must still call Dispose on the old Cues, even if you use "replace" for the replacement mode.

     


    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 09-05-2008 11:44 AM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    jwatte:
    You must still call Dispose on the old Cues, even if you use "replace" for the replacement mode. 

    Should I be calling SoundBank.Dispose in Update?  I am not calling SoundBank.Dispose, at all.  I followed the "Beginner's Guide to 3D Games" tutorial, and it never used this. 

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-15-2008 4:25 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    jwatte:
    You must still call Dispose on the old Cues, even if you use "replace" for the replacement mode.

     

    Can you give me an example of when I should call dispose?  The sound in question is my ship's firing shot, which is called 10..15 times per second throughout the game.

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-15-2008 4:38 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    I am unknowledgeable in audio maintenance... all I do is:

    - call SoundBank.PlayCue() on each event (i.e., my ship shooting)
    - call AudioEngine.Update() each Game.Update()

    What other maintenance must I do?

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-15-2008 10:03 PM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    Should I optimize PlayCue() calls if cue the same sound a lot?

    Is calling PlayCue() on the same sound (one instance limit) 10..20 times per frame similar to calling it once time per frame, or is there a performance hit?

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-16-2008 1:53 AM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    I have have 50+ combat units vying for sound effects in my game, and no performance issues. I am doing "limit instances: 3" and "fail to play" for weapon sounds. Maybe try that instead?
  • 09-16-2008 1:54 AM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    Perhaps try Cue c = SoundBank.GetCue("name"). And then try replaying the same cue object. Possibly the SoundBank.PlayCue call is causing your problem because it prepares a new Cue each time? Just a guess.

    [edit] I found an interesting MSDN thread which may be related to this: https://forums.microsoft.com/msdn/ShowPost.aspx?PostID=1298653&SiteID=1

    Maybe the best approach is to use GetCue() and cache the Cue object so it never goes out of scope. Then, before playing, check whether it's valid with (Cue.IsPrepared and !Cue.IsDisposed) and replace it with GetCue() again if it's not valid. [/edit]

  • 09-16-2008 10:46 AM In reply to

    Re: xact: instance limiting of 1 on shot sound slows down game!

    Fippy Darkpaw:
    I have have 50+ combat units vying for sound effects in my game, and no performance issues. I am doing "limit instances: 3" and "fail to play" for weapon sounds. Maybe try that instead?

    I have 100's of enemies and 1,000's of bullets, each causing a sound effect.  I do not like the "fail to play" because in shooter games, generally the sound is expected to restart.  Think of any shooter game's player's weapon.  Or think of the tinging sound Contra and Super-C would make when you'd hit an enemy.  A sound was played every time, just restarted.  It creates an intense effect that you lose with "fail to play".  I did try it, though, so thank you.

    I think my problem is calling PlayCue way too much.  We are going to test this out today and post back the results! :)

    --
    Matthew Doucette / Xona Games
    my 2D shooter Xbox 360 game: Duality: ZF
  • 09-16-2008 10:54 AM In reply to