On Dec 4, 2006, at 10:38 AM, Thomas Grill wrote:
Am 04.12.2006 um 15:30 schrieb Hans-Christoph Steiner:
We are in the middle of trying to make [hidio] as robust as possible in terms of plugging and unplugging devices. One thing I noticed is that if I have Pd running only a sine wave, then I plug or unplug a USB device, I get an interruption in the sound.
If I do the same thing with Audacity or Max/MSP, there is not interruption in the sound. Any ideas what's the root of this?
I have no idea about the inner workings of hidio (is there a separate low-priority thread for handling the HID requests?)
This was bugging me so I have to respond to it. From what I've seen, I think handling HID I/O in a low priority thread would be a bad idea. Do you know any application that does that? The effect would be that your mouse pointer would skip whenever something with higher priority was run. This may be the case on Windows, but definitely not on Mac OS X and GNU/Linux.
On Mac OS X, the kernel queues HID events and uses wired kernel memory for the queues to ensure that those events get out there as soon as possible and reliably without a thread. No example code that I have seen, from Apple or others, puts HID event handling in a thread. To put it simply: you don't want your mouse pointer to be pre-empted.
.hc
but Max/MSP has a different thread for DSP processing, and messaging is split into high and low-priority tasks.
best greetings, Thomas
-- Thomas Grill http://grrrr.org
------------------------------------------------------------------------
The arc of history bends towards justice. - Dr. Martin Luther King, Jr.