• 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
AUFilePlayer, checking when its finished playing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AUFilePlayer, checking when its finished playing


  • Subject: AUFilePlayer, checking when its finished playing
  • From: GW Rodriguez <email@hidden>
  • Date: Tue, 26 Oct 2010 22:02:40 -0400

Hi everyone, quick question regarding the AUFilePlayer.  I want to know if there is a better way to determine when a region of audio is complete then the way I'm doing it.  Here's my method:

-(void) fileHasEnded:(NSTimer *) timer {

    if (fileIsPlaying) {

Float64 endTime = audioRegion.mStartFrame + audioRegion.mFramesToPlay;

UInt32 size = sizeof(currentTime);

CheckError(AudioUnitGetProperty(fileAU, 

kAudioUnitProperty_CurrentPlayTime, 

kAudioUnitScope_Global, 

0, 

              &currentTime, 

&size), 

          "Getting fileAU current playtime for fileHasEnded failed", kLine);

if (currentTime.mSampleTime >= endTime)

[self stop];

}

}

Basically I have added this method to the current run loop.  It calculates the end time in frames and then gets the property kAudioUnitProperty_CurrentPlayTime.  I then check that value with the known end time, once the current time is >= to the end time then i call my stop method.

Any better, or should I say more efficient, ways to accomplish this query?

- GW

 _______________________________________________
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

  • Prev by Date: Re: AudioUnits and the MacOS X App Store
  • Next by Date: Voice recognition and text to speech library
  • Previous by thread: Re: Forcing iPhone microphone as Audio Input when headset is plugged in
  • Next by thread: Voice recognition and text to speech library
  • Index(es):
    • Date
    • Thread