SoundIn in MacOS X?

John M McIntosh johnmci at smalltalkconsulting.com
Tue Feb 5 05:27:34 UTC 2002


>HOOORRRAYYYYY!!  Way to go, John!
>

Alright I send Mark a copy, if any desperate squeaker out there using 
os-x wants a beta let me know. I'm awaiting feedback on 3.2.2 first.

Here's the lowdown on the problem. The SPBRecord would return zeros. 
Also asking for a mono-microphone on your mono-microphone powerbook 
would get a hardware error, for which you then ask for a stereo feed, 
that's ok, but then you get to fiddle with the bytes, Eric Scharff 
had pointed that out to me awhile back. Now why zero, but only in 
production builds?

Ah you guessed it, not that I did at first I was grumbling about 
compiler optimzation and interrupt routines, ITIMER logic. It seems 
the sigalarm tramples over the sound logic and you're toast. 
Therefore after a bit of reading, fiddling, etc, I ripped it out and 
installed an old fashion timer routine to trigger a callback every 
16ms.

Ah but what happens, how is it mapped from os-7 logic to os-x? It 
seems it maps to

pthread_make_periodic_np

A nice clean solution. (not if you don't have pthreads of course, but 
hey I've got pthreads). This seems to give good results, makes sound 
recording work, and doesn't trash profiling like the sigalrm stuff 
did. mmm it's only a lowres millisecond timer so I don't get excited 
if it gets blocked for a few ms for i/o and the like.

-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list