• 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: setting same IOProc more than once?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting same IOProc more than once?


  • Subject: Re: setting same IOProc more than once?
  • From: Jeff Moore <email@hidden>
  • Date: Tue, 1 Oct 2002 12:13:11 -0700

On Tuesday, October 1, 2002, at 11:20 AM, Gary Scavone wrote:

I'm trying to add the same IOProc for the same device more than once,
but AudioDeviceAddIOProc() returns a
"kAudioHardwareIllegalOperationError". What I'm trying to do probably
seems kind of stupid, but within the multiple stream scheme that I've
setup in my cross-platform realtime audio input/output c++ class, it
makes sense. This single IOProc uses distinct client data to
subsequently call the routine which handles the input/output.

As you've surmised, the HAL only allows you to register an address as an IOProc once.

I've explored various ways around this but I keep running into
problems. Is there a good reason why the CoreAudio API doesn't allow
this? Is there a way to "trick" it into believing that I'm using
different IOProcs? I tried using distinct pointers to the same
routine, but it apparently dereferences the pointer.

Why do you want to register the same IOProc twice?

While it is true that you can have multiple IOProcs in a single process, this by no means means that it is a good thing to do. It is better for performance and for system resource usage if each process does it's own mixing prior to handing the data to the hardware for mixing with the rest of the system's sound going to that device. This saves on both time and space resources in the kernel: less wired memory is used and less time is spent inside the kernel trap the HAL calls to to perform IO with the driver.

The main reason why the HAL has to allow multiple IOProcs in a process is to permit libraries of code that may not know anything about each other to work with the same audio device at the same time.

The main reason why the HAL behaves as it does with multiple IOProcs is to discourage a single entity from registering multiple IOProcs in a process. Granted, there are a myriad of ways around this, but it's good to use API conventions to suggest usage.

--

Jeff Moore
Core Audio
Apple
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: [coreaudio] Re: AU interface consistency
  • Next by Date: Re: AU interface consistency
  • Previous by thread: setting same IOProc more than once?
  • Next by thread: Re: AU HostCallback - musical location
  • Index(es):
    • Date
    • Thread