samedi 31 janvier 2015

How to convert a .wav file to a .caf file for use in iOS

I don't know squat about audio or the Terminal. I've use this Terminal command to convert a wav file for use in iOS:



afconvert -v -f 'caff' -d LEI16 -s 1 /users/myUserName/Desktop/hibeep.wav /users/myUserName/Desktop/hibeep.caf


After adding the file to my project, nothing happens when I execute:



NSURL * softURL = [[NSBundle mainBundle] URLForResource: @"hibeep" withExtension: @"caf"];
CFURLRef softSoundURL = (__bridge CFURLRef) softURL;
AudioServicesCreateSystemSoundID(softSoundURL, &_beepSound);
AudioServicesPlaySystemSound (_beepSound);


Yet, when I click on hibeep.caf in the Project Navigator, the sound will play fine.


I have tried this in both the simulator and on an iPad.


Any suggestions?


Thanks


Aucun commentaire:

Enregistrer un commentaire