mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6043 from andyque/fix4590
closed #4590, fixed rewind problems
This commit is contained in:
commit
c43b0f6cb0
|
@ -95,9 +95,9 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
|
||||
-(void) play {
|
||||
if (enabled_) {
|
||||
self->systemPaused = NO;
|
||||
self->paused = NO;
|
||||
self->stopped = NO;
|
||||
systemPaused = NO;
|
||||
paused = NO;
|
||||
stopped = NO;
|
||||
[audioSourcePlayer play];
|
||||
} else {
|
||||
CDLOGINFO(@"Denshion::CDLongAudioSource long audio source didn't play because it is disabled");
|
||||
|
@ -105,24 +105,26 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
}
|
||||
|
||||
-(void) stop {
|
||||
self->paused = NO;
|
||||
self->stopped = YES;
|
||||
paused = NO;
|
||||
stopped = YES;
|
||||
[audioSourcePlayer stop];
|
||||
}
|
||||
|
||||
-(void) pause {
|
||||
self->paused = YES;
|
||||
paused = YES;
|
||||
[audioSourcePlayer pause];
|
||||
}
|
||||
|
||||
-(void) rewind {
|
||||
self->paused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer setCurrentTime:0];
|
||||
[audioSourcePlayer play];
|
||||
stopped = NO;
|
||||
}
|
||||
|
||||
-(void) resume {
|
||||
if (!stopped) {
|
||||
self->paused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer play];
|
||||
}
|
||||
}
|
||||
|
@ -623,7 +625,7 @@ static BOOL configured = FALSE;
|
|||
}
|
||||
|
||||
- (void) applicationWillResignActive {
|
||||
self->_resigned = YES;
|
||||
_resigned = YES;
|
||||
|
||||
//Set the audio sesssion to one that allows sharing so that other audio won't be clobbered on resume
|
||||
[self audioSessionSetCategory:AVAudioSessionCategoryAmbient];
|
||||
|
@ -668,7 +670,7 @@ static BOOL configured = FALSE;
|
|||
|
||||
- (void) applicationDidBecomeActive {
|
||||
|
||||
if (self->_resigned) {
|
||||
if (_resigned) {
|
||||
_resigned = NO;
|
||||
//Reset the mode incase something changed with audio while we were inactive
|
||||
[self setMode:_mode];
|
||||
|
|
|
@ -94,8 +94,8 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
|
||||
-(void) play {
|
||||
if (enabled_) {
|
||||
self->systemPaused = NO;
|
||||
self->paused = NO;
|
||||
systemPaused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer play];
|
||||
} else {
|
||||
CDLOGINFO(@"Denshion::CDLongAudioSource long audio source didn't play because it is disabled");
|
||||
|
@ -103,22 +103,23 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
}
|
||||
|
||||
-(void) stop {
|
||||
self->paused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer stop];
|
||||
}
|
||||
|
||||
-(void) pause {
|
||||
self->paused = YES;
|
||||
paused = YES;
|
||||
[audioSourcePlayer pause];
|
||||
}
|
||||
|
||||
-(void) rewind {
|
||||
self->paused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer setCurrentTime:0];
|
||||
[audioSourcePlayer play];
|
||||
}
|
||||
|
||||
-(void) resume {
|
||||
self->paused = NO;
|
||||
paused = NO;
|
||||
[audioSourcePlayer resume];
|
||||
}
|
||||
|
||||
|
@ -618,7 +619,7 @@ static BOOL configured = FALSE;
|
|||
}
|
||||
|
||||
- (void) applicationWillResignActive {
|
||||
self->_resigned = YES;
|
||||
_resigned = YES;
|
||||
|
||||
//Set the audio sesssion to one that allows sharing so that other audio won't be clobbered on resume
|
||||
[self audioSessionSetCategory:AVAudioSessionCategoryAmbient];
|
||||
|
@ -663,7 +664,7 @@ static BOOL configured = FALSE;
|
|||
|
||||
- (void) applicationDidBecomeActive {
|
||||
|
||||
if (self->_resigned) {
|
||||
if (_resigned) {
|
||||
_resigned = NO;
|
||||
//Reset the mode incase something changed with audio while we were inactive
|
||||
[self setMode:_mode];
|
||||
|
|
Loading…
Reference in New Issue