project_files/HedgewarsMobile/Classes/AudioManagerController.m
changeset 6667 142fe596e75e
parent 6656 6aeaba3ee584
child 6700 e04da46ee43c
equal deleted inserted replaced
6666:0e2f5b81cbf2 6667:142fe596e75e
    66 +(void) stopBackgroundMusic {
    66 +(void) stopBackgroundMusic {
    67     [backgroundMusic stop];
    67     [backgroundMusic stop];
    68 }
    68 }
    69 
    69 
    70 +(void) fadeOutBackgroundMusic {
    70 +(void) fadeOutBackgroundMusic {
       
    71     if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"music"] boolValue] == NO)
       
    72         return;
       
    73 
    71     if (audioFaderQueue == nil)
    74     if (audioFaderQueue == nil)
    72         audioFaderQueue = [[NSOperationQueue alloc] init];
    75         audioFaderQueue = [[NSOperationQueue alloc] init];
    73     if (backgroundMusic == nil)
    76     if (backgroundMusic == nil)
    74         [AudioManagerController loadBackgroundMusic];
    77         [AudioManagerController loadBackgroundMusic];
    75     if (fadeOut == nil)
    78     if (fadeOut == nil)
    77 
    80 
    78     [audioFaderQueue addOperation:fadeOut];
    81     [audioFaderQueue addOperation:fadeOut];
    79 }
    82 }
    80 
    83 
    81 +(void) fadeInBackgroundMusic {
    84 +(void) fadeInBackgroundMusic {
       
    85     if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"music"] boolValue] == NO)
       
    86         return;
       
    87 
    82     if (audioFaderQueue == nil)
    88     if (audioFaderQueue == nil)
    83         audioFaderQueue = [[NSOperationQueue alloc] init];
    89         audioFaderQueue = [[NSOperationQueue alloc] init];
    84     if (backgroundMusic == nil)
    90     if (backgroundMusic == nil)
    85         [AudioManagerController loadBackgroundMusic];
    91         [AudioManagerController loadBackgroundMusic];
    86     if (fadeIn == nil)
    92     if (fadeIn == nil)