DPortAudio

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Jul 14 12:34:11 PDT 2011


This is a direct D binding of the PortAudio C library, meaning it's
not OOP but a plain D conversion of its headers. PortAudio is
MIT-licensed, and these bindings are Boost-licensed.

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).

Derelict also has 1-byte aligned struct members and it might suffer
from the same issues, but I haven't tested it out so I can't confirm.
In either case Derelict is a game-oriented library, and contains no
examples on how to use PortAudio, plus it's on dsource which is a
graveyard of dead projects anyway.

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.

It also has one standalone example, in which you can play your qwerty
keyboard and the app will play a sinewave at a certain tone in the
left and right channles, and draw the sinewaves on the screen for both
channels. The visuals are updated as you "play" your keyboard. :) This
example is currently built on win32 only.

Here's a screenshot:

http://i.imgur.com/7zsdJ.png

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.


More information about the Digitalmars-d-announce mailing list