• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: afinfo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: afinfo


  • Subject: Re: afinfo
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 5 Nov 2010 15:59:49 +0100

Yes. This property can only be used with the AudioFileAPI.
If you opened your file using ExtAudioFile API, you can get the underlying AudioFileID by querying the kExtAudioFileProperty_AudioFile property.
And then, you can query the estimated duration using AudioFileGetProperty().

AFAIK, AudioFile API does not provide a way to directly get the exact duration, that's why I suggested ExtAudioFile in the first place. But if you only need estimated duration, it may be more efficient to use AudioFileOpenURL directly.

Le 5 nov. 2010 à 15:42, Robert Martin a écrit :

> Try AudioFileOpenURL and AudioFileGetProperty (not ExtAudioFile)
>
> On Nov 5, 2010, at 9:52 AM, email@hidden wrote:
>
>> 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);
>>
>> }
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

-- Jean-Daniel




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: afinfo
      • From: "email@hidden" <email@hidden>
References: 
 >Re: afinfo (From: "email@hidden" <email@hidden>)
 >Re: afinfo (From: Robert Martin <email@hidden>)

  • Prev by Date: Re: afinfo
  • Next by Date: Re: afinfo
  • Previous by thread: Re: afinfo
  • Next by thread: Re: afinfo
  • Index(es):
    • Date
    • Thread