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>
alsaloop allows create a PCM loopback between a PCM capture device
and a PCM playback device.
alsaloop supports multiple soundcards, adaptive clock synchronization,
adaptive rate resampling using the samplerate library (if available in
the system). Also, mixer controls can be redirected from one card to
another (for example Master and PCM).
Signed-off-by: Jaroslav Kysela <perex@perex.cz>