config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).
Related: https://github.com/alsa-project/alsa-utils/pull/223
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib
- EPIPE and ESTRPIPE are different usage, but currently
EPIPE is used when ESTRPIPE is not defined.
To fix this problem, assign ESPIPE instead.
Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Linux 5.15 will introduce a new control element "Playback Pitch 1000000"
(commit 6fec018 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for
sync playback") which provides feedback mechanism for playback direction
of USB Audio Gadget. The control operates in the same way as the
existing control element "Capture Pitch 1000000".
This patch adds support for this feature.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Renaming capt_pitch to ctl_pitch to respect the naming style of
snd_ctl_elem_value_t fields in loopback_handle. Also making the variable
name suitable for planned support of playback pitch.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The value 'auto' was not checked which resulted in using
SYNC_TYPE_NONE instead of SYNC_TYPE_AUTO.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
If snd-aloop device is on playback side, the required sync mode is
PLAYSHIFT. That means Loopback ctl elem "PCM Rate Shift 100000" of the
corresponding capture side of the Loopback pipe must be controlled (by
a reciprocal).
ASCII name of the playback rate shift ctl elem is specified with newly
added option -x/--prateshift, e.g.:
-P hw:Loopback,0 -S playshift \
-x iface=PCM,name='PCM Rate Shift 100000',device=1
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
When debugging what ctl elem was found and opened (if any) a debug log is
helpful.
Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In Linux 5.14, a new feedback mechanism for USB Audio
Gadget is introduced (commit e89bb428), along with a
new control element "Capture Pitch 1000000". This patch
adds support for this feature. Note that this property
seems to be the reverse of PCM Rate Shift, so we have
to take reciprocal of pitch.
Signed-off-by: Yunhao Tian <t123yh@outlook.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The silence frames generation in xrun_sync() seems to be currently
a bit off as snd_pcm_format_set_silence() uses a wrong buffer address
and size for zero-ing out the data. Consequently instead of clearing
out the last frame(s), snd_pcm_format_set_silence() ends up silencing
samples somewhere else in the buffer. This is partilarly more obvious
for higher frame sizes (e.g. more than 2 channels).
This patch fixes this issue by correcting the parameters passed to
snd_pcm_format_set_silence().
BugLink: https://github.com/alsa-project/alsa-utils/pull/58
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
When doing loopback between two audio card with
same sampling frequency, I noticed slow increase
of pitch_diff.
When I changed order of get_queued_playback_samples()
vs get_queued_capture_samples(), I noticed same drift
of pitch_diff but if was decreasing this time.
This seems to be caused by non-atomic consecutive
snd_pcm_delay() invocation for playback then for
capture. snd_pcm_delay() measures delay between
read/write call and actual ADC/DAC operation.
So while we get this value for playback path in
get_queued_playback_samples(), next call to
get_queued_capture_samples() will happen a little
bit later so snd_pcm_delay() may return incorrect
value.
Be interleaving get_queued_{playback,capture}_samples()
order, we divide this small error between playback
and capture paths. I do not see any issues anymore
with one-way drift of pitch_diff.
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
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>
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX, as _NP
(non-portable) suggests.
exposing such a symbol in musl libc would lock in the ABI for all
times and makes it impossible to do future changes to the under-
lying struct without hideous symbol versioning hacks.
use the portable way instead: pthread_once was designed for such
cases.
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Tested-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
in POSIX, there is no <sys/signal.h>.
it's merely a legacy alias used by glibc, and the header does nothing
else than including <signal.h>.
so let's do the right thing and use the right name, which works everywhere.
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
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>
When alsaloop is built with libsamplerate, it quits immediately with
No libsamplerate suppor
message. It's because the check of -A option and it's set as default
non-zero value.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The previous code does not work as expected for some period_size
configurations. We do not rely on the period size value, so do not
correlate the avail_min parameter with this value.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- added -W/--wake option to reduce poll time
- another try to fix the avail_min parameter for playback
- fixed initial silence fill
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In some cases it might be usefull to specify another CTL device names.
Add -X/--pctl and -Y/--cctl options.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- added workaround for alsa-lib (pthread configuration parsing issue) -
the workaround must be activated manually using ('--workaround serialopen')
- fixed avail_min initialization (caused high CPU usage or xruns)
- fixed shared buffer initialization (both capture and playback buffers
must have equal number of samples in this config)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>