Re: afinfo
Re: afinfo
Thank you very much ! It works now.
Karsten
Am 05.11.2010 um 15:59 schrieb Jean-Daniel Dupas:
> 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
References: | |
| >Re: afinfo (From: "email@hidden" <email@hidden>) |
| >Re: afinfo (From: Robert Martin <email@hidden>) |
| >Re: afinfo (From: Jean-Daniel Dupas <email@hidden>) |