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

  • Home
  • SEARCH
  • 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 7773673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:11:06+00:00 2026-06-01T17:11:06+00:00

I have a charging up sound effect that is 8 seconds long, which is

  • 0

I have a charging up sound effect that is 8 seconds long, which is triggered to play only at the end of each level in my game.

The problem is, the sound effect stops midway through when there are other sounds playing at the same time (lasers, explosions, etc). I was reading elsewhere that you can have up to 32 simultaneous sounds playing at the same time, but the game is maybe playing up to 7 or 8 sound effects at the same time max. But the charging up sound effect still cuts out.

If I don’t do any shooting in the game and let the charging up effect just play, it plays all the way through.

I preload my sounds at start up like so:

-(void)setupSound
{
    [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"Kickshock.mp3" loop:YES];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"explosion_large.caf"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"explosion_small.caf"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"laser_ship.caf"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"powerup.mp3"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"railgun.mp3"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"metal.mp3"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"count.mp3"];
    [[SimpleAudioEngine sharedEngine] preloadEffect:@"charge_up.mp3"];
}

-(id)init
{
    if( (self = [super init]) )
    {
        [self setupSound];
        // Rest of other code..
    }
    return self;
}

and I play them when needed (shooting laser, end of level, things exploding, etc):

[[SimpleAudioEngine sharedEngine] playEffect:@"charge_up.mp3" pitch:1.0 pan:0.0 gain:0.4];

I’m guessing that the charge up sound is losing its “slot” since other sounds are playing? Like mentioned above, I only have 7 or 8 sounds max playing simultaneously when the charging up sound effect cuts off.

If my sound is losing its “slot”, is there a way that I can lock in a particular sound effect so that it won’t lose its “slot”?

Any idea on what I’m doing wrong or what I can do to remedy this? Any help is greatly appreciated! 😀 Thanks for looking.

  • 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-06-01T17:11:07+00:00Added an answer on June 1, 2026 at 5:11 pm

    To play multiple sounds, I’d use CDAudioManager with CDSoundEngine instead of SimpleAudioEngine.

    CDSoundEngine allows multiple channels (up to 32), which can play sounds at the same time.

    Example:

    // create engine
    CDSoundEngine * engine = [CDAudioManager sharedManager].soundEngine;
    
    // assign groups
    NSArray * groups = [NSArray arrayWithObjects:
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1],
        [NSNumber numberWithInt:1], nil];
    
    [engine defineSourceGroups:groups];
    [CDAudioManager initAsynchronously:kAMM_FxPlusMusicIfNoOtherAudio];
    
    // load requests
    NSMutableArray * requests = [[[NSMutableArray alloc] init] autorelease];
    
    NSString * plist_sounds = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"Sounds.plist"]];
    if (![[NSFileManager defaultManager] fileExistsAtPath:plist_sounds]) {
        plist_sounds = [[NSBundle mainBundle] pathForResource:@"Sounds" ofType:@"plist"];
    }
    NSDictionary * dictionary_sounds = [[NSDictionary dictionaryWithContentsOfFile:plist_sounds] objectForKey:@"Sounds"];   
    if (dictionary_sounds != nil) {
        for (id key in dictionary_sounds) {
            [requests addObject:[[[CDBufferLoadRequest alloc] init:[key intValue] filePath:[dictionary_sounds objectForKey:key]] autorelease]];
        }
    }
    
    [engine loadBuffersAsynchronously:requests];
    

    Then to play a sound:

    - (ALuint)play:(NSInteger)sound group:(NSInteger)group loop:(BOOL)forever volume:(float)volume {
         [[CDAudioManager sharedManager].soundEngine playSound:sound sourceGroupId:group pitch:1.0f pan:0.0f gain:volume loop:forever];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql SELECT query which is fast (<0.1 sec) but only the
In my game engine I have a State class that represents the game world
changing a static resource during runtine is something that sounds not possible. I have
I have JSON that keep changing , I need in android to keep updating
I have a jquery flexigrid that I'm dynamically changing so that it displays different
I have a text box whose content is constantly changing and whenever that happens,
One of the things that has long bugged me about the FileSystemWatcher is the
I have made a player that plays mp3 and does the job very well
I have a working mic recording script in AS3 which I have been able
I have a PlaceHolder control inside of a ListView that I am using to

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.