summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-07-25 10:52:20 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-07-25 10:52:20 +0000
commitd30aff0c8eee838d92d6ae854abd3a550e63f3bc (patch)
tree2c5987554d0158979e4b0904292bf691fc8e7628 /usr.bin/aucat
parent79aea50c7469da79466afbe39dd054c7f3fde0ae (diff)
fix comments, remove no longer needed declaration, reorder includes
from Thomas Pfaff
Diffstat (limited to 'usr.bin/aucat')
-rw-r--r--usr.bin/aucat/abuf.c29
-rw-r--r--usr.bin/aucat/amsg.h10
-rw-r--r--usr.bin/aucat/aparams.c20
-rw-r--r--usr.bin/aucat/aparams.h10
-rw-r--r--usr.bin/aucat/aproc.c26
-rw-r--r--usr.bin/aucat/aproc.h10
-rw-r--r--usr.bin/aucat/aucat.c28
-rw-r--r--usr.bin/aucat/conf.h8
-rw-r--r--usr.bin/aucat/dev.c93
-rw-r--r--usr.bin/aucat/dev.h3
-rw-r--r--usr.bin/aucat/file.c12
-rw-r--r--usr.bin/aucat/file.h4
-rw-r--r--usr.bin/aucat/headers.c11
-rw-r--r--usr.bin/aucat/legacy.c38
-rw-r--r--usr.bin/aucat/listen.c8
-rw-r--r--usr.bin/aucat/listen.h4
-rw-r--r--usr.bin/aucat/pipe.c17
-rw-r--r--usr.bin/aucat/pipe.h6
-rw-r--r--usr.bin/aucat/safile.c16
-rw-r--r--usr.bin/aucat/safile.h7
-rw-r--r--usr.bin/aucat/sock.c63
-rw-r--r--usr.bin/aucat/sock.h8
-rw-r--r--usr.bin/aucat/wav.c21
-rw-r--r--usr.bin/aucat/wav.h4
24 files changed, 247 insertions, 209 deletions
diff --git a/usr.bin/aucat/abuf.c b/usr.bin/aucat/abuf.c
index 043fe15f3ea..6a9dab383ca 100644
--- a/usr.bin/aucat/abuf.c
+++ b/usr.bin/aucat/abuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: abuf.c,v 1.12 2009/07/19 15:49:48 martynas Exp $ */
+/* $OpenBSD: abuf.c,v 1.13 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -37,10 +37,10 @@
#include <stdlib.h>
#include <string.h>
-#include "conf.h"
+#include "abuf.h"
#include "aparams.h"
#include "aproc.h"
-#include "abuf.h"
+#include "conf.h"
#ifdef DEBUG
void
@@ -113,7 +113,7 @@ abuf_del(struct abuf *buf)
}
/*
- * Clear buffer contents
+ * Clear buffer contents.
*/
void
abuf_clear(struct abuf *buf)
@@ -154,7 +154,7 @@ abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
}
/*
- * Discard the block at the start postion
+ * Discard the block at the start postion.
*/
void
abuf_rdiscard(struct abuf *buf, unsigned count)
@@ -173,7 +173,7 @@ abuf_rdiscard(struct abuf *buf, unsigned count)
}
/*
- * Commit the data written at the end postion
+ * Commit the data written at the end postion.
*/
void
abuf_wcommit(struct abuf *buf, unsigned count)
@@ -217,8 +217,8 @@ abuf_wgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs)
}
/*
- * flush buffer either by dropping samples or by calling the aproc
- * call-back to consume data. Return 0 if blocked, 1 otherwise
+ * Flush buffer either by dropping samples or by calling the aproc
+ * call-back to consume data. Return 0 if blocked, 1 otherwise.
*/
int
abuf_flush_do(struct abuf *buf)
@@ -248,8 +248,8 @@ abuf_flush_do(struct abuf *buf)
}
/*
- * fill the buffer either by generating silence or by calling the aproc
- * call-back to provide data. Return 0 if blocked, 1 otherwise
+ * Fill the buffer either by generating silence or by calling the aproc
+ * call-back to provide data. Return 0 if blocked, 1 otherwise.
*/
int
abuf_fill_do(struct abuf *buf)
@@ -283,7 +283,7 @@ abuf_fill_do(struct abuf *buf)
/*
* Notify the reader that there will be no more input (producer
- * disappeared) and destroy the buffer
+ * disappeared) and destroy the buffer.
*/
void
abuf_eof_do(struct abuf *buf)
@@ -305,7 +305,7 @@ abuf_eof_do(struct abuf *buf)
/*
* Notify the writer that the buffer has no more consumer,
- * and destroy the buffer
+ * and destroy the buffer.
*/
void
abuf_hup_do(struct abuf *buf)
@@ -359,7 +359,7 @@ abuf_flush(struct abuf *buf)
* call-back of the reader.
*
* Return 1 if the buffer was filled, and 0 if eof condition occured. The
- * reader must detach the buffer on EOF condition, since it's aproc->eof()
+ * reader must detach the buffer on EOF condition, since its aproc->eof()
* call-back will never be called.
*/
int
@@ -384,7 +384,7 @@ abuf_fill(struct abuf *buf)
/*
* Run a read/write loop on the buffer until either the reader or the
- * writer blocks, or until the buffer reaches eofs. We can not get hup hear,
+ * writer blocks, or until the buffer reaches eofs. We can not get hup here,
* since hup() is only called from terminal nodes, from the main loop.
*
* NOTE: The buffer may disappear (ie. be free()ed) if eof is reached, so
@@ -512,7 +512,6 @@ abuf_opos(struct abuf *buf, int delta)
{
struct aproc *p = buf->wproc;
-
if (p && p->ops->opos) {
buf->inuse++;
p->ops->opos(p, buf, delta);
diff --git a/usr.bin/aucat/amsg.h b/usr.bin/aucat/amsg.h
index 44950c32ee1..f0563e9019a 100644
--- a/usr.bin/aucat/amsg.h
+++ b/usr.bin/aucat/amsg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amsg.h,v 1.8 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: amsg.h,v 1.9 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -96,14 +96,14 @@ struct amsg {
};
/*
- * initialize an amsg structure: fill all fields with 0xff, so the read
- * can test which fields were set
+ * Initialize an amsg structure: fill all fields with 0xff, so the read
+ * can test which fields were set.
*/
#define AMSG_INIT(m) do { memset((m), 0xff, sizeof(struct amsg)); } while (0)
/*
- * since the structure is memset to 0xff, the MSB can be used to check
- * if any filed was set
+ * Since the structure is memset to 0xff, the MSB can be used to check
+ * if any field was set.
*/
#define AMSG_ISSET(x) (((x) & (1 << (8 * sizeof(x) - 1))) == 0)
diff --git a/usr.bin/aucat/aparams.c b/usr.bin/aucat/aparams.c
index 2e03c461d4e..1d1d31bf381 100644
--- a/usr.bin/aucat/aparams.c
+++ b/usr.bin/aucat/aparams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aparams.c,v 1.6 2009/01/23 17:38:15 ratchov Exp $ */
+/* $OpenBSD: aparams.c,v 1.7 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -43,7 +43,7 @@ int aparams_ctltovol[128] = {
/*
* Generate a string corresponding to the encoding in par,
- * return the length of the resulting string
+ * return the length of the resulting string.
*/
int
aparams_enctostr(struct aparams *par, char *ostr)
@@ -73,8 +73,8 @@ aparams_enctostr(struct aparams *par, char *ostr)
/*
* Parse an encoding string, examples: s8, u8, s16, s16le, s24be ...
- * set *istr to the char following the encoding. Retrun the number
- * of bytes consumed
+ * set *istr to the char following the encoding. Return the number
+ * of bytes consumed.
*/
int
aparams_strtoenc(struct aparams *par, char *istr)
@@ -115,7 +115,7 @@ aparams_strtoenc(struct aparams *par, char *istr)
le = NATIVE_LE;
/*
- * get (optionnal) endianness
+ * get (optional) endianness
*/
if (p[0] == 'l' && p[1] == 'e') {
le = 1;
@@ -129,7 +129,7 @@ aparams_strtoenc(struct aparams *par, char *istr)
return 0;
/*
- * get (optionnal) number of bytes
+ * get (optional) number of bytes
*/
if (*p >= '0' && *p <= '9') {
bps = *p - '0';
@@ -139,7 +139,7 @@ aparams_strtoenc(struct aparams *par, char *istr)
p++;
/*
- * get (optionnal) alignement
+ * get (optional) alignement
*/
if (p[0] == 'm' && p[1] == 's' && p[2] == 'b') {
msb = 1;
@@ -234,7 +234,7 @@ aparams_eq(struct aparams *par1, struct aparams *par2)
}
/*
- * Retrurn true if first channel range includes second range
+ * Return true if first channel range includes second range.
*/
int
aparams_subset(struct aparams *subset, struct aparams *set)
@@ -243,7 +243,7 @@ aparams_subset(struct aparams *subset, struct aparams *set)
}
/*
- * grow channels range and sample rate of ``set'' in order ``subset'' to
+ * Grow channels range and sample rate of ``set'' in order ``subset'' to
* become an actual subset of it.
*/
void
@@ -258,7 +258,7 @@ aparams_grow(struct aparams *set, struct aparams *subset)
}
/*
- * Return true if rates are the same
+ * Return true if rates are the same.
*/
int
aparams_eqrate(struct aparams *p1, struct aparams *p2)
diff --git a/usr.bin/aucat/aparams.h b/usr.bin/aucat/aparams.h
index d89aaaf2637..ce7db4c5521 100644
--- a/usr.bin/aucat/aparams.h
+++ b/usr.bin/aucat/aparams.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aparams.h,v 1.5 2008/11/20 10:10:01 ratchov Exp $ */
+/* $OpenBSD: aparams.h,v 1.6 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -26,8 +26,8 @@
#define BITS_MAX 32 /* max bits per sample */
/*
- * maximum size of the encording string (the longest possible
- * encoding is ``s24le3msb'')
+ * Maximum size of the encording string (the longest possible
+ * encoding is ``s24le3msb'').
*/
#define ENCMAX 10
@@ -40,12 +40,12 @@
#endif
/*
- * default bytes per sample for the given bits per sample
+ * Default bytes per sample for the given bits per sample.
*/
#define APARAMS_BPS(bits) (((bits) <= 8) ? 1 : (((bits) <= 16) ? 2 : 4))
/*
- * encoding specification
+ * Encoding specification.
*/
struct aparams {
unsigned bps; /* bytes per sample */
diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c
index 16809ca5cb1..364338b3b29 100644
--- a/usr.bin/aucat/aproc.c
+++ b/usr.bin/aucat/aproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.c,v 1.32 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: aproc.c,v 1.33 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -49,10 +49,10 @@
#include <stdlib.h>
#include <string.h>
-#include "conf.h"
-#include "aparams.h"
#include "abuf.h"
+#include "aparams.h"
#include "aproc.h"
+#include "conf.h"
#include "file.h"
struct aproc *
@@ -366,7 +366,7 @@ wpipe_new(struct file *f)
/*
* Append the given amount of silence (or less if there's not enough
- * space), and crank mixitodo accordingly
+ * space), and crank mixitodo accordingly.
*/
void
mix_bzero(struct abuf *obuf, unsigned zcount)
@@ -398,7 +398,7 @@ mix_badd(struct abuf *ibuf, struct abuf *obuf)
obuf->mixitodo, ibuf->mixodone);
/*
- * calculate the maximum we can read
+ * Calculate the maximum we can read.
*/
idata = (short *)abuf_rgetblk(ibuf, &icount, 0);
icount /= ibuf->bpf;
@@ -406,14 +406,14 @@ mix_badd(struct abuf *ibuf, struct abuf *obuf)
return;
/*
- * zero-fill if necessary
+ * Zero-fill if necessary.
*/
zcount = ibuf->mixodone + icount * obuf->bpf;
if (zcount > obuf->mixitodo)
mix_bzero(obuf, zcount - obuf->mixitodo);
/*
- * calculate the maximum we can write
+ * Calculate the maximum we can write.
*/
odata = (short *)abuf_wgetblk(obuf, &ocount, ibuf->mixodone);
ocount /= obuf->bpf;
@@ -566,7 +566,7 @@ mix_eof(struct aproc *p, struct abuf *ibuf)
if (!aproc_inuse(p)) {
DPRINTF("mix_eof: %s: from input\n", p->name);
/*
- * find a blocked input
+ * Find a blocked input.
*/
odone = obuf->len;
LIST_FOREACH(i, &p->ibuflist, ient) {
@@ -578,7 +578,7 @@ mix_eof(struct aproc *p, struct abuf *ibuf)
odone = i->mixodone;
}
/*
- * no blocked inputs, check if output is blocked
+ * No blocked inputs. Check if output is blocked.
*/
if (LIST_EMPTY(&p->ibuflist) || odone == obuf->mixitodo)
abuf_run(obuf);
@@ -651,7 +651,7 @@ mix_new(char *name, int maxlat)
}
/*
- * Normalize input levels
+ * Normalize input levels.
*/
void
mix_setmaster(struct aproc *p)
@@ -720,7 +720,7 @@ sub_bcopy(struct abuf *ibuf, struct abuf *obuf)
}
/*
- * Handle buffer overruns, return 0 if the stream died
+ * Handle buffer overruns. Return 0 if the stream died.
*/
int
sub_xrun(struct abuf *ibuf, struct abuf *i)
@@ -841,7 +841,7 @@ sub_hup(struct aproc *p, struct abuf *obuf)
if (!aproc_inuse(p)) {
DPRINTF("sub_hup: %s: from input\n", p->name);
/*
- * find a blocked output
+ * Find a blocked output.
*/
idone = ibuf->len;
LIST_FOREACH(i, &p->obuflist, oent) {
@@ -853,7 +853,7 @@ sub_hup(struct aproc *p, struct abuf *obuf)
idone = i->subidone;
}
/*
- * no blocked outputs, check if input is blocked
+ * No blocked outputs. Check if input is blocked.
*/
if (LIST_EMPTY(&p->obuflist) || idone == ibuf->used)
abuf_run(ibuf);
diff --git a/usr.bin/aucat/aproc.h b/usr.bin/aucat/aproc.h
index 41b8ea253f7..43e3619688f 100644
--- a/usr.bin/aucat/aproc.h
+++ b/usr.bin/aucat/aproc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aproc.h,v 1.17 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: aproc.h,v 1.18 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -95,19 +95,19 @@ struct aproc_ops {
/*
* Real-time record position changed (for input buffer),
- * by the given amount of _frames_
+ * by the given amount of _frames_.
*/
void (*ipos)(struct aproc *, struct abuf *, int);
/*
* Real-time play position changed (for output buffer),
- * by the given amount of _frames_
+ * by the given amount of _frames_.
*/
void (*opos)(struct aproc *, struct abuf *, int);
/*
- * destroy the aproc, called just before to free the
- * aproc structure
+ * Destroy the aproc, called just before to free the
+ * aproc structure.
*/
void (*done)(struct aproc *);
};
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index 1cd8fbedb69..eb9cf868f0b 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.61 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.62 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -15,9 +15,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
-#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <err.h>
#include <errno.h>
@@ -30,16 +30,16 @@
#include <unistd.h>
#include <varargs.h>
-#include "conf.h"
+#include "abuf.h"
#include "aparams.h"
#include "aproc.h"
-#include "abuf.h"
-#include "wav.h"
-#include "listen.h"
+#include "conf.h"
#include "dev.h"
+#include "listen.h"
#include "midi.h"
-#include "opt.h"
#include "miofile.h"
+#include "opt.h"
+#include "wav.h"
#define MODE_PLAY 1
#define MODE_REC 2
@@ -53,7 +53,7 @@ volatile int quit_flag = 0;
/*
* SIGINT handler, it raises the quit flag. If the flag is already set,
* that means that the last SIGINT was not handled, because the process
- * is blocked somewhere, so exit
+ * is blocked somewhere, so exit.
*/
void
sigint(int s)
@@ -64,7 +64,7 @@ sigint(int s)
}
/*
- * increase debug level on SIGUSR1
+ * Increase debug level on SIGUSR1.
*/
void
sigusr1(int s)
@@ -74,7 +74,7 @@ sigusr1(int s)
}
/*
- * decrease debug level on SIGUSR2
+ * Decrease debug level on SIGUSR2.
*/
void
sigusr2(int s)
@@ -152,7 +152,7 @@ opt_xrun(void)
return XRUN_SYNC;
if (strcmp("error", optarg) == 0)
return XRUN_ERROR;
- errx(1, "%s: onderrun/overrun policy", optarg);
+ errx(1, "%s: underrun/overrun policy", optarg);
}
int
@@ -521,7 +521,7 @@ aucat_main(int argc, char **argv)
}
/*
- * if there are no sockets paths provided use the default
+ * If there are no sockets paths provided use the default.
*/
if (l_flag && SLIST_EMPTY(&sfiles)) {
farg_add(&sfiles, &dopar, &dipar,
@@ -558,7 +558,7 @@ aucat_main(int argc, char **argv)
/*
* Open the device. Give half of the buffer to the device,
- * the other half is for the socket/files
+ * the other half is for the socket/files.
*/
if (n_flag) {
dev_loopinit(&dipar, &dopar, bufsz);
@@ -602,7 +602,7 @@ aucat_main(int argc, char **argv)
}
/*
- * loop, start audio
+ * Loop, start audio.
*/
for (;;) {
if (quit_flag) {
diff --git a/usr.bin/aucat/conf.h b/usr.bin/aucat/conf.h
index 7d89c965f9b..4730f7780a6 100644
--- a/usr.bin/aucat/conf.h
+++ b/usr.bin/aucat/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.7 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: conf.h,v 1.8 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -18,7 +18,7 @@
#define CONF_H
/*
- * debug trace levels:
+ * Debug trace levels:
*
* 0 - traces are off
* 1 - init, free, stuff that's done only once
@@ -44,7 +44,7 @@ extern int debug_level;
#endif
/*
- * number of blocks in the device play/record buffers. because Sun API
+ * Number of blocks in the device play/record buffers. Because Sun API
* cannot notify apps of the current positions, we have to use all N
* buffers devices blocks plus one extra block, to make write() block,
* so that poll() can return the exact postition.
@@ -52,7 +52,7 @@ extern int debug_level;
#define DEV_NBLK 2
/*
- * number of blocks in the wav-file i/o buffers
+ * Number of blocks in the wav-file i/o buffers.
*/
#define WAV_NBLK 6
diff --git a/usr.bin/aucat/dev.c b/usr.bin/aucat/dev.c
index f091cbefbbb..097838d6e5e 100644
--- a/usr.bin/aucat/dev.c
+++ b/usr.bin/aucat/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.26 2009/02/06 08:26:34 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.27 2009/07/25 10:52:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -14,15 +14,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include "dev.h"
#include "abuf.h"
#include "aproc.h"
-#include "pipe.h"
#include "conf.h"
+#include "dev.h"
+#include "pipe.h"
#include "safile.h"
unsigned dev_bufsz, dev_round, dev_rate;
@@ -30,8 +31,8 @@ struct aparams dev_ipar, dev_opar;
struct aproc *dev_mix, *dev_sub, *dev_rec, *dev_play;
/*
- * same as dev_init(), but create a fake device that records what is
- * played
+ * Same as dev_init(), but create a fake device that records what is
+ * played.
*/
void
dev_loopinit(struct aparams *dipar, struct aparams *dopar, unsigned bufsz)
@@ -68,7 +69,7 @@ dev_loopinit(struct aparams *dipar, struct aparams *dopar, unsigned bufsz)
}
/*
- * same as dev_done(), but destroy a loopback device
+ * Same as dev_done(), but destroy a loopback device.
*/
void
dev_loopdone(void)
@@ -82,7 +83,7 @@ dev_loopdone(void)
dev_mix->refs--;
dev_mix = NULL;
/*
- * generate EOF on all inputs
+ * Generate EOF on all inputs.
*/
restart:
LIST_FOREACH(f, &file_list, entry) {
@@ -102,9 +103,9 @@ dev_roundof(unsigned newrate)
}
/*
- * open the device with the given hardware parameters and create a mixer
+ * Open the device with the given hardware parameters and create a mixer
* and a multiplexer connected to it with all necessary conversions
- * setup
+ * setup.
*/
int
dev_init(char *devpath,
@@ -117,8 +118,8 @@ dev_init(char *devpath,
unsigned nfr, ibufsz, obufsz;
/*
- * ask for 1/4 of the buffer for the kernel ring and
- * limit the block size to 1/4 of the requested buffer
+ * Ask for 1/4 of the buffer for the kernel ring and
+ * limit the block size to 1/4 of the requested buffer.
*/
dev_bufsz = (bufsz + 3) / 4;
dev_round = (bufsz + 3) / 4;
@@ -150,9 +151,9 @@ dev_init(char *devpath,
bufsz = (bufsz > dev_bufsz) ? bufsz - dev_bufsz : 0;
/*
- * use 1/8 of the buffer for the mixer/converters. Since we
+ * Use 1/8 of the buffer for the mixer/converters. Since we
* already consumed 1/4 for the device, bufsz represents the
- * remaining 3/4. So 1/8 is 1/6 of 3/4
+ * remaining 3/4. So 1/8 is 1/6 of 3/4.
*/
nfr = (bufsz + 5) / 6;
nfr += dev_round - 1;
@@ -161,12 +162,12 @@ dev_init(char *devpath,
nfr = dev_round;
/*
- * create record chain
+ * Create record chain.
*/
if (dipar) {
aparams_init(&ipar, dipar->cmin, dipar->cmax, dipar->rate);
/*
- * create the read end
+ * Create the read end.
*/
dev_rec = rpipe_new(f);
dev_rec->refs++;
@@ -175,7 +176,7 @@ dev_init(char *devpath,
ibufsz += nfr;
/*
- * append a converter, if needed
+ * Append a converter, if needed.
*/
if (!aparams_eqenc(dipar, &ipar)) {
conv = dec_new("subin", dipar);
@@ -187,7 +188,7 @@ dev_init(char *devpath,
dev_ipar = ipar;
/*
- * append a "sub" to which clients will connect
+ * Append a "sub" to which clients will connect.
*/
dev_sub = sub_new("sub", nfr);
dev_sub->refs++;
@@ -198,12 +199,12 @@ dev_init(char *devpath,
}
/*
- * create play chain
+ * Create play chain.
*/
if (dopar) {
aparams_init(&opar, dopar->cmin, dopar->cmax, dopar->rate);
/*
- * create the write end
+ * Create the write end.
*/
dev_play = wpipe_new(f);
dev_play->refs++;
@@ -212,7 +213,7 @@ dev_init(char *devpath,
obufsz += nfr;
/*
- * append a converter, if needed
+ * Append a converter, if needed.
*/
if (!aparams_eqenc(&opar, dopar)) {
conv = enc_new("mixout", dopar);
@@ -224,7 +225,7 @@ dev_init(char *devpath,
dev_opar = opar;
/*
- * append a "mix" to which clients will connect
+ * Append a "mix" to which clients will connect.
*/
dev_mix = mix_new("mix", nfr);
dev_mix->refs++;
@@ -240,8 +241,8 @@ dev_init(char *devpath,
}
/*
- * cleanly stop and drain everything and close the device
- * once both play chain and record chain are gone
+ * Cleanly stop and drain everything and close the device
+ * once both play chain and record chain are gone.
*/
void
dev_done(void)
@@ -254,14 +255,14 @@ dev_done(void)
dev_mix->u.mix.flags |= MIX_AUTOQUIT;
dev_mix = NULL;
/*
- * generate EOF on all inputs (but not the device), and
+ * Generate EOF on all inputs (but not the device), and
* put the mixer in ``autoquit'' state, so once buffers
* are drained the mixer will terminate and shutdown the
- * write-end of the device
+ * write-end of the device.
*
* NOTE: since file_eof() can destroy the file and
* reorder the file_list, we have to restart the loop
- * after each call to file_eof()
+ * after each call to file_eof().
*/
restart:
LIST_FOREACH(f, &file_list, entry) {
@@ -272,7 +273,7 @@ dev_done(void)
}
/*
- * wait play chain to terminate
+ * Wait for play chain to terminate.
*/
if (dev_play) {
while (!LIST_EMPTY(&dev_play->ibuflist)) {
@@ -289,11 +290,11 @@ dev_done(void)
dev_sub->u.sub.flags |= SUB_AUTOQUIT;
dev_sub = NULL;
/*
- * same as above, but for the record chain: generate eof
+ * Same as above, but for the record chain: generate eof
* on the read-end of the device and wait record buffers
- * to desappear. We must stop the device first, because
+ * to disappear. We must stop the device first, because
* play-end will underrun (and xrun correction code will
- * insert silence on the record-end of the device)
+ * insert silence on the record-end of the device).
*/
if (dev_rec) {
dev_stop();
@@ -311,7 +312,7 @@ dev_done(void)
}
/*
- * start the (paused) device. By default it's paused
+ * Start the (paused) device. By default it's paused.
*/
void
dev_start(void)
@@ -332,7 +333,7 @@ dev_start(void)
}
/*
- * pause the device
+ * Pause the device.
*/
void
dev_stop(void)
@@ -353,7 +354,7 @@ dev_stop(void)
}
/*
- * find the end points connected to the mix/sub
+ * Find the end points connected to the mix/sub.
*/
int
dev_getep(struct abuf **sibuf, struct abuf **sobuf)
@@ -390,8 +391,8 @@ dev_getep(struct abuf **sibuf, struct abuf **sobuf)
}
/*
- * sync play buffer to rec buffer (for instance when one of
- * them underruns/overruns)
+ * Sync play buffer to rec buffer (for instance when one of
+ * them underruns/overruns).
*/
void
dev_sync(struct abuf *ibuf, struct abuf *obuf)
@@ -411,7 +412,7 @@ dev_sync(struct abuf *ibuf, struct abuf *obuf)
return;
/*
- * calculate delta, the number of frames the play chain is ahead
+ * Calculate delta, the number of frames the play chain is ahead
* of the record chain. It's necessary to schedule silences (or
* drops) in order to start playback and record in sync.
*/
@@ -424,15 +425,15 @@ dev_sync(struct abuf *ibuf, struct abuf *obuf)
if (delta > 0) {
/*
- * if the play chain is ahead (most cases) drop some of
- * the recorded input, to get both in sync
+ * If the play chain is ahead (most cases) drop some of
+ * the recorded input, to get both in sync.
*/
obuf->drop += delta * obuf->bpf;
abuf_ipos(obuf, -delta);
} else if (delta < 0) {
/*
- * if record chain is ahead (should never happen,
- * right?) then insert silence to play
+ * If record chain is ahead (should never happen,
+ * right?) then insert silence to play.
*/
ibuf->silence += -delta * ibuf->bpf;
abuf_opos(ibuf, delta);
@@ -441,10 +442,10 @@ dev_sync(struct abuf *ibuf, struct abuf *obuf)
}
/*
- * attach the given input and output buffers to the mixer and the
+ * Attach the given input and output buffers to the mixer and the
* multiplexer respectively. The operation is done synchronously, so
* both buffers enter in sync. If buffers do not match play
- * and rec
+ * and rec.
*/
void
dev_attach(char *name,
@@ -532,7 +533,7 @@ dev_attach(char *name,
}
/*
- * sync play to record
+ * Sync play to record.
*/
if (ibuf && obuf) {
ibuf->duplex = obuf;
@@ -542,7 +543,7 @@ dev_attach(char *name,
}
/*
- * change the playback volume of the fiven stream
+ * Change the playback volume of the given stream.
*/
void
dev_setvol(struct abuf *ibuf, int vol)
@@ -557,8 +558,8 @@ dev_setvol(struct abuf *ibuf, int vol)
}
/*
- * clear buffers of the play and record chains so that when the device
- * is started, playback and record start in sync
+ * Clear buffers of the play and record chains so that when the device
+ * is started, playback and record start in sync.
*/
void
dev_clear(void)
diff --git a/usr.bin/aucat/dev.h b/usr.bin/aucat/dev.h
index 451a32a5a8c..5de327e2ed3 100644
--- a/usr.bin/aucat/dev.h
+++ b/usr.bin/aucat/dev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.h,v 1.10 2009/02/06 08:26:34 ratchov Exp $ */
+/* $OpenBSD: dev.h,v 1.11 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -19,7 +19,6 @@
struct aproc;
struct aparams;
-struct file;
struct abuf;
extern unsigned dev_bufsz, dev_round, dev_rate;
diff --git a/usr.bin/aucat/file.c b/usr.bin/aucat/file.c
index e1c707027fa..1663701a778 100644
--- a/usr.bin/aucat/file.c
+++ b/usr.bin/aucat/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.12 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: file.c,v 1.13 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -53,10 +53,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include "abuf.h"
+#include "aproc.h"
#include "conf.h"
#include "file.h"
-#include "aproc.h"
-#include "abuf.h"
#define MAXFDS 100
@@ -262,8 +262,8 @@ file_poll(void)
int timo;
/*
- * fill the pfds[] array with files that are blocked on reading
- * and/or writing, skipping those that're just waiting
+ * Fill the pfds[] array with files that are blocked on reading
+ * and/or writing, skipping those that are just waiting.
*/
DPRINTFN(4, "file_poll:");
nfds = 0;
@@ -412,7 +412,7 @@ filelist_done(void)
}
/*
- * close all listening sockets
+ * Close all listening sockets.
*
* XXX: remove this
*/
diff --git a/usr.bin/aucat/file.h b/usr.bin/aucat/file.h
index dc0c825da1f..4458f6977fb 100644
--- a/usr.bin/aucat/file.h
+++ b/usr.bin/aucat/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.7 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: file.h,v 1.8 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -21,9 +21,7 @@
#include <sys/types.h>
struct file;
-struct aparams;
struct aproc;
-struct abuf;
struct pollfd;
struct timo {
diff --git a/usr.bin/aucat/headers.c b/usr.bin/aucat/headers.c
index 8b62a3e49bf..a3b52e139b3 100644
--- a/usr.bin/aucat/headers.c
+++ b/usr.bin/aucat/headers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: headers.c,v 1.6 2009/04/22 10:57:33 ratchov Exp $ */
+/* $OpenBSD: headers.c,v 1.7 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -23,12 +23,12 @@
#include <string.h>
#include <unistd.h>
-#include "conf.h"
#include "aparams.h"
+#include "conf.h"
#include "wav.h"
/*
- * encoding IDs used in .wav headers
+ * Encoding IDs used in .wav headers.
*/
#define WAV_ENC_PCM 1
#define WAV_ENC_ALAW 6
@@ -213,7 +213,7 @@ wav_writehdr(int fd, struct aparams *par)
datasz = 0;
/*
- * check that encoding is supported by .wav file format
+ * Check that encoding is supported by .wav file format.
*/
if (par->bits > 8 && !par->le) {
warnx("samples must be little endian");
@@ -224,7 +224,8 @@ wav_writehdr(int fd, struct aparams *par)
return 0;
}
if ((par->bits <= 8 && par->sig) || (par->bits > 8 && !par->sig)) {
- warnx("samples with more (less) than 8 bits must be signed (unsigned)");
+ warnx("samples with more (less) than 8 bits must be signed "
+ "(unsigned)");
return 0;
}
if (8 * par->bps != par->bits && !par->msb) {
diff --git a/usr.bin/aucat/legacy.c b/usr.bin/aucat/legacy.c
index b8bfc8121c5..d07f8feed86 100644
--- a/usr.bin/aucat/legacy.c
+++ b/usr.bin/aucat/legacy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: legacy.c,v 1.6 2009/04/22 10:57:33 ratchov Exp $ */
+/* $OpenBSD: legacy.c,v 1.7 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 1997 Kenneth Stailey. All rights reserved.
*
@@ -30,25 +30,28 @@
#include <sndio.h>
-#include <stdlib.h>
+#include <err.h>
#include <fcntl.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <err.h>
#include "wav.h"
-/* headerless data files. played at /dev/audio's defaults.
+/*
+ * Headerless data files. Played at /dev/audio's defaults.
*/
#define FMT_RAW 0
-/* Sun/NeXT .au files. header is skipped and /dev/audio is configured
+/*
+ * Sun/NeXT .au files. Header is skipped and /dev/audio is configured
* for monaural 8-bit ulaw @ 8kHz, the de facto format for .au files,
* as well as the historical default configuration for /dev/audio.
*/
#define FMT_AU 1
-/* RIFF WAV files. header is parsed for format details which are
+/*
+ * RIFF WAV files. Header is parsed for format details which are
* applied to /dev/audio.
*/
#define FMT_WAV 2
@@ -75,7 +78,8 @@ legacy_play(char *dev, char *aufile)
}
if (read(fd, magic, sizeof(magic)) != sizeof(magic)) {
- /* read() error, or the file is smaller than sizeof(magic).
+ /*
+ * read() error, or the file is smaller than sizeof(magic).
* treat as a raw file, like previous versions of aucat.
*/
} else if (!strncmp(magic, ".snd", 4)) {
@@ -96,7 +100,8 @@ legacy_play(char *dev, char *aufile)
fmt = FMT_WAV;
}
- /* seek to start of audio data. wav_readhdr already took care
+ /*
+ * Seek to start of audio data. wav_readhdr already took care
* of this for FMT_WAV.
*/
if (fmt == FMT_RAW || fmt == FMT_AU)
@@ -135,24 +140,27 @@ legacy_play(char *dev, char *aufile)
if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
warnx("can't set audio parameters");
- /* only WAV could fail in previous aucat versions (unless
+ /*
+ * Only WAV could fail in previous aucat versions (unless
* the parameters returned by AUDIO_GETINFO would fail,
- * which is unlikely)
+ * which is unlikely).
*/
if (fmt == FMT_WAV)
return(1);
}
- /* parameters may be silently modified. see audio(9)'s
- * description of set_params. for compatability with previous
+ /*
+ * Parameters may be silently modified. See audio(9)'s
+ * description of set_params. For compatability with previous
* aucat versions, continue running if something doesn't match.
*/
if (par.bits != spar.bits ||
par.sig != par.sig ||
par.le != spar.le ||
par.pchan != spar.pchan ||
- /* devices may return a very close rate, such as 44099 when
- * 44100 was requested. the difference is inaudible. allow
+ /*
+ * Devices may return a very close rate, such as 44099 when
+ * 44100 was requested. The difference is inaudible. Allow
* 2% deviation as an example of how to cope.
*/
(par.rate > spar.rate * 1.02 || par.rate < spar.rate * 0.98)) {
@@ -178,7 +186,7 @@ legacy_play(char *dev, char *aufile)
warn("read");
sio_close(hdl);
- (void) close(fd);
+ close(fd);
return(0);
}
diff --git a/usr.bin/aucat/listen.c b/usr.bin/aucat/listen.c
index 06748be0917..43b7cabbc8c 100644
--- a/usr.bin/aucat/listen.c
+++ b/usr.bin/aucat/listen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.c,v 1.9 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: listen.c,v 1.10 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -29,8 +29,8 @@
#include <unistd.h>
#include "conf.h"
-#include "sock.h"
#include "listen.h"
+#include "sock.h"
struct fileops listen_ops = {
"listen",
@@ -138,7 +138,7 @@ listen_close(struct file *file)
{
struct listen *f = (struct listen *)file;
- (void)unlink(f->path);
+ unlink(f->path);
free(f->path);
- (void)close(f->fd);
+ close(f->fd);
}
diff --git a/usr.bin/aucat/listen.h b/usr.bin/aucat/listen.h
index d33a8f026f4..8b156d61925 100644
--- a/usr.bin/aucat/listen.h
+++ b/usr.bin/aucat/listen.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: listen.h,v 1.4 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: listen.h,v 1.5 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -19,8 +19,8 @@
#include <sys/types.h>
-#include "file.h"
#include "aparams.h"
+#include "file.h"
struct listen {
struct file file;
diff --git a/usr.bin/aucat/pipe.c b/usr.bin/aucat/pipe.c
index 9752db97304..418be80f074 100644
--- a/usr.bin/aucat/pipe.c
+++ b/usr.bin/aucat/pipe.c
@@ -1,5 +1,22 @@
+/*
+ * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <sys/time.h>
#include <sys/types.h>
+
#include <err.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/usr.bin/aucat/pipe.h b/usr.bin/aucat/pipe.h
index 043dab40c3d..b648cdfe963 100644
--- a/usr.bin/aucat/pipe.h
+++ b/usr.bin/aucat/pipe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipe.h,v 1.1 2008/10/26 08:49:44 ratchov Exp $ */
+/* $OpenBSD: pipe.h,v 1.2 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -19,8 +19,6 @@
#include "file.h"
-struct aparams;
-
struct pipe {
struct file file;
int fd; /* file descriptor */
@@ -36,4 +34,4 @@ int pipe_nfds(struct file *);
int pipe_pollfd(struct file *, struct pollfd *, int);
int pipe_revents(struct file *, struct pollfd *);
-#endif /* !defined(FILE_H) */
+#endif /* !defined(PIPE_H) */
diff --git a/usr.bin/aucat/safile.c b/usr.bin/aucat/safile.c
index d6768162646..a8cd4b8dd23 100644
--- a/usr.bin/aucat/safile.c
+++ b/usr.bin/aucat/safile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safile.c,v 1.13 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: safile.c,v 1.14 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -15,21 +15,21 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <poll.h>
+#include <sndio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sndio.h>
+#include "aparams.h"
+#include "aproc.h"
#include "conf.h"
+#include "dev.h"
#include "file.h"
-#include "aproc.h"
-#include "aparams.h"
#include "safile.h"
-#include "dev.h"
struct safile {
struct file file;
@@ -80,7 +80,7 @@ safile_cb(void *addr, int delta)
}
/*
- * open the device
+ * Open the device.
*/
struct safile *
safile_new(struct fileops *ops, char *path,
@@ -193,7 +193,7 @@ safile_read(struct file *file, unsigned char *data, unsigned count)
unsigned us;
if (!(f->file.state & FILE_ROK)) {
- DPRINTF("file_read: %s: bad state\n", f->file.name);
+ DPRINTF("safile_read: %s: bad state\n", f->file.name);
abort();
}
gettimeofday(&tv0, NULL);
diff --git a/usr.bin/aucat/safile.h b/usr.bin/aucat/safile.h
index 795e59b376e..7bb818cce5e 100644
--- a/usr.bin/aucat/safile.h
+++ b/usr.bin/aucat/safile.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: safile.h,v 1.3 2008/12/07 17:10:41 ratchov Exp $ */
+/* $OpenBSD: safile.h,v 1.4 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -17,7 +17,6 @@
#ifndef SAFILE_H
#define SAFILE_H
-struct file;
struct fileops;
struct safile;
struct aparams;
@@ -28,10 +27,10 @@ struct safile *safile_new(struct fileops *, char *,
extern struct fileops safile_ops;
/*
- * Sun API specific functions
+ * Sun API specific functions.
*/
struct audio_prinfo;
int sun_infotopar(struct audio_prinfo *, struct aparams *);
void sun_partoinfo(struct audio_prinfo *, struct aparams *);
-#endif /* !defined(SUN_H) */
+#endif /* !defined(SAFILE_H) */
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index f94be462b18..b0cbba5bdc6 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.19 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.20 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -24,13 +24,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "aproc.h"
+
#include "abuf.h"
-#include "sock.h"
-#include "dev.h"
+#include "aproc.h"
#include "conf.h"
+#include "dev.h"
#include "midi.h"
#include "opt.h"
+#include "sock.h"
int sock_attach(struct sock *, int);
int sock_read(struct sock *);
@@ -97,9 +98,9 @@ rsock_out(struct aproc *p, struct abuf *obuf)
DPRINTFN(4, "rsock_out: %p\n", f);
/*
- * when calling sock_read(), we may receive a ``STOP'' command,
+ * When calling sock_read(), we may receive a ``STOP'' command,
* and detach ``obuf''. In this case, there's no more caller and
- * we'll stop processing further messages, resulting in a dead lock.
+ * we'll stop processing further messages, resulting in a deadlock.
* The solution is to iterate over sock_read() in order to
* consume all messages().
*/
@@ -190,7 +191,7 @@ wsock_in(struct aproc *p, struct abuf *ibuf)
DPRINTFN(4, "wsock_in: %p\n", f);
/*
- * see remark in rsock_out()
+ * See remark in rsock_out().
*/
for (;;) {
if (!sock_write(f))
@@ -270,8 +271,8 @@ struct aproc_ops wsock_ops = {
};
/*
- * initialise socket in the SOCK_HELLO state with default
- * parameters
+ * Initialise socket in the SOCK_HELLO state with default
+ * parameters.
*/
struct sock *
sock_new(struct fileops *ops, int fd)
@@ -313,7 +314,7 @@ sock_new(struct fileops *ops, int fd)
}
/*
- * free buffers
+ * Free buffers.
*/
void
sock_freebuf(struct sock *f)
@@ -331,7 +332,7 @@ sock_freebuf(struct sock *f)
}
/*
- * allocate buffers, so client can start filling write-end.
+ * Allocate buffers, so client can start filling write-end.
*/
void
sock_allocbuf(struct sock *f)
@@ -357,7 +358,7 @@ sock_allocbuf(struct sock *f)
}
/*
- * free buffers
+ * Set volume.
*/
void
sock_setvol(struct sock *f, int vol)
@@ -374,7 +375,7 @@ sock_setvol(struct sock *f, int vol)
}
/*
- * attach play and/or record buffers to dev_mix and/or dev_sub
+ * Attach play and/or record buffers to dev_mix and/or dev_sub.
*/
int
sock_attach(struct sock *f, int force)
@@ -385,8 +386,8 @@ sock_attach(struct sock *f, int force)
wbuf = LIST_FIRST(&f->pipe.file.wproc->ibuflist);
/*
- * if in SOCK_START state, dont attach until
- * the buffer isn't completely filled
+ * If in SOCK_START state, dont attach until
+ * the buffer isn't completely filled.
*/
if (!force && rbuf && ABUF_WOK(rbuf))
return 0;
@@ -395,7 +396,7 @@ sock_attach(struct sock *f, int force)
f->pstate = SOCK_RUN;
/*
- * attach them to the device
+ * Attach them to the device.
*/
dev_attach(f->pipe.file.name,
(f->mode & AMSG_PLAY) ? rbuf : NULL, &f->rpar, f->xrun,
@@ -405,7 +406,7 @@ sock_attach(struct sock *f, int force)
dev_setvol(rbuf, f->vol);
/*
- * send the initial position, if needed
+ * Send the initial position, if needed.
*/
for (;;) {
if (!sock_write(f))
@@ -433,8 +434,8 @@ sock_reset(struct sock *f)
}
/*
- * read a message from the file descriptor, return 1 if done, 0
- * otherwise. The message is stored in f->rmsg
+ * Read a message from the file descriptor, return 1 if done, 0
+ * otherwise. The message is stored in f->rmsg.
*/
int
sock_rmsg(struct sock *f)
@@ -459,7 +460,7 @@ sock_rmsg(struct sock *f)
}
/*
- * write a message to the file descriptor, return 1 if done, 0
+ * Write a message to the file descriptor, return 1 if done, 0
* otherwise. The "m" argument is f->rmsg or f->wmsg, and the "ptodo"
* points to the f->rtodo or f->wtodo respectively.
*/
@@ -486,7 +487,7 @@ sock_wmsg(struct sock *f, struct amsg *m, unsigned *ptodo)
}
/*
- * read data chunk from the file descriptor, return 1 if at least one
+ * Read data chunk from the file descriptor, return 1 if at least one
* byte was read, 0 if the file blocked.
*/
int
@@ -522,7 +523,7 @@ sock_rdata(struct sock *f)
}
/*
- * write data chunk to the file descriptor, return 1 if at least one
+ * Write data chunk to the file descriptor, return 1 if at least one
* byte was written, 0 if the file blocked.
*/
int
@@ -561,7 +562,7 @@ sock_wdata(struct sock *f)
if (f->pstate == SOCK_MIDI)
return 0;
/*
- * there's no dev_detach() routine yet,
+ * There's no dev_detach() routine yet,
* so now we abruptly destroy the buffer.
* Until we implement dev_detach, complete
* the packet with zeros...
@@ -785,7 +786,7 @@ sock_hello(struct sock *f)
}
/*
- * execute message in f->rmsg and change the state accordingly; return 1
+ * Execute message in f->rmsg and change the state accordingly; return 1
* on success, and 0 on failure, in which case the socket is destroyed.
*/
int
@@ -962,7 +963,7 @@ sock_execmsg(struct sock *f)
}
/*
- * create a new data/pos message
+ * Create a new data/pos message.
*/
int
sock_buildmsg(struct sock *f)
@@ -978,7 +979,7 @@ sock_buildmsg(struct sock *f)
}
/*
- * if pos changed, build a MOVE message
+ * If pos changed, build a MOVE message.
*/
if (f->tickpending && f->delta >= 0) {
DPRINTFN(4, "sock_buildmsg: %p: POS: %d\n", f, f->delta);
@@ -993,7 +994,7 @@ sock_buildmsg(struct sock *f)
}
/*
- * if data available, build a DATA message
+ * If data available, build a DATA message.
*/
p = f->pipe.file.wproc;
ibuf = LIST_FIRST(&p->ibuflist);
@@ -1015,7 +1016,7 @@ sock_buildmsg(struct sock *f)
}
/*
- * read from the socket file descriptor, fill input buffer and update
+ * Read from the socket file descriptor, fill input buffer and update
* the state. Return 1 if at least one message or 1 data byte was
* processed, 0 if something blocked.
*/
@@ -1051,7 +1052,7 @@ sock_read(struct sock *f)
}
/*
- * process messages to return
+ * Process messages to return.
*/
int
sock_return(struct sock *f)
@@ -1075,7 +1076,7 @@ sock_return(struct sock *f)
for (;;) {
/*
* in() may trigger rsock_done and destroy the
- * wsock
+ * wsock.
*/
rp = f->pipe.file.rproc;
if (!rp || !rp->ops->in(rp, NULL))
@@ -1089,7 +1090,7 @@ sock_return(struct sock *f)
}
/*
- * write messages and data on the socket file descriptor. Return 1 if
+ * Write messages and data on the socket file descriptor. Return 1 if
* at least one message or one data byte was processed, 0 if something
* blocked.
*/
diff --git a/usr.bin/aucat/sock.h b/usr.bin/aucat/sock.h
index d9535c8442f..d0eaeda1986 100644
--- a/usr.bin/aucat/sock.h
+++ b/usr.bin/aucat/sock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.h,v 1.7 2009/07/25 08:44:27 ratchov Exp $ */
+/* $OpenBSD: sock.h,v 1.8 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -17,16 +17,16 @@
#ifndef SOCK_H
#define SOCK_H
-#include "pipe.h"
-#include "aparams.h"
#include "amsg.h"
+#include "aparams.h"
+#include "pipe.h"
struct opt;
struct sock {
struct pipe pipe;
/*
- * socket and protocol specific stuff, mainly used
+ * Socket and protocol specific stuff, mainly used
* to decode/encode messages in the stream.
*/
struct amsg rmsg, wmsg; /* messages being sent/received */
diff --git a/usr.bin/aucat/wav.c b/usr.bin/aucat/wav.c
index 40f22c23a8b..e11e01ff3c5 100644
--- a/usr.bin/aucat/wav.c
+++ b/usr.bin/aucat/wav.c
@@ -1,4 +1,21 @@
+/*
+ * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
#include <sys/types.h>
+
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
@@ -79,9 +96,9 @@ short wav_alawmap[256] = {
};
/*
- * max data of a .wav file. The total file size must be smaller than
+ * Max data of a .wav file. The total file size must be smaller than
* 2^31, and we also have to leave some space for the headers (around 40
- * bytes)
+ * bytes).
*/
#define WAV_DATAMAX (0x7fff0000)
diff --git a/usr.bin/aucat/wav.h b/usr.bin/aucat/wav.h
index f7581ebe846..b3fef15a0f8 100644
--- a/usr.bin/aucat/wav.h
+++ b/usr.bin/aucat/wav.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wav.h,v 1.3 2009/04/22 10:57:33 ratchov Exp $ */
+/* $OpenBSD: wav.h,v 1.4 2009/07/25 10:52:19 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -19,8 +19,8 @@
#include <sys/types.h>
-#include "pipe.h"
#include "aparams.h"
+#include "pipe.h"
struct wav {
struct pipe pipe;