I implemented a ring buffer with cyclic DMA and audio now works fine.
I just copypasted dmastart() in dma.c to make dmaloop(), removed the
interrupt setting and made the next control block the initial control
block instead of nil so it keeps looping. This should be cleaned up
somehow...
Then, instead of dmawait() in audioclose(), the DMA device is polled
until it gets to the last written sample, then DMA and PWM is shut down.
There is no volume file yet. After that, I guess I'll start messing with
the videocore...