Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found a poast about this on the Cocos2D-iPhone.org forums. While I don't fully understand it--but I'm working on it--it did seem to take care of the problem, at least temporarily. What he did was write this method in the CDAudioManger.m file:</p> <pre><code>-(void) releaseBufferForFile:(NSString *) filePath { int bufferId = [self bufferForFile:filePath create:NO]; if (bufferId != kCDNoBuffer) { [soundEngine unloadBuffer:bufferId]; [loadedBuffers removeObjectForKey:filePath]; NSNumber *freedBufferId = [[NSNumber alloc] initWithInt:bufferId]; [freedBufferId autorelease]; [freedBuffers addObject:freedBufferId]; } } @end - (void) interruption:(NSNotification*)notification { NSDictionary *interuptionDict = notification.userInfo; NSNumber* interuptionTypeValue = [dict valueForKey:AVAudioSessionInterruptionTypeKey]; NSUInteger interuptionType = [interuptionTypeValue intValue]; if (interuptionType == AVAudioSessionInterruptionTypeBegan) [self beginInterruption]; #if __CC_PLATFORM_IOS &gt;= 40000 else if (interuptionType == AVAudioSessionInterruptionTypeEnded) [self endInterruptionWithFlags:(NSUInteger)[interuptionDict valueForKey:AVAudioSessionInterruptionOptionKey]]; #else else if (interuptionType == AVAudioSessionInterruptionTypeEnded) [self endInterruption]; #endif } </code></pre> <p>Then he replaced:</p> <pre><code>AVAudioSession *session = [AVAudioSession sharedInstance]; session.delegate = self; </code></pre> <p>with this:</p> <pre><code>[AVAudioSession sharedInstance]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interruption:) name:AVAudioSessionInterruptionNotification object:nil]; </code></pre> <p>Here's the link: <a href="http://www.cocos2d-iphone.org/forum/topic/49956" rel="nofollow noreferrer">http://www.cocos2d-iphone.org/forum/topic/49956</a></p> <p>If and when I develop a better understand of what this code is doing, I'll be sure to edit this post.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload