• 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
Loading in background thread, audio glitches
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading in background thread, audio glitches


  • Subject: Loading in background thread, audio glitches
  • From: Seth Nickell <email@hidden>
  • Date: Sun, 2 Aug 2009 14:45:04 -0700

I'm hacking out an AudioUnit effects plugin, and getting weird glitches in the output audio. I've spent a couple days debugging these to no avail.

While my AU is processing, I occasionally load a WAV file in the background (Cocoa UI thread, or a new pthread) using AudioFileReadBytes(). If I stall the background thread using "while (true)" right before the call to AudioFileReadBytes() I get no glitches. If I stall immediately after, I get a glitch (short burst of noise).

The obvious candidate is memory corruption, but GuardMalloc reports nothing, and I'm doing lots of other operations that don't seem to cause problems.

// size is pretty large, size = 80000 or so
// irURL is a URL to a WAV inside my bundle

float *loadSignal(CFURLRef irURL, uint32_t size) {

AudioFileID fileID;

OSStatus result;


float *buffer = new float[size]();


result = AudioFileOpenURL(irURL, fsRdPerm, 0, &fileID);

assert(result == noErr);

UInt32 ioNumBytes = size * sizeof(float);

// while(true); here = no glitch on ::Process() thread

result = AudioFileReadBytes(fileID, false, 0, &ioNumBytes, buffer);

// while(true); here = glitch

assert(result == noErr);


result = AudioFileClose(fileID);

assert(result == noErr);


return buffer;

}

Is there something else potentially going on with, I dunno, mutexes inside CoreAudio getting held or something like that? But I assume CoreAudio will output silence if stalled, not noise, correct?

I appreciate any suggestions of where to go from here.

-Seth

 _______________________________________________
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: 64bit processing - Why?
  • Next by Date: Re: Echo cancellation and audio codec in coreaudio
  • Previous by thread: Re: 64bit processing - Why?
  • Next by thread: Re: Echo cancellation and audio codec in coreaudio
  • Index(es):
    • Date
    • Thread