core audio - How do I get the filesystem path for a resource on iPhone? -
On the iPhone, I need to get the path to the resource. I'm fine, it did, but when it comes to the CFURLCreateFromFileSystemRepresentation thing I do not know how to solve it. Why is this error? Any solution or solution will be highly appreciated. Thank you in advance.
To run audio using audioquake on iPhone, I have taken a look at the following examples: Speak Hear, Audio Options (from simple SDK directory) and AudioQuestate. I tried to do this and said that, trying to keep the puzzle together. Right now, I've been stuck on the program crashing up from the sndFile above the crash due to the exception.
On the actual iPhone device I am using AvAudioPlayer to play every sound on my iPhone games, the sound can be played when it is too short for the sound, so I decided that I AudioQueue must be used.
- (id) initWithFile: (NSString *) Argv {if (self = [super init]) {NSString * soundFilePath = [[NSBundle mainBundle] pathForResource: argv ofType: @ "MP3 "]; Int len = [sound filepath length]; Char * fpath = new four [lane]; // This is to change the NSString * * To match / need the CFURLCreateFromFileSystemReresentation function (INTI = 0; I & lt; [SoundFileLength Length]; I ++) {FPIT [I] = [SoundFilePath CharacterEntx : I]; } CFURLRef sndFile = CFURLCreateFromFileSystemRepresentation (NULL, (const UInt8 *) trappath, strollon (trapped), false); If (! SndFile) {NSLog (@ "sndFile Error"); XThrowIfError (! SndFile, "File can not parse path"); }}
Why do you need a CFURL?
If you have a method that requires a CFL, then you can just use NSURL for toll free bridging. So to make NSURL, you just do:
NSString * soundFilePath = [[NSBundle main bundle] Pathfoser resource: argv ofType: @ "MP3"]; NSURL * soundURL = [NSUr File URL Thread: SoundFilePath];
In general, if you use CF objects, then you are probably doing something wrong.
Comments
Post a Comment