152 } |
152 } |
153 |
153 |
154 void updateVisualsNewTurn(void) { |
154 void updateVisualsNewTurn(void) { |
155 [amvc_instance updateAmmoVisuals]; |
155 [amvc_instance updateAmmoVisuals]; |
156 } |
156 } |
157 |
|
158 /* |
|
159 // http://stackoverflow.com/questions/287543/how-to-programatically-sense-the-iphone-mute-switch |
|
160 BOOL isAppleDeviceMuted(void) { |
|
161 if (!gAudioSessionInited) { |
|
162 AudioSessionInterruptionListener inInterruptionListener = NULL; |
|
163 OSStatus error; |
|
164 if ((error = AudioSessionInitialize(NULL, NULL, inInterruptionListener, NULL))) |
|
165 DLog(@"*** Error *** error in AudioSessionInitialize: %d", error); |
|
166 else |
|
167 gAudioSessionInited = YES; |
|
168 } |
|
169 UInt32 propertySize = sizeof(CFStringRef); |
|
170 BOOL muteResult = NO; |
|
171 |
|
172 // this checks if there is volume |
|
173 Float32 volume; |
|
174 OSStatus n = AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, &propertySize, &volume); |
|
175 if (n != 0) |
|
176 DLog( @"AudioSessionGetProperty 'volume': %d", n ); |
|
177 BOOL volumeResult = (volume == 0.0f); |
|
178 |
|
179 // this checks if the device is muted |
|
180 CFStringRef state; |
|
181 n = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state); |
|
182 if (n != 0) |
|
183 DLog( @"AudioSessionGetProperty 'audioRoute': %d", n ); |
|
184 else { |
|
185 NSString *result = (NSString *)state; |
|
186 muteResult = ([result length] == 0); |
|
187 releaseAndNil(result); |
|
188 } |
|
189 return volumeResult || muteResult; |
|
190 } |
|
191 */ |
|