• 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: Calculating duration of an AIF file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating duration of an AIF file


  • Subject: Re: Calculating duration of an AIF file
  • From: tahome izwah <email@hidden>
  • Date: Sat, 5 Dec 2009 13:44:26 +0100

Looks like you're passing the wrong variable type (should be a Float64
not a UInt64).

AudioFile.h states:

	@constant	kAudioFilePropertyEstimatedDuration
					The value is a Float64 representing an estimated duration in
seconds. If duration can be calculated without scanning the entire
file,
					or all the audio data packets have been scanned, the value will
accurately reflect the duration of the audio data.


HTH
--th

2009/12/5 Harry G <email@hidden>:
> Hi there I'm trying to calculate the duration of an AIF file, could you have
> a quick look at this code please and tell me where im going wrong. I'm
> developing this on the iPhone. The result is always 0. Thanks in advance.
>
> + (UInt64)getAudioFileDuration:(NSString*)soundPath {
> NSURL *afUrl = [NSURL fileURLWithPath:soundPath];
> AudioFileID fileID;
> OSStatus result = AudioFileOpenURL((CFURLRef)afUrl,
> kAudioFileReadPermission, 0, &fileID);
> UInt64 outDataSize = 0;
> UInt32 thePropSize = sizeof(UInt64);
> result = AudioFileGetProperty(fileID, kAudioFilePropertyEstimatedDuration,
> &thePropSize, &outDataSize);
> AudioFileClose(fileID);
> return outDataSize;
> }
>
> ....
> NSLog(@"why is this always 0?   %qu", [MySoundClass
> getAudioFileDuration:@"openPage.aif"]);
>
 _______________________________________________
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: Calculating duration of an AIF file
      • From: Harry G <email@hidden>
References: 
 >Calculating duration of an AIF file (From: Harry G <email@hidden>)

  • Prev by Date: Calculating duration of an AIF file
  • Next by Date: AudioConverter with kAudioFormatiLBC - available bitrates
  • Previous by thread: Calculating duration of an AIF file
  • Next by thread: Re: Calculating duration of an AIF file
  • Index(es):
    • Date
    • Thread