static int timelimit = 0;
static int quiet_mode = 0;
static int file_type = FORMAT_DEFAULT;
-static unsigned int sleep_min = 0;
static int open_mode = 0;
static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
static int mmap_flag = 0;
"-f, --format=FORMAT sample format (case insensitive)\n"
"-r, --rate=# sample rate\n"
"-d, --duration=# interrupt after # seconds\n"
-"-s, --sleep-min=# min ticks to sleep\n"
"-M, --mmap mmap stream\n"
"-N, --nonblock nonblocking mode\n"
"-F, --period-time=# distance between interrupts is # microseconds\n"
int main(int argc, char *argv[])
{
int option_index;
- char *short_options = "hnlLD:qt:c:f:r:d:s:MNF:A:R:T:B:vIPC";
+ char *short_options = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vIPC";
static struct option long_options[] = {
{"help", 0, 0, 'h'},
{"version", 0, 0, OPT_VERSION},
{"format", 1, 0, 'f'},
{"rate", 1, 0, 'r'},
{"duration", 1, 0 ,'d'},
- {"sleep-min", 1, 0, 's'},
{"mmap", 0, 0, 'M'},
{"nonblock", 0, 0, 'N'},
{"period-time", 1, 0, 'F'},
case 'd':
timelimit = strtol(optarg, NULL, 0);
break;
- case 's':
- sleep_min = strtol(optarg, NULL, 0);
- break;
case 'N':
nonblock = 1;
open_mode |= SND_PCM_NONBLOCK;
error(_("Unable to obtain xfer align\n"));
exit(EXIT_FAILURE);
}
- if (sleep_min)
- xfer_align = 1;
- err = snd_pcm_sw_params_set_sleep_min(handle, swparams,
- sleep_min);
- assert(err >= 0);
if (avail_min < 0)
n = chunk_size;
else
ssize_t r;
ssize_t result = 0;
- if (sleep_min == 0 &&
- count < chunk_size) {
+ if (count < chunk_size) {
snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels);
count = chunk_size;
}
ssize_t r;
size_t result = 0;
- if (sleep_min == 0 &&
- count != chunk_size) {
+ if (count != chunk_size) {
unsigned int channel;
size_t offset = count;
size_t remaining = chunk_size - count;
size_t result = 0;
size_t count = rcount;
- if (sleep_min == 0 &&
- count != chunk_size) {
+ if (count != chunk_size) {
count = chunk_size;
}
size_t result = 0;
size_t count = rcount;
- if (sleep_min == 0 &&
- count != chunk_size) {
+ if (count != chunk_size) {
count = chunk_size;
}
{
if (buffer_pos > 0) {
size_t b;
- if (sleep_min == 0) {
- if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0)
- fprintf(stderr, _("voc_pcm_flush - silence error"));
- b = chunk_size;
- } else {
- b = buffer_pos * 8 / bits_per_frame;
- }
+ if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0)
+ fprintf(stderr, _("voc_pcm_flush - silence error"));
+ b = chunk_size;
if (pcm_write(audiobuf, b) != (ssize_t)b)
error(_("voc_pcm_flush error"));
}
if (r == 0)
break;
l += r;
- } while (sleep_min == 0 && (size_t)l < chunk_bytes);
+ } while ((size_t)l < chunk_bytes);
l = l * 8 / bits_per_frame;
r = pcm_write(audiobuf, l);
if (r != l)
if (r == 0)
break;
c += r;
- } while (sleep_min == 0 && c < expected);
+ } while (c < expected);
c = c * 8 / bits_per_sample;
r = pcm_writev(bufs, channels, c);
if ((size_t)r != c)