Re: Newbie documentation for MIDI
Re: Newbie documentation for MIDI
- Subject: Re: Newbie documentation for MIDI
- From: Chris Reed <email@hidden>
- Date: Wed, 27 Nov 2002 12:02:34 -0600
On Wednesday, November 27, 2002, at 01:20 am, Michael Bishop wrote:
Originally I was just looking for something that would be simple
enough for my real-time thread to notify my UI thread that there was
more MIDI available for it to process and nothing more really. I
wanted the real-time thread to send a message without blocking, but I
didn't need the messaging technique to be really complex and the UI
didn't need to update immediately, just in a reasonable amount of > time.
For this type of signalling (rather than messaging), you really should
also consider using semaphores in their role as signalling primitives.
I think in other discussion on this list, it was determined that mach
semaphores were the best to use and wouldn't block in this role.
1. Create a semaphore with a count of 0.
2. The consumer tries to acquire semaphore and blocks. (semaphore_wait)
3. The producer releases the semaphore when more data is available,
allowing the consumer to unblock. (semaphore_signal)
I've not personally used this method with mach semaphores, but it's
worked beautifully on every other system I've worked with. The latest
version of Kurt Revis' PlayBufferedSoundFile example uses this type of
signalling.
http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz
-chris
_______________________________________________
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.