Skip to contentSkip to conversation

Test device for automated testing

DISCUSSION Uli Franke 2 participants 5 messages Sep 16, 2015 – Sep 17, 2015

lore
Share & tools
lore

Uli Franke

author
#0 lore raw

Hi everybody,

we're currently writing a lot of ALSA user space applications. In order to test this code with our unit testing and other test environments we'd like to know if there's a dummy PCM device which provides the fundamental operations like reading/writing and setting the common hardware parameters. It doesn't even have to supply some useful functionality like loop back or similar.

Neither the docs nor the goo led us to something useful.

Thanks and regards
Uli

#1 lore raw
Quoted 5 lines · Uli Franke

we're currently writing a lot of ALSA user space applications. In order to test this code with our unit testing and other test environments we'd like to know if there's a dummy PCM device which provides the fundamental operations like reading/writing and setting the common hardware parameters.

That would be the snd-dummy module.

If you cannot load kernel drivers, you could try the virtual "null" device, but that one does not have realistic timing.

Regards,
Clemens

author
#2 lore raw
Quoted 8 lines · Clemens Ladisch
Quoted 5 lines · Uli Franke

we're currently writing a lot of ALSA user space applications. In order to test this code with our unit testing and other test environments we'd like to know if there's a dummy PCM device which provides the fundamental operations like reading/writing and setting the common hardware parameters.

That would be the snd-dummy module.

Great - that's what we're looking for. I'll check it out.

Quoted 2 lines

If you cannot load kernel drivers, you could try the virtual "null" device, but that one does not have realistic timing.

I tried the "null" but this fails when setting hw parameters with an assertion.

Regards
Uli

#3 lore raw
Quoted 2 lines · Uli Franke

I tried the "null" but this fails when setting hw parameters with an assertion.

In theory, the null device does not have any restrictions. But an assertion indicates a programming error (somewhere). What is the message, and what are the hw parameters?

Regards,
Clemens

author
#4 lore raw
Quoted 7 lines · Clemens Ladisch
Quoted 2 lines · Uli Franke

I tried the "null" but this fails when setting hw parameters with an assertion.

In theory, the null device does not have any restrictions. But an assertion indicates a programming error (somewhere). What is the message, and what are the hw parameters?

The assertion fails with

pcm_params.c:2360: _snd_pcm_hw_params_internal: Assertion `err >= 0' failed.

There's only a single result on google [1] which discusses this assertion but the thread doesn't result in any meaningful conclusion.

I assembled a small test program which causes this very assertion to fail.

#include <alsa/asoundlib.h>

int main ()

{
	snd_pcm_hw_params_t *params;
	snd_pcm_t *pcm;

	snd_pcm_open(&pcm, "null", SND_PCM_STREAM_PLAYBACK, 0);
	snd_pcm_hw_params_malloc(&params);
	snd_pcm_hw_params_any(pcm, params);
	snd_pcm_hw_params(pcm, params);

	return 0;
}

I appended some system specs [2] (in case you should need more, just let me know).

Regards
Uli

____
[1] http://sourceforge.net/p/cmus/mailman/message/32707782/
[2] System specs:

uli@ankerklause:~/.../dlna/wdmr$ uname -a
Linux ankerklause 3.16.0-46-generic #62~14.04.1-Ubuntu SMP Tue Aug 11
16:28:19 UTC 2015 i686 i686 i686 GNU/Linux
uli@ankerklause:~/.../dlna/wdmr$ aptitude show libasound2
Package: libasound2
State: installed
Automatically installed: yes
Multi-Arch: same
Version: 1.0.27.2-3ubuntu7
Priority: optional
Section: libs
Maintainer: Ubuntu Developers <[email protected]>
Architecture: i386
Uncompressed Size: 1'208 k
Depends: libc6 (>= 2.16), libasound2-data (>= 1.0.27.2-3ubuntu7)
PreDepends: multiarch-support
Suggests: libasound2-plugins (>= 1.0.24)
Breaks: bluez-alsa (<= 4.94-2), libasound2-plugin-equal (<= 0.6-1),
libasound2-plugins (< 1.0.24)
Provided by: liboss4-salsa-asound2
Description: shared library for ALSA applications
This package contains the ALSA library and its standard plugins, as well
as the required configuration files.

ALSA is the Advanced Linux Sound Architecture.
Homepage: http://www.alsa-project.org/