We're using the below code and calling this code many times through the app to play the button and application sounds. Currently we're having an issue where the volume controls on the device do not change the internal application volume. We can turn the volume all the way to off and the application will still play sounds. Is there a way to detect when the hardware volume controls have been changes and update the sound volume accordingly? We don't want to update sliders simply make the audio session respond to the newly set volume. Thank you very much in advance.
AudioSessionInitialize(NULL, NULL, NULL, self);
UInt32 category = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
sizeof(category),
&category);
AudioSessionSetActive(YES);
NSString *path = [NSString stringWithFormat:@"%@/%@.wav",
[[NSBundle mainBundle] resourcePath],
sound];
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);