Hi,
I tried to get the kAudioFilePropertyEstimatedDuration property, but I always receive an error ( NSLog(@"property error") ) and the value of seconds is 0. What am I doing wrong ? I would be very thankful for an answer.
Karsten
-(void) duration
{ NSURL *inputFileURL = [NSURL fileURLWithPath:PathName]; OSStatus Error = noErr; ExtAudioFileRef file; Error = ExtAudioFileOpenURL((CFURLRef)inputFileURL, &file); if(Error != 0) NSLog(@"file not loaded"); NSTimeInterval seconds; //Float64 seconds; ?? UInt32 propertySize = sizeof(seconds); Error = ExtAudioFileGetProperty(file, kAudioFilePropertyEstimatedDuration, &propertySize, &seconds); if(Error != 0) NSLog(@"property error"); NSLog(@"duration: %f", seconds); if(Error != 0) NSLog(@"error"); //printf("duration %f \n",seconds);
ExtAudioFileDispose(file);
}
|