OSDN Git Service

android-x86/external-alsa-utils.git
5 years agoaxfer: correct message to notice that help text is implemented
Takashi Sakamoto [Sun, 27 Jan 2019 05:49:43 +0000 (14:49 +0900)]
axfer: correct message to notice that help text is implemented

Now help message is available to give help option to command line.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: correct description about snoop mode of libffado
Takashi Sakamoto [Sun, 27 Jan 2019 05:48:33 +0000 (14:48 +0900)]
axfer: correct description about snoop mode of libffado

The libffado library can listen to isochronous channels to which unit on
IEEE 1394 bus transfers packets as long as the unit allows software to
read the channel from its register.

This commit corrects description about snoop mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: fulfill section for backward compatibitity for chmap option
Takashi Sakamoto [Sun, 27 Jan 2019 05:39:18 +0000 (14:39 +0900)]
axfer: fulfill section for backward compatibitity for chmap option

At present, axfer losts backward compatibility to aplay in a point of
'chmap' option.

This commit filfills a section to describe lose of backward compatibility
of chmap option.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a section about unit test
Takashi Sakamoto [Sun, 27 Jan 2019 05:27:11 +0000 (14:27 +0900)]
axfer: add a section about unit test

Two unit tests are available to check internal implementation of axfer.
They perform file I/O for many times and take much time to finish.

This commit adds a section about it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoalsamixer: define _GNU_SOURCE to get exp10
Jaroslav Kysela [Fri, 18 Jan 2019 08:24:12 +0000 (09:24 +0100)]
alsamixer: define _GNU_SOURCE to get exp10

Fixes Master, Headphones and Speaker stuck at -8 percentage after
building with Clang 7.0.1 and getting warned about implicit declaration
of exp10, which is behind _GNU_SOURCE as a non-standard feature. Thanks
Takashi Iwai for the CFLAGS suggestion on the mailing list. GCC build is
not affected, so not adding a compiler check to the configure script.

uClibc-ng has got exp10 since 1.0.12, so the fallback macro is no longer
needed. However, alsa-utils relies on gettext so might need further
patches to actually work on uClibc systems.

Signed-off-by: makepost <makepost@firemail.cc>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoRelease v1.1.8
Jaroslav Kysela [Mon, 7 Jan 2019 12:55:40 +0000 (13:55 +0100)]
Release v1.1.8

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoMakefile.am: add README.md to EXTRA_DIST
Jaroslav Kysela [Mon, 7 Jan 2019 13:57:55 +0000 (14:57 +0100)]
Makefile.am: add README.md to EXTRA_DIST

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
5 years agoaxfer: add an explanation about advantages/issues of Timer-based scheduling model
Takashi Sakamoto [Sat, 5 Jan 2019 08:42:10 +0000 (17:42 +0900)]
axfer: add an explanation about advantages/issues of Timer-based scheduling model

Timer-based scheduling model has some merits against IRQ-based
scheduling model. However, as of Linux kernel v4.21, ALSA PCM interface
between kernel/userspace has a lack of some features.

This commit adds a subsection to describe it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add an explanation about Timer-based scheduling model
Takashi Sakamoto [Sat, 5 Jan 2019 08:42:09 +0000 (17:42 +0900)]
axfer: add an explanation about Timer-based scheduling model

This commit fulfills a subsection titled as 'Timer-based scheduling model'.

This scheduling model is introduced in a recent decade. In this model,
applications should take care of its timing to operate sampled data
according to any timer. This is an optional behaviour of runtime of
PCM substream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add an explanation about IRQ-based scheduling model
Takashi Sakamoto [Sat, 5 Jan 2019 08:42:08 +0000 (17:42 +0900)]
axfer: add an explanation about IRQ-based scheduling model

This commit adds a section titled as 'SCHEDULING MODEL' and fulfill a
subsection titled as 'IRQ-based scheduling model'.

This scheduling model is for a typical applications to operate a kind of
data sampled against actual time. In this model, ALSA PCM core maintains
timing of the applications with notification of hardware by
blocking/waking up their processes. This is a default behaviour of
runtime of PCM substream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add text for compatibility loss of sw parameter in libasound backend
Takashi Sakamoto [Fri, 21 Dec 2018 11:48:44 +0000 (20:48 +0900)]
axfer: add text for compatibility loss of sw parameter in libasound backend

At present, some options for software parameters have actual effects in
cases neither mmap operation nor timer-based scheduling model is used.
For mmap operation, backward compatibility  to aplay(1) is lost.

This commit adds descriptions about it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: fulfill manual section for libasound backend
Takashi Sakamoto [Thu, 20 Dec 2018 06:39:40 +0000 (15:39 +0900)]
axfer: fulfill manual section for libasound backend

This commit attempts to describe purpose of each option with more texts
than aplay(1).

I note that a section for scheduling model will be prepared near future.
This commit just adds a placeholder for the section.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: print help for libasound backend
Takashi Sakamoto [Mon, 17 Dec 2018 06:51:03 +0000 (15:51 +0900)]
axfer: print help for libasound backend

This commit attempts to categorise existing options to four parts;
basics, software features, libasound plugin options and debug assistant.
These categories will assist users to get purpose of each option.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: fulfill manual section for libffado backend
Takashi Sakamoto [Fri, 21 Dec 2018 05:16:24 +0000 (14:16 +0900)]
axfer: fulfill manual section for libffado backend

I note that libffado backend has no support for suspend/resume because
libffado has enough implementation for these features even if it exports
some symbols for them. For this backend, reception of signals for the
features brings abortion of runtime.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: print help for libffado backend
Takashi Sakamoto [Mon, 17 Dec 2018 06:51:20 +0000 (15:51 +0900)]
axfer: print help for libffado backend

This commit adds help texts for libffado backend.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: correct description about signal handling
Takashi Sakamoto [Mon, 31 Dec 2018 02:35:31 +0000 (11:35 +0900)]
axfer: correct description about signal handling

Some items in a section for POSIX SIGNALS includes wrong texts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: fix typo in axfer(1) manual
Takashi Sakamoto [Sat, 22 Dec 2018 01:09:46 +0000 (10:09 +0900)]
axfer: fix typo in axfer(1) manual

A line has meaningless 'H' letter in its end.

Fixes: c5b2beebfdc2 ('axfer: add a manual for entry point')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: fix no return statement in print_help() function
Takashi Sakamoto [Mon, 17 Dec 2018 05:07:27 +0000 (14:07 +0900)]
axfer: fix no return statement in print_help() function

A function, print_help() in xfer module is defined to return integer
value, however this is useledd.

This commit fixes it.

Fixes: 908ff69be246 ('axfer: print help text of transfer subcommand just for common options')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: enable each backend to print own help
Takashi Sakamoto [Fri, 7 Dec 2018 09:41:02 +0000 (18:41 +0900)]
axfer: enable each backend to print own help

This commit adds an operation for xfer backend to print help text.
In this time, content of the help is not implemented yet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: print help text of transfer subcommand just for common options
Takashi Sakamoto [Fri, 7 Dec 2018 09:41:02 +0000 (18:41 +0900)]
axfer: print help text of transfer subcommand just for common options

This commit adds help text of transfer subcommand.

In this time, backend options are not described. They will be added in
future commits.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: print help text of list subcommand
Takashi Sakamoto [Fri, 7 Dec 2018 09:41:02 +0000 (18:41 +0900)]
axfer: print help text of list subcommand

This commit adds help text of list subcommand.

This help text can not be in execution of alias (aplay/arecord) due to
program design.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: print help text of command entry
Takashi Sakamoto [Fri, 7 Dec 2018 09:41:02 +0000 (18:41 +0900)]
axfer: print help text of command entry

This commit adds help text of command entry. This is printed when
help subcommand is given, or a valid subcommand or a valid direction
are not given.

Unfortunately, at present, execution of alias (aplay/arecord) with help
options prints the added help text. It should print help options in
transfer subcommand. This bug will fixed in future commits.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a section about design of transfer subcommand
Takashi Sakamoto [Wed, 5 Dec 2018 21:31:46 +0000 (06:31 +0900)]
axfer: add a section about design of transfer subcommand

An implementation of transfer subcommand is the most large part and
complicated somehow. This commit adds a section titled 'DESIGN' to
manual to overall design of the subcommand.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a section to describe compatibility to aplay(1)
Takashi Sakamoto [Wed, 5 Dec 2018 21:31:46 +0000 (06:31 +0900)]
axfer: add a section to describe compatibility to aplay(1)

The axfer(1) is designed to keep backward compatibility to aplay(1)
as much as possible, however some changes are added to its behaviour.

This commit adds a section titles 'COMPATIBILITY TO APLAY' to each
manuals.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a manual for transfer subcommand
Takashi Sakamoto [Wed, 5 Dec 2018 21:31:46 +0000 (06:31 +0900)]
axfer: add a manual for transfer subcommand

This commit adds a manual for transfer subcommand in axfer(1). This
subcommand is a main feature of this command, to transfer audio data
frame between device/node and file/stdio.

This subcommand is designed to have several transmission backend.
Detail explanation about these backends is added in future commits.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a manual for list subcommand
Takashi Sakamoto [Wed, 5 Dec 2018 21:31:46 +0000 (06:31 +0900)]
axfer: add a manual for list subcommand

This commit adds a manual for list subcommand of axfer(1). At present,
this subcommand prints helpful information to transfer subcommand in
libasound backend.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a manual for entry point
Takashi Sakamoto [Wed, 5 Dec 2018 21:31:46 +0000 (06:31 +0900)]
axfer: add a manual for entry point

This commit adds a manual for axfer(1). This command is an entry point
to supported subcommand.

I note that axfer(1) has renewed option system against aplay(1). The
command get positional two options for subcommand and direction. In
short:
 $ axfer transfer capture|playback [options for transfer subcommand]
 $ axfer list capture|playback [options for list subcommand]
 $ axfer version
 $ axfer help

Manuals to subcommands are added later separately.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: check whether a terminal is referred for stdio
Takashi Sakamoto [Wed, 5 Dec 2018 01:25:04 +0000 (10:25 +0900)]
axfer: check whether a terminal is referred for stdio

A reference to a terminal for standard input/output brings some
troubles. For capture transmission, it can bring some terminal
control codes and it's possible to make the terminal in disorder.
For playback transmission, it can bring endless loop to read
data for detection of type of container.

This commit checks whether a terminal is referred for the standard
input/output by a call isatty(3). When detecting a terminal,
axfer run time prints message and goes to finish.

Suggested-by: Takashi Iwai <tiwai@suse.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: truncate parsed arguments before operating subcommand
Takashi Sakamoto [Mon, 3 Dec 2018 21:33:42 +0000 (06:33 +0900)]
axfer: truncate parsed arguments before operating subcommand

When subcommands are operated, top-most two arguments are already
parsed in renewed command system, thus they're useless. Besides,
they're possible to be parsed by getopt_long(3).

This commit truncates these options before entering subcommand
operation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: use transfer subcommand as a default for compatibility mode to aplay(1)
Takashi Sakamoto [Mon, 3 Dec 2018 21:33:42 +0000 (06:33 +0900)]
axfer: use transfer subcommand as a default for compatibility mode to aplay(1)

At present, both of help and transfer subcommands are used when options
are missing in compatibility mode to aplay(1). However, in a view of
users, it should be transfer subcommand.

This commit uses transfer subcommand as a default for the mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: use second argument in command line for transmission direction
Takashi Sakamoto [Mon, 3 Dec 2018 21:33:42 +0000 (06:33 +0900)]
axfer: use second argument in command line for transmission direction

In renewed command system, axfer uses first argument for subcommand. In
popular subcommand such as transfer, transmission direction is required.
At present, some options in aplay(1) are used for this purpose however
it's understandable to use second argument for this purpose.

This commit uses second argument as fixed position to indicate
direction for renewed command system.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: apply refactoring in list subcommand for new command system
Takashi Sakamoto [Mon, 3 Dec 2018 21:33:42 +0000 (06:33 +0900)]
axfer: apply refactoring in list subcommand for new command system

This commit splits option parser for new command system into a function
for readability.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: apply refactoring to list subcommand for backward compatibility to aplay(1)
Takashi Sakamoto [Mon, 3 Dec 2018 21:33:42 +0000 (06:33 +0900)]
axfer: apply refactoring to list subcommand for backward compatibility to aplay(1)

This commit splits option parser for backward compatibility to aplay(1)
in list subcommand. Supported operations are listed in local enumeration.

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

At present, axfer is designed to use several types of backend for
transmission of data frames. This commit is an implementation
example of the backend.

Libffado is a userspace library for transmission of data frames according
to protocols similar to IEC 61883-1/6. This library handles audio and
music units on IEEE 1394 bus.

Unfortunately, this library executes ctor/dtor of instances for some
objects in startup/finish routines of C runtime. As a result, it outputs
some superfluous messages even if the backend is not actually used.
Furthermore, this library brings memory leak internally. Therefore,
it's not practical to build this backend for generic purposes. Although
the backend implementation works fine, this commit is just for technical
preview.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: obsolete some unimplemented options
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:46 +0000 (15:41 +0900)]
axfer: obsolete some unimplemented options

Althogh many options are actually supported by aplay, some of them are
not enough good in practical points. For example, '--test-position'
option is meaningless for some use cases. Furthermore, due to practical
reasons, some options are not implemented well; e.g. vumeter.

This commit marks such options as 'obsoleted'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add support for timer-based scheduling model with MMAP operation
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:45 +0000 (15:41 +0900)]
axfer: add support for timer-based scheduling model with MMAP operation

In 2010, ALSA PCM interface got an flag of hardware parameters to suppress
periodical interrupts, according to a request from PulseAudio developer.

In typical PCM operation for usual hardware, PCM drivers configure the
hardware to generate the periodical interrupts to notify that the same
amount of data frames as a period of PCM buffer is actually transferred
via serial sound interface. The flag can suppress this if the driver
support it.

There's some merits of this configuration:
 - No interrupt context run for PCM substream. The PCM substream is
   handled in any process context only. No need to care of race
   conditions between interrupt/process contexts. This is good for
   developers of drivers and applications.
 - CPU time is not used for handlers on the interrupt context. The CPU
   time can be dedicated for the other tasks. This is good in a point
   of Time Sharing System.
 - Hardware is not configured to generate interrupts. This is good in a
   point of reduction of overall power consumption.

Disabling period interrupt is used for 'Timer-based scheduling' to
consume data frames on PCM buffer independently of interrupt context. As
noted, no interrupt context runs for PCM substream, thus any blocking
operation is not released. Furthermore, system calls for multiplexed I/O
is not also released without timeout.

In this scheduling model, applications need to care of available space on
PCM buffer by lapse of time, typically by yielding CPU and wait for
rescheduling. For the yielding, timeout is calculated for preferable
amount of PCM frames to process. This is an additional merit for
applications, like sound servers. when an I/O thread of the server wait
for the timeout, the other threads can process data frames for server
clients. Furthermore, with usage of rewinding/forwarding, applications
can achieve low latency between transmission position and handling
position even if they uses large size of PCM buffers.

But the timeout should be calculated with enough care of hardware
capabilities. To disable period interrupt, used hardware should satisfy
some requirements for data transmission:
1. Even if drivers don't handle interrupts to queue next data transmission,
   hardware voluntarily perform the data transmission when needed
   (typically by requesting DMA automatically).
2. hardware has a capability to report current position of data
   transmission with enough accuracy against the data transmission.
   developers refer this as 'granularity'. If hardware can always
   reports updated position after the data transmission finishes, the
   granularity equals to the size of period of PCM buffer.
3. a fine size of data transmission in one time. This size is decided
   depending on configuration of hardware or DMA controller, but for
   efficiency it may not be one byte. Thus some amount of data frame is
   transferred by one data transmission. Developers refer this as
   'burst-ness'.

The timeout should be calculated according to the item 2 and 3, however
in current ALSA PCM interface supplemental information is not delivered
from drivers to applications. Although at present userspace applications
should be written by a speculative way for this point, there's few
problems because there're a few hardware which satisfy the above items.
However, when more drivers supports this feature, the problem may largely
be exposed and bothers application developers.

This commit adds an option to use 'timer-based scheduling' for data
transmission. This commit adds '--sched-model' option, and the scheduling
mode is enabled when 'timer' is assigned to the option by equal sign.

Although there's some TODOs, you can see the scheduling mode in this
simple program, like:

$ axfer transfer --sched-model=timer -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer --sched-model=timer -C -d 2 -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 an implementation of waiter for epoll(7)
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:44 +0000 (15:41 +0900)]
axfer: add an implementation of waiter for epoll(7)

This commit adds support of waiter for Linux specific epoll(7) system call.
For portability to the other Unix-like systems such as xBSD, modification
of Makefile.am may be required for conditional build, but this commit
includes no changes for it.

Below lines are examples to use this option:
$ axfer transfer --waiter-type=epoll -M -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer --waiter-type=epoll -M -C -d 2 -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 an implementation of waiter for select(2)
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:43 +0000 (15:41 +0900)]
axfer: add an implementation of waiter for select(2)

This commit adds support of waiter for select(2) system call.

Below lines are examples to use this option:
$ axfer transfer --waiter-type=select -M -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer --waiter-type=select -M -C -d 2 -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 an implementation of waiter for poll(2)
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:42 +0000 (15:41 +0900)]
axfer: add an implementation of waiter for poll(2)

This commit adds support of waiter for poll(2) system call.

Below lines are examples to use this option:
$ axfer transfer --waiter-type=poll -M -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer --waiter-type=poll -M -C -d 2 -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 an option for waiter type
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:41 +0000 (15:41 +0900)]
axfer: add an option for waiter type

This commit is an integration to add an option for users to choose waiter
type. Users give the type to value to '--waiter-type' ('-w') option to
choose it. Currently, 'snd_pcm_wait()' is just supported as a default.
This alsa-lib API is implemented with a call of poll(2).

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add a common interface of waiter for I/O event notification
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:40 +0000 (15:41 +0900)]
axfer: add a common interface of waiter for I/O event notification

There're several types of system calls for multiplexed I/O. They're used to
receive notifications of I/O events. Typically, userspace applications call
them against file descriptor to yield CPU. When I/O is enabled on any of
the descriptors, a task of the application is rescheduled, then the
application execute I/O calls.

This commit adds a common interface for this type of system calls, named as
'waiter'. This is expected to be used with non-blocking file operation and
operations on mapped page frame.

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

As of 2017, two userspace library implementations are known; alsa-lib and
tinyalsa. The latter is simple I/O library to use ALSA PCM interface. On
the other hand, alsa-lib is more complicated than it. This is because it's
designed to add features to transmission of data frames; e.g. sample
resampling. To achieve this, alsa-lib has its configuration space and
plugin system.

In aplay, some options are implemented as a flag for the plugins in
alsa-lib. The flag is given to snd_pcm_open(). This commit adds support
for the flags.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add options for software parameters of PCM substream
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:38 +0000 (15:41 +0900)]
axfer: add options for software parameters of PCM substream

In ALSA PCM interface, some parameters are used to configure runtime of
PCM substream independently of actual hardware. These parameters are
mainly used to decide the detailed timing to start/stop PCM substream and
release I/O blocking state of application. These parameters are
represented and delivered by a structure.

In alsa-lib PCM API, the structure is hidden from userspace applications.
The applications can set/get actual parameters by helper functions.

In aplay, three of the parameters are configurable. This commit adds
support for them. When no options are given, default values are used.

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

In ALSA PCM interface, two parameters are used for size of intermediate
buffer for data frames; period size and buffer size. Actual effects of
these sizes differs depending on hardware, but basically the size of
period is used for intervals of hardware interrupts and the size of buffer
is used to maintain the intermediate buffer as ring buffer. These
parameters can be configured as a part of hardware parameters by
data frame unit or micro second. PCM API in alsa-lib also includes
helper functions to configure them by the two units.

This commit adds support for options to the parameters by both units. When
no options are given, default values are applied according to current
aplay; available maximum size of buffer up to 500msec, a quarter of the
size of buffer for period size. However, these calculation should be
reconsidered somehow.

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

In aplay, '--test-nowait' is used to suppress calls of snd_pcm_wait()
when I/O operations return -EAGAIN or process truncated number of data
frames. This seems to be for debugging purpose. In this program, this
option is equivalent to suppress event waiting.

This commit adds support for this option.

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

In alsa-lib PCM API, data frames can be handled in mapped page frame,
instead of calling any system calls.

This commit support for this type of operation. To reduce CPU usage,
this commit uses 'snd_pcm_wait()' to wait for event notification.

Below lines are examples to execute:
$ axfer transfer -M -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer -M -C -d 2 -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 non-blocking operation
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:34 +0000 (15:41 +0900)]
axfer: add support for non-blocking operation

In alsa-lib PCM API, snd_pcm_read[i|n]() and snd_pcm_write[i|n] can be
used with non-blocking mode. This is available when SND_PCM_NONBLOCK is
used as 'mode' argument for a call of snd_pcm_open().

This commit adds support this type of operation. To reduce CPU usage, this
commit uses 'snd_pcm_wait()' to wait for event notification.

Below lines are examples to execute:
$ axfer transfer -N -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv
$ axfer transfer -N -C -d 2 -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 an option to finish transmission at XRUN
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:33 +0000 (15:41 +0900)]
axfer: add an option to finish transmission at XRUN

In aplay, '--fatal-errors' option has an effect to give up recovery of PCM
substream from XRUN state. This commit adds support for this option.

In original implementation, this option brings program abort. This seems
to generate core dump of process VMA. However, typically, XRUN comes from
timing mismatch between hardware and application, therefore core dump has
less helpful. This commit finishes this program in usual way with this
option at XRUN.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoaxfer: add options related to duration and obsolete '--max-file-size' option
Takashi Sakamoto [Tue, 13 Nov 2018 06:41:32 +0000 (15:41 +0900)]
axfer: add options related to duration and obsolete '--max-file-size' option

In aplay, some options are available to stop data transmission by frame
unit. This commit adds support for the options below:
 * --duration (-d)
  * For duration seconds. The number of data frames transferred in this
  * runtime is calculated by this value and sampling rate.
 * --samples (-s)
  * For the number of data frames to handle in this runtime.

An original aplay has a similar option; '--max-file-time'. This option
is used for capture data transmission to switch file to write data frame
up to maximum number of frames which container format supports, instead
of terminating. However, this may brings complicated file handling to
this program. To reduce maintaining cost, this option is obsoleted.
Additionally, a handler for SIGUSR1 Unix signal has similar feature to
switch the file. For the same reason, the handler is also obsoleted.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>