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

Calculating duration of an AIF file


  • Subject: Calculating duration of an AIF file
  • From: Harry G <email@hidden>
  • Date: Sat, 5 Dec 2009 12:26:20 +0000

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: tahome izwah <email@hidden>
  • Prev by Date: Re: pass-thru using audio queues
  • Next by Date: Re: Calculating duration of an AIF file
  • Previous by thread: Re: short question about ScheduledAudioFileRegion struct
  • Next by thread: Re: Calculating duration of an AIF file
  • Index(es):
    • Date
    • Thread