src/audio/coreaudio/SDL_coreaudio.m
changeset 12001 84c2582329b0
parent 11945 ffd52bb02bcc
child 12503 806492103856
equal deleted inserted replaced
12000:bb2e9f36b7ff 12001:84c2582329b0
   353             NSString *desc = err.description;
   353             NSString *desc = err.description;
   354             SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
   354             SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
   355             return NO;
   355             return NO;
   356         }
   356         }
   357 
   357 
   358         if (open_playback_devices + open_capture_devices == 1) {
   358         if (open && (open_playback_devices + open_capture_devices) == 1) {
   359             if (![session setActive:YES error:&err]) {
   359             if (![session setActive:YES error:&err]) {
   360                 NSString *desc = err.description;
   360                 NSString *desc = err.description;
   361                 SDL_SetError("Could not activate Audio Session: %s", desc.UTF8String);
   361                 SDL_SetError("Could not activate Audio Session: %s", desc.UTF8String);
   362                 return NO;
   362                 return NO;
   363             }
   363             }
   390             this->hidden->interruption_listener = CFBridgingRetain(listener);
   390             this->hidden->interruption_listener = CFBridgingRetain(listener);
   391         } else {
   391         } else {
   392             if (this->hidden->interruption_listener != NULL) {
   392             if (this->hidden->interruption_listener != NULL) {
   393                 SDLInterruptionListener *listener = nil;
   393                 SDLInterruptionListener *listener = nil;
   394                 listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener);
   394                 listener = (SDLInterruptionListener *) CFBridgingRelease(this->hidden->interruption_listener);
       
   395                 [center removeObserver:listener];
   395                 @synchronized (listener) {
   396                 @synchronized (listener) {
   396                     listener.device = NULL;
   397                     listener.device = NULL;
   397                 }
   398                 }
   398                 [center removeObserver:listener];
       
   399             }
   399             }
   400         }
   400         }
   401     }
   401     }
   402 
   402 
   403     return YES;
   403     return YES;