• 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
Threading Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threading Question


  • Subject: Threading Question
  • From: ben kamen <email@hidden>
  • Date: Mon, 30 Jan 2012 13:30:14 -0800

Hello,

I have an iOS synth app and I am running into a problem that I think needs to be resolved through thread management or through some sort of locking system.

I have an envelope generator, a c++ object, to which I call "attack()" "decay()" from an audio controller object.  The envelope objects calls "decay()" and "sustain()" to itself within the render loop at appropriate times.

I've noticed that the "attack()" and "release()" functions get called on different threads than the "sustain()" and "decay()" functions, which sometimes (though not terribly often) results in the messages occuring out of order, and causes notes to get stuck on.

After some research my thinking is that I need a way to ensure that the audio controller only can call "attack()" or "release()" between render callbacks, or even better, in between processing each frame. Is there a design pattern or preferred method that can help me ensure that that will happen?  A code example would be incredibly helpful.

I realize this could also be a DSP question, but I'm pretty sure that is not my issue here.  I'm interested in knowing what the proper way to avoid this kind of situation is.

Thanks in advance!

Ben
 _______________________________________________
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: Threading Question
      • From: Gregory Wieber <email@hidden>
    • Re: Threading Question
      • From: Morgan Packard <email@hidden>
    • Re: Threading Question
      • From: Mark Pauley <email@hidden>
  • Prev by Date: Identical Audio Unit Channel Layout for Input and Output
  • Next by Date: Re: Threading Question
  • Previous by thread: Identical Audio Unit Channel Layout for Input and Output
  • Next by thread: Re: Threading Question
  • Index(es):
    • Date
    • Thread