mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6014 from andyque/fix_issue4562
closed #4562, Stopped music could also be resumed on iOS
This commit is contained in:
commit
a3a0833401
|
@ -100,6 +100,7 @@ typedef enum {
|
|||
BOOL backgroundMusic;
|
||||
// whether background music is paused
|
||||
BOOL paused;
|
||||
BOOL stopped;
|
||||
@public
|
||||
BOOL systemPaused;//Used for auto resign handling
|
||||
NSTimeInterval systemPauseLocation;//Used for auto resign handling
|
||||
|
|
|
@ -48,6 +48,7 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
mute = NO;
|
||||
enabled_ = YES;
|
||||
paused = NO;
|
||||
stopped = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -96,6 +97,7 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
if (enabled_) {
|
||||
self->systemPaused = NO;
|
||||
self->paused = NO;
|
||||
self->stopped = NO;
|
||||
[audioSourcePlayer play];
|
||||
} else {
|
||||
CDLOGINFO(@"Denshion::CDLongAudioSource long audio source didn't play because it is disabled");
|
||||
|
@ -104,6 +106,7 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
|
||||
-(void) stop {
|
||||
self->paused = NO;
|
||||
self->stopped = YES;
|
||||
[audioSourcePlayer stop];
|
||||
}
|
||||
|
||||
|
@ -118,9 +121,11 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
}
|
||||
|
||||
-(void) resume {
|
||||
self->paused = NO;
|
||||
[audioSourcePlayer play];
|
||||
}
|
||||
if (!stopped) {
|
||||
self->paused = NO;
|
||||
[audioSourcePlayer play];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL) isPlaying {
|
||||
if (state != kLAS_Init) {
|
||||
|
|
|
@ -119,7 +119,7 @@ NSString * const kCDN_AudioManagerInitialised = @"kCDN_AudioManagerInitialised";
|
|||
|
||||
-(void) resume {
|
||||
self->paused = NO;
|
||||
[audioSourcePlayer play];
|
||||
[audioSourcePlayer resume];
|
||||
}
|
||||
|
||||
-(BOOL) isPlaying {
|
||||
|
|
|
@ -96,6 +96,7 @@ extern OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *o
|
|||
- (BOOL)playAtTime:(NSTimeInterval) time; /* play a sound some time in the future. time should be greater than deviceCurrentTime. */
|
||||
- (void)pause; /* pauses playback, but remains ready to play. */
|
||||
- (void)stop; /* stops playback. no longer ready to play. */
|
||||
- (BOOL) resume;
|
||||
|
||||
/* properties */
|
||||
|
||||
|
|
|
@ -88,7 +88,13 @@ OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *outData)
|
|||
result = [_player resume];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) resume{
|
||||
BOOL result = [_player resume];
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
-(void) pause {
|
||||
[_player pause];
|
||||
|
|
Loading…
Reference in New Issue