33 s->hwpos +=
delta *
s->channels *
s->bps;
37 const char *audio_device)
43 hdl = sio_open(audio_device, is_output ? SIO_PLAY : SIO_REC, 0);
53 par.le = SIO_LE_NATIVE;
56 par.pchan =
s->channels;
58 par.rchan =
s->channels;
59 par.rate =
s->sample_rate;
61 if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
63 "channels: %d sample rate: %d\n",
s->channels,
s->sample_rate);
67 if (par.bits != 16 || par.sig != 1 ||
68 (is_output && (par.pchan !=
s->channels)) ||
69 (!is_output && (par.rchan !=
s->channels)) ||
70 (par.rate !=
s->sample_rate)) {
72 "channels: %d sample rate: %d\n",
s->channels,
s->sample_rate);
76 s->buffer_size = par.round * par.bps *
77 (is_output ? par.pchan : par.rchan);
88 s->channels = is_output ? par.pchan : par.rchan;
89 s->sample_rate = par.rate;
94 if (!sio_start(hdl)) {