pcaudiolib: update to 1.2.
This commit is contained in:
parent
302febbf6b
commit
1c5b5ce14c
3 changed files with 3 additions and 97 deletions
|
@ -1,19 +0,0 @@
|
||||||
commit d6a6b00aa4334b461c1a09c27b6c681eaac8da8a
|
|
||||||
Author: Martin Schreiber <mse00000@gmail.com>
|
|
||||||
Date: Sat Mar 10 06:55:58 2018 +0100
|
|
||||||
|
|
||||||
* Alsa: fixed sample_size calculation, multiply with channel count.
|
|
||||||
|
|
||||||
diff --git src/alsa.c src/alsa.c
|
|
||||||
index 34e39be..6af1941 100644
|
|
||||||
--- a/src/alsa.c
|
|
||||||
+++ b/src/alsa.c
|
|
||||||
@@ -53,7 +53,7 @@ alsa_object_open(struct audio_object *object,
|
|
||||||
return -EEXIST;
|
|
||||||
|
|
||||||
snd_pcm_format_t pcm_format;
|
|
||||||
-#define FORMAT(srcfmt, dstfmt, size) case srcfmt: pcm_format = dstfmt; self->sample_size = size; break;
|
|
||||||
+#define FORMAT(srcfmt, dstfmt, size) case srcfmt: pcm_format = dstfmt; self->sample_size = size*channels; break;
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
FORMAT(AUDIO_OBJECT_FORMAT_ALAW, SND_PCM_FORMAT_A_LAW, 1)
|
|
|
@ -1,76 +0,0 @@
|
||||||
commit a41d46e816d2cbcd93564c42b65a87af547bcb2d
|
|
||||||
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
||||||
Date: Sun Oct 11 17:34:57 2020 +0200
|
|
||||||
|
|
||||||
Fix cancellation snappiness
|
|
||||||
|
|
||||||
Screen reader users report getting late cancellation, or even mixtures
|
|
||||||
of speech. This is because the default buffering parameters of alsa or
|
|
||||||
pulseaudio are relatively large.
|
|
||||||
|
|
||||||
This change sets alsa and pulseaudio buffer sizes to 10ms worth of audio,
|
|
||||||
which is the human snappiness perception limit.
|
|
||||||
|
|
||||||
diff --git src/alsa.c src/alsa.c
|
|
||||||
index 64d5a90..c856788 100644
|
|
||||||
--- a/src/alsa.c
|
|
||||||
+++ b/src/alsa.c
|
|
||||||
@@ -99,6 +99,7 @@ alsa_object_open(struct audio_object *object,
|
|
||||||
|
|
||||||
snd_pcm_hw_params_t *params = NULL;
|
|
||||||
snd_pcm_hw_params_malloc(¶ms);
|
|
||||||
+ snd_pcm_uframes_t bufsize = (rate * channels * LATENCY) / 1000;
|
|
||||||
|
|
||||||
int err = 0;
|
|
||||||
if ((err = snd_pcm_open(&self->handle, self->device ? self->device : "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0)
|
|
||||||
@@ -113,6 +114,8 @@ alsa_object_open(struct audio_object *object,
|
|
||||||
goto error;
|
|
||||||
if ((err = snd_pcm_hw_params_set_channels(self->handle, params, channels)) < 0)
|
|
||||||
goto error;
|
|
||||||
+ if ((err = snd_pcm_hw_params_set_buffer_size_near(self->handle, params, &bufsize)) < 0)
|
|
||||||
+ goto error;
|
|
||||||
if ((err = snd_pcm_hw_params(self->handle, params)) < 0)
|
|
||||||
goto error;
|
|
||||||
if ((err = snd_pcm_prepare(self->handle)) < 0)
|
|
||||||
diff --git src/audio_priv.h src/audio_priv.h
|
|
||||||
index 9526138..669a037 100644
|
|
||||||
--- a/src/audio_priv.h
|
|
||||||
+++ b/src/audio_priv.h
|
|
||||||
@@ -52,6 +52,10 @@ struct audio_object
|
|
||||||
int error);
|
|
||||||
};
|
|
||||||
|
|
||||||
+/* We try to aim for 10ms cancelation latency, which will be perceived as
|
|
||||||
+ * "snappy" by users */
|
|
||||||
+#define LATENCY 10
|
|
||||||
+
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
diff --git src/pulseaudio.c src/pulseaudio.c
|
|
||||||
index d23366d..2f80c62 100644
|
|
||||||
--- a/src/pulseaudio.c
|
|
||||||
+++ b/src/pulseaudio.c
|
|
||||||
@@ -74,6 +74,13 @@ pulseaudio_object_open(struct audio_object *object,
|
|
||||||
}
|
|
||||||
|
|
||||||
int error = 0;
|
|
||||||
+ pa_buffer_attr battr;
|
|
||||||
+
|
|
||||||
+ battr.fragsize = (uint32_t) -1;
|
|
||||||
+ battr.maxlength = (uint32_t) -1;
|
|
||||||
+ battr.minreq = (uint32_t) -1;
|
|
||||||
+ battr.prebuf = (uint32_t) -1;
|
|
||||||
+ battr.tlength = pa_bytes_per_second(&self->ss) * LATENCY / 1000;
|
|
||||||
self->s = pa_simple_new(NULL,
|
|
||||||
self->application_name,
|
|
||||||
PA_STREAM_PLAYBACK,
|
|
||||||
@@ -81,7 +88,7 @@ pulseaudio_object_open(struct audio_object *object,
|
|
||||||
self->description,
|
|
||||||
&self->ss,
|
|
||||||
NULL,
|
|
||||||
- NULL,
|
|
||||||
+ &battr,
|
|
||||||
&error);
|
|
||||||
return error;
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'pcaudiolib'
|
# Template file for 'pcaudiolib'
|
||||||
pkgname=pcaudiolib
|
pkgname=pcaudiolib
|
||||||
version=1.1
|
version=1.2
|
||||||
revision=1
|
revision=1
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
hostmakedepends="automake libtool which pkg-config"
|
hostmakedepends="automake libtool which pkg-config"
|
||||||
|
@ -9,8 +9,9 @@ short_desc="Portable C Audio Library"
|
||||||
maintainer="Joey <joey@imap.cc>"
|
maintainer="Joey <joey@imap.cc>"
|
||||||
license="GPL-3.0-or-later"
|
license="GPL-3.0-or-later"
|
||||||
homepage="https://github.com/espeak-ng/pcaudiolib"
|
homepage="https://github.com/espeak-ng/pcaudiolib"
|
||||||
|
changelog="https://raw.githubusercontent.com/espeak-ng/pcaudiolib/master/ChangeLog.md"
|
||||||
distfiles="https://github.com/espeak-ng/pcaudiolib/archive/${version}.tar.gz"
|
distfiles="https://github.com/espeak-ng/pcaudiolib/archive/${version}.tar.gz"
|
||||||
checksum=699a5a347b1e12dc5b122e192e19f4db01621826bf41b9ebefb1cbc63ae2180b
|
checksum=44b9d509b9eac40a0c61585f756d76a7b555f732e8b8ae4a501c8819c59c6619
|
||||||
|
|
||||||
pre_configure() {
|
pre_configure() {
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue