Here’s my code to play sound:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Feel" ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
AVAudioPlayer *_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];
[_audioPlayer prepareToPlay];
_audioPlayer.numberOfLoops = -1;
[fileURL release];
_audioPlayer.currentTime = 0;
[_audioPlayer play];
My problem is to how to vibrate while playing this sound?
For vibration, read the “System Sound Services Reference” documentation, especially the AudioServicesPlaySystemSound() method, with the constant kSystemSoundID_Vibrate.
Don’t forget to link your project to the AudioToolbox framework.