OSDN Git Service

android-x86/external-alsa-utils.git
8 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>
8 years agoalsabat: add buffer size and period size settings
vivian,zhang [Tue, 31 May 2016 07:31:32 +0000 (15:31 +0800)]
alsabat: add buffer size and period size settings

Add buffer size and period size settings in alsabat.
With -E and -B options, alsabat performs the test with
specified buffer size and period size

Signed-off-by: Zhang Vivian <vivian.zhang@intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: add terminate status check for capture thread
Lu, Han [Sun, 17 Apr 2016 01:26:45 +0000 (09:26 +0800)]
alsabat: add terminate status check for capture thread

In loopback test, alsabat use pthread_join(pthread_t thread, **retval)
to wait for the capture thread to terminate. If the capture thread was
canceled, PTHREAD_CANCELED is placed in *retval, and the access to the
**retval will fail. Add status check to prevent illegal access to the
**retval.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoaplay: fix lurking capture file overwrite bug
David Fries [Thu, 14 Apr 2016 04:32:46 +0000 (23:32 -0500)]
aplay: fix lurking capture file overwrite bug

If -d was given to arecord while commit
8aa13eec80eac312e4b99423909387660fb99b8f (now reverted) was in effect,
the last read would be shorter than the chunk size, but pcm_read would
read and return the chunk size, the samples were discarded, and
capture() continued in a loop because count never reached 0.  arecord
opens a new file each loop iteration, if arecord is dynamically naming
files, --use-strftime option or beyond the wave 2GB limit, this will
generate a series of header only wave files.  If the file is unique
the originally recorded data is lost and it will continue overwriting
the same file with a header only wave file.

While the current pcm_read can't fail (it can exit), it is better to
just fix this lurking bug in case it is "fixed" again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoRelease v1.1.1
Jaroslav Kysela [Thu, 31 Mar 2016 14:37:02 +0000 (16:37 +0200)]
Release v1.1.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agoalsa-info: add alsa-info.sh.1 to EXTRA_DIST
Jaroslav Kysela [Thu, 31 Mar 2016 14:35:26 +0000 (16:35 +0200)]
alsa-info: add alsa-info.sh.1 to EXTRA_DIST

8 years agoalsabat: add tinyalsa support
Lu, Han [Wed, 23 Mar 2016 07:52:47 +0000 (15:52 +0800)]
alsabat: add tinyalsa support

Use "configure --enable-alsabat-backend-tiny" for alsabat to use
tinyalsa as backend lib. On a system that has both ALSA and tinyalsa
installed, alsabat will use ALSA library by default.
The intention is for alsabat to run on tinyalsa platforms such as
Android or some Internet of Things(IoT) devices.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: move alsa process to a single block
Lu, Han [Wed, 23 Mar 2016 07:52:46 +0000 (15:52 +0800)]
alsabat: move alsa process to a single block

Move all alsa callings to a single block (alsa.c), so other blocks
such as the main structure, the signal process and the data analysis
modules will be independent to alsa, and new modules such as a
tinyalsa interface can be easily embedded into alsabat.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: use general data generator function
Lu, Han [Wed, 23 Mar 2016 07:52:45 +0000 (15:52 +0800)]
alsabat: use general data generator function

Use general data generator to replace local function, so other
modules can reuse the data generator rather than re-implement it.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: clean return value for playback and capture threads
Lu, Han [Wed, 23 Mar 2016 07:52:44 +0000 (15:52 +0800)]
alsabat: clean return value for playback and capture threads

Remove unnecessary prints in playback and capture threads, and replace
the return value "0" with error code for convenience of maintaining.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: use general function for wav header update
Lu, Han [Wed, 23 Mar 2016 07:52:43 +0000 (15:52 +0800)]
alsabat: use general function for wav header update

In playback thread, use general function update_wav_header()
to replace a bunch of code, so the structure is cleaner and
no need to define variable "wav".

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: refactoring alsa capture thread
Lu, Han [Wed, 23 Mar 2016 07:52:42 +0000 (15:52 +0800)]
alsabat: refactoring alsa capture thread

Refactoring ALSA capture thread:
  1. Move file open/seek operations to sub function, so all file
  processes are now on a single function (read_from_pcm_loop()), so
  the structure is more reasonable, the function API is simplified
  and no need file cleanup in thread loop.
  2. Replace the wav header processing lines with a general function
  (update_wav_header()), which can be reused in other sections.
  3. Add pthread_exit() for thread to exit safely in single line mode,
  and correct comment.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsactl: init/ca0106, init/hda - use CTL{values} instead CTL{value}
Jaroslav Kysela [Tue, 22 Mar 2016 15:53:30 +0000 (16:53 +0100)]
alsactl: init/ca0106, init/hda - use CTL{values} instead CTL{value}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agoalsactl: remove debug line in set_ctl_values()
Jaroslav Kysela [Tue, 22 Mar 2016 15:50:31 +0000 (16:50 +0100)]
alsactl: remove debug line in set_ctl_values()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agoalsabat: use variable for thread return value
Lu, Han [Mon, 21 Mar 2016 11:05:49 +0000 (19:05 +0800)]
alsabat: use variable for thread return value

Use variable instead of 0/1 to indicate the return value of
playback and capture threads.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: fix fopen and messages
Lu, Han [Mon, 21 Mar 2016 11:05:48 +0000 (19:05 +0800)]
alsabat: fix fopen and messages

All files should be opened in either "rb" or "wb" in current
usage.
Remove incorrect and unneccesary prints.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: fix misusing of errno
Lu, Han [Mon, 21 Mar 2016 11:05:47 +0000 (19:05 +0800)]
alsabat: fix misusing of errno

Preserve errno value before use, since the value might be
changed by another library call.
Add "#include <errno.h>" and remove redundant include.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: add bash test script
Lu, Han [Tue, 15 Mar 2016 03:18:54 +0000 (11:18 +0800)]
alsabat: add bash test script

Add bash script for alsabat feature test. It covers basic alsabat
features, including waveform and wav file generate, playback,
capture and analysis with configurable parameters under different
work modes. (loopback, single line, standalone and local mode)
Usage examples:
        alsabat-test.sh
        alsabat-test.sh plughw:1,0
        alsabat-test.sh plughw:1,0 plughw:1,0

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: add standalone mode
Lu, Han [Tue, 15 Mar 2016 03:18:53 +0000 (11:18 +0800)]
alsabat: add standalone mode

Add support for standalone mode where alsabat will run on a
different machine to the one being tested.
In standalone mode, the alsabat just generates, playback and
capture sound data like in normal mode, but does not analyze.
The alsabat being built without libfftw3 support is always work
in standalone mode.
The alsabat in normal mode can also bypass data analysis using
option "--standalone".

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: add default device name for playback and capture
Lu, Han [Tue, 15 Mar 2016 03:18:52 +0000 (11:18 +0800)]
alsabat: add default device name for playback and capture

Add default name for the playback and capture devices, in case
they were not set by user through '-D', '-P' or '-C' options.
Previously, if no device be specified, the alsabat will start
a playback thread and a capture thread, and then exit the
threads with error log.
If only one of playback and capture is specified, the alsabat
will work on single line mode as before, where only one thread
(playback or capture) will be started.
The patch was tested on Ubuntu and Chrome OS.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoaplay/arecord: handle parsing errors of parameter values
erwin [Fri, 11 Mar 2016 11:40:30 +0000 (11:40 +0000)]
aplay/arecord: handle parsing errors of parameter values

when a user enters a command, he expects his command to be executed
as specified or aborted if it is impossible to fulfill his request

right now a command like "arecord -d hw:1,0 --max-file-time 1h recording.wav"
will happily record something and exit without error status while the resulting
recording contains definitely not what the user requested

to fix this, the patch handles the number parsing function's error channel
and checks whether the parsed number has any trailing characters

Signed-off-by: erwin <nebelbank@posteo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoaconnect: Show sequencer sound card numer/PID via aconnect
Martin Koegler [Tue, 8 Mar 2016 22:06:47 +0000 (23:06 +0100)]
aconnect: Show sequencer sound card numer/PID via aconnect

rawmidi devices expose the card number via IOCTLs, which allows to
find the corresponding device in sysfs.

The sequencer provides no identifing data. Chromium works around this
issue by scanning rawmidi as well as sequencer devices and matching
them by using assumtions, how the kernel register sequencer devices.

This patch adds support for displaying the sound card number/PID to
aconnect.

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: truncate sample frames for faster FFT analysis
Lu, Han [Mon, 29 Feb 2016 02:33:45 +0000 (10:33 +0800)]
alsabat: truncate sample frames for faster FFT analysis

Truncate the sample frames to powers of 2, since the FFTW algorithm
runs especially fast in this case, and other sizes may be computed
by means of a slow, general-purpose algorithm.
In my test environment applying the patch, a sound clip of 33072
frames is cut off to 32768 frames before analysis, and the time
cost is reduced from 6.128s to 0.224s.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoUpdate .gitignore
Takashi Iwai [Wed, 3 Feb 2016 07:50:28 +0000 (08:50 +0100)]
Update .gitignore

bat was renamed to alsabat.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsabat: rename to avoid naming conflict
Lu, Han [Wed, 3 Feb 2016 06:20:33 +0000 (14:20 +0800)]
alsabat: rename to avoid naming conflict

alsa-utils as well as bareos-bat (as well a some Bacula packages)
all contain a program called /usr/bin/bat, which causes conflicts on
various distributions ("basic audio tester" vs "bareos administration
tool"("bacula administration tool")).
Rename to avoid conflict.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoamixer: skip showing asoc tlv byte controls
Vinod Koul [Thu, 28 Jan 2016 08:32:18 +0000 (14:02 +0530)]
amixer: skip showing asoc tlv byte controls

ASoC TLV Byte controls are very large size controls so we should add new
options for these. So skip dumping contents for these.

$amixer -c0 cget numid=16
numid=16,iface=MIXER,name='mdl params'
  ; type=BYTES,access=-----RW-,values=30336
  ; ASoC TLV Byte control, skipping bytes dump

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsa-info.sh: add man page
Jaroslav Kysela [Wed, 13 Jan 2016 08:46:31 +0000 (09:46 +0100)]
alsa-info.sh: add man page

8 years agobat: Don't pass incompatible function pointers to pthread_cleanup_push()
Takashi Iwai [Mon, 9 Nov 2015 13:09:50 +0000 (14:09 +0100)]
bat: Don't pass incompatible function pointers to pthread_cleanup_push()

pthread_cleanup_push() takes a function pointer for void (void *).
Although it may work in most cases, we shouldn't pass an incompatible
function pointer there, as some old gcc complains:
  alsa.c:560: warning: initialization from incompatible pointer type
  alsa.c:562: warning: initialization from incompatible pointer type

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agobat: Avoid local signal.h file
Takashi Iwai [Mon, 9 Nov 2015 13:04:11 +0000 (14:04 +0100)]
bat: Avoid local signal.h file

The local header file named as "signal.h" causes mysterious compile
error when built with an old glibc.
 signal.h:27: error: conflicting types for 'sin_generator_init'
 ./signal.h:27: error: previous declaration of 'sin_generator_init' was here
 signal.h:28: error: conflicting types for 'sin_generator_next_sample'
 ./signal.h:28: error: previous declaration of 'sin_generator_next_sample' was here
 ....

This turned out to be the conflict of signal.h; namely, pthread.h that
is included before our local signal.h also includes "pthread.h".
Since our local "signal.h" has a higher priority, it gets loaded
instead of the expected pthread's one.  Then we load it again, and it
screws up.

Although it's basically a bug of pthread, it's anyway not good to have
a header file conflicting with the standard header file.  So, let's
name it more explicitly as specific to BAT, bat-signal.h, for avoiding
such a conflict.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoRelease v1.1.0
Jaroslav Kysela [Tue, 27 Oct 2015 16:34:26 +0000 (17:34 +0100)]
Release v1.1.0

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agobat: add all headers to noinst_HEADERS
Jaroslav Kysela [Tue, 27 Oct 2015 16:32:51 +0000 (17:32 +0100)]
bat: add all headers to noinst_HEADERS

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agobat: don't link all binaries with fftw library, add missing header
Jaroslav Kysela [Tue, 27 Oct 2015 16:15:58 +0000 (17:15 +0100)]
bat: don't link all binaries with fftw library, add missing header

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agoconfigure.ac: check for fftw3/m(sqrtf)/pthread only when BAT is enabled
Jaroslav Kysela [Tue, 27 Oct 2015 15:09:30 +0000 (16:09 +0100)]
configure.ac: check for fftw3/m(sqrtf)/pthread only when BAT is enabled

8 years agoBAT: Add missing locale.h header
Caleb Crome [Fri, 23 Oct 2015 17:46:09 +0000 (17:46 +0000)]
BAT: Add missing locale.h header

Missing include became apparent when -O3 was not specified.
Added the header to remove error messages during debug compile.

Signed-off-by: Caleb Crome <caleb@crome.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add man page
Lu, Han [Wed, 21 Oct 2015 06:53:27 +0000 (14:53 +0800)]
BAT: Add man page

Add more information about BAT utility, including design intent,
principles, use mode, hardware connection, options, example and
return value.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Use dynamic temp file
Lu, Han [Tue, 20 Oct 2015 08:45:48 +0000 (16:45 +0800)]
BAT: Use dynamic temp file

Use dynamic temp file instead of fixed temp file to store recorded
wav data, for better security.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Change comments and interface of usage()
Lu, Han [Tue, 20 Oct 2015 08:45:47 +0000 (16:45 +0800)]
BAT: Change comments and interface of usage()

1. Change comment strings to make the descriptions more clear;
2. Add indent for option lines that have no indent;
3. Use a const string instead of argv[0] as program name.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Use colon instead of comma for separation
Lu, Han [Tue, 20 Oct 2015 08:45:46 +0000 (16:45 +0800)]
BAT: Use colon instead of comma for separation

Use colon instead of comma to separate frequency parameters, for
in several locale comma may be handled as decimal point.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Remove redundant message strings
Lu, Han [Tue, 20 Oct 2015 08:45:45 +0000 (16:45 +0800)]
BAT: Remove redundant message strings

Cutting down 6 message strings to 2, as translators need to work
on each different variant.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agobuild: Do not try to detect cross-compiler
Mike Frysinger [Thu, 8 Oct 2015 16:14:05 +0000 (12:14 -0400)]
build: Do not try to detect cross-compiler

cross compilers are passed via path may not be a gcc based cross
compiler in such cases this check fails and try's to force gcc based
cross compiler detection, This code is a convenience that limits the
build system.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd bat binary to .gitignore
Takashi Iwai [Fri, 2 Oct 2015 10:47:25 +0000 (12:47 +0200)]
Add bat binary to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd compile to .gitignore
Takashi Iwai [Fri, 2 Oct 2015 10:47:03 +0000 (12:47 +0200)]
Add compile to .gitignore

Another junk.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add Makefile and configures
Lu, Han [Wed, 23 Sep 2015 07:48:55 +0000 (15:48 +0800)]
BAT: Add Makefile and configures

Add Makefile and configures that enable BAT on alsa-utils

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add spectrum analysis functions
Lu, Han [Wed, 23 Sep 2015 07:48:54 +0000 (15:48 +0800)]
BAT: Add spectrum analysis functions

Add functions that detecting signal frequency through spectrum
analyzing.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add converting functions
Lu, Han [Wed, 23 Sep 2015 07:48:53 +0000 (15:48 +0800)]
BAT: Add converting functions

Add functions that converting audio samples to double data for analysis,
and functions that converting float data to audio samples for playback.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add signal generator
Lu, Han [Wed, 23 Sep 2015 07:48:52 +0000 (15:48 +0800)]
BAT: Add signal generator

Add function that generates sine waveform through math lib.
The waveform can be used as source for playback or analysis.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Caleb Crome <caleb@crome.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add playback and record functions
Lu, Han [Wed, 23 Sep 2015 07:48:51 +0000 (15:48 +0800)]
BAT: Add playback and record functions

Add functions as main loop of playback thread and record thread.
The functions access pcm hardware through ALSA APIs.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add common definitions and functions
Lu, Han [Wed, 23 Sep 2015 07:48:50 +0000 (15:48 +0800)]
BAT: Add common definitions and functions

Add common definitions of macros and data structures; Add functions
that used by multiple components, such as wav file reading and writing.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoBAT: Add initial functions
Lu, Han [Wed, 23 Sep 2015 07:48:49 +0000 (15:48 +0800)]
BAT: Add initial functions

Add main entrance, command line parsing, parameter initiating and
thread initiating functions for BAT.

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Bernard Gautier <bernard.gautier@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsactl: Manage both save and restore in a single unit
Takashi Iwai [Tue, 29 Sep 2015 15:26:34 +0000 (17:26 +0200)]
alsactl: Manage both save and restore in a single unit

With RemainAfterExit=true, we can manage both save and restore of the
card state in a single unit file.  This will fix also the case where
systemd reloads the service; with two individual units, it will
restore the previous state before saving, and may lead to inconsistent
state suddenly.

Also fix alsa-state.service as well to make both start and stop
working in a simpler way.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=929619
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoaplay: fix VU meter for S24_LE etc formats
Ricard Wanderlof [Tue, 15 Sep 2015 11:10:00 +0000 (13:10 +0200)]
aplay: fix VU meter for S24_LE etc formats

When recording or playing back audio in a format where the number of
significant bits is less than the physical width (e.g. S24_LE), the VU
meter code needs to consider the number of significant bits in the samples
rather than the physical sample width (e.g. 24 vs 32 bits). Otherwise the
resulting VU meter display will be far too low and it will just indicate
0% all the time.

Tested with a device supporting the S24_LE format.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoarecord: Remove only regular files
Alexander Volkov [Mon, 21 Sep 2015 13:05:57 +0000 (16:05 +0300)]
arecord: Remove only regular files

arecord removes a file before writing into it. It's not
appropriate in some cases. For example, if you a pass
a symlink to a file, then the symlink will be removed
while the user expects to record into the symlink's target.
Another case is recording into the device file. Some
modems provide a tty device file as a voice device.
And it's not possible to write into it under root with
arecord, because it removes the device file.

So check the type of a file before writing into it and
remove only regular files.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agospeaker-test: fix option ordering
Ken Benoit [Thu, 17 Sep 2015 19:06:38 +0000 (15:06 -0400)]
speaker-test: fix option ordering

The -c and -s options needed to be provided in a specific order for the -s option to work correctly.

This pulls the speaker option check outside of the option parsing so that all the options have been parsed before checking to see if the parameter to -s is correct.

Signed-off-by: Ken Benoit <kbenoit@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agoalsactl: Add path condition to alsa-store and alsa-restore services
Takashi Iwai [Mon, 10 Aug 2015 12:42:24 +0000 (14:42 +0200)]
alsactl: Add path condition to alsa-store and alsa-restore services

With alsa-restore.service and alsa-store.service, systemd invokes
alsactl at boot and shutdown times.  When this is invoked on a system
without sound cards, it results in an ugly error message from alsact

  /usr/sbin/alsactl: save_state:1590: No soundcards found...
  return code is "19"

Add ConditionPathExistsGlob checks of /dev/snd/control* devices for
avoiding unnecessary invocations of alsactl on such a system.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=940950
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsaucm: Drop localbuild hacks
Takashi Iwai [Tue, 4 Aug 2015 16:26:40 +0000 (18:26 +0200)]
alsaucm: Drop localbuild hacks

The include and library paths shouldn't be across the build tree.
The installed alsa-lib must have the UCM support for building the
stuff here in alsa-utils repo correctly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd topology/alsatplg to .gitignore
Takashi Iwai [Tue, 4 Aug 2015 15:46:02 +0000 (17:46 +0200)]
Add topology/alsatplg to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add command line topology tool to build topology binaries
Liam Girdwood [Tue, 4 Aug 2015 15:23:03 +0000 (16:23 +0100)]
topology: Add command line topology tool to build topology binaries

Add a command line tool that will parse topology text files and convert to the binary
topology data as used by the kernel.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agospeaker-test: Add option to specify signal scale
Julian Scheel [Tue, 30 Jun 2015 06:57:49 +0000 (08:57 +0200)]
speaker-test: Add option to specify signal scale

Allow generated signals (sine and noise) to have a specified signal scale
instead of using hardcoded limits of 80%. This can be handy for debugging, ie
when analysing clipping issues with audio drivers.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoalsactl: terminate readlink result string
Tobias Stoeckmann [Sat, 11 Jul 2015 11:23:57 +0000 (13:23 +0200)]
alsactl: terminate readlink result string

readlink does not guarantee that its result string is nul-terminated.
Instead, increase the buffer by one byte to make sure that we can
add '\0' at the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoaplay: Fix uninterruptible aplay
Takashi Iwai [Wed, 29 Apr 2015 16:01:58 +0000 (18:01 +0200)]
aplay: Fix uninterruptible aplay

When aplay is invoked to play from stdin, it can't be terminated by
normal signals like SIGTERM or SIGINT.  It's because our signal
handler tries to trap as much as possible while the stalling point is
not in the PCM loop but rather the file I/O.

For fixing this, leave our signal handler once when a signal is
received and snd_pcm_abort() is called.  At the next hit, it shall be
handled normally.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoaplay: Fix type for signal flag
Takashi Iwai [Wed, 29 Apr 2015 16:01:07 +0000 (18:01 +0200)]
aplay: Fix type for signal flag

A flag used in signal handlers has to be a special atomic type,
volatile sig_atomic_t.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsa-info: Don't try update when wget isn't available
Takashi Iwai [Mon, 27 Apr 2015 19:27:05 +0000 (21:27 +0200)]
alsa-info: Don't try update when wget isn't available

... otherwise it overwrites a zero size file.  Also add a check of
zero size file in the update procedure, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoamixer: expand local storage for item name according to kernel code
Takashi Sakamoto [Wed, 8 Apr 2015 16:30:56 +0000 (01:30 +0900)]
amixer: expand local storage for item name according to kernel code

According to kernel code (snd_ctl_elem_init_enum_names() in
sound/core/control.c), the maximum length of item name is 63 characters
(+ 1 terminator = 64 bytes). But current amixer implementation
uses 40 bytes. This causes name truncation and fail to operation.

This commit fixes this bug by expanding the length of local variables.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoamixer: Don't set only the first item in sset_enum()
Peter Meerwald [Tue, 3 Mar 2015 17:39:52 +0000 (18:39 +0100)]
amixer: Don't set only the first item in sset_enum()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoRelease v1.0.29
Jaroslav Kysela [Thu, 26 Feb 2015 14:49:40 +0000 (15:49 +0100)]
Release v1.0.29

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoalsa-info.sh: add script to EXTRA_DIST (automake)
Jaroslav Kysela [Thu, 26 Feb 2015 14:47:27 +0000 (15:47 +0100)]
alsa-info.sh: add script to EXTRA_DIST (automake)

9 years agoconfigure: allow contitional compilation of alsaucm
Matthieu Crapet [Wed, 14 Jan 2015 14:44:19 +0000 (15:44 +0100)]
configure: allow contitional compilation of alsaucm

If alsa-lib have been compiled with --disable-ucm, alsaucm can't be built.
Detection is dynamic, no configure command line option is available for now.

Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsactl/init: Add "Line Out" to list of outputs to initialize
David Henningsson [Mon, 12 Jan 2015 15:48:38 +0000 (16:48 +0100)]
alsactl/init: Add "Line Out" to list of outputs to initialize

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsactl/init: Change the "basic rules" description
David Henningsson [Mon, 12 Jan 2015 15:48:37 +0000 (16:48 +0100)]
alsactl/init: Change the "basic rules" description

We now enable more outputs than just the main speaker, so update
the basic rules to reflect the actual situation.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsactl: add missing state_unlock() call
Jaroslav Kysela [Wed, 24 Dec 2014 19:15:26 +0000 (20:15 +0100)]
alsactl: add missing state_unlock() call

9 years agoamixer: Parse the value more strictly
Takashi Iwai [Sun, 23 Nov 2014 09:04:24 +0000 (10:04 +0100)]
amixer: Parse the value more strictly

So far amixer allows some unexpected suffix and assumes as a raw
absolute value without returning an error.  This is rather dangerous,
e.g. user might not notice that a completely wrong value was set when
the command line included a typo.

This patch makes the parser a bit more strict: it doesn't allow any
longer invalid suffixes, instead either returns an error or skips the
invalid value, depending on the operation mode.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoamixer: Make "dB" case-insensitive in set commands
Takashi Iwai [Sun, 23 Nov 2014 08:40:07 +0000 (09:40 +0100)]
amixer: Make "dB" case-insensitive in set commands

We don't have to be necessarily too strict about case-sensitivity of
"dB" suffix used in set commands.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoRevert "aplay: fix pcm_read() return value"
Jaroslav Kysela [Wed, 1 Oct 2014 13:43:57 +0000 (15:43 +0200)]
Revert "aplay: fix pcm_read() return value"

This reverts commit 8aa13eec80eac312e4b99423909387660fb99b8f.

The semantics for pcm_read() and pcm_readv() was changed, but the
callers expect the exact frame count as requested. It's possible
to fix callers, but the fix is more complicated than to revert the
change. Note that '-d' processing was broken in some cases.

Note: The reverted commit allows that the return value might be
greater than requested (see the first condition in read routines).

9 years agoalsactl: coverity - missing_va_end – va_end was not called for "ap"
Jaroslav Kysela [Wed, 24 Sep 2014 08:52:17 +0000 (10:52 +0200)]
alsactl: coverity - missing_va_end – va_end was not called for "ap"

9 years agomonitor: fix clang warning - Declared variable-length array (VLA) has zero size
Jaroslav Kysela [Wed, 24 Sep 2014 08:50:54 +0000 (10:50 +0200)]
monitor: fix clang warning - Declared variable-length array (VLA) has zero size

9 years agospeaker-text: fix simple signess assignment warning
Jaroslav Kysela [Wed, 24 Sep 2014 08:47:48 +0000 (10:47 +0200)]
speaker-text: fix simple signess assignment warning

9 years agoalsactl: aded missing monitor() prototype
Jaroslav Kysela [Wed, 24 Sep 2014 08:46:02 +0000 (10:46 +0200)]
alsactl: aded missing monitor() prototype

9 years agoalsactl: Fix the file locking routines (for the state management)
Jaroslav Kysela [Wed, 24 Sep 2014 08:35:53 +0000 (10:35 +0200)]
alsactl: Fix the file locking routines (for the state management)

9 years agospeaker-test: Add missing draining at the end
Takashi Iwai [Tue, 16 Sep 2014 14:36:44 +0000 (16:36 +0200)]
speaker-test: Add missing draining at the end

Without the call of snd_pcm_drain() the pending data on the buffer
might be discarded, which results in the abort of playback sound in
the middle.  Let's fix it.

Reported-and-tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsa-info: Refactor "withall" logic
David Henningsson [Fri, 22 Aug 2014 08:31:41 +0000 (10:31 +0200)]
alsa-info: Refactor "withall" logic

Previously, using --output, --no-upload, --upload and --pastebin
switches implied the withall switch.

A more intuitive logic would be that --with-all is disabled if you
use another --with* switch, such as --withdmesg, and only then.

Also update script version to reflect the behaviour change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsa-info: Make sure all full script is run even with "output" option
David Henningsson [Fri, 22 Aug 2014 08:31:40 +0000 (10:31 +0200)]
alsa-info: Make sure all full script is run even with "output" option

For some reason, when the --output option is used, less information
is included compared to when no options are used. This is unexpected.

Fix this by running "withall" also when the output option is used.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoAdd missing alsa-info entry to the root Makefile.am
Takashi Iwai [Tue, 12 Aug 2014 14:19:06 +0000 (16:19 +0200)]
Add missing alsa-info entry to the root Makefile.am

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoAdd alsa-info.sh to alsa-utils repo
Takashi Iwai [Wed, 30 Jul 2014 10:18:07 +0000 (12:18 +0200)]
Add alsa-info.sh to alsa-utils repo

Copied the latest version (0.4.63) from alsa-driver repo.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoalsamixer: include missing mixer_controls.h
Jaroslav Kysela [Wed, 25 Jun 2014 08:49:23 +0000 (10:49 +0200)]
alsamixer: include missing mixer_controls.h

9 years agoalsactl: save state - do not call rename for stdio
Jaroslav Kysela [Wed, 25 Jun 2014 08:47:21 +0000 (10:47 +0200)]
alsactl: save state - do not call rename for stdio

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoRelease v1.0.28
Jaroslav Kysela [Fri, 13 Jun 2014 17:21:05 +0000 (19:21 +0200)]
Release v1.0.28

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoaplay: Fix VU-meter stdout/stderr mess
Sergey [Fri, 13 Jun 2014 01:28:49 +0000 (05:28 +0400)]
aplay: Fix VU-meter stdout/stderr mess

Commit 6bbeb78d forgot to change some of VU-meter output to stderr.
This patch makes the output of `aplay -vvv` consistent again.

Signed-off-by: Sergey <sergemp@mail.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoalsactl: Fixup test for mydatadir/sbindir
David Henningsson [Fri, 13 Jun 2014 09:31:44 +0000 (11:31 +0200)]
alsactl: Fixup test for mydatadir/sbindir

Use the "mydatadir" name consistently.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoalsactl: Do not run udev rule before datadir/sbindir are both mounted
David Henningsson [Fri, 13 Jun 2014 08:04:25 +0000 (10:04 +0200)]
alsactl: Do not run udev rule before datadir/sbindir are both mounted

Sometimes 90-alsa-restore.rules is run before /usr is mounted,
and alsactl restore depends on /usr/share/alsa being present.

If /usr/share/alsa is not present, we're so early in the boot
process that alsa-restore.service (or upstart equivalent) will
run later on.

BugLink: https://bugs.launchpad.net/bugs/1289730
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoaplay/arecord: Add more in_aborting checks to read/write loops
Jaroslav Kysela [Fri, 13 Jun 2014 08:52:26 +0000 (10:52 +0200)]
aplay/arecord: Add more in_aborting checks to read/write loops

Reported-by: Sergey <sergemp@mail.ru>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
9 years agoconfigure.ac: cosmetic change
Jaroslav Kysela [Thu, 12 Jun 2014 08:48:22 +0000 (10:48 +0200)]
configure.ac: cosmetic change

10 years agoalsactl: add -L (no-lock) and change -D (lock-dir) to -O (state-lock-file)
Jaroslav Kysela [Wed, 7 May 2014 09:13:41 +0000 (11:13 +0200)]
alsactl: add -L (no-lock) and change -D (lock-dir) to -O (state-lock-file)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoModernize configure.ac
Jaroslav Kysela [Wed, 7 May 2014 07:49:52 +0000 (09:49 +0200)]
Modernize configure.ac

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoconfigure.in -> configure.ac rename
Jaroslav Kysela [Wed, 7 May 2014 07:46:08 +0000 (09:46 +0200)]
configure.in -> configure.ac rename

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoMakefiles - use AM_CPPFLAGS instead INCLUDES
Jaroslav Kysela [Wed, 7 May 2014 07:43:45 +0000 (09:43 +0200)]
Makefiles - use AM_CPPFLAGS instead INCLUDES

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoupdate the gettext configuration
Jaroslav Kysela [Wed, 7 May 2014 07:29:16 +0000 (09:29 +0200)]
update the gettext configuration

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoconfigure: add --with-lock-dir option
Jaroslav Kysela [Wed, 7 May 2014 07:19:36 +0000 (09:19 +0200)]
configure: add --with-lock-dir option

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agoalsactl: Store lockfile in /var/lock, add -D option to specify the lock dir
Julian Scheel [Tue, 6 May 2014 19:32:19 +0000 (21:32 +0200)]
alsactl: Store lockfile in /var/lock, add -D option to specify the lock dir

It can not be generally assumed that the directories in which asound.state
resides are writable. Use /var/lock and allow users to alter this path.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agofix aconnect -l option
Karl Bongers [Wed, 7 May 2014 04:06:47 +0000 (23:06 -0500)]
fix aconnect -l option

aconnect -l would just print usage.
This fix makes it do what usage says it should do.

Signed-off-by: Karl Bongers <karlbongers@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
10 years agospeaker-test: update man page for new -X arg, also consistency fixes
Erik Ackermann [Wed, 26 Feb 2014 14:52:29 +0000 (06:52 -0800)]
speaker-test: update man page for new -X arg, also consistency fixes

Signed-off-by: Erik Ackermann <kurterikackermann@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>