• 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: Slight audio glitch when pressing the sleep/wake button on iPhone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slight audio glitch when pressing the sleep/wake button on iPhone


  • Subject: Re: Slight audio glitch when pressing the sleep/wake button on iPhone
  • From: "Roni Music" <email@hidden>
  • Date: Wed, 11 Mar 2009 17:30:57 +0100


----- Original Message ----- From: "William Stewart" <email@hidden>
To: "Roni Music" <email@hidden>
Cc: <email@hidden>
Sent: Wednesday, March 11, 2009 1:35 AM
Subject: Re: Slight audio glitch when pressing the sleep/wake button on iPhone




On Mar 10, 2009, at 7:21 AM, Roni Music wrote:


My application is playing audio using kAudioUnitSubType_RemoteIO similar to the aurioTouch sample and everything works great
except that I'm experiencing a slight audio glitch when pressing the sleep/wake button on the iPhone. The iPod app on the iPhone doesn't do this and a couple of other iPhone audio apps
doesn't either so there must be something that I'm missing?


When sleeping, the inNumberFrames in the render callback changes from 1024 to 4096 if that's related to this problem?

Yes, that can happen, so you should be prepared to provide those number of samples. The I/O size changes to conserve battery power when the screen is dimmed


There are plenty of frames in the buffer that is generated by the feeder thread so it's not related to that.

So, that sounds like you are doing that (I just wanted to make that point)


This is on an iPhone 3G with OS 2.1.1 and I'm building against SDK 2.2

Any advice?

I think this is a known problem that we've since fixed - can you try this on 2.2 and see if it reproduces there.


Actually I am on an iPhone with OS 2.2.1 (not 2.1.1) and building against SDK 2.2

For testing I removed my own buffer stuff from the render callback and changed
to just playing a sinus tone that is generated in the callback, same problem.


But if I change from using kAudioSessionCategory_MediaPlayback into
kAudioSessionCategory_PlayAndRecord the problem goes away
but the sounds from the internal speaker is too low to be useable for my app.


Here is how I setup my audio output (ripped out from my C++ audio output class):

void TestAudioOutput(CAStreamBasicDescription & outFormat)
{
               AudioUnit  mOutputUnit;

               AudioComponent comp;
               AudioComponentDescription desc;

               desc.componentType = kAudioUnitType_Output;
               desc.componentSubType = kAudioUnitSubType_RemoteIO;
               desc.componentManufacturer = kAudioUnitManufacturer_Apple;
               desc.componentFlags = 0;
               desc.componentFlagsMask = 0;

               comp = AudioComponentFindNext(NULL, &desc);
               XThrowIf(comp == NULL, -1, "find audio output unit failed");


XThrowIfError(AudioComponentInstanceNew(comp, &mOutputUnit), "open audio output unit failed");



UInt32 enableIO = 1;
XThrowIfError(AudioUnitSetProperty(mOutputUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output, 0,
&enableIO,
sizeof(enableIO)), "AudioUnitSetProperty (kAudioUnitProperty_EnableIO output) failed");



// set render callback AURenderCallbackStruct input; input.inputProc = StaticRenderCallback; input.inputProcRefCon = this;

XThrowIfError(AudioUnitSetProperty(
mOutputUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Global,
0,
&input, sizeof(input)), "SetRenderCallback to output unit failed");




// set stream format
XThrowIfError(AudioUnitSetProperty(
mOutputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&outFormat,
sizeof(AudioStreamBasicDescription)), "set audio output format failed");



XThrowIfError(AudioUnitInitialize(mOutputUnit), "initialize audio output unit failed");



XThrowIfError(AudioOutputUnitStart(mOutputUnit), "start audio output unit failed");


}


The above code works perfect except for the sleep/wake button glitch

Thanks,
Rolf




Thanks

Bill



Rolf



_______________________________________________ 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: Slight audio glitch when pressing the sleep/wake button on iPhone
      • From: William Stewart <email@hidden>
References: 
 >Slight audio glitch when pressing the sleep/wake button on iPhone (From: "Roni Music" <email@hidden>)
 >Re: Slight audio glitch when pressing the sleep/wake button on iPhone (From: William Stewart <email@hidden>)

  • Prev by Date: Audio glitches with aach on iPhone when locked
  • Next by Date: Re: Audio glitches with aach on iPhone when locked
  • Previous by thread: Re: Slight audio glitch when pressing the sleep/wake button on iPhone
  • Next by thread: Re: Slight audio glitch when pressing the sleep/wake button on iPhone
  • Index(es):
    • Date
    • Thread