• 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: How do you pause, stop and reset an AUFilePlayer in IOS5?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you pause, stop and reset an AUFilePlayer in IOS5?


  • Subject: Re: How do you pause, stop and reset an AUFilePlayer in IOS5?
  • From: Aran Mulholland <email@hidden>
  • Date: Thu, 19 Jul 2012 09:36:10 +1000

You can't pause the AUFilePlayer. What you can do is call something like

    AudioTimeStamp ts;
    UInt32 size = sizeof(ts);
    AudioUnitGetProperty(filePlayerUnit_,
kAudioUnitProperty_CurrentPlayTime, kAudioUnitScope_Global, 0, &ts,
&size);
    Float64 sampleFrame = ts.mSampleTime;

to get the currently playing sample frame, then call

   AudioUnitReset(filePlayerUnit_, kAudioUnitScope_Global, 0);

To stop it and if you want to resume playback (from pause), schedule a
new region with the sample time you had before you called
AudioUnitReset. Be nice if it had a pause, but not hard to implement
yourself.


Aran

On Thu, Jul 19, 2012 at 7:06 AM, Beleg Da'Bear <email@hidden> wrote:
> I am working with core audio using an AUFilePlayer to load a few mp3s into a
> mixer unit, everything plays great however I am unable to pause the music or
> rewind the music back to the start. I tried Starting and stopping the
> AudioGraph, but once the playback is stopped, I can't get it to restart. I
> also tried using AudioUnitSetProperty to set the file playback to 0
> i.e something along these lines:
>
>         ScheduledAudioFileRegion rgn;
>         memset (&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
>         rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
>         rgn.mTimeStamp.mSampleTime = 0;
>         rgn.mCompletionProc = NULL;
>         rgn.mCompletionProcUserData = NULL;
>         rgn.mAudioFile = inputFile;
>         rgn.mLoopCount = 1;
>         rgn.mStartFrame = 0;
>
>         rgn.mFramesToPlay = nPackets * inputFormat.mFramesPerPacket;
>
>         AudioUnitSetProperty(fileUnit,
> kAudioUnitProperty_ScheduledFileRegion,
>                              kAudioUnitScope_Global, 0,&rgn, sizeof(rgn));
>
> Any suggestions?
>
>  _______________________________________________
> 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
>
 _______________________________________________
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: How do you pause, stop and reset an AUFilePlayer in IOS5?
      • From: Robert Martin <email@hidden>
References: 
 >How do you pause, stop and reset an AUFilePlayer in IOS5? (From: "Beleg Da'Bear" <email@hidden>)

  • Prev by Date: How do you pause, stop and reset an AUFilePlayer in IOS5?
  • Next by Date: Re: How do you pause, stop and reset an AUFilePlayer in IOS5?
  • Previous by thread: How do you pause, stop and reset an AUFilePlayer in IOS5?
  • Next by thread: Re: How do you pause, stop and reset an AUFilePlayer in IOS5?
  • Index(es):
    • Date
    • Thread