version 1.61, 2008/06/11 21:59:25 |
version 1.62, 2008/06/22 21:04:01 |
|
|
int play_track(int, int, int, int); |
int play_track(int, int, int, int); |
int get_vol(int *, int *); |
int get_vol(int *, int *); |
int status(int *, int *, int *, int *); |
int status(int *, int *, int *, int *); |
|
int is_wave(int fd); |
__dead void tao(int argc, char **argv); |
__dead void tao(int argc, char **argv); |
int play(char *arg); |
int play(char *arg); |
int info(char *arg); |
int info(char *arg); |
|
|
} |
} |
} |
} |
|
|
|
/* |
|
* Check if audio file has RIFF WAVE format. If not, we assume it's just PCM. |
|
*/ |
|
int |
|
is_wave(int fd) |
|
{ |
|
char buf[WAVHDRLEN]; |
|
int rv; |
|
|
|
rv = 0; |
|
if (read(fd, buf, sizeof(buf)) == sizeof(buf)) { |
|
if (memcmp(buf, "RIFF", 4) == 0 && |
|
memcmp(buf + 8, "WAVE", 4) == 0) |
|
rv = 1; |
|
} |
|
|
|
return (rv); |
|
} |
|
|
__dead void |
__dead void |
tao(int argc, char **argv) |
tao(int argc, char **argv) |
{ |
{ |
|
|
if (fstat(tr->fd, &sb) == -1) |
if (fstat(tr->fd, &sb) == -1) |
err(1, "cannot stat file %s", tr->file); |
err(1, "cannot stat file %s", tr->file); |
tr->sz = sb.st_size; |
tr->sz = sb.st_size; |
if (tr->type == 'a') |
tr->off = 0; |
tr->sz -= WAVHDRLEN; |
if (tr->type == 'a') { |
|
if (is_wave(tr->fd)) { |
|
tr->sz -= WAVHDRLEN; |
|
tr->off = WAVHDRLEN; |
|
} |
|
} |
if (SLIST_EMPTY(&tracks)) |
if (SLIST_EMPTY(&tracks)) |
SLIST_INSERT_HEAD(&tracks, tr, track_list); |
SLIST_INSERT_HEAD(&tracks, tr, track_list); |
else |
else |