I guess the first comment should be that the VW interface doesn't work reliably and has been adandoned. I'll describe it and explain.
In VW, you can use the DLLCC (dynamic linked library and C connect) API to link ST80 with external APIs. It's supposedly easier to use than the user primitives interface. The tool can parse a C header file and create a Smalltalk mirror class with glue code for calling the C functions. Users can write C code that signals Smalltalk semaphores or creates other callbacks.
The PortAudio API is based on registering a callback function with the sound driver; this gets called for every buffer of output, i.e., on the order of every couple msec or so. In a well-behaved app., the callback simply copies sample data from a stored buffer into the requested buffer, signals the "producer" thread, and returns. I think that the VW semaphore mechanism is too slow for this, but never got around to tracing it more closely. My work in ST80 is mainly about controlling external synthesis SW from Smalltalk, meaning that we use the OpenSoundControl protocol (OSC) to control synthesis servers, instead of doing the synthesis and sound output from ST. This is why I never finished the sound IO stuff, though it would be really interesting to have working...
At any rate, the glue code I have for PortAudio in VW ought to be quite useable for a Squeak FFI interface, *if* the callback triggering method is fast enough to service the callbacks. I'll attach a smaller zip file with just the related C and ST code. Take a look at the README file and the ST source for the glue code (the external interface classes) and the "port" classes.
stp

-- Stephen Travis Pope -- http://create.ucsb.edu/~stp Dept. of Music and Grad. Program in Media Arts and Technology University of California, Santa Barbara
Begin forwarded message:
From: Brad Fuller brad@sonaural.com Date: November 3, 2005 8:26:19 AM PST To: Stephen Travis Pope stp@create.ucsb.edu, squeakaudio@create.ucsb.edu Subject: Re: [SqueakAudio] PortAudio Port Help Request
Stephen Travis Pope wrote:
Hey, this sounds interesting! We've built loads of PortAudio interfaces, including for VisualWorks. It's all pretty easy, but you have to manage the timing of the audio call-backs and Smalltalk semaphores carefully to avoid dropping buffers. There's cross- platform VW wrapper code (using the DLLCC Smalltalk-to-C API) in the Siren7 release (http://www.create.ucsb.edu/Siren/ Siren7.2.tgz).
stp
Thanks Stephen! I know nothing about WV wrapper method. How (dis)similiar is it to Squeak primitives or FFI? Any more wisdom of your PortAudio<->VW journey is most welcome.
What version of PortAudio have you linked to?
-- Stephen Travis Pope -- http://create.ucsb.edu/~stp Dept. of Music and Grad. Program in Media Arts and Technology University of California, Santa Barbara
Begin forwarded message:
From: Brad Fuller brad@sonaural.com Date: November 1, 2005 10:43:33 AM PST To: Squeak List squeak-dev@lists.squeakfoundation.org, squeakaudio@create.ucsb.edu Subject: [SqueakAudio] PortAudio Port Help Request
Anyone interested in working with me on porting PortAudio (http:// portaudio.com/) to Squeak? I've never built a primitive before although I've gotten the Linux 3.8 VM to build using VMMaker (whew.) So, if you have experience in this area, that would be an added bonus!
I want to start on Linux first using v19 preferably with the JACK (http://jackit.sourceforge.net/) interface,. But ALSA (http://alsa- project.org/) would be fine for now. Linux primarily because of the free C tools - I have no C tools for Windows or Mac. But, if someone would like to help and start with Windows, I could get tools. (I don't have a MAC at my disposal right now. But, if you'd like to start on MAC, I could potentially get one.)
Please let me know online or off if you're interested. I think it would make a great addition to the usefulness of Squeak for audio and video.
thanks,
brad
-- Brad Fuller (408) 799-6124 ** Sonaural Audio Studios ** (408) 799-6123 West San Jose (408) 799-6124 Cambrian ________________________________ Hear us online: www.Sonaural.com See me on O'Reilly: http://www.oreillynet.com/pub/au/2184
squeak-dev@lists.squeakfoundation.org