Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:04:49+00:00 2026-05-23T10:04:49+00:00

WP7 suffers pretty severe performance penalties when too many sounds are played. I have

  • 0

WP7 suffers pretty severe performance penalties when too many sounds are played. I have an AudioManager that keeps track of SoundEffectInstances and prevents too many from playing at once.

However, some things don’t require an instance and simply call Play() on a SoundEffect itself. For example, a bullet plays an impact sound when it hits something but doesn’t actually need an instance.

My current system only manages Instances. What I’d like to do is see if I have an existing instance of that SoundEffect on hand that’s not used and simply play it. This would require finding the SoundEffect type of a SoundEffectInstance, checking if it’s played and then playing it if not. Doing this will enable me to keep track of total playing sounds more accurately.

Hopefully that makes sense and someone can point me in the right direction.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:04:49+00:00Added an answer on May 23, 2026 at 10:04 am

    The important thing to decide is how you are going to manage the number of playing SoundEffectInstances at once? The obvious way is to modify your gameplay code (or levels or whatever) such that the number of playing sounds simply never grows too large.

    But if this is not acceptable you will need to enforce a hard limit somehow. And the question is: how are you going to do it? Will each sound effect have a maximum number of instances of that effect? Or will you have “sound classes” (where the class has a maximum play count)? Or just a global maximum sound count? Will the cap be enforced by preventing additional sounds from playing? Or by cutting off sounds that are already playing?

    What I would suggest is creating a wrapper object around SoundEffect that implements pretty much the same thing that SoundEffect.Play does (it internally manages a pool of SoundEffectInstances, reusing them when they are finished playing). Then add your playback cap functionality on top of it.

    So your wrapper class might look something like this:

    class MySoundEffect
    {
        SoundEffect sound;
        List<SoundEffectInstance> instances;
        int maxInstances;
    }
    

    Or perhaps like this:

    class MySoundEffect
    {
        static int[] soundClassMaximums = { 2, 2, 5, 10 };
        static int[] soundClassInstanceCount;
    
        SoundEffect sound;
        List<SoundEffectInstance> instances;
        int class;
    }
    

    And then you would use MySoundEffect everywhere you’d normally be using SoundEffect.

    Take a look at ExEn. Because it implements the internals of SoundEffect, you can possibly borrow its pooling code, which is similar to what the real XNA SoundEffect does, and then use it as a starting point for your own instance pool with your added functionality.

    There are other ways to do it, and it will depend on your architecture. But basically it is up to you to track the association between sound effects and instances. There’s no way to do it in the XNA API (short of doing some nasty reflection).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WP7 app that is connecting to my GAE backend via oauth.
Hi i have a WP7 application that calls a wcf who runs with membership
I have a WP7 XNA game that needs to save the state whenever the
I have a WP7 app that requires most of its pages to retrieve data
I have built a WP7.1 application that uses a local database. I used sqlmetal
I have a Mango WP7.5 app that uses a local SqlCe database. I would
I have a WP7 application that I've disabled the idle capabilities of the phone
Does anyone have some WP7 code for the animations within the ListItem descriptions that
For my WP7 app, I have a setting that I use to specify whether
I have some WP7 code that looks like this: using System.Windows; using System.Windows.Threading; public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.