14.7.2011 22.34, Andrej Mitrovic kirjoitti:
There are already two bindings that exist for PortAudio. One is at
http://www.dsource.org/projects/bindings/wiki/Portaudio, and the other
is Derelict which has its own binding as well.
However the dsource bindings have missing symbols, and the 1-byte
alignment of struct members crashes the tests which I've ported to D.
When using default 4-byte alignment the tests will run without issues
(the PortAudio documentation recommends 4-byte alignment, so I don't
know why 1-byte alignment was used).


I made the bindings on dsource... I don't know about the alignment stuff. The decision to use 1-byte alignment was made with trial and error. I think it was propably the only way the whole thing worked on Linux at the time. (A couple of years ago.) It still works "fine" on Linux and Mac OS X with the 1-byte alignment. I should propably test 4-byte alignment again. (If I get the time...) I'm using GDC as the compiler.

There were some performance issues with the D versions. It was much easier for the D versions to drop audio, than the corresponding C versions, but that might have been due to the alignment or other issues... I remember there were some issues with threads, GC and crashes. But it eventually worked. By trial and error, which isn't such a good way to write software.

For the above reasons (and because I've worked on PortMidi as well),
I've started my own bindings to PortAudio. Currently it's only built
on Win32 platforms, but I'll see about getting it to work on Linux as
well.

Project link: https://github.com/AndrejMitrovic/DPortAudio

It has about 15 ported tests, with a few dozen more to do.

Great stuff. I hope you get it to work on Linux as well, as I don't want to start messing with it until somebody else has gotten it working. You are obviously doing a much better job at making the bindings complete with good examples. That is great!

More samples will be coming by, including how to use PortAudio with
PortMidi to make some cool realtime manipulation of audio data and
visuals via a MIDI interface.

That would be nice. I've been meaning to test PortMidi to get some midi controls for my app (the Pihlaja video viewer thing).

On a related note, I've also made bindings (barely working) for Jack.
http://www.dsource.org/projects/bindings/browser/trunk/jack
It might not be much interest for Windows users, and it's a bit more complex system, but I found it to perform a little better than PortAudio. (But that might be due to the alignment issues in my PortAudio bindings, as discussed above.) Oh, and Jack also works on Windows nowadays.

I'm still using PortAudio for my app, as it was easier to bundle into my installer, but I might change to Jack (it also has midi support) if my app ever becomes more audio oriented. I can change between the two with a compile switch (hurray, how wonderful).

Jonas Kivi

Reply via email to