Search code examples
objective-ciosxcodeaudioaudiotoolbox

iOS system sound service unable to adjust volume


in .h:

#import <AudioToolbox/AudioToolbox.h>
@interface ViewController : UIViewController {
    SystemSoundID beatAudio;
}

in.m:

//File path already created
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &(beatAudio));
AudioServicesPlaySystemSound(beatAudio);

The sound is perfect, but when I toggle up and down the volume bar, the volume of this sound is not affected. Any solutions?


Solution

  • You've created it as a system sound, and in order for them to be affected by the volume control, you have to change the phone settings

    Go into settings->sounds and select 'Change with Buttons' to on.

    You may not need to play this sound as a system sound though ?