OSDN Git Service

android-x86/external-alsa-utils.git
5 years agoaxfer: add an option to dump available hardware parameters
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:31 +0000 (15:41 +0900)]
axfer: add an option to dump available hardware parameters

In ALSA PCM interface, before configuring hardware actually, applications
can request available set of hardware parameters for runtime of PCM
substream. The set of parameters are represented and delivered by a
structure.

In alsa-lib PCM API, the above design is abstracted by a series of
snd_pcm_hw_params_xxx() functions. An actual layout of the structure is
hidden from applications by an opaque pointer.

In aplay, '--dump-hw-params' option is for this purpose. With this option,
the command output available set of the hardware parameters.

This commit adds support for the option. Unlike aplay, this commit takes
this program to finish after dumping the parameters for simplicity of
usage.

I note that all of combinations in the set are not necessarily available
when the PCM substream includes dependencies of parameters described by
constraints and rules.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add informative output and an option to suppress it
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:30 +0000 (15:41 +0900)]
axfer: add informative output and an option to suppress it

In current aplay, some informative output is available as a default. This
can be suppressed by a quiet option. This commit adds support for it.

An original aplay implementation has no effect of this option in a case
to handle multiple files. However, in a point of usability, this commit
support this case.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a sub-command to transfer data frames
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:29 +0000 (15:41 +0900)]
axfer: add a sub-command to transfer data frames

In current aplay, default action is to transfer data frames from/to
devices. This commit adds support for this functionality.

Event loop is included in an added file. In the loop, the number of
handled data frames is manipulated by an appropriate way. As a result, users
can stop data transmission frames by frame.

Unlike aplay, when catching SIGSTP, this application performs to suspend
PCM substream. When catching SIGCONT, it performs to resume the PCM
substream. The aim of this design is to avoid XRUN state of the PCM
substream. If users/developers need to any XRUN-recovery test, it's
better to work for the other ways.

Below lines are examples to execute:
$ axfer transfer -P -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer -C -D hw:1,0 /dev/null -r 48000 -vvv

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for blocking data transmission operation of alsa-lib PCM API
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:28 +0000 (15:41 +0900)]
axfer: add support for blocking data transmission operation of alsa-lib PCM API

In alsa-lib PCM API, snd_pcm_read[i|n]() and snd_pcm_write[i|n]() are used
to transfer data frames from/to hardware. When a handler is not opened with
specific flags, these functions perform blocking operation; i.e. the
function call doesn't return till all of request number of data frames are
actually handled, or call is interrupted by Unix signals, or PCM substeam
corrupts due to hardware reasons.

This commit adds support for this type of data transmission. For cases that
requested data frames are not processed by container interface, this commit
adds internal cache mechanism to handle rest of data frames in next timing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support to transfer data frames by alsa-lib PCM APIs
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:27 +0000 (15:41 +0900)]
axfer: add support to transfer data frames by alsa-lib PCM APIs

This commit adds support fo alsa-lib PCM API as a backend of 'xfer'
module. In a set of alsa-lib PCM API, there're two ways to handle data
frames; by calling ioctl(2) with some specific commands with buffer in
user space, or copying data frames on mapped page frames. To support
both ways, this commit adds an operation structure as abstraction.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a parser for command-line options
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:26 +0000 (15:41 +0900)]
axfer: add a parser for command-line options

In aplay, many command-line options are supported. Some of them have
dependency or conflicts. Furthemore, some of them are just for
runtime configuration of alsa-lib(libasound), and some options can
be used by several xfer backends commonly; e.g. options for file name,
sample format and sampling rate.

This commit adds a parser for the common options below.
 * --help (-h)
  * Just output 'help' string (not written yet).
 * --verbose (-v)
  * For verbose output, including information about xfer, mapper and
    container.
 * --format (-f): string. format literals or one of ['cd'|'cdr'|'dat']
  * For sample format supported by ALSA PCM interface. Special format
    can be used. For playback, this is auto-detected according to actual
    file format.
 * --channels (-c)
  * For the number of samples included in one data frame. For playback,
    this is auto-detected according to actual file format, except for
    'raw' format. This option can conflict to above format option.
 * --rate (-r)
  * For the number of data frames transferred in one second. For playback,
    this is auto-detected according to actual file format, except for
    'raw' format. This option can conflict to format option above.
 * --file-type (-f): string. one of ['wav'|'au'|'voc'|'raw']
  * For format of files of given paths. For playback, this is optional
    because the format is auto-detected. For capture, this is optional too
    because the format is decided according to suffix of given path.
    Anyway, this option is used for cases to fail to detect or decide.
 * --separate-channels (-I)
  * When using several files as source or destination for transmission
    of data frame, this option can be used with several file paths.

When '--separate-channels' option is used, users can give several file
paths to source/destination of data transmission, else they can give single
file path for the purpose. When multiple files are handled by this option,
for playback, data frames in first channel is used to construct buffer for
data transmission with multi channel. For capture, data frames in each
channel of buffer are written to each of given path. Furthermore, when a
single path is given for capture, file paths are auto-generated according
to available number of channels. For example, 'name.wav' is given for
2 channels capture, 'name-0.wav' and 'name-1.wav' are generated. In a
case of no suffix, 'name-0' and 'name-1' are generated.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a common interface to transfer data frames
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:25 +0000 (15:41 +0900)]
axfer: add a common interface to transfer data frames

ALSA has PCM interface to transfer data frames. In userspace, there're
some implementation to utilize this interface to produce application
programming interface; alsa-lib (libasound) and tinyalsa. However, it's
possible to use the interface with raw I/O operations.

This commit adds an common interface to transfer data frames for this
program, named as 'xfer'. This internal interface is designed for users
to select several backend for data transmission. This includes some
functions expected to be called by main program just for data
transmission. In an aspect to maintain PCM substream, suspend feature is
required to handle a pair of SIGTSTP/SIGCONT UNIX signals.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a unit test for mapper interface
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:24 +0000 (15:41 +0900)]
axfer: add a unit test for mapper interface

In former commits, mapper module gets supports of muxer/demuxer for
single/multiple targets for playback source or capture destination. This
commit adds a unit test for them. This includes positive test cases only.
The test cases actually generate I/O to file systems for many test cases.
It takes a bit long time to finish.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a mapper for multiple target
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:23 +0000 (15:41 +0900)]
axfer: add support for a mapper for multiple target

This commit adds support of mapper for 'multiple' target. This handles
several files via 'container' functions, and constructs data frame buffer
for playback, or splits data frames from data frame buffer for capture.
When playback source files includes data frames with several channels, the
first channel is used to construct buffer. For capture direction, each of
channel of data frame is stored in one file, thus the file includes one
channel of data frame. When handling non-interleaved buffer, a caller
should use an array of buffer for each of channels with non-interleaved
data frames.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a mapper for single target
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:22 +0000 (15:41 +0900)]
axfer: add support for a mapper for single target

In usual use case of aplay, single file is used to playback or capture data
frames.

This commit adds support of single type mapper for this use case. All of
supported file format can include data frame with interleaved alignment,
thus this mapper have a functionality to convert from several types of
data frame alignment to interleaved alignment or vise versa. When
handling non-interleaved buffer, a caller should use an array of buffer
for each of channels with non-interleaved data frames.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a common interface to align data frames on different layout
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:21 +0000 (15:41 +0900)]
axfer: add a common interface to align data frames on different layout

In current aplay, several files can be handled as source of data frames for
playback, or destination of captured data frames by an option
'--separate-channels' (-I).

On the other hand, in ALSA PCM kernel/user interface, several types of
buffer are used to communicate between application/hardware;
 - mapped page frame for data frames with interleaved alignment
 - mapped page frame for data frames with non-interleaved alignment
 - buffer in user space for data frames with interleaved alignment
 - a list of buffer in user space for data frames with non-interleaved
   alignment

This commit adds a common interface, named as 'mapper' to convert frame
alignment between these two sides. This interface includes two types;
'muxer' and 'demuxer'. The 'muxer' is for playback direction, to
construct playback buffer with PCM frames from several files. The 'demuxer'
is for capture direction, to split PCM frames from capture buffer to
each of file. Unlike multimedia containers such as MPEG 2/4 Systems,
the 'muxer' and 'demuxer' are for playback/capture buffer, not for file
contents.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add unit test for container interface
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:20 +0000 (15:41 +0900)]
axfer: add unit test for container interface

In former commits, container module gets supports of parser/builder for
several types of file format. This commit adds a unit test for them.
This includes positive test cases only. The test cases actually generate
I/O to file systems for many test cases. It takes a long time to finish.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a container of raw data
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:19 +0000 (15:41 +0900)]
axfer: add support for a container of raw data

This commit adds support for raw data without any headers/chunks/blocks.
A parser of container cannot recognize format of sample without
supplemental information.

Additionally, it includes no magic bytes. A parser of container should
process first several bytes as a part of PCM frames, instead of magic
bytes.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a container of Creative Tech. voice format
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:18 +0000 (15:41 +0900)]
axfer: add support for a container of Creative Tech. voice format

This commit adds support for data of Creative Tech. voice format. In this
data format, values in each of field are represented in little-endian byte
order and available formats of data sample are restricted in little-endian
byte order.

In version 1.10 of this format, sampling rate is represented with
reciprocal number of the rate, thus we cannot calculate original sampling
rate precisely just from its header. For example at 44.1kHz, file header
includes 233 (=256-1,000,000/44,100), but we cannot recover the value just
from the code (43478.2...). For my convenience, this commit adds a
pre-computed table and lookup major rates from the table.

Additionally, this format can includes several blocks with different
sample format. When handling this type of file, we need to start/stop
substream for each of the block, while this brings complicated code.
This type of format is enough ancient and presently quite minor. This
commit takes a compromise and handles a first sample block only.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a container of Sparc AU format
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:17 +0000 (15:41 +0900)]
axfer: add support for a container of Sparc AU format

This commit adds support for data of Sparc AU format. In this data format,
values in each of field are encoded in big-endian byte order and available
formats of data sample are restricted in big-endian byte order.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for a container of Microsoft/IBM RIFF/Wave format
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:16 +0000 (15:41 +0900)]
axfer: add support for a container of Microsoft/IBM RIFF/Wave format

This commit adds support for data of Microsoft/IBM RIFF/Wave format. In
this data format, values in each of field are encoded in both bit/little
byte order but inner a file the same order is used. Magic bytes in the
beginning of data indicated which byte order is used for the file.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a common interface to handle a file with audio-specific data format
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:15 +0000 (15:41 +0900)]
axfer: add a common interface to handle a file with audio-specific data format

Current aplay supports several types of data format for file; Microsoft/IBM
RIFF/Wave (.wav), Sparc AU (.au) and Creative Tech. voice (.voc). These
formats were designed to handle audio-related data with interleaved frame
alignment.

This commit adds a common interface to handle the file format, named as
'container' module. This includes several functions to build/parse
the format data from any file descriptors. Furthermore, this includes
several helper functions for implementations of each builder/parser.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a sub-command to print list of PCMs/devices
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:14 +0000 (15:41 +0900)]
axfer: add a sub-command to print list of PCMs/devices

Original aplay implementation has a feature to output two types of list;
devices and PCMs. The list of devices is a result to query sound card and
pcm component structured maintained in kernel land. The list of PCMs is a
result to parse runtime configuration files in alsa-lib. Entries in the
former list is corresponding to ALSA PCM character device
('/dev/snd/pcm%uC%uD[p|c]'), while entries in the latter list includes
some 'virtual' instances in application runtime.

This commit adds an implementation for the above functionality. This is
executed by taking 'list' sub-command. A 'device' option has the same
effect as '--list-devices' and '-L' of aplay. A 'pcm' option has the same
effect as '--list-pcms' and '-l' of aplay. In both cases, an additional
option is required for stream direction. Below is examples of new command
system for this sub-command.

$ axfer list device -C (= arecord --list-devices)
$ axfer list pcm -P    (= aplay -l)

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add an entry point for this command
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:13 +0000 (15:41 +0900)]
axfer: add an entry point for this command

This commit adds a new command, 'axfer' ('ALSA transfer'), to transfer data
frames described in asound.h. This command is intended to replace current
aplay. The most of features and command line parameters come from aplay as
much as possible, while it has more better feature and code to maintain.

This commit adds an entry point for this command. Current option system of
aplay is still available, while this command has a sub-command system like
commands in iproute2.

Currently, two sub-commands are supported; 'list' and 'transfer'. The
'list' sub-command has the same effect as '-l' and '-L' options of aplay.
The 'transfer' sub-command has the same effect as the main feature of
aplay. For the sub-command system, an option for stream direction is
required; '-P' for playback and '-C' for capture. If you create symbolic
links to this binary for aplay/arecord, please execute:
$ ln -s axfer aplay
$ ln -s axfer arecord

Actual code for each sub-command will be implemented in later commits.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaplay: improve available conditions for '--samples' and '--duration' options
Takashi Sakamoto [Mon, 5 Nov 2018 23:57:48 +0000 (08:57 +0900)]
aplay: improve available conditions for '--samples' and '--duration' options

Either '--samples' ('-s') and '--duration' ('-d') option is available
exclusively, according to its semantics and actual implementation.

This commit improves description of manual at this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaplay: add a paragraph for '--samples' ('-s') option to aplay manual
Takashi Sakamoto [Mon, 5 Nov 2018 23:51:16 +0000 (08:51 +0900)]
aplay: add a paragraph for '--samples' ('-s') option to aplay manual

A '--samples' ('-s') option was added so that record/playback process is
terminated after handling the same number of PCM frames as a value of the
option. However this option is not described in aplay manual.

This commit adds a paragraph for the option.

Fixes: 3d44e2bc159e ('aplay: Add samples argument for playing/recording a given number of samples')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaplay: delete paragraph for obsoleted '--sleep-min' ('-s') option from aplay manual
Takashi Sakamoto [Mon, 5 Nov 2018 23:34:04 +0000 (08:34 +0900)]
aplay: delete paragraph for obsoleted '--sleep-min' ('-s') option from aplay manual

A '--sleep-min' option was already obsoleted for aplay. On the other hand,
a paragraph for the option was left as is.

This commit deletes the paragraph.

Fixes: 4cb74aed89f1 ('Remove sleep_min from aplay')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Daniel Baluta daniel.baluta@nxp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agotopology/topology.c: drop unneeded <dlfcn.h> include
Thomas Petazzoni [Thu, 1 Nov 2018 14:17:47 +0000 (15:17 +0100)]
topology/topology.c: drop unneeded <dlfcn.h> include

This include is not used/needed and prevents building on systems that
don't provide <dlfcn.h>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoinitial version of .travis.yml
Jaroslav Kysela [Wed, 24 Oct 2018 15:47:05 +0000 (17:47 +0200)]
initial version of .travis.yml

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agofix gettextize
Jaroslav Kysela [Wed, 24 Oct 2018 16:26:19 +0000 (18:26 +0200)]
fix gettextize

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agorename and update README.md
Jaroslav Kysela [Wed, 24 Oct 2018 15:38:30 +0000 (17:38 +0200)]
rename and update README.md

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaloop: more avail_min cleanups
Jaroslav Kysela [Wed, 24 Oct 2018 13:20:22 +0000 (15:20 +0200)]
alsaloop: more avail_min cleanups

1) do not increase avail_min forever

It seems that there are broken plugins like pulse which returns from poll()
immediately regardless avail_min settings.

2) remove ommited debug printf()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoRelease v1.1.7
Jaroslav Kysela [Tue, 16 Oct 2018 08:08:36 +0000 (10:08 +0200)]
Release v1.1.7

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsamixer: fix gcc warnings
Jaroslav Kysela [Sun, 14 Oct 2018 15:03:08 +0000 (17:03 +0200)]
alsamixer: fix gcc warnings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: lock - fix the array size (gcc warning)
Jaroslav Kysela [Sun, 14 Oct 2018 15:01:38 +0000 (17:01 +0200)]
alsactl: lock - fix the array size (gcc warning)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaplay: add missing block brackets
Jaroslav Kysela [Sun, 14 Oct 2018 15:00:26 +0000 (17:00 +0200)]
aplay: add missing block brackets

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaloop: pcmjob - fix few warnings
Jaroslav Kysela [Sun, 14 Oct 2018 14:59:28 +0000 (16:59 +0200)]
alsaloop: pcmjob - fix few warnings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: use signalfd to catch UNIX signal
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:34 +0000 (23:36 +0900)]
alsactl: use signalfd to catch UNIX signal

In a mode of 'monitor, event loop runs to dispatch asynchronous event
emitted by control node. In this case, UNIX signal is used to terminate
the event loop.

This commit uses signalfd to catch the UNIX signal.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: handle detection of new sound card
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:33 +0000 (23:36 +0900)]
alsactl: handle detection of new sound card

At present, plug-and-play is not supported in a mode of 'monitor',
thus new sound card is not handled during runtime. This is not happy.

This commit uses Linux-specific inotify(7) to monitor '/dev/snd'
directory. When some files are newly added to the directory,
event dispatcher is suspended. Event sources are scanned again and the
dispatcher continue to run.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: handle disconnection of sound card
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:32 +0000 (23:36 +0900)]
alsactl: handle disconnection of sound card

Once sound card becomes disconnection state, corresponding control node
becomes to emit error event for listeners. When catching this type of
event, event dispatcher should stop observation of the node. However,
at present, a mode of monitor can't handle this correctly. As a result,
poll(2) is executed quite frequently in loop with no wait. This results
100% consumption of CPU time.

This commit takes the dispatcher to remove the node from observation
list when detecting the disconnection state.

Reported-by: Thomas Gläßle <thomas@coldfix.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: obsolete array for maintenance of handlers
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:31 +0000 (23:36 +0900)]
alsactl: obsolete array for maintenance of handlers

In former commits, handlers of control node are maintained by link list,
instead of one-dimensional array.

This commit obsoletes the array and split source preparation to a
function.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: use a list of source for event dispatcher instead of an array of source
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:30 +0000 (23:36 +0900)]
alsactl: use a list of source for event dispatcher instead of an array of source

In a previous commit, handlers of control nodes are maintained by link
list.

This commit uses the list to register/unregister event sources to
dispatcher.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: use link list to maintain source of events
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:29 +0000 (23:36 +0900)]
alsactl: use link list to maintain source of events

At present, handlers for control nodes are maintained by one-dimensional
array. This is not necessarily useful to maintain handlers with
associated information.

This commit adds link-list for the maintenance.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: use epoll(7) instead of poll(2)
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:28 +0000 (23:36 +0900)]
alsactl: use epoll(7) instead of poll(2)

Linux kernel supports unique system call; epoll(7). This allows
applications to make associations for descriptor-unique data in a
easy way.

This commit uses epoll(7) instead of poll(2) for this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: add an iterator of registered instances of sound card
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:27 +0000 (23:36 +0900)]
alsactl: add an iterator of registered instances of sound card

In a mode of 'monitor', when given no argument, all of available control
node is observed for their events. At present, discovering the nodes is
done according to sound card number, instead of listing nodes in
configuration space of alsa-lib.

This commit adds a structure to discover sound cards with a simple
interface.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsactl: split event loop code to a function
Takashi Sakamoto [Sun, 14 Oct 2018 14:36:26 +0000 (23:36 +0900)]
alsactl: split event loop code to a function

In a mode of 'monitor', an event loop runs.

This commit applies a small refactoring to splits the loop into a
function for readability.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsatplg: add man file
Jaroslav Kysela [Tue, 9 Oct 2018 08:53:08 +0000 (10:53 +0200)]
alsatplg: add man file

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsaucm: add alsa-ucm udev rules for PAZ00 (Toshiba AC100/Dynabook AZ).
Jaroslav Kysela [Fri, 7 Sep 2018 08:53:19 +0000 (10:53 +0200)]
alsaucm: add alsa-ucm udev rules for PAZ00 (Toshiba AC100/Dynabook AZ).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoalsabat: Allow custom sample format for round trip latency test
Jonathan Liu [Sun, 5 Aug 2018 03:59:35 +0000 (13:59 +1000)]
alsabat: Allow custom sample format for round trip latency test

Setting the format to BAT_PCM_FORMAT_S16_LE in the round trip latency
test initialization is redundant as it is already set by default to
BAT_PCM_FORMAT_S16_LE unless a sample format is specified on the command
line.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agospeaker-test: Allow sampling rates up to 768000
Julian Scheel [Thu, 7 Jun 2018 09:10:55 +0000 (11:10 +0200)]
speaker-test: Allow sampling rates up to 768000

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>
5 years agospeaker-test: Remove unused variable
Julian Scheel [Wed, 23 May 2018 13:42:21 +0000 (15:42 +0200)]
speaker-test: Remove unused variable

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agospeaker-test: Support S24_3LE sample format
Julian Scheel [Wed, 23 May 2018 13:42:20 +0000 (15:42 +0200)]
speaker-test: Support S24_3LE sample format

Implement support signed 24 bit samples, packed in 3 bytes.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Fix invalid file size check for non-regular files
Takashi Iwai [Tue, 15 May 2018 20:17:01 +0000 (22:17 +0200)]
aplay: Fix invalid file size check for non-regular files

aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size.  This works fine for regular files, but when a special file like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.

A proper fix is to do this sanity check only for a regular file.

Reported-by: Jay Foster <jay@systech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoRelease v1.1.6
Jaroslav Kysela [Tue, 3 Apr 2018 08:58:10 +0000 (10:58 +0200)]
Release v1.1.6

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agobat: alsa.c - move the thread cleanup pop before goto exit3
Jaroslav Kysela [Tue, 3 Apr 2018 08:48:52 +0000 (10:48 +0200)]
bat: alsa.c - move the thread cleanup pop before goto exit3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoaplay: Fix wav file not being split on 32 bit platforms
erwin [Tue, 13 Mar 2018 18:51:24 +0000 (19:51 +0100)]
aplay: Fix wav file not being split on 32 bit platforms

On my 32 bit armhf board arecord exits because of write() returning EFBIG
when the output file size reaches 2147483647 bytes.

To fix this, include generated header file before system header files
so that _FILE_OFFSET_BITS=64 is used properly, as required in documentation
"man feature_test_macros".

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agospeaker-test: Refactor the tone-generator codes
Takashi Iwai [Mon, 5 Mar 2018 15:10:42 +0000 (16:10 +0100)]
speaker-test: Refactor the tone-generator codes

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>
6 years agoalsaloop: fix a typo in the comparison
Kirill Marinushkin [Mon, 5 Feb 2018 06:47:11 +0000 (07:47 +0100)]
alsaloop: fix a typo in the comparison

Hello maintainers,

I would like to suggest you a patch which fixes a typo in the alsa-utils
alsaloop.

Best Regards,
Kirill Marinushkin

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoalsactl: Only start restore service when asoundrc file exists
Ikey Doherty [Tue, 12 Dec 2017 13:32:34 +0000 (13:32 +0000)]
alsactl: Only start restore service when asoundrc file exists

This solves the chicken and egg problem on fresh installations whereby
the alsa state file does not yet exist, and alsa-restore unit attempted
to launch without first having a state file.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Adjust sample rate limits to support newer hardware
Jussi Laako [Thu, 7 Dec 2017 11:57:14 +0000 (13:57 +0200)]
aplay: Adjust sample rate limits to support newer hardware

There are number of devices that support up to 384 kHz sampling rate and
some devices up to 768 kHz sampling rate. This patch increases sanity
check limit to 768k in order to support testing of such hardware.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoChange FSF address (Franklin Street)
Jaroslav Kysela [Tue, 14 Nov 2017 13:28:51 +0000 (14:28 +0100)]
Change FSF address (Franklin Street)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoRelease v1.1.5
Jaroslav Kysela [Tue, 14 Nov 2017 07:52:09 +0000 (08:52 +0100)]
Release v1.1.5

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoalsactl: Move systemd unit start-up from basic.target to sound.target
Chris Mayo [Tue, 26 Sep 2017 18:36:12 +0000 (19:36 +0100)]
alsactl: Move systemd unit start-up from basic.target to sound.target

Ensures soundcard is ready before restoring state.

sound.target added to systemd in v18:
https://cgit.freedesktop.org/systemd/systemd/commit/?id=88dfa2938af

Simplify dependencies:
 - After=alsa-state.service is not needed because both units test for
   @daemonswitch@ with opposite outcomes.

 - After=sysinit.target is automatically added by systemd.

First proposed by Tom Yan.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoalsabat: fix one uninitialized warning issue
Zhang Keqiao [Wed, 30 Aug 2017 01:26:16 +0000 (09:26 +0800)]
alsabat: fix one uninitialized warning issue

Fix a variable uninitialized issue, adding the initialized assignment to fix it.

Signed-off-by: Zhang Keqiao <keqiaox.k.zhang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Fix playback for small raw files
Daniel Baluta [Tue, 8 Aug 2017 22:06:00 +0000 (01:06 +0300)]
aplay: Fix playback for small raw files

This fixes a bug when trying to play files with size
smaller than maximum supported header size.

Lets have a look at the following example:

$ aplay -s 2 sample.raw

-> playback_go(fd = 10, loaded = 26, count = 2, name="sample.raw")
--> l = loaded = 26
--> c = count - written = 2
--> c -= l = 2 - 26 = -24
---> r = safe_read(fd, audiobuf + 26, -24)
---> r = -1, EXIT_FAILURE

In this case we have already 'loaded' from the input file more
bytes that we need to send to pcm device. So, we need to adjust
the number of bytes loaded and avoid reading a negative number
of bytes.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Refactor playback code
Daniel Baluta [Tue, 8 Aug 2017 22:05:59 +0000 (01:05 +0300)]
aplay: Refactor playback code

This introduces read_header function which tries
to read the header of an audio file in order to determine
its type.

This has the following effects:
(1) makes code easier to read
(2) don't abort if file size is less than expected header

(2), allows us to play small files with size smaller than any
supported audio file headers.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Add samples argument for playing/recording a given number of samples
Ion-Horia Petrisor [Tue, 8 Aug 2017 22:05:58 +0000 (01:05 +0300)]
aplay: Add samples argument for playing/recording a given number of samples

-s --samples allows aplay to be used for playback/capture a given
number of samples per channel

Signed-off-by: Ion-Horia Petrisor <ion-horia.petrisor@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: interrupt streaming via signal in voc_pcm_write
Srikanth Krishnakar [Mon, 19 Dec 2016 08:34:39 +0000 (14:04 +0530)]
aplay: interrupt streaming via signal in voc_pcm_write

aplay/arecord (alsa-utils v1.1.2) cannot interrupt streaming
via CTRL-C. Fixed the issue by properly handling 'in_aborting'
flag in appropriate functions.

Signed-off-by: Anant Agrawal <Anant_Agrawal@mentor.com>
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoaplay: Fix --max-file-time option 32 bits overflow
Scott Gilliland [Fri, 23 Jun 2017 18:35:03 +0000 (18:35 +0000)]
aplay: Fix --max-file-time option 32 bits overflow

Fix bug in arecord --max-file-time where the file size could overflow
32 bits.

Signed-off-by: Scott Gilliland <scott.gilliland@gatech.edu>
Acked-by: John Sauter <John_Sauter@systemeyescomputerstore.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoalsatplg: fix topology compiler long option parsing
Liam Girdwood [Wed, 14 Jun 2017 11:25:33 +0000 (12:25 +0100)]
alsatplg: fix topology compiler long option parsing

verbose, compile and output options all have a parameter.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: delete output file if parsing fails.
Liam Girdwood [Fri, 9 Jun 2017 15:33:42 +0000 (16:33 +0100)]
topology: delete output file if parsing fails.

Currently the binary output file is left when parsing fails. This confuses
GNU Make if the parsing fails and causes the compilation to partially
complete.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoRelease v1.1.4
Jaroslav Kysela [Fri, 12 May 2017 08:01:46 +0000 (10:01 +0200)]
Release v1.1.4

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
7 years agoaplay: Introduce and use xwrite helper
Daniel Baluta [Mon, 10 Apr 2017 07:04:33 +0000 (10:04 +0300)]
aplay: Introduce and use xwrite helper

Write can return less then requested bytes, but we treat this as
an error thus ending up with confusing error messages.

Fix this by introducing xwrite helper, which makes sure all bytes
are written or an error is returned.

With this patch an usecase where disk is filled by recording will
print:
$ /mnt/msc/audio.wav: No space left on device

instead of random messages like:

$/mnt/msc/audio.wav: No such file or directory

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoamidi: optarg might be NULL, fix 't' argument parsing
Jaroslav Kysela [Mon, 27 Feb 2017 08:04:08 +0000 (09:04 +0100)]
amidi: optarg might be NULL, fix 't' argument parsing

7 years agoalsa-info: add ACPI device status
Pierre-Louis Bossart [Tue, 10 Jan 2017 00:32:24 +0000 (18:32 -0600)]
alsa-info: add ACPI device status

BIOS vendors typically reuse the same definitions between different
platforms and expose the relevant hardware by changing the value of
the _STA method.

For example on the Asus T100HA, there are 3 HID values for audio
codecs in the DSDT table but two have a zero status and will be
ignored by the ACPI subsystem.

$ more /sys/bus/acpi/devices/10EC*/status
::::::::::::::
/sys/bus/acpi/devices/10EC3270:00/status
::::::::::::::
15
::::::::::::::
/sys/bus/acpi/devices/10EC5640:00/status
::::::::::::::
0
::::::::::::::
/sys/bus/acpi/devices/10EC5648:00/status
::::::::::::::
0

This information is very useful to figure out which HIDs/quirks need
to be supported. Add log to alsa-info.sh to only expose non-zero
results of the ACPI _STA method, e.g.

!!ACPI Device Status Information
!!---------------

/sys/bus/acpi/devices/10EC3270:00/status   15

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsa-info: provide more DMI information
Pierre-Louis Bossart [Tue, 10 Jan 2017 00:32:23 +0000 (18:32 -0600)]
alsa-info: provide more DMI information

Some manufacturers don't provide useful information for Manufacturer
and Product Name but instead use Board Vendor and Board Name fields,
add them to alsa-info log

Example on Intel NUC:

!!DMI Information
!!---------------

Manufacturer:
Product Name:
Product Version:
Firmware Version:  KYSKLi70.86A.0042.2016.0929.1933
Board Vendor:      Intel Corporation
Board Name:        NUC6i7KYB

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsactl: Remove standard output definition in systemd unit
Paul Menzel [Tue, 8 Jul 2014 07:23:06 +0000 (07:23 +0000)]
alsactl: Remove standard output definition in systemd unit

`/lib/systemd/system/alsa-restore.service` specifies
`StandardOutput=syslog`. This overrides the `DefaultStandardOutput`
setting from `/etc/systemd/system.conf`, which the system administrator
can use to specify how output gets logged. In particular, the sysadmin
may want output to go to the journal, or to syslog, or nowhere at all [1].

This patch removes the definition entirely, so the units can use the
system default.

Upstream the patch from the Debian package [2].

[1] https://bugs.debian.org/741123
    "systemd services should not use StandardOutput=syslog; should rely
     on DefaultStandardOutput"
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/systemd_standardoutput.patch/

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
CC: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsaucm: Add alsaucm.rst to EXTRA_DIST
Takashi Iwai [Wed, 28 Dec 2016 14:58:51 +0000 (15:58 +0100)]
alsaucm: Add alsaucm.rst to EXTRA_DIST

Otherwise it's missing in the tarball.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoRelease v1.1.3
Jaroslav Kysela [Tue, 20 Dec 2016 09:12:29 +0000 (10:12 +0100)]
Release v1.1.3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
7 years agoalsactl: Fix potential NULL dereferences in daemon mode
Takashi Iwai [Fri, 9 Dec 2016 16:28:47 +0000 (17:28 +0100)]
alsactl: Fix potential NULL dereferences in daemon mode

The code releasing the each card object may access to NULL when a
bogus count is given.  Add a NULL check just to make sure.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoINSTALL: document how to configure a build for installation in a local dir
Antonio Ospite [Fri, 9 Dec 2016 13:02:32 +0000 (14:02 +0100)]
INSTALL: document how to configure a build for installation in a local dir

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoAdd alsaucm.1 to .gitignore
Takashi Iwai [Fri, 9 Dec 2016 16:24:14 +0000 (17:24 +0100)]
Add alsaucm.1 to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsaucm: add a man page, generated from reStructuredText
Antonio Ospite [Fri, 9 Dec 2016 13:02:31 +0000 (14:02 +0100)]
alsaucm: add a man page, generated from reStructuredText

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoconfigure.ac: add a check for rst2man, a reStructuredText man page generator
Antonio Ospite [Fri, 9 Dec 2016 13:02:30 +0000 (14:02 +0100)]
configure.ac: add a check for rst2man, a reStructuredText man page generator

Define a USE_RST2MAN conditional so that, when available, rst2man can be
used to generate man pages from reStructuredText source files.

The code follows what is done to check for xmlto.

On Debian system, the rst2man executable is provided by python-docutils
or python3-docutils.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoconfigure.ac: fix the check for xmlto availability
Antonio Ospite [Fri, 9 Dec 2016 13:02:29 +0000 (14:02 +0100)]
configure.ac: fix the check for xmlto availability

The same $xmlto variable is used both in AC_ARG_ENABLE and
AC_CHECK_PROG, but the latter is not setting a value to it when the
program is not found.

These two facts result in the "yes" value from the AC_ARG_ENABLE macro
to be still kept in the variable when the program is not found by
AC_CHECK_PROG, causing USE_XMLTO to be always set, finally resulting in
a build failure in case the xmlto program is not actually in the PATH.

As possible fix could have been to set "no" as a value in AC_CHECK_PROG
when program is not found.

However using two separate variables is more explicit, so fix the issue
this way.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsaucm: mention the "list1" command in the usage output
Antonio Ospite [Fri, 9 Dec 2016 13:02:28 +0000 (14:02 +0100)]
alsaucm: mention the "list1" command in the usage output

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agospeaker-test: Fix chmap wav file selection.
Arnaud Pouliquen [Wed, 7 Dec 2016 16:44:26 +0000 (17:44 +0100)]
speaker-test: Fix chmap wav file selection.

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>
7 years agoaplay: Fix to handle pause when system is suspended/Resumed
Jeeja KP [Mon, 28 Nov 2016 16:32:00 +0000 (22:02 +0530)]
aplay: Fix to handle pause when system is suspended/Resumed

If PCM is paused and then we do system supend-resume, the stream throws
error(EBADF) when stream is paused released.

Check the pcm state before pause/release and if stream is suspended,
call snd_pcm_resume to resume the stream.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsaloop: try adapt avail_min for playback to avoid 100% CPU usage
Jaroslav Kysela [Tue, 18 Oct 2016 11:57:19 +0000 (13:57 +0200)]
alsaloop: try adapt avail_min for playback to avoid 100% CPU usage

7 years agoamidi: add sysex-interval option
Felipe F. Tonello [Tue, 30 Aug 2016 16:02:48 +0000 (17:02 +0100)]
amidi: add sysex-interval option

This patch adds a new option to amidi tool: sysex-interval.

It adds a delay (in milliseconds) in between each SysEx message - it searches
for a 0xF7 byte.

This is very useful when sending firmware updates to a remote device via SysEx
or any other use that requires this delay in between SysEx messages.

`amidi' manual was updated with an example usage as well.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add system power management S3 test
Keqiao, Zhang [Fri, 26 Aug 2016 15:37:55 +0000 (23:37 +0800)]
alsabat: add system power management S3 test

Support audio pause/resume for playback and capture. The user can
pause alsabat playback/capture threads by sending a signal. The patch
provides a method for QA to quick test audio during system s3.

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: fix alsabat -86 error
Keqiao, Zhang [Fri, 26 Aug 2016 15:37:54 +0000 (23:37 +0800)]
alsabat: fix alsabat -86 error

alsabat reports -86 error when system suspend and resume. Check the
return value of read_to_pcm() and write_to_pcm(), when -x8 err is
detected, do resume and wait for read/write to pcm to complete.

Write PCM device error: Streams pipe error(-86)
Read PCM device error: Streams pipe error(-86)
*** Error in alsabat: double free or corruption (out): 0x00007fb438001810 ***

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add amixer config files
Focus Luo [Mon, 22 Aug 2016 16:16:50 +0000 (00:16 +0800)]
alsabat: add amixer config files

This patch includes the reference asound.state config files
on Intel Skylake, Broadwell and Hsawell platforms

Signed-off-by: Focus Luo <focus.luo@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: automation test scripts
Focus Luo [Mon, 22 Aug 2016 16:16:49 +0000 (00:16 +0800)]
alsabat: automation test scripts

This patch includes automated test scripts for linux audio driver
based on alsa-lib interface by using alsabat as test tool.
It supports analog and display(HDMI/DP) audio test.
The package needs the alsa-utils, alsa-lib installed environment.

Signed-off-by: Focus Luo <focus.luo@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoamidi: fix timeout handling
Clemens Ladisch [Sat, 13 Aug 2016 14:41:58 +0000 (16:41 +0200)]
amidi: fix timeout handling

The timeout is not supposed to expire when ignored messages are
received.  This cannot be handled with the poll() timeout, so add
a separate timer.

Reported-by: Martin Tarenskeen <m.tarenskeen@gmail.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoamidi: ignore not only Active Sensing but also Clock bytes
Clemens Ladisch [Sat, 13 Aug 2016 14:41:23 +0000 (16:41 +0200)]
amidi: ignore not only Active Sensing but also Clock bytes

Active Sensing messages are sent by many devices in the background and
would only interfere with the actual messages that amidi is supposed to
capture.  Therefore, amidi ignores them by default.  However, there are
also devices that send Clock messages with the same problem, so it is
a better idea to filter them out, too.

Reported-by: Martin Tarenskeen <m.tarenskeen@gmail.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoRelease v1.1.2
Jaroslav Kysela [Tue, 2 Aug 2016 17:09:45 +0000 (19:09 +0200)]
Release v1.1.2

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
7 years agoalsabat: make snr_is_valid static
Vinod Koul [Tue, 19 Jul 2016 09:05:09 +0000 (14:35 +0530)]
alsabat: make snr_is_valid static

The compilation fails due to multiple defination of snr_is_valid

common.o: In function `snr_is_valid':
bat/common.h:99: multiple definition of `snr_is_valid'
bat.o:bat/common.h:99: first defined here

signal.o: In function `snr_is_valid':
bat/common.h:99: multiple definition of `snr_is_valid'
bat.o:bat/common.h:99: first defined here

latencytest.o: In function `snr_is_valid':
bat/common.h:99: multiple definition of `snr_is_valid'
bat.o:bat/common.h:99: first defined here

analyze.o: In function `snr_is_valid':
bat/common.h:99: multiple definition of `snr_is_valid'
bat.o:bat/common.h:99: first defined here

alsa.o: In function `snr_is_valid':
bat/common.h:99: multiple definition of `snr_is_valid'
bat.o:bat/common.h:99: first defined here

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: fix a missing break in switch
Lu, Han [Sun, 12 Jun 2016 10:17:00 +0000 (18:17 +0800)]
alsabat: fix a missing break in switch

Add the break line for OPT_ROUNDUPLATENCY case.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add noise detection
Lu, Han [Wed, 8 Jun 2016 19:42:49 +0000 (03:42 +0800)]
alsabat: add noise detection

Alsabat reports error when noise above threshold be detected.
Use either of the options below to designate the threshold. (e.g.
if the ratio of noise to signal is 5%, the snr is about 26dB.)
    --snr-db <value in dB>
    --snr-pc <value in %>

The noise detection is performed in time domain. On each period
of the sine wave being analyzed, alsabat substracts a clean sine
wave from the source, calculates the RMS value of the residual,
and compares the result with the threshold. At last, alsabat
returns the number of periods with noise above threshold. 0 is
returned when the source is clean.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add a single channel sine wave generator
Lu, Han [Wed, 8 Jun 2016 19:42:48 +0000 (03:42 +0800)]
alsabat: add a single channel sine wave generator

Add function generate_sine_wave_raw_mono(). It serves as a single
channel sine wave generator, to provide data for calculation (e.g.
for noise analysis).
The function is similar to generate_sine_wave(), but a lite revision.
It has no dependency on bat channels and target frequency, no malloc
inside, no data conversion from float to integer samples, and supports
one channel only.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add channels parameter for adjust_waveform()
Lu, Han [Wed, 8 Jun 2016 19:42:47 +0000 (03:42 +0800)]
alsabat: add channels parameter for adjust_waveform()

The function adjust_waveform() is a component of generate_sine_wave(),
and depended on bat->channels parameter. Add parameter "channels" to
remove the dependency, and then adjust_waveform() can be applied on
other use cases, e.g. a single channel sine wave generator.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: align the data type on float
Lu, Han [Wed, 8 Jun 2016 19:42:46 +0000 (03:42 +0800)]
alsabat: align the data type on float

Aligning the data type of fftw analyzer, sample converter and other
components on float, because:
  1. avoid unnecessary data type conversion;
  2. using float is more efficient than using double;
  3. the extra double accuracy is not required.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: add round trip audio latency test
vivian,zhang [Fri, 3 Jun 2016 02:05:08 +0000 (10:05 +0800)]
alsabat: add round trip audio latency test

Audio latency is the time delay as an audio signal passes through
a system. There are many kinds of audio latency metrics. One useful
metric is the round trip latency, which is the sum of output latency
and input latency.

The measurement step works like below:
1. Listen and measure the average loudness of the environment for
one second;
2. Create a threshold value 16 decibels higher than the average
loudness;
3. Begin playing a ~1000 Hz sine wave and start counting the samples
elapsed;
4. Stop counting and playing if the input's loudness is higher than
the threshold, as the output wave is probably coming back;
5. Calculate the audio latency value in milliseconds.

Signed-off-by: Zhang Vivian <vivian.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoalsabat: fix a possible memory leak
Lu, Han [Wed, 1 Jun 2016 08:54:28 +0000 (16:54 +0800)]
alsabat: fix a possible memory leak

Fix a possible memory leak in generate_sine_wave(). Memory free was
ignored when the function return an error.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>