project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 4507 0f9b86942c19
parent 4504 8906b2409d97
child 4752 d65705a67c4e
equal deleted inserted replaced
4506:37744d5c877e 4507:0f9b86942c19
   154 void updateVisualsNewTurn(void) {
   154 void updateVisualsNewTurn(void) {
   155     DLog(@"updating visuals");
   155     DLog(@"updating visuals");
   156     [amvc_instance updateAmmoVisuals];
   156     [amvc_instance updateAmmoVisuals];
   157 }
   157 }
   158 
   158 
       
   159 /*
   159 // http://stackoverflow.com/questions/287543/how-to-programatically-sense-the-iphone-mute-switch
   160 // http://stackoverflow.com/questions/287543/how-to-programatically-sense-the-iphone-mute-switch
   160 BOOL isAppleDeviceMuted(void) {
   161 BOOL isAppleDeviceMuted(void) {
   161     if (!gAudioSessionInited) {
   162     if (!gAudioSessionInited) {
   162         AudioSessionInterruptionListener inInterruptionListener = NULL;
   163         AudioSessionInterruptionListener inInterruptionListener = NULL;
   163         OSStatus error;
   164         OSStatus error;
   164         if ((error = AudioSessionInitialize (NULL, NULL, inInterruptionListener, NULL)))
   165         if ((error = AudioSessionInitialize(NULL, NULL, inInterruptionListener, NULL)))
   165             DLog(@"*** Error *** error in AudioSessionInitialize: %d", error);
   166             DLog(@"*** Error *** error in AudioSessionInitialize: %d", error);
   166         else
   167         else
   167             gAudioSessionInited = YES;
   168             gAudioSessionInited = YES;
   168     }
   169     }
   169     UInt32 propertySize = sizeof(CFStringRef);
   170     UInt32 propertySize = sizeof(CFStringRef);
   172     // this checks if there is volume
   173     // this checks if there is volume
   173     Float32 volume;
   174     Float32 volume;
   174     OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume);
   175     OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume);
   175     if (n != 0)
   176     if (n != 0)
   176         DLog( @"AudioSessionGetProperty 'volume': %d", n );
   177         DLog( @"AudioSessionGetProperty 'volume': %d", n );
   177     BOOL volumeResult = (volume == 0.0);
   178     BOOL volumeResult = (volume == 0.0f);
   178     
   179     
   179     // this checks if the device is muted
   180     // this checks if the device is muted
   180     CFStringRef state;
   181     CFStringRef state;
   181     n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
   182     n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
   182     if (n != 0)
   183     if (n != 0)
   186         muteResult = ([result length] == 0);
   187         muteResult = ([result length] == 0);
   187         releaseAndNil(result);
   188         releaseAndNil(result);
   188     }
   189     }
   189     return volumeResult || muteResult;
   190     return volumeResult || muteResult;
   190 }
   191 }
       
   192 */