Recently users reported a bug, I tested it and found it is a common
issue on Laptop or Desktop machines.
The issue is users plug a headset and use "arecord test.wav" to
record a sound with default input volume, the recorded sound has
poor quality and nearly can't distinguish it is the sound we want
to record.
This is because the input volume is low and the default format is U8.
The driver records sound with 16bit, because the input volume is low,
most of samples are within (-256,+256), when converting 16bit to U8,
those samples will be 0x7f. This is called quantization noise and we
could only workaround it by increase the input volume or adding -f to
arecord.
But users want to record a better quality sound with default input
volume (after installing a new OS, the volume is the default volume),
and they don't want to add parameters to the arecord because most of
new linux users just use "arecord test.wav".
So this patch tries to change the default format from U8 to S16_LE/BE.
If the machine doesn't support S16_LE/BE, it still uses U8 as default
format.
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The count argument was renamed to samples to correctly represent
the value meaning. Also, remove the wrong count recalculation lines
for 16-bit, 24-bit and 32-bit samples.
BugLink: https://github.com/alsa-project/alsa-utils/issues/57
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Fix a minor typo for the '-f cdr' description.
Fixes: 55cd025f18 ("aplay -- update the man file")
BugLink: https://github.com/alsa-project/alsa-utils/pull/34
From: YetAnotherNerd <YetAnotherNerd@users.noreply.github.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The system sku is used in SOF machine drivers to set specific quirks,
expose it in alsa-info to help support users. Example on a SoundWire
enabled device:
cat /sys/class/dmi/id/product_sku
0A32
dmidecode -s system-sku-number
0A32
Add a variable and expose the results of both methods.
Note that the dmidecode support is very recent and might not yet be
available in all distros:
http://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=d70d5e686148eabe90c89fbf4cdcf5258db5aa05
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Halve the double negative ‘if no loopback mode is not available’.
Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This patch changes the way aborted stream is being saved. Currently when
abort signal happens the write back of read samples is skipped but there
is no reason to not save them. Also, we need to know how much frames have
been read and write only those.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This patch changes the logic of pcm_read() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.
Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This patch changes the logic of pcm_readv() when abort signal has been
detected. During such condition we should return the amount of frames
actually read instead of the size requested by caller.
Currently functions pcm_read() and pcm_readv() when aborted (in_aborting
flag set) return the amount of requested frames instead of those actually
read prior to interrupt. The consequence of this is repetition of recent X
frames where X stands for amount of frames in one period. This problem is
barely visible or rather audible when the period is small like few
milliseconds because repetition of 1 [ms] of data is not-noticeable
however if we use buffer and period sizes in seconds then the problem
becomes apparent.
Example issue -> thesofproject/sof#3189
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The silence frames generation in xrun_sync() seems to be currently
a bit off as snd_pcm_format_set_silence() uses a wrong buffer address
and size for zero-ing out the data. Consequently instead of clearing
out the last frame(s), snd_pcm_format_set_silence() ends up silencing
samples somewhere else in the buffer. This is partilarly more obvious
for higher frame sizes (e.g. more than 2 channels).
This patch fixes this issue by correcting the parameters passed to
snd_pcm_format_set_silence().
BugLink: https://github.com/alsa-project/alsa-utils/pull/58
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
If we use 'alsaucm -n -b -' with 'get "CapturePCM/Internal Mic"' then
the alsaucm will report error and stop immediately. The reason is that
the parse_line in usecase.c appends an empty argument if a command ends
with quotes.
This change adds a patch to fix the parse_line function in usecase.c.
Signed-off-by: Cheng Yueh <cyueh@chromium.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
textbox.c, mixer_display.c:
- Replaced manual line drawing code `for (...) mvwaddch(...)` by the
functions `mvwhline/mvwvline` provided by standard curses
card_select.c, proc_files.c:
- Moved duplicate code in the create() functions to menu_widget_create()
in menu_widget.c
card_select.c:
- Removed redundant calls to sprintf()
device_name.c:
- Combined multiple calls to form_opts_off()
- Recognize ASCII DEL (127) as backspace
widget.c:
- Uncommented code for setting a dummy key handler (all existing
widgets do provide a key handling function)
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Added configparser.c and curskey.c:
- Lines starting with arbitrary whitespace + '#' are comments
- Words in a command name don't have a fixed order (toggle_mute is the
same as mute_toggle)
Moved read_file() from textbox.c to utils.c, so configparser.c can make
use of it.
Added command line options:
-f/-F to specify/disable configuration file
-m/-M to enable/disable mouse
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is a preparation for the configuration file parser.
The `int attr_*` variables have been moved into a separate struct.
Members of that struct are alphabetically ordered, so an attribute can
later be accessed by its name.
Added `int get_color_pair(short fg, short bg)` for returning or
creating a color pair number.
Added call to `use_default_colors()` for enabling access to the
terminal's default color (-1).
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Mouse support has been added for mixer_widget.c, card_select.c and
proc_files.c.
In the mixer widget the mouse is handled as follows:
- After an element has been printed in mixer_display.c, a call to
clickable_set() will store the coordinates of the drawn area plus the
command enum that should be executed on click. An optional argument
holds an index which points to the selected mixer control.
- on_mouse_click() searches for a matching rectangle, focuses the mixer
control and returns the command enum.
In the menu widgets, the menu_driver() function handles mouse input.
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is a preparation for making keybindings configurable.
The hardcoded keys in the switch statements of mixer_widget.c,
textbox.c, proc_files.c and card_select.c have been replaced by
command enums. The command that shall be executed is looked up in
the arrays `mixer_bindings` and `textbox_bindings`.
The channel_mask enum has been made public, since LEFT and RIGHT are
used as command arguments in bindings.c.
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Obtaining the new window size using TIOCGWINSZ and setting it using
resize_term(), so getmaxyx() reports the actual terminal size.
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In commit "ae9ddeb63443cc2c46e0f0b915466cca0f800372" the rint() was
changed to ceil(). Revert it back. The rint() rounding is more precise
for most cases.
Also, handle the special case where the percentual value is greather
then zero. Set the min + 1 value in this case.
At last, fix the return value in convert_prange() when range is zero.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The generic initialization code returns error code 99 (-99). Take
all those codes equal or above (bellow) this value as non-fatal.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This might become a Pandora's box given
the amount of obscure package managers
on the planet but these two account for
most *nix-like systems with ALSA it seems.
Added support for querying ALSA packages
installed through rpm and dpkg; tested
on ALT (rpm) and OS Elbrus (dpkg).
Suggested-by: Anton Farygin <rider@altlinux.org>
See-also: http://bugzilla.altlinux.org/38416
Signed-off-by: Jaroslav Kysela <perex@perex.cz>