On 03/21/12 01:08, Pierre Abbat wrote:
How can I hear the sound as the program generates it?
I would suggest reviewing the code for systems that do the same. see also the 'sound(4)' page for relavent refs. CSound / snd and other 'synthesis toolkit' kinds of things might be a good candidate.
Can the same code work on both DFly and Linux?
With judicious use of cpp macros. :D Serously though, alsa for linux has an oss api emulation, and theoretically a userland library for non-alsa (read non-linux) platforms exists / works, though I haven't had luck with it on dfly Alternately you can write for a platform-independant library/API such as jack / esd / nas / SDL, portAudio etc. I would probably suggest this to start with since dealing with low-level audio is pretty tricky and unrewarding - lots of things about buffers and latency and various stuff, unless you want to learn these things directly. This also to some extent isolates your code from underlying system changes. the linux audio pages http://linux-sound.org/ are a really good mostly-linux centric reference, but various references there will be generally applicable to general audio under unix-like systems and some will be highly cross platform, etc. I would suggest spending a good deal of time reviewing the packages in pkgsrc/audio and figuring out which might fit your needs or serve as a good example and build from there. Note: not everything builds / runs 100% with all features on DragonFly there, so keep this in mind & expect to muck around