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; |