project_files/HedgewarsMobile/Classes/ObjcExports.m
changeset 4488 e83216eba1db
parent 4461 2f4f5d649bcd
child 4504 8906b2409d97
equal deleted inserted replaced
4486:2c8e4d859d37 4488:e83216eba1db
   169 
   169 
   170     // this checks if there is volume
   170     // this checks if there is volume
   171     Float32 volume;
   171     Float32 volume;
   172     OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume);
   172     OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume);
   173     if (n != 0)
   173     if (n != 0)
   174         DLog( @"AudioSessionGetProperty: %d", n );
   174         DLog( @"AudioSessionGetProperty 'volume': %d", n );
   175     BOOL volumeResult = (volume == 0.0);
   175     BOOL volumeResult = (volume == 0.0);
   176     
   176     
   177     // this checks if the device is muted
   177     // this checks if the device is muted
   178     CFStringRef state;
   178     CFStringRef state;
   179     n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
   179     n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
   180     if (n != 0)
   180     if (n != 0)
   181         DLog( @"AudioSessionGetProperty: %d", n );
   181         DLog( @"AudioSessionGetProperty 'audioRoute': %d", n );
   182     NSString *result = (NSString *)state;
   182     NSString *result = (NSString *)state;
   183     BOOL muteResult = ([result length] == 0);
   183     BOOL muteResult = ([result length] == 0);
   184     releaseAndNil(result);
   184     releaseAndNil(result);
   185     
   185     
   186     return volumeResult || muteResult;
   186     return volumeResult || muteResult;