project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m
branchios-revival
changeset 11137 14f50dde3e8c
parent 8441 a00b0fa0dbd7
child 12872 00215a7ec5f5
equal deleted inserted replaced
11136:9b5f60bc059e 11137:14f50dde3e8c
    77   ALog(@"Failed to init class (%@) with AVAudioPlayer instance, use initFadeWithAudioPlayer:",[self class]);
    77   ALog(@"Failed to init class (%@) with AVAudioPlayer instance, use initFadeWithAudioPlayer:",[self class]);
    78   return nil;
    78   return nil;
    79 }
    79 }
    80 
    80 
    81 - (void)main {
    81 - (void)main {
    82   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    82   @autoreleasepool {
       
    83 
    83   [NSThread sleepForTimeInterval:_delay];
    84   [NSThread sleepForTimeInterval:_delay];
    84   if ([self.audioPlayer isKindOfClass:[AVAudioPlayer class]]) {
    85   if ([self.audioPlayer isKindOfClass:[AVAudioPlayer class]]) {
    85     [self beginFadeOperation];
    86     [self beginFadeOperation];
    86   }
    87   }
    87   else {
    88   else {
    88     ALog(@"AudioPlayerFadeOperation began with invalid AVAudioPlayer");
    89     ALog(@"AudioPlayerFadeOperation began with invalid AVAudioPlayer");
    89   }
    90   }
    90 
    91 
    91   [pool release];
    92   }
    92 }
    93 }
    93 
    94 
    94 - (void)beginFadeOperation {
    95 - (void)beginFadeOperation {
    95   if (![self.audioPlayer isPlaying] && _playBeforeFade) [self.audioPlayer play];
    96   if (![self.audioPlayer isPlaying] && _playBeforeFade) [self.audioPlayer play];
    96 
    97