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>
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: 3d44e2bc15 ('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>
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: 4cb74aed89 ('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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
There are many redundant open codes in speaker-test for performing the
similar things, and especially the tone generator codes are ugly.
Let's clean up a bit. This patch combines all open-codes into a
single common helper with the callback for generating the tone.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hello maintainers,
I would like to suggest you a patch which fixes a typo in the alsa-utils
alsaloop.
Best Regards,
Kirill Marinushkin
Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This solves the chicken and egg problem on fresh installations whereby
the alsa state file does not yet exist, and alsa-restore unit attempted
to launch without first having a state file.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There are number of devices that support up to 384 kHz sampling rate and
some devices up to 768 kHz sampling rate. This patch increases sanity
check limit to 768k in order to support testing of such hardware.
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Ensures soundcard is ready before restoring state.
sound.target added to systemd in v18:
https://cgit.freedesktop.org/systemd/systemd/commit/?id=88dfa2938af
Simplify dependencies:
- After=alsa-state.service is not needed because both units test for
@daemonswitch@ with opposite outcomes.
- After=sysinit.target is automatically added by systemd.
First proposed by Tom Yan.
Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix a variable uninitialized issue, adding the initialized assignment to fix it.
Signed-off-by: Zhang Keqiao <keqiaox.k.zhang@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This fixes a bug when trying to play files with size
smaller than maximum supported header size.
Lets have a look at the following example:
$ aplay -s 2 sample.raw
-> playback_go(fd = 10, loaded = 26, count = 2, name="sample.raw")
--> l = loaded = 26
--> c = count - written = 2
--> c -= l = 2 - 26 = -24
---> r = safe_read(fd, audiobuf + 26, -24)
---> r = -1, EXIT_FAILURE
In this case we have already 'loaded' from the input file more
bytes that we need to send to pcm device. So, we need to adjust
the number of bytes loaded and avoid reading a negative number
of bytes.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
-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>
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>
verbose, compile and output options all have a parameter.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently the binary output file is left when parsing fails. This confuses
GNU Make if the parsing fails and causes the compilation to partially
complete.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>