add a new "-B buffersize" flag to both audioplay and audiorecord.
suggested by jmcneill@. sort audioplay manual some.
This commit is contained in:
parent
393a0deb05
commit
ebcfca8be3
@ -1,6 +1,6 @@
|
||||
.\" $NetBSD: audioplay.1,v 1.21 2008/05/29 14:51:27 mrg Exp $
|
||||
.\" $NetBSD: audioplay.1,v 1.22 2010/12/29 13:09:03 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1998-2002 Matthew R. Green
|
||||
.\" Copyright (c) 1998, 1999, 2002, 2010 Matthew R. Green
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -24,7 +24,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 13, 2002
|
||||
.Dd December 30, 2010
|
||||
.Dt AUDIOPLAY 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -32,11 +32,12 @@
|
||||
.Nd play audio files
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl iqVh
|
||||
.Op Fl v Ar volume
|
||||
.Op Fl hiqV
|
||||
.Op Fl b Ar balance
|
||||
.Op Fl p Ar port
|
||||
.Op Fl B Ar buffersize
|
||||
.Op Fl d Ar device
|
||||
.Op Fl p Ar port
|
||||
.Op Fl v Ar volume
|
||||
.Oo
|
||||
.Fl f
|
||||
.Op Fl c Ar channels
|
||||
@ -58,22 +59,23 @@ understood by the underlying driver.
|
||||
.Sh OPTIONS
|
||||
The following options are available:
|
||||
.Bl -tag -width 123456
|
||||
.It Fl i
|
||||
If the audio device cannot be opened, exit now rather than wait for it.
|
||||
.It Fl q
|
||||
Be quiet.
|
||||
.It Fl V
|
||||
Be verbose.
|
||||
.It Fl h
|
||||
Print a help message.
|
||||
.It Fl v
|
||||
Set the volume (gain) to
|
||||
.Ar volume .
|
||||
This value must be between 0 and 255.
|
||||
.It Fl b
|
||||
Set the balance to
|
||||
.Ar balance .
|
||||
This value must be between 0 and 63.
|
||||
.It Fl B
|
||||
Set the write block size to
|
||||
.Ar buffersize .
|
||||
The default value is the play.buffer_size of the audio device.
|
||||
.It Fl d
|
||||
Set the audio device to be
|
||||
.Ar device .
|
||||
The default is
|
||||
.Pa /dev/sound .
|
||||
.It Fl h
|
||||
Print a help message.
|
||||
.It Fl i
|
||||
If the audio device cannot be opened, exit now rather than wait for it.
|
||||
.It Fl p
|
||||
Set the output port to
|
||||
.Ar port .
|
||||
@ -84,11 +86,14 @@ are
|
||||
.Dq headphone
|
||||
and
|
||||
.Dq line .
|
||||
.It Fl d
|
||||
Set the audio device to be
|
||||
.Ar device .
|
||||
The default is
|
||||
.Pa /dev/sound .
|
||||
.It Fl q
|
||||
Be quiet.
|
||||
.It Fl v
|
||||
Set the volume (gain) to
|
||||
.Ar volume .
|
||||
This value must be between 0 and 255.
|
||||
.It Fl V
|
||||
Be verbose.
|
||||
.It Fl f
|
||||
Force playing, even if the format is unknown.
|
||||
The
|
||||
@ -97,11 +102,11 @@ flag can be used in addition with the following flags to
|
||||
change the number of channels, encoding, precision and
|
||||
sample rate.
|
||||
.It Fl c
|
||||
when combined with the
|
||||
When combined with the
|
||||
.Fl f
|
||||
option, sets the number of channels to its argument.
|
||||
.It Fl e
|
||||
when combined with the
|
||||
When combined with the
|
||||
.Fl f
|
||||
option, sets the encoding to its argument.
|
||||
Possible values are
|
||||
@ -127,12 +132,12 @@ Possible values are
|
||||
and
|
||||
.Cm mpeg_l2_system .
|
||||
.It Fl P
|
||||
when combined with the
|
||||
When combined with the
|
||||
.Fl f
|
||||
option, sets the precision to its argument.
|
||||
This value must be either 4, 8, 16, 24 or 32.
|
||||
.It Fl s
|
||||
when combined with the
|
||||
When combined with the
|
||||
.Fl f
|
||||
option, sets the sample rate to its argument.
|
||||
This value must be a valid value for the audio device or an error will
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: play.c,v 1.50 2009/04/11 10:43:09 lukem Exp $ */
|
||||
/* $NetBSD: play.c,v 1.51 2010/12/29 13:09:03 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Matthew R. Green
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2010 Matthew R. Green
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -28,7 +28,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: play.c,v 1.50 2009/04/11 10:43:09 lukem Exp $");
|
||||
__RCSID("$NetBSD: play.c,v 1.51 2010/12/29 13:09:03 mrg Exp $");
|
||||
#endif
|
||||
|
||||
|
||||
@ -87,13 +87,17 @@ main(argc, argv)
|
||||
const char *defdevice = _PATH_SOUND;
|
||||
const char *device = NULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "b:C:c:d:e:fhip:P:qs:Vv:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "b:B:C:c:d:e:fhip:P:qs:Vv:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
decode_int(optarg, &balance);
|
||||
if (balance < 0 || balance > 64)
|
||||
errx(1, "balance must be between 0 and 63");
|
||||
break;
|
||||
case 'B':
|
||||
bufsize = strsuftoll("write buffer size", optarg,
|
||||
1, UINT_MAX);
|
||||
break;
|
||||
case 'c':
|
||||
decode_int(optarg, &channels);
|
||||
if (channels < 0)
|
||||
@ -180,7 +184,8 @@ main(argc, argv)
|
||||
|
||||
if (ioctl(audiofd, AUDIO_GETINFO, &info) < 0)
|
||||
err(1, "failed to get audio info");
|
||||
bufsize = info.play.buffer_size;
|
||||
if (bufsize == 0)
|
||||
bufsize = info.play.buffer_size;
|
||||
if (bufsize < 32 * 1024)
|
||||
bufsize = 32 * 1024;
|
||||
|
||||
@ -258,11 +263,9 @@ play(file)
|
||||
|
||||
/*
|
||||
* give the VM system a bit of a hint about the type
|
||||
* of accesses we will make.
|
||||
* of accesses we will make. we don't care about errors.
|
||||
*/
|
||||
if (madvise(addr, sizet_filesize, MADV_SEQUENTIAL) < 0 &&
|
||||
!qflag)
|
||||
warn("madvise failed, ignoring");
|
||||
madvise(addr, sizet_filesize, MADV_SEQUENTIAL);
|
||||
|
||||
/*
|
||||
* get the header length and set up the audio device
|
||||
@ -470,8 +473,8 @@ usage()
|
||||
|
||||
fprintf(stderr, "Usage: %s [-hiqV] [options] files\n", getprogname());
|
||||
fprintf(stderr, "Options:\n\t"
|
||||
"-C audio control device\n\t"
|
||||
"-b balance (0-63)\n\t"
|
||||
"-B buffer size\n\t"
|
||||
"-d audio device\n\t"
|
||||
"-f force settings\n\t"
|
||||
"\t-c forced channels\n\t"
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" $NetBSD: audiorecord.1,v 1.38 2009/07/02 04:45:27 mrg Exp $
|
||||
.\" $NetBSD: audiorecord.1,v 1.39 2010/12/29 13:09:03 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1998-1999 Matthew R. Green
|
||||
.\" Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -24,7 +24,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 13, 2002
|
||||
.Dd December 30, 2010
|
||||
.Dt AUDIORECORD 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -34,6 +34,7 @@
|
||||
.Nm
|
||||
.Op Fl afhqV
|
||||
.Op Fl b Ar balance
|
||||
.Op Fl B Ar buffersize
|
||||
.Op Fl c Ar channels
|
||||
.Op Fl d Ar device
|
||||
.Op Fl e Ar encoding
|
||||
@ -73,6 +74,10 @@ Append to the specified file, rather than overwriting.
|
||||
Set the balance to
|
||||
.Ar balance .
|
||||
This value must be between 0 and 63.
|
||||
.It Fl B Ar buffersize
|
||||
Set the audio device read buffer size to
|
||||
.Ar buffersize .
|
||||
The default value is the record.buffer_size of the audio device.
|
||||
.It Fl c Ar channels
|
||||
Set number of channels to
|
||||
.Ar channels .
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: record.c,v 1.47 2009/04/11 10:43:10 lukem Exp $ */
|
||||
/* $NetBSD: record.c,v 1.48 2010/12/29 13:09:03 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2002 Matthew R. Green
|
||||
* Copyright (c) 1999, 2002, 2003, 2005, 2010 Matthew R. Green
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -32,11 +32,11 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: record.c,v 1.47 2009/04/11 10:43:10 lukem Exp $");
|
||||
__RCSID("$NetBSD: record.c,v 1.48 2010/12/29 13:09:03 mrg Exp $");
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/audioio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
@ -93,11 +93,11 @@ main(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
u_char *buffer;
|
||||
size_t len, bufsize;
|
||||
size_t len, bufsize = 0;
|
||||
int ch, no_time_limit = 1;
|
||||
const char *defdevice = _PATH_SOUND;
|
||||
|
||||
while ((ch = getopt(argc, argv, "ab:C:F:c:d:e:fhi:m:P:p:qt:s:Vv:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "ab:B:C:F:c:d:e:fhi:m:P:p:qt:s:Vv:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
aflag++;
|
||||
@ -107,6 +107,10 @@ main(argc, argv)
|
||||
if (balance < 0 || balance > 63)
|
||||
errx(1, "balance must be between 0 and 63");
|
||||
break;
|
||||
case 'B':
|
||||
bufsize = strsuftoll("read buffer size", optarg,
|
||||
1, UINT_MAX);
|
||||
break;
|
||||
case 'C':
|
||||
/* Ignore, compatibility */
|
||||
break;
|
||||
@ -199,10 +203,6 @@ main(argc, argv)
|
||||
if (encoding == -1)
|
||||
errx(1, "unknown encoding, bailing...");
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
encoding = AUDIO_ENCODING_ULAW;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* open the output file
|
||||
@ -246,7 +246,8 @@ main(argc, argv)
|
||||
*/
|
||||
if (ioctl(audiofd, AUDIO_GETINFO, &oinfo) < 0)
|
||||
err(1, "failed to get audio info");
|
||||
bufsize = oinfo.record.buffer_size;
|
||||
if (bufsize == 0)
|
||||
bufsize = oinfo.record.buffer_size;
|
||||
if (bufsize < 32 * 1024)
|
||||
bufsize = 32 * 1024;
|
||||
omonitor_gain = oinfo.monitor_gain;
|
||||
@ -778,6 +779,7 @@ usage()
|
||||
getprogname());
|
||||
fprintf(stderr, "Options:\n\t"
|
||||
"-b balance (0-63)\n\t"
|
||||
"-B buffer size\n\t"
|
||||
"-c channels\n\t"
|
||||
"-d audio device\n\t"
|
||||
"-e encoding\n\t"
|
||||
|
Loading…
Reference in New Issue
Block a user