summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/aucat/wav.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/aucat/wav.c b/usr.bin/aucat/wav.c
index 97044f6f44e..0534c6913cd 100644
--- a/usr.bin/aucat/wav.c
+++ b/usr.bin/aucat/wav.c
@@ -796,7 +796,11 @@ wav_new_in(struct fileops *ops, struct dev *dev,
close(fd);
return NULL;
}
+ f->mode = mode;
f->pstate = WAV_CFG;
+ f->endpos = f->startpos = 0;
+ f->next = wav_list;
+ wav_list = f;
if (hdr == HDR_WAV) {
if (!wav_readhdr(f->pipe.fd, par,
&f->startpos, &f->rbytes, &f->map)) {
@@ -805,7 +809,6 @@ wav_new_in(struct fileops *ops, struct dev *dev,
}
f->endpos = f->startpos + f->rbytes;
} else {
- f->startpos = 0;
f->endpos = pipe_endpos(&f->pipe.file);
if (f->endpos > 0) {
if (!pipe_seek(&f->pipe.file, 0)) {
@@ -846,8 +849,6 @@ wav_new_in(struct fileops *ops, struct dev *dev,
dbg_puts("\n");
}
#endif
- f->next = wav_list;
- wav_list = f;
return f;
}
@@ -881,7 +882,11 @@ wav_new_out(struct fileops *ops, struct dev *dev,
close(fd);
return NULL;
}
+ f->mode = mode;
f->pstate = WAV_CFG;
+ f->endpos = f->startpos = 0;
+ f->next = wav_list;
+ wav_list = f;
if (hdr == HDR_WAV) {
par->le = 1;
par->sig = (par->bits <= 8) ? 0 : 1;
@@ -892,14 +897,11 @@ wav_new_out(struct fileops *ops, struct dev *dev,
}
f->wbytes = WAV_DATAMAX;
f->endpos = f->startpos;
- } else {
+ } else
f->wbytes = -1;
- f->startpos = f->endpos = 0;
- }
f->dev = dev;
f->mmc = mmc;
f->join = join;
- f->mode = mode;
f->hpar = *par;
f->hdr = hdr;
f->xrun = xrun;