1. CocosDenshion이 재생중인 effects / bgm 만을 일시정지 하도록 수정한다.
2. AppDelegate.cpp 에서 pause / resume 을 하지 않는다. OS 에서 일시정지 하도록 놔두면 된다.
3. (선택사항) AppController.mm 에서 pauseAllEffects 와 resumeAllEffects 를 ApplicationWillResignActive 와 applicationDidBecomeActive 에 넣어 준다.

앞에 + 표시 되어있는 부분이 추가된 부분이다.

/**** CDAudioManager.m ****/
 -(void) pauseBackgroundMusic
  {
 +    if (![self.backgroundMusic isPlaying]) {
 +        return;
 +    }
 +	
      [self.backgroundMusic pause];
  }    


/**** CocosDenshion.m ****/
(void) pauseSound:(ALuint) sourceId {
    if (!functioning_) {
        return;
    }
 +
 +  // only pause a sound id that is playing
 +  ALint state;
 +  alGetSourcei(sourceId, AL_SOURCE_STATE, &state);
 +  if (state != AL_PLAYING)
 +  {
 +    return;
 +  }
 +
    alSourcePause(sourceId);
    alGetError();//Clear error in case we pause any sounds that couldn't be paused
  }


원본 URL
http://discuss.cocos2d-x.org/t/sound-fx-not-playing-after-a-while/623/25

Posted by 후미카
:

카테고리

전체보기 (102)
Development (102)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

달력

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

글 보관함