Commit graph

66 commits

Author SHA1 Message Date
Anssi Hannula
58752c3ae3 speaker-test: Show out-of-chmap channels as Unknown
Currently speaker-test falls back to ALSA default channel names for
channels out-of-chmap.

This causes e.g. the 4th channel of
$ speaker-test -c4 -Dhdmi -m "FR,FL,FC"
to be shown as "Rear Right".

Change the code to show such channels as Unknown instead, similar to
when snd_pcm_chmap_long_name() does not know the name.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-12 09:10:37 +01:00
Anssi Hannula
5b0c6da0d8 speaker-test: Always show chmap channel names if available
Currently speaker-test only uses channel names retrieved by
snd_pcm_chmap_long_name() when a channel map has been manually set.

However, the device may provide a default (or fixed) channel map that
differs from the traditional ALSA map, in which case wrong channel names
are shown.

Fix that by always using the name from the channel map when a channel
map is present.

Note that the names retrieved by snd_pcm_chmap_long_name() are not
currently localized via gettext.

Also note that Linux kernel HDMI driver reported wrong default channel
maps before 56cac413dd6d43af8355f5d1f90a199b540f73fc ("ALSA: hda - hdmi:
Fix reported channel map on common default layouts").

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-12 09:10:26 +01:00
Anssi Hannula
a1992044d5 speaker-test: Fix chmapped channel selection without specified chmap
The channel selection currently does not work properly when there is a
driver-provided non-ALSA-traditional channel map but no manual channel
map was explicitely requested with "-m".

For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
that it is otherwise the same as the traditional ALSA channel map,
except that the traditional rear speakers are considered
rear-center speakers and the traditional side speakers are considered
rear speakers.

Speaker-test tries to play back channels in this following order:
  0, /* Front Left  */
  4, /* Center      */
  1, /* Front Right */
  7, /* Side Right  */
  3, /* Rear Right  */
  2, /* Rear Left   */
  6, /* Side Left   */
  5, /* LFE         */

When it is the time to play back Side Left/Right, speaker-test tries to
look for SL/SR in the chmap, but doesn't find it, so it just plays back
channels 6/7 (which indeed are the side speakers, or RL/RR in this
channel map - so the correct channels are selected).

When it becomes the time to playback Rear Left/Right, speaker-test again
tries to find RL/RR in the chmap, and this time it does find them in the
chmap positions 6/7.

So the channels 6/7 are tested twice and 2/3 are never tested.

To fix this, define a generic playback order channel_order[] to be used
when the channel map is present (but not user-defined) and generate a
(speaker/playback number => channel number) mapping with the channels
ordered in the following order:
1. regular channels found in channel_order[] in the defined order,
2. channels not found in channel_order[] ordered by channel number.
3. UNKNOWN channels ordered by channel number.
4. NA channels ordered by channel number.
For channels outside the channel map just use their channel numbers (so
they will be last after all of the above).

For example, if the playback device has a fictional default channel map
of FR,FL,UNKNOWN1,FOO,BAR,RR,RL,UNKNOWN2, the playback order will be
FL,FR,RR,RL,FOO,BAR,UNKNOWN1,UNKNOWN2(,any_extra_channels).

When the channel mapping is specified manually, the specified order is
used for playback as before.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-12 09:09:48 +01:00
David Henningsson
7ac9508c4e speaker-test: Fix wrong wave file played back in chmap setup
When explicitly specifying channel maps, we need to use that when
loading wave files so the correct file is played back.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-06-14 14:05:23 +02:00
Jordi Mallach
093a371a27 Several formatting fixes for manpages.
Fix many occurrences of unescaped “-”.
Fix minor English issue.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:38:13 +02:00
Elimar Riesebieter
48554fc28b Fix several typos in manpage and help strings.
Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-05-16 10:38:02 +02:00
Jaroslav Kysela
46cb355d4f speaker-test: change the interrupt handling logic to follow aplay/arecord
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-04-08 13:57:51 +02:00
Jaroslav Kysela
741064c601 speaker-test: try to call snd_pcm_close() when a signal is received
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2013-03-22 13:59:31 +01:00
Antonio Ospite
cd39cfb480 speaker-test: increase the maximum supported rate to 384000
There are some devices around supporting this sample rate so let's make
speaker-test capable to deal with them.

Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-17 07:46:32 +01:00
Takashi Iwai
7b14c00b56 speaker-test: Update man page for chmap option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-20 14:00:02 +02:00
Takashi Iwai
951cb2c297 speaker-test: Add support for channel mapping API
The surround channel map follows the given channel map from the
driver if available.

Also, the channels can be specified manually via -m option.
Pass the channel map like "FL,FR,FC,LFE".

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-17 12:23:08 +02:00
Daniel T Chen
471191abe5 speaker-test.1: Clarify man page by giving examples
BugLink: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620513

From the Debian bug report:
"The speaker-test manpage could be improved somewhat by helping a
little bit the user determine how to find out the devices he can test.

Based on http://alsa.opensrc.org/Speaker-test I have make some changes
to the manpage (diff attached) to describe a little bit more how
speaker-test can be used alongside 'aplay'.

Please consider the following patch for
alsa-utils-1.0.23/speaker-test/speaker-test.1"

Signed-off-by: Javier Fernández-Sanguino Peña <jfs@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-06-05 09:56:34 +02:00
David Henningsson
b67d215d20 speaker-test: Don't retry after fatal errors
Fixup commit 9b1a2566: Remove error loop

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-10-17 10:17:14 +02:00
Jaroslav Kysela
4c337275d1 speaker-test: add test pattern for PCM layer debugging purposes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-08-18 08:22:23 +02:00
Jaroslav Kysela
0034b1f83f speaker-test: add fflush(stdout) to write_loop
Flush stdout for pipes. The monitor tool from hda-analyzer requires this.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-01-27 10:28:17 +01:00
Jaroslav Kysela
075becdb1a speaker-test: not all sample formats are supported - show only supported ones
Also, check if given format is supported.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-12-15 15:34:46 +01:00
Jaroslav Kysela
d18aebca5b speaker-test: add -d (--debug) option to show PCM parameters
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-12-15 15:27:05 +01:00
Dan McGee
6a1109b732 speaker-test: only check byte order once
Rather than having numerous preprocessor directives scattered in the code
checking __BYTE_ORDER, only check it once and define a set of macros
accordingly that can be used in the rest of the code. This makes things
simpler to read and less error-prone.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2009-05-11 09:08:35 +02:00
Dan McGee
8b0db35f63 speaker-test: move existing endian macros up in the file
This is necessary for a later patch removing the various endianness checks
sprinkled throughout the code.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2009-05-11 09:08:15 +02:00
Dan McGee
21d3717c3f Remove dead/commented out code
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2009-05-11 09:07:18 +02:00
Dan McGee
f0a3bdc88b Allow frequencies down to 30 Hz
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2009-05-11 09:06:57 +02:00
Dan McGee
7d051f7e10 speaker-test: allow frequency to be floating point
Use atof() rather than atoi() to store the frequency- we were already using
a floating point value internally but did not let the user specify one from
the command line.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2009-05-11 09:06:33 +02:00
Wu Fengguang
0e8fcfc2ce speaker-test.c - add readability comments to speaker channels
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-20 18:01:44 +01:00
Takashi Iwai
0d6134450e speaker-test: Fix floating-point exception bug
The period_size an buffer_size parameters must be taken after calling
snd_pcm_hw_params().  Otherwise they could be undefined numbers.
For example, period_size gets 0 when pcsp driver is used, resulting in
a floating-point exception error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-26 14:27:24 +01:00
Diego E. 'Flameeyes' Pettenò
6232f1c96c Make some static tables and strings constants.
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.

The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:10:02 +01:00
Diego E. 'Flameeyes' Pettenò
f53441ae68 Remove some unused variables.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:09:52 +01:00
Diego 'Flameeyes' Pettenò
01285f20d9 Move conditional inclusion of locale.h further down.
Without this patch, ENABLE_NLS is checked before ever being defined
(aconfig.h is not yet included), and thus locale.h would never be
included even when NLS is enabled.

Signed-off-by: Diego 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-13 13:22:13 +01:00
Jaroslav Kysela
9957c66e46 alsactl - install initialization files
Also, spearate SOUNDSDIR and DATADIR in configure.in.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 12:31:00 +02:00
Giuliano Pochini
1b7f9278af speaker-test.c - fix pink noise generator on big-endian archs
This patch makes speaker-test fill the buffers with properly coded data on
both big- and little-endian processors.

Signed-off-by: Giuliano Pochini <pochini@shiny.it>
2008-04-28 09:16:27 +02:00
Takashi Iwai
6372f4acc2 speaker-test.c - fix sine generator on big-endian archs
speaker-test doesn't work well when you choose a little-endian format on a
big-endian processor, or the opposite. Yes, I know about plughw:, but for
debugging purposes it may not be an option. The following patch add proper
support for S32 and S16 support for but LE and BE processors:

- The "if (bits-per-sample)" construct was replaced by case (format).
- Support for S16_BE, S32_BE formats was added.
- S16_LE and S32_LE were made compatible with big-endian processors.
- NB: The pink noise generator wasn't changed (I'll do if this patch is OK).

From: Giuliano Pochini <pochini@shiny.it>
2008-04-21 15:19:27 +02:00
Takashi Iwai
9abeb5843a Remove xfer_align
The xfer_align is the obsolete feature now.  Remove it from aplay
and speaker-test to avoid deprecated calls.
2008-01-08 18:39:06 +01:00
Takashi Iwai
1e6f486623 speaker-test - Put errors to stderr
Error messages should be shown in stderr.
2007-11-05 12:44:13 +01:00
Takashi Iwai
9dd3e2801c speaker-test - Fix number of periods to play
The number of periods to play in pink and sine modes could be calculated
as zero, which results in just silence.  Make the minimal value 1.
2007-11-05 12:40:35 +01:00
Takashi Iwai
1a388d149f Add missing library dependency
speaker-test requires math library.
2007-06-04 15:14:47 +02:00
Jaroslav Kysela
affb999faf speaker-test: fix typos in manpage
See bug#2178
Debian 364560
2006-10-01 15:16:13 +02:00
Takashi Iwai
7af6e01ace Fix the default buffer size calculation in speaker-test
Fixed the default buffer size calculation in speaker-test.
The size should be aligned to nperiods.
2006-05-12 18:07:07 +02:00
Takashi Iwai
6d1673526b Avoid unnecessary drain/restart in speaker-test
Avoid unnecessary drain/restart in speaker-test when the buffer
is enough small.
2006-04-06 19:19:07 +02:00
Takashi Iwai
9b1a2566a1 Remove loops after errors
Don't retry after fatal errors.
2006-03-29 17:06:44 +00:00
Takashi Iwai
a948ec4204 Fix a typo in speaker-test help text
Fix a typo in speaker-test help text.  Updated ja.po, too.
2006-03-27 11:24:09 +00:00
Takashi Iwai
35544911e8 Fix missing commas
Fixed missing commas in array elements (ALSA bug#1938).
2006-03-24 16:36:31 +00:00
Takashi Iwai
5e1a68b7b7 Improve buffer/period set up in speaker-test
Improve buffer/period set up in speaker-test.

- Don't ignore -b and -p options but use them if specified
- Clean up and improvement of messy buffer/period setup codes
- Add -P option for specifying number of periods explicitly
2006-03-24 14:46:52 +00:00
Takashi Iwai
8e821d4fee Add missing comma
Add a missing comma in the last fix...
2006-03-21 11:14:54 +00:00
Takashi Iwai
69c5beb106 Add --nloops option and fix manpage
- Added --nloops option to specify the number of loops
- Fixed man page of speaker-test
2006-03-06 19:42:23 +00:00
Takashi Iwai
8e6170206d Tentative fix for speaker-test WAV with 5 or more channels
Fix the WAV file name for center/lfe.  Use the existing
"Rear_Center.wav" for LFE as a workaround.
2006-03-02 11:41:58 +00:00
James Courtier-Dutton
2975ef9e75 speaker-test: Fix version reporting. 2005-12-22 13:35:42 +00:00
Takashi Iwai
35c0bd63ec Fix compile on big-endian arch
Fix compile on big-endian arch.
2005-12-14 15:11:42 +00:00
Takashi Iwai
9fe49dd30f speaker-test - Fix missing i18n
Add the gettext tags to newly added texts.
2005-12-01 11:31:26 +00:00
Takashi Iwai
9da694ef02 Add WAV file playback support to speaker-test
Add WAV file playback support to speaker-test.
The support is still limited to S16_LE, and doesn't refer to csv file yet.
2005-11-30 17:09:17 +00:00
James Courtier-Dutton
b69100fb0a Make speaker-test compatible with dmix by default. 2005-11-19 13:31:21 +00:00
Takashi Iwai
9dc666526f Disable NLS support when --disable-nls is passed
Disable NLS support when --disable-nls is passed (bug#1514).
2005-11-08 16:43:36 +00:00