0
0

Hi,

i want to create a sound with a file which is not in the mainBundle
but in the documents folder.

i tried this:

[code:3orxcppd]
// this way i usually can open a file in the documents folder

NSString *fileName=[NSString stringWithFormat:@"record.wav"];
NSArray *dirPaths dirPaths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);;
NSString *docsDir docsDir=[dirPaths objectAtIndex:0];
NSString *recordingFilePath=[docsDir stringByAppendingPathComponent:fileName];
NSURL *recordingFileUrl=[[NSURL alloc]initFileURLWithPath:recordingFilePath];

//here the fmod part

char buffer[300] = {0};
[[recordingFileUrl absoluteString]getCString:buffer maxLength:300 encoding:NSASCIIStringEncoding];
result = system->createSound(buffer, FMOD_SOFTWARE | FMOD_LOOP_NORMAL | FMOD_UNICODE, NULL, &sound[0]);
[/code:3orxcppd]

but i always get ‘File not found (23)’ error

when i log the buffer, the path is correct and the file exists

[quote:3orxcppd]
file:///localhost/Users/MYNAME/Library/Application%20Support/iPhone%20Simulator/4.1/Applications/8520BEAC-ADD7-49DA-927B-65E4FC28DE60/Documents/record.wav[/quote:3orxcppd]

can anyone help?

thanks

  • You must to post comments
0
0

Instead of using NSURL, just use the NSString "recordingFilePath".

  • George
  • You must to post comments
0
0

Thanks

it works now

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.