summaryrefslogtreecommitdiff
path: root/aplay
Commit message (Collapse)AuthorAgeFilesLines
...
* aplay: Refactor playback codeDaniel Baluta2017-08-091-37/+107
| | | | | | | | | | | | | | | | | This introduces read_header function which tries to read the header of an audio file in order to determine its type. This has the following effects: (1) makes code easier to read (2) don't abort if file size is less than expected header (2), allows us to play small files with size smaller than any supported audio file headers. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Add samples argument for playing/recording a given number of samplesIon-Horia Petrisor2017-08-091-5/+29
| | | | | | | | | -s --samples allows aplay to be used for playback/capture a given number of samples per channel Signed-off-by: Ion-Horia Petrisor <ion-horia.petrisor@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: interrupt streaming via signal in voc_pcm_writeSrikanth Krishnakar2017-07-101-1/+1
| | | | | | | | | | | | aplay/arecord (alsa-utils v1.1.2) cannot interrupt streaming via CTRL-C. Fixed the issue by properly handling 'in_aborting' flag in appropriate functions. Signed-off-by: Anant Agrawal <Anant_Agrawal@mentor.com> Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com> Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com> Signed-off-by: Timo Wischer <twischer@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Fix --max-file-time option 32 bits overflowScott Gilliland2017-06-261-1/+1
| | | | | | | | | Fix bug in arecord --max-file-time where the file size could overflow 32 bits. Signed-off-by: Scott Gilliland <scott.gilliland@gatech.edu> Acked-by: John Sauter <John_Sauter@systemeyescomputerstore.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Introduce and use xwrite helperDaniel Baluta2017-04-101-18/+37
| | | | | | | | | | | | | | | | | | | Write can return less then requested bytes, but we treat this as an error thus ending up with confusing error messages. Fix this by introducing xwrite helper, which makes sure all bytes are written or an error is returned. With this patch an usecase where disk is filled by recording will print: $ /mnt/msc/audio.wav: No space left on device instead of random messages like: $/mnt/msc/audio.wav: No such file or directory Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Fix to handle pause when system is suspended/ResumedJeeja KP2016-11-281-0/+7
| | | | | | | | | | | | If PCM is paused and then we do system supend-resume, the stream throws error(EBADF) when stream is paused released. Check the pcm state before pause/release and if stream is suspended, call snd_pcm_resume to resume the stream. Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: fix lurking capture file overwrite bugDavid Fries2016-04-141-3/+6
| | | | | | | | | | | | | | | | | | 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>
* aplay/arecord: handle parsing errors of parameter valueserwin2016-03-111-12/+76
| | | | | | | | | | | | | | | 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>
* aplay: fix VU meter for S24_LE etc formatsRicard Wanderlof2015-09-231-2/+3
| | | | | | | | | | | | | | 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>
* arecord: Remove only regular filesAlexander Volkov2015-09-231-1/+5
| | | | | | | | | | | | | | | | | 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>
* aplay: Fix uninterruptible aplayTakashi Iwai2015-04-291-1/+1
| | | | | | | | | | | | | 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>
* aplay: Fix type for signal flagTakashi Iwai2015-04-291-1/+1
| | | | | | | 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>
* Revert "aplay: fix pcm_read() return value"Jaroslav Kysela2014-10-011-2/+2
| | | | | | | | | | | | 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).
* aplay: Fix VU-meter stdout/stderr messSergey2014-06-131-3/+3
| | | | | | | | 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>
* aplay/arecord: Add more in_aborting checks to read/write loopsJaroslav Kysela2014-06-131-4/+4
| | | | | Reported-by: Sergey <sergemp@mail.ru> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Makefiles - use AM_CPPFLAGS instead INCLUDESJaroslav Kysela2014-05-071-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: fix timespec to msec conversionOlivier Langlois2014-01-221-1/+1
| | | | | | | There is 1M nsec in a msec. Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: fix pcm_read() return valueOlivier Langlois2014-01-081-2/+2
| | | | | | | | | Because of the way the pcm_read() functions are currently used, returning rcount or result is equivalent but I feel it is more accurate to return 'result'. Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: fix two off by one errorsJurgen Kramer2013-09-091-2/+2
| | | | | | | Attached patch for aplay fixes two off-by-one errors preventing usage of the last available sample format. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Several formatting fixes for manpages.Jordi Mallach2013-05-161-14/+14
| | | | | | | | Fix many occurrences of unescaped “-”. Fix minor English issue. Signed-off-by: Jordi Mallach <jordi@debian.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Fix several typos in manpage and help strings.Elimar Riesebieter2013-05-161-1/+1
| | | | | Signed-off-by: Jordi Mallach <jordi@debian.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* arecord: add a missing break to the capture loopJaroslav Kysela2013-04-171-0/+3
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay/arecord: change the interrupt handling using snd_pcm_abort()Jaroslav Kysela2013-04-081-24/+15
| | | | | | | | | It is required (exclude the fatal SIGABRT) to call snd_pcm_close() and the end of work (outside of the interrupt handler). Use new snd_pcm_abort() function to inform alsa-lib to not ignore EINTR and move the in_aborting variable to the global scope to be checked in the i/o loops. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay/arecord: added isatty() check (interactive mode)Jaroslav Kysela2013-03-221-0/+4
| | | | | | Turn off the interactive mode when stdin is not a tty. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: Add the support for big-endian WAV format (RIFX)Takashi Iwai2012-12-132-29/+73
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Show usage if no parameter is passedFabio Estevam2012-11-131-0/+8
| | | | | | | | | When aplay/arecord are called without any argument the application hangs forever. Instead of hanging, print the usage and exit. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: fix typo & silence warning..Jaroslav Kysela2012-09-241-4/+6
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: More support for channel map optionTakashi Iwai2012-09-202-11/+149
| | | | | | | | | | Now aplay tries to follow the given channel map by rearranging the channels even when the channel map override isn't allowed but if the device is still capable to return a channel map. Also update the man page appropriately. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Add support for channel mappingTakashi Iwai2012-09-171-2/+38
| | | | | | | | | With -m option, user can specify the order of channel map. As of this commit, it just tries to override the channel map, thus it works only on devices that support the channel map override like HDMI. Adjusting the channel order in aplay itself will be added later. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Use open() instead of open64()Arun Raghavan2012-07-171-3/+3
| | | | | | | | AC_SYS_LARGEFILE in configure.in will automatically set up defines so that open() will support large files if supported, and if not, this allows us to fall back gracefully to non-LFS open(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Fix signal.h includeArun Raghavan2012-07-171-1/+1
| | | | | | The correct header to include is <signal.h> not <sys/signal.h>. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: print vu-meter to stderr, not stdoutJerome Carretero2012-05-111-7/+7
| | | | | | | | | It allows showing the vu-meter while recording to stdout, eg: aplay -C -V stereo | oggenc - > out.ogg Signed-off-by: Jerome Carretero <cJ@zougloub.eu> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay/arecord: option to treat any xrun as fatalBen Gardiner2012-03-192-2/+19
| | | | | Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay - option to dump HW parametersPavel Hofman2012-03-062-2/+23
| | | | | | | | Dumping HW parameters of the current device with snd_pcm_hw_params_dump, a new option --dump-hw-params added. Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Fix the examples in aplay.1Jaroslav Kysela2012-02-061-2/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: Add backward compatible endian macro definitionsJaroslav Kysela2012-01-251-0/+8
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: Fix spelling errorDavid Henningsson2011-10-121-1/+1
| | | | | | | BugLink: https://bugs.launchpad.net/bugs/816388 Reported-by: Chad Dunlap <cldunlap1@gmail.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
* aplay: increase channel limit to 256Tim Blechmann2011-06-291-2/+2
| | | | | | | | | | aplay is limited to 32 channels, which makes it impossible to use it for testing devices with more channels. here we increase the limit to 256, which should be sufficient for a virtual device made of 4 64-channel soundcards. Signed-off-by: Tim Blechmann <tim@klingt.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: Use standard endian convesionsTakashi Iwai2011-06-031-5/+5
| | | | | | asm/*.h stuff shouldn't be used directly from the user-space apps. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Add include files for mkdir()Takashi Iwai2011-06-031-0/+2
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Avoid recursive signal handlingTakashi Iwai2011-06-031-0/+6
| | | | | | | When abort() is issued in snd_pcm_close() path, it may loop recursively and crash. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay: Add -i option for interactive modeTakashi Iwai2011-06-032-1/+17
| | | | | | | | | | The recent addition of pause/resume control via keyboard brought a problem when aplay/arecord is invoked in background. For avoiding regressions, it's safer to use non-interactive mode as default and enable the new feature via an option. Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* aplay/arecord: term_c_lflag variable might be unitialized in some casesJaroslav Kysela2010-08-181-2/+2
| | | | | | | The term_c_lflag variable might be unitialized in some cases. Add extra check to avoid setting of wrong value. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: fix termio settings - return back old c_flag value on exitJaroslav Kysela2010-07-151-1/+17
| | | | | | | - symptom - ssh client password authentication does not work with the modified terminal settings Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay/arecord: Added hardware pause support (press SPACE or Enter)Jaroslav Kysela2010-07-151-5/+73
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay -- update the man fileJohn Sauter2010-01-101-7/+84
| | | | | | | | Bring the man file up to date, documenting the signals and all the options, including those added for audio surveilance. Signed-off-by: John Sauter <John_Sauter@systemeyescomputerstore.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay -- add features for audio surveilanceJohn Sauter2010-01-101-6/+181
| | | | | | | | | Add signal SIGUSR1 to turn over the output file, --max-file-time to cause the output file to turn over automatically, and --use-strftime to create output files based on the current time. Signed-off-by: John Sauter <John_Sauter@systemeyescomputerstore.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay - add option --process-id-fileJohn Sauter2010-01-101-64/+100
| | | | | | | | Write the process ID to a file so other programs can signal aplay. When aplay exits, delete the file. Signed-off-by: John Sauter <John_Sauter@systemeyescomputerstore.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* aplay: Dump PCM state on xrun when verbose mode is activeJaroslav Kysela2010-01-081-0/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* arecord: fix wrong chunk_size initialization when verbose and mmap flags are setJaroslav Kysela2009-11-091-2/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>