libasound-d 2.0.0

D bindings for ALSA (Advanced Linux Sound Architecture) libasound2 library.

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:


This package contains ALSA library headers translated to D.

dstep was used to generate the binding which was then modified to build properly.

You will need to add "asound" to your "libs" or "posix-libs" section in your project dub.json file to link to the libasound2 library.


libasound2 makes heavy use of anonymous structures. When allocating such structures macros are often used to allocate the structure on the stack using alloca(). Currently these macros have not been translated to a D equivalent. If anyone has any good ideas for a mixin template or something, please let me know.

Example alloca() structure allocation

This example is for the snd_seq_port_info_t structure.

C code

snd_seq_port_info_t *port_info = NULL;
snd_seq_port_info_alloca (&port_info);

Equivalent D code

import core.stdc.stdlib : alloca;
import core.stdc.string : memset;

snd_seq_port_info_t *port_info;
port_info = cast(typeof(port_info))alloca(snd_seq_port_info_sizeof());
memset(port_info, 0, snd_seq_port_info_sizeof());

Release history

  • v2.0.0 (2023-05-30)
  • First release


ALSA library and these bindings are licensed under the terms of LGPL-2.1 or later. See the file LICENSE for more details.


libasound2 has several authors, including:

See libasound2 sources for more details.

This D binding was created by "Element Green"

2.0.0 2023-May-30
Show all 1 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 1 downloads this month

  • 7 downloads total

Short URL: