use milliseconds for the buffer size, in the sndio backend

ok stsp, dcoppa
This commit is contained in:
ratchov 2012-05-10 22:42:23 +00:00
parent 301f0c2a42
commit 9970c33a42
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.44 2012/05/09 20:53:35 ratchov Exp $
# $OpenBSD: Makefile,v 1.45 2012/05/10 22:42:23 ratchov Exp $
SHARED_ONLY = Yes
@ -6,7 +6,7 @@ COMMENT = input and output plugins for audacious
V = 3.2
DISTNAME = audacious-plugins-$V
REVISION = 3
REVISION = 4
CATEGORIES = audio multimedia

View File

@ -32,6 +32,11 @@
#include "config.h"
/*
* minimum output buffer size in milliseconds
*/
#define BUFFER_SIZE_MIN 250
bool_t sndio_init(void);
void sndio_cleanup(void);
void sndio_about(void);
@ -215,6 +220,7 @@ sndio_open(int fmt, int rate, int nch)
int i;
struct sio_par askpar;
GtkWidget *dialog = NULL;
unsigned buffer_size;
hdl = sio_open(strlen(audiodev) > 0 ? audiodev : NULL, SIO_PLAY, 1);
if (!hdl) {
@ -238,7 +244,10 @@ sndio_open(int fmt, int rate, int nch)
askpar.le = fmt_to_par[i].le;
askpar.pchan = nch;
askpar.rate = rate;
askpar.appbufsz = aud_get_int(NULL, "output_buffer_size");
buffer_size = aud_get_int(NULL, "output_buffer_size");
if (buffer_size < BUFFER_SIZE_MIN)
buffer_size = BUFFER_SIZE_MIN;
askpar.appbufsz = buffer_size * rate / 1000;
if (!sio_setpar(hdl, &askpar) || !sio_getpar(hdl, &par)) {
g_warning("failed to set parameters");
sndio_close();