valioiv
valioiv

Reputation: 423

How to write dummy ALSA compliant device driver?

I want to write dummy ALSA compliant driver as a loadable kernel module. When accessing it by aplay/arecord throught the ALSA-lib, let's say, it must behave as normal 7.1 channel audio device providing all the basic controls at least - sampling rates, number of channels, format, etc... Underneath it will just get every channel from the audio stream and will send it through the network as UDP packet stream. It must be capable to be loaded multiple times and ultimately it would expose as many as want audio devices under /dev. In that way we will have multiple virtual sound cards in the system.

What should be the minimal structure of such a kernel module? Can you give me an example skeleton (at least the interfaces) to be 100% ALSA compliant? ALSA driver examples are so poor...

Upvotes: 4

Views: 3708

Answers (2)

valioiv
valioiv

Reputation: 423

I think I've just found what I need. There are no better ALSA interface examples than "dummy" and "aloop" templates under sound/drivers directory in the kernel tree:

https://alsa-project.org/main/index.php/Matrix:Module-dummy

https://www.alsa-project.org/main/index.php/Matrix:Module-aloop

I'll need to implement the network part only.

EDIT: Adding yet another project for a very simple but essential virtual ALSA driver:

https://alsa-project.org/main/index.php/Minivosc

EDIT 2020_09_25: Yet another great ALSA example:

https://www.openpixelsystems.org/posts/2020-06-27-alsa-driver/

Upvotes: 4

hailuodev
hailuodev

Reputation: 772

  • install alsa-base alsa-util
  • modprobe snd-dummy
  • use alsamixer or use mocp(need install moc) to conifg add dummy-audio success

Upvotes: 2

Related Questions