- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib
- EPIPE and ESTRPIPE are different usage, but currently
EPIPE is used when ESTRPIPE is not defined.
To fix this problem, assign ESPIPE instead.
Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The CSV file is not used. The .wav file names are fixed
in the source code, but the directory may be specified
using --wavdir. Remove this file until there's a demand
for the more precise .wav file mapping.
Fixes: https://github.com/alsa-project/alsa-utils/issues/133
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
These formats are sometimes advertised by drivers, e.g. SOF.
The format is 3 bytes packed in 32-bit container, with the MSB zeroed
out.
sample: 0x00123456
S24_LE format:
b0 56
b1 34
b2 12
b3 00
S24_BE format:
b0 00
b1 12
b2 34
b3 56
I only tested the S24_LE format with the SOF driver, S24_BE was added
for symmetry only.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There are audio devices around that support up to 768kHz playback, allow
testing them by increasing the maximum supported sampling rate.
Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There are many redundant open codes in speaker-test for performing the
similar things, and especially the tone generator codes are ugly.
Let's clean up a bit. This patch combines all open-codes into a
single common helper with the callback for generating the tone.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The channel selection currently does not work properly when a channel
map control is provided but no manual channel map was explicitly
requested with "-m".
For example, the CEA/HDMI 6ch (surround 5.1) map is:
FL, FR, LFE, FC, RL, RR.
Tested command: speaker-test -D hdmi -c 6 -t wav
Speaker-test tries to play channels in this following order:
0 - Front Left
3 - Front Center
1 - Front Right
5 - Rear Right
4 - Rear Left
2 - LFE
But wav file played on associated speakers are not aligned. Here are
the real files played:
0- /usr/share/sounds/alsa/Front_Left.wav => OK
3- /usr/share/sounds/alsa/Rear_Right.wav => OK
1- /usr/share/sounds/alsa/Front_Right.wav => OK
5- /usr/share/sounds/alsa/Rear_Center.wav => KO
4- found file /usr/share/sounds/alsa/Front_Center.wav => KO
2- /usr/share/sounds/alsa/Rear_Left.wav => KO
Issue is that associated wav files ordering is reworked only if
channel_map_set variable is set.
Fix consists in allowing wavs re-ordering if a channel mapping as been
get or set, i.e. channel_map is not null.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The -c and -s options needed to be provided in a specific order for the -s option to work correctly.
This pulls the speaker option check outside of the option parsing so that all the options have been parsed before checking to see if the parameter to -s is correct.
Signed-off-by: Ken Benoit <kbenoit@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Allow generated signals (sine and noise) to have a specified signal scale
instead of using hardcoded limits of 80%. This can be handy for debugging, ie
when analysing clipping issues with audio drivers.
Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Without the call of snd_pcm_drain() the pending data on the buffer
might be discarded, which results in the abort of playback sound in
the middle. Let's fix it.
Reported-and-tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>