> Your message has motivated me to publish my own PortAudio binding,
> which provides a simpler, more efficient callback-based interface:
I tried this, and after rewriting the code a bit, I managed to decrease
CPU load by 70-80%, which is not bad for starters. However, I'm getting
random segfaults, and I've no idea why.
Here's the modified player module (hpaste kindly rearranged the empty
lines for some reason):
Instead of building a list of samples right away, I use an unfoldr-style
generator to fill the buffer, whose initial state is created by
mixGenerator, and its stepper function is nextSample.
In order to get this working, I renamed your module to avoid conflict
with the other PortAudio binding, and I had to change the dependencies
in the cabal file to base >= 4 && < 5 because of the exception handling
There's also some broken MVar-based code to handle the end of the song,
you can ignore that for the time being.
http://www.fastmail.fm - The professional email service
Haskell-Cafe mailing list