I have a list of short wav files. Two of these files do not play on either the simulator or the device itself. All are wav files 1 second long.
This is how I play the files
SystemSoundID soundID;
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sound1" ofType:@"wav"];
NSURL *fileUrl = [NSURL fileURLWithPath:filePath];
AudioServicesCreateSystemSoundID((CFURLRef)fileUrl, &soundID);
AudioServicesPlaySystemSound(soundID);
Can someone please tell me what the problem could be. Thanks.
P.S. When I view the files in Finder, the files not playing show the default player as QuickTime and the others show the default player as iTunes if that helps in any way.
The solution as Alan suggested is to use AIFF files. To convert wav to AIFF, open the sound file in iTunes. In iTunes, select Preferences->General->Import Settings->Import using AIFF Encoder. Select the sound file and in Advanced menu option select the option "Create AIFF version"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…