Iain,
This sounds like a cool project! The support for this type of 3d spatialization is starting to appear for linux so maybe soon this can be cross-platform. As far as the synchronization goes, PD only calls dsp_tick() when the sys_send_dacs() returns SENDDACS_YES or SENDDACS_SLEPT. If the nosound option is called PD fakes this by checking the system clock to see if enough time has passed for the 'sound card' to have written data. The chances of this timing working with your sound card buffer seem kind of slim. Take a look at m_sched.c.
It sounds like what you are doing is writing to the sound card from an object? This may cause problems because you are not garunteed where your object will be placed in the dsp chain and, of course, the synchronization problems you are running into. You might look into rewriting the sys_audio functions (that open, write to, and close the sound card). I don't know enough about A3D to know if this makes sense, but this is where all audio io happens in pd at the moment.
Karl
On Wed, 15 Mar 2000 Iain.Mott@CMIS.CSIRO.AU wrote:
Hi
I've been doing some work writing an interface in Pd to an A3D sound card. (cards with Aureal's "Vortex 2" chipset enabling hardware spatialisation of sound). So far I've implemented a movable 'listener' object and movable sound source(s) which load a sound file in memory and play in a loop.
At present the A3d API works only on Win 98 - and that's what I'm using - waving the -nosound flag on the Pd command line to avoid audio clahes. There's talk of eventual Linux support in the future.
Have got part the way through writing another source object that accepts streamed PCM data from other Pd objects. The object works, however there is a synchronisation problem between Pd and the sound card, leading to glitches after a few seconds. Presently Pd is transferring blocks of 64 bytes to a circular buffer on the card. This buffer seems to tick along at a slightly slower rate to Pd (both are set to work at 44.1) and eventually the card attempts to read parts of the buffer that are concurrently being written to.
It's possible with the A3d API to access the current playback position in the circular buffer and this seems to be the only avenue for synchronisation with the api itself. Is there a way of tying Pd's 'tick rate' to these values?
Cheers, iain
| Karl W. MacMillan | | Peabody Institute of the Johns Hopkins University | | Network and Telecommunications Services | | karlmac@peabody.jhu.edu | | 410/659-8297 |