-/* $OpenBSD: sun.c,v 1.37 2010/05/25 06:49:13 ratchov Exp $ */
+/* $OpenBSD: sun.c,v 1.38 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
static int
sun_infotoenc(struct sun_hdl *hdl, struct audio_prinfo *ai, struct sio_par *par)
{
- par->msb = 1;
+ par->msb = ai->msb;
par->bits = ai->precision;
- par->bps = SIO_BPS(par->bits);
+ par->bps = ai->bps;
switch (ai->encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
par->le = 1;
continue;
}
cap->enc[nenc].bits = ae.precision;
- cap->enc[nenc].bps = SIO_BPS(ae.precision);
- cap->enc[nenc].msb = 1;
+ cap->enc[nenc].bps = ae.bps;
+ cap->enc[nenc].msb = ae.msb;
enc_map |= (1 << nenc);
nenc++;
}
return 0;
}
ibpf = (hdl->sio.mode & SIO_REC) ?
- aui.record.channels * SIO_BPS(aui.record.precision) : 1;
+ aui.record.channels * aui.record.bps : 1;
obpf = (hdl->sio.mode & SIO_PLAY) ?
- aui.play.channels * SIO_BPS(aui.play.precision) : 1;
+ aui.play.channels * aui.play.bps : 1;
DPRINTF("sun_setpar: bpf = (%u, %u)\n", ibpf, obpf);
-.\" $OpenBSD: audio.4,v 1.61 2009/06/27 14:28:39 jmc Exp $
+.\" $OpenBSD: audio.4,v 1.62 2010/07/15 03:43:11 jakemsr Exp $
.\" $NetBSD: audio.4,v 1.20 1998/05/28 17:27:15 augustss Exp $
.\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 27 2009 $
+.Dd $Mdocdate: July 15 2010 $
.Dt AUDIO 4
.Os
.Sh NAME
char name[MAX_AUDIO_DEV_LEN]; /* name of encoding */
int encoding; /* value for encoding parameter */
int precision; /* value for precision parameter */
+ int bps; /* value for bps parameter */
+ int msb; /* value for msb parameter */
int flags;
#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
} audio_encoding_t;
u_int sample_rate; /* sample rate in bit/s */
u_int channels; /* number of channels, usually 1 or 2 */
u_int precision; /* number of bits/sample */
+ u_int bps; /* number of bytes/sample */
+ u_int msb; /* data alignment */
u_int encoding; /* data encoding (AUDIO_ENCODING_* below) */
u_int gain; /* volume level */
u_int port; /* selected I/O port */
The
.Va precision
parameter describes the number of bits of audio data per sample.
-For sample formats such as 8, 16, and 32-bit, where the number of audio data
-bits is a power of 2,
+The
+.Va bps
+parameter describes the number of bytes of audio data per sample.
+The
+.Va msb
+parameter describes the alignment of the data in the sample.
+It is only meaningful when
.Va precision
-is also exactly the size of each sample.
-For other sample formats the sample size is the smallest power of
-2 bits that the data can fit into.
-For example the sample size of 20 and 24-bit formats is 32 bits.
+/ NBBY <
+.Va bps .
+A value of 1 means the data is aligned to the most significant bit.
.Pp
The
.Va gain ,
-.\" $OpenBSD: audio.9,v 1.21 2008/10/27 07:53:24 jmc Exp $
+.\" $OpenBSD: audio.9,v 1.22 2010/07/15 03:43:11 jakemsr Exp $
.\" $NetBSD: audio.9,v 1.14 2000/02/11 22:56:15 kleink Exp $
.\"
.\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 27 2008 $
+.Dd $Mdocdate: July 15 2010 $
.Dt AUDIO 9
.Os
.Sh NAME
u_long sample_rate; /* sample rate */
u_int encoding; /* mu-law, linear, etc */
u_int precision; /* bits/sample */
+ u_int bps; /* bytes/sample */
+ u_int msb; /* data alignment */
u_int channels; /* mono(1), stereo(2) */
/* Software en/decode functions, set if SW coding required by HW */
void (*sw_code)(void *, u_char *, int);
-/* $OpenBSD: harmony.c,v 1.26 2008/04/21 00:32:42 jakemsr Exp $ */
+/* $OpenBSD: harmony.c,v 1.27 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2003 Jason L. Wright (jason@thought.net)
default:
err = EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return (err);
}
else
return (EINVAL);
- bits |= harmony_speed_bits(sc, &p->sample_rate);
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
+
+ bits |= harmony_speed_bits(sc, &p->sample_rate);
sc->sc_cntlbits = bits;
sc->sc_need_commit = 1;
-/* $OpenBSD: awacs.c,v 1.24 2008/10/30 06:22:38 todd Exp $ */
+/* $OpenBSD: awacs.c,v 1.25 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: awacs.c,v 1.4 2001/02/26 21:07:51 wiz Exp $ */
/*-
default:
return (EINVAL);
}
+ ae->bps = AUDIO_BPS(ae->precision);
+ ae->msb = 1;
+
return (0);
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
/* Set the speed */
-/* $OpenBSD: i2s.c,v 1.17 2008/11/07 19:53:20 todd Exp $ */
+/* $OpenBSD: i2s.c,v 1.18 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: i2s.c,v 1.1 2003/12/27 02:19:34 grant Exp $ */
/*-
44100, /* sample_rate */
AUDIO_ENCODING_SLINEAR_BE, /* encoding */
16, /* precision */
+ 2, /* bps */
+ 1, /* msb */
2, /* channels */
NULL, /* sw_code */
1 /* factor */
err = EINVAL;
break;
}
+ ae->bps = AUDIO_BPS(ae->precision);
+ ae->msb = 1;
return (err);
}
p->sample_rate = sc->sc_rate;
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
+
return 0;
}
-/* $OpenBSD: mavb.c,v 1.12 2010/07/02 03:24:50 blambert Exp $ */
+/* $OpenBSD: mavb.c,v 1.13 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
default:
return (EINVAL);
}
+ ae->bps = AUDIO_BPS(ae->precision);
+ ae->msb = 1;
return (0);
}
p->sample_rate = 48000;
p->encoding = AUDIO_ENCODING_SLINEAR_BE;
p->precision = 16;
+ p->bps = 2;
+ p->msb = 1;
p->channels = 2;
p->factor = 2;
if (mode == AUMODE_PLAY)
error = mavb_set_play_format(sc, play->encoding);
if (error)
return (error);
+
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
}
if (setmode & AUMODE_RECORD) {
error = mavb_set_rec_format(sc, rec->encoding);
if (error)
return (error);
+
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
}
return (0);
-/* $OpenBSD: amd7930.c,v 1.32 2009/04/10 20:53:51 miod Exp $ */
+/* $OpenBSD: amd7930.c,v 1.33 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: amd7930.c,v 1.37 1998/03/30 14:23:40 pk Exp $ */
/*
int setmode, usemode;
struct audio_params *p, *r;
{
- if (p->sample_rate < 7500 || p->sample_rate > 8500 ||
- p->encoding != AUDIO_ENCODING_ULAW ||
- p->precision != 8 ||
- p->channels != 1)
- return (EINVAL);
- p->sample_rate = 8000; /* no other rates supported by amd chip */
+ p->encoding = AUDIO_ENCODING_ULAW;
+ p->precision = 8;
+ p->bps = 1;
+ p->msb = 1;
+ p->channels = 1;
+ /* no other rates supported by amd chip */
+ p->sample_rate = 8000;
return (0);
}
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
+ fp->bps = 1;
+ fp->msb = 1;
fp->flags = 0;
break;
default:
-/* $OpenBSD: cs4231.c,v 1.28 2010/06/18 23:47:24 miod Exp $ */
+/* $OpenBSD: cs4231.c,v 1.29 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
default:
err = EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return (err);
}
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
sc->sc_format_bits = bits;
sc->sc_channels = p->channels;
-/* $OpenBSD: ce4231.c,v 1.25 2010/02/22 00:43:30 jakemsr Exp $ */
+/* $OpenBSD: ce4231.c,v 1.26 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
default:
err = EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return (err);
}
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
sc->sc_format_bits = bits;
sc->sc_channels = p->channels;
-/* $OpenBSD: zaurus_audio.c,v 1.10 2008/04/21 00:32:42 jakemsr Exp $ */
+/* $OpenBSD: zaurus_audio.c,v 1.11 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org>
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof(aep->name));
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+ return (0);
}
int
return (EINVAL);
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
+
pxa2x0_i2s_setspeed(&sc->sc_i2s, &play->sample_rate);
}
return (EINVAL);
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
+
pxa2x0_i2s_setspeed(sc, &rec->sample_rate);
}
#endif
-/* $OpenBSD: audio.c,v 1.107 2009/11/09 17:53:39 nicm Exp $ */
+/* $OpenBSD: audio.c,v 1.108 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
#define ROUNDSIZE(x) x &= -16 /* round to nice boundary */
-#define AUDIO_BPS(bits) ((bits) <= 8 ? 1 : (((bits) <= 16) ? 2 : 4))
-
int audio_blk_ms = AUDIO_BLK_MS;
int audiosetinfo(struct audio_softc *, struct audio_info *);
/* The default audio mode: 8 kHz mono ulaw */
struct audio_params audio_default =
- { 8000, AUDIO_ENCODING_ULAW, 8, 1, 0, 1 };
+ { 8000, AUDIO_ENCODING_ULAW, 8, 1, 1, 1, 0, 1 };
struct cfattach audio_ca = {
sizeof(struct audio_softc), audioprobe, audioattach,
void
audio_print_params(char *s, struct audio_params *p)
{
- printf("audio: %s sr=%ld, enc=%d, chan=%d, prec=%d\n", s,
- p->sample_rate, p->encoding, p->channels, p->precision);
+ printf("audio: %s sr=%ld, enc=%d, chan=%d, prec=%d bps=%d\n", s,
+ p->sample_rate, p->encoding, p->channels, p->precision, p->bps);
}
#endif
sc->sc_pnintr = 0;
sc->sc_pblktime = (u_long)(
(u_long)sc->sc_pr.blksize * 100000 /
- (u_long)(AUDIO_BPS(sc->sc_pparams.precision) *
+ (u_long)(sc->sc_pparams.bps *
sc->sc_pparams.channels *
sc->sc_pparams.sample_rate)) * 10;
DPRINTF(("audio: play blktime = %lu for %d\n",
sc->sc_rnintr = 0;
sc->sc_rblktime = (u_long)(
(u_long)sc->sc_rr.blksize * 100000 /
- (u_long)(AUDIO_BPS(sc->sc_rparams.precision) *
+ (u_long)(sc->sc_rparams.bps *
sc->sc_rparams.channels *
sc->sc_rparams.sample_rate)) * 10;
DPRINTF(("audio: record blktime = %lu for %d\n",
ai.record.encoding = sc->sc_rparams.encoding;
ai.record.channels = sc->sc_rparams.channels;
ai.record.precision = sc->sc_rparams.precision;
+ ai.record.bps = sc->sc_rparams.bps;
+ ai.record.msb = sc->sc_rparams.msb;
ai.record.pause = 0;
ai.play.sample_rate = sc->sc_pparams.sample_rate;
- ai.play.encoding = sc->sc_pparams.encoding;
+ ai.play.encoding = sc->sc_pparams.encoding;
ai.play.channels = sc->sc_pparams.channels;
ai.play.precision = sc->sc_pparams.precision;
+ ai.play.bps = sc->sc_pparams.bps;
+ ai.play.msb = sc->sc_pparams.msb;
ai.play.pause = 0;
ai.mode = mode;
sc->sc_rr.blkset = sc->sc_pr.blkset = 0; /* Block sizes not set yet */
rb = &sc->sc_rr;
}
- fs = parm->channels * AUDIO_BPS(parm->precision);
+ fs = parm->channels * parm->bps;
bs = fpb * fs;
maxbs = rb->bufsize / 2;
if (bs > maxbs)
audio_fill_silence(struct audio_params *params, u_char *start, u_char *p, int n)
{
size_t rounderr;
- int i, samplesz, nsamples;
+ int i, nsamples;
u_char auzero[4] = {0, 0, 0, 0};
/*
* beginning of the sample, so we overwrite partially written
* ones.
*/
- samplesz = AUDIO_BPS(params->precision);
- rounderr = (p - start) % samplesz;
+ rounderr = (p - start) % params->bps;
p -= rounderr;
n += rounderr;
- nsamples = n / samplesz;
+ nsamples = n / params->bps;
switch (params->encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
auzero[0] = 0x55;
break;
case AUDIO_ENCODING_ULINEAR_LE:
- auzero[samplesz - 1] = 0x80;
+ if (params->msb == 1)
+ auzero[params->bps - 1] = 0x80;
+ else
+ auzero[params->bps - 1] = 1 << ((params->precision + 7) % NBBY);
break;
case AUDIO_ENCODING_ULINEAR_BE:
- auzero[0] = 0x80;
+ if (params->msb == 1)
+ auzero[0] = 0x80;
+ else
+ auzero[0] = 1 << ((params->precision + 7) % NBBY);
break;
case AUDIO_ENCODING_MPEG_L1_STREAM:
case AUDIO_ENCODING_MPEG_L1_PACKETS:
break;
}
while (--nsamples >= 0) {
- for (i = 0; i < samplesz; i++)
+ for (i = 0; i < params->bps; i++)
*p++ = auzero[i];
}
}
* original formula:
* sc->sc_rr.drops /
* sc->sc_rparams.factor /
- * (sc->sc_rparams.channels * AUDIO_BPS(sc->sc_rparams.precision))
+ * (sc->sc_rparams.channels * sc->sc_rparams.bps)
*/
case AUDIO_RERROR:
*(int *)addr = sc->sc_rr.drops /
(sc->sc_rparams.factor * sc->sc_rparams.channels *
- AUDIO_BPS(sc->sc_rparams.precision));
+ sc->sc_rparams.bps);
break;
case AUDIO_PERROR:
*(int *)addr = sc->sc_pr.drops /
(sc->sc_pparams.factor * sc->sc_pparams.channels *
- AUDIO_BPS(sc->sc_pparams.precision));
+ sc->sc_pparams.bps);
break;
/*
rp.precision = r->precision;
nr++;
}
+ if (p->bps != ~0) {
+ pp.bps = p->bps;
+ np++;
+ }
+ if (r->bps != ~0) {
+ rp.bps = r->bps;
+ nr++;
+ }
+ if (p->msb != ~0) {
+ pp.msb = p->msb;
+ np++;
+ }
+ if (r->msb != ~0) {
+ rp.msb = r->msb;
+ nr++;
+ }
if (p->channels != ~0) {
pp.channels = p->channels;
np++;
pp.encoding = rp.encoding;
pp.channels = rp.channels;
pp.precision = rp.precision;
+ pp.bps = rp.bps;
+ pp.msb = rp.msb;
} else if (setmode == AUMODE_PLAY) {
rp.sample_rate = pp.sample_rate;
rp.encoding = pp.encoding;
rp.channels = pp.channels;
rp.precision = pp.precision;
+ rp.bps = pp.bps;
+ rp.msb = pp.msb;
}
}
sc->sc_rparams = rp;
if (r->block_size == ~0 || r->block_size == 0) {
fpb = rp.sample_rate * audio_blk_ms / 1000;
} else {
- fs = rp.channels * AUDIO_BPS(rp.precision);
+ fs = rp.channels * rp.bps;
fpb = (r->block_size * rp.factor) / fs;
}
if (sc->sc_rr.blkset == 0)
if (p->block_size == ~0 || p->block_size == 0) {
fpb = pp.sample_rate * audio_blk_ms / 1000;
} else {
- fs = pp.channels * AUDIO_BPS(pp.precision);
+ fs = pp.channels * pp.bps;
fpb = (p->block_size * pp.factor) / fs;
}
if (sc->sc_pr.blkset == 0)
r->channels = sc->sc_rparams.channels;
p->precision = sc->sc_pparams.precision;
r->precision = sc->sc_rparams.precision;
+ p->bps = sc->sc_pparams.bps;
+ r->bps = sc->sc_rparams.bps;
+ p->msb = sc->sc_pparams.msb;
+ r->msb = sc->sc_rparams.msb;
p->encoding = sc->sc_pparams.encoding;
r->encoding = sc->sc_rparams.encoding;
-/* $OpenBSD: audio_if.h,v 1.26 2008/04/21 00:32:42 jakemsr Exp $ */
+/* $OpenBSD: audio_if.h,v 1.27 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: audio_if.h,v 1.24 1998/01/10 14:07:25 tv Exp $ */
/*
#ifndef _SYS_DEV_AUDIO_IF_H_
#define _SYS_DEV_AUDIO_IF_H_
+#define AUDIO_BPS(bits) (bits) <= 8 ? 1 : ((bits) <= 16 ? 2 : 4)
+
/*
* Generic interface to hardware driver.
*/
u_long sample_rate; /* sample rate */
u_int encoding; /* mu-law, linear, etc */
u_int precision; /* bits/sample */
+ u_int bps; /* bytes/sample */
+ u_int msb; /* data alignment */
u_int channels; /* mono(1), stereo(2) */
/* Software en/decode functions, set if SW coding required by HW */
void (*sw_code)(void *, u_char *, int);
-/* $OpenBSD: btsco.c,v 1.4 2008/11/25 18:29:27 todd Exp $ */
+/* $OpenBSD: btsco.c,v 1.5 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: btsco.c,v 1.22 2008/08/06 15:01:23 plunky Exp $ */
/*-
ae->precision = 16;
ae->flags = 0;
break;
-
default:
err = EINVAL;
}
+ ae->bps = AUDIO_BPS(ae->precision);
+ ae->msb = 1;
return err;
}
p->sample_rate = 8000;
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
p->precision = 16;
+ p->bps = 2;
+ p->msb = 1;
p->channels = 1;
}
return 0;
-/* $OpenBSD: ac97.c,v 1.72 2010/02/25 21:22:42 ratchov Exp $ */
+/* $OpenBSD: ac97.c,v 1.73 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999, 2000 Constantine Sapuntzakis
48000, /* sample_rate */
AUDIO_ENCODING_SLINEAR_LE, /* encoding */
16, /* precision */
+ 2, /* bps */
+ 1, /* msb */
2, /* channels */
NULL, /* sw_code */
1 /* factor */
-/* $OpenBSD: ad1848.c,v 1.34 2010/06/30 11:21:35 jakemsr Exp $ */
+/* $OpenBSD: ad1848.c,v 1.35 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: ad1848.c,v 1.45 1998/01/30 02:02:38 augustss Exp $ */
/*
return EINVAL;
/*NOTREACHED*/
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = 1;
+ r->msb = 1;
sc->format_bits = bits;
sc->channels = p->channels;
-/* $OpenBSD: ess.c,v 1.15 2010/06/30 20:39:02 blambert Exp $ */
+/* $OpenBSD: ess.c,v 1.16 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: ess.c,v 1.44.4.1 1999/06/21 01:18:00 thorpej Exp $ */
/*
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
if (usemode == AUMODE_RECORD)
-/* $OpenBSD: gus.c,v 1.33 2009/08/26 22:29:09 jasper Exp $ */
+/* $OpenBSD: gus.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
r->sw_code = p->sw_code = swap_bytes;
break;
}
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
return 0;
}
return(EINVAL);
/*NOTREACHED*/
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
-/* $OpenBSD: sbdsp.c,v 1.30 2010/04/03 23:22:42 jakemsr Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.31 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
struct audio_encoding *fp;
{
struct sbdsp_softc *sc = addr;
- int emul;
+ int emul, found = 0;
emul = ISSB16CLASS(sc) ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return 0;
+ found = 1;
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ found = 1;
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ found = 1;
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = emul;
- return 0;
+ found = 1;
+ break;
}
- if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ)
+ if (found) {
+ fp->bps = 1;
+ fp->msb = 1;
+ return 0;
+ } else if (!ISSB16CLASS(sc) && sc->sc_model != SB_JAZZ)
return EINVAL;
switch(fp->index) {
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return 0;
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = emul;
- return 0;
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ fp->bps = 2;
+ fp->msb = 1;
return 0;
}
p->sw_code = swcode;
p->factor = factor;
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
DPRINTF(("sbdsp_set_params: model=%d, mode=%d, rate=%ld, prec=%d, chan=%d, enc=%d -> tc=%02x, cmd=%02x, bmode=%02x, cmdchan=%02x, swcode=%p, factor=%d\n",
sc->sc_model, mode, p->sample_rate, p->precision, p->channels,
p->encoding, tc, m->cmd, bmode, m->cmdchan, swcode, factor));
-/* $OpenBSD: auacer.c,v 1.6 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: auacer.c,v 1.7 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $ */
/*-
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return (0);
}
int
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
if (AC97_IS_FIXED_RATE(sc->codec_if))
p->sample_rate = AC97_SINGLE_RATE;
-/* $OpenBSD: auglx.c,v 1.3 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: auglx.c,v 1.4 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return 0;
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return 0;
}
default:
return EINVAL;
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
orate = adj_rate = play->sample_rate;
default:
return EINVAL;
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
orate = rec->sample_rate;
error = ac97_set_rate(sc->codec_if, AC97_REG_PCM_LR_ADC_RATE,
-/* $OpenBSD: auich.c,v 1.82 2010/06/07 23:35:24 ratchov Exp $ */
+/* $OpenBSD: auich.c,v 1.83 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2000,2001 Michael Shalayeff
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
+ aep->bps = 2;
+ aep->msb = 1;
return (0);
default:
return (EINVAL);
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+ return (0);
}
}
default:
return (EINVAL);
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
orate = adj_rate = play->sample_rate;
if (sc->sc_ac97rate != 0)
default:
return (EINVAL);
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
orate = rec->sample_rate;
if (sc->sc_ac97rate != 0)
-/* $OpenBSD: auixp.c,v 1.24 2009/10/12 19:43:52 jakemsr Exp $ */
+/* $OpenBSD: auixp.c,v 1.25 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
/*
aep->encoding = AUDIO_ENCODING_ULINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(aep->name, AudioEmulaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(aep->name, AudioEalaw, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ALAW;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(aep->name, AudioEslinear, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR;
aep->precision = 8;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(aep->name, AudioEslinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_LE;
aep->precision = 16;
aep->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(aep->name, AudioEulinear_le, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_LE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(aep->name, AudioEslinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_SLINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(aep->name, AudioEulinear_be, sizeof aep->name);
aep->encoding = AUDIO_ENCODING_ULINEAR_BE;
aep->precision = 16;
aep->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ aep->bps = AUDIO_BPS(aep->precision);
+ aep->msb = 1;
+
+ return (0);
}
default:
return (EINVAL);
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
temprate = play->sample_rate;
error = ac97_set_rate(co->codec_if,
default:
return (EINVAL);
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
error = ac97_set_rate(co->codec_if, AC97_REG_PCM_LR_ADC_RATE,
&rec->sample_rate);
-/* $OpenBSD: autri.c,v 1.24 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: autri.c,v 1.25 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return 0;
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
-/* $OpenBSD: auvia.c,v 1.44 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: auvia.c,v 1.45 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: auvia.c,v 1.28 2002/11/04 16:38:49 kent Exp $ */
/*-
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
+ fp->bps = 2;
+ fp->msb = 1;
return (0);
default:
return (EINVAL);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
}
+
void
auvia_set_params_sub(struct auvia_softc *sc, struct auvia_softc_chan *ch,
struct audio_params *p)
return (EINVAL);
}
auvia_set_params_sub(sc, ch, p);
+
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
-/* $OpenBSD: azalia.c,v 1.173 2010/06/27 21:47:07 jakemsr Exp $ */
+/* $OpenBSD: azalia.c,v 1.174 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_SLINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
}
}
par->sw_code = swcode;
+ par->bps = AUDIO_BPS(par->precision);
+ par->msb = 1;
return (0);
}
this->encs[i].index = i;
this->encs[i].encoding = encs[i] & 0xff;
this->encs[i].precision = encs[i] >> 8;
+ this->encs[i].bps = AUDIO_BPS(encs[i] >> 8);
+ this->encs[i].msb = 1;
this->encs[i].flags = 0;
switch (this->encs[i].encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
-/* $OpenBSD: cmpci.c,v 1.25 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: cmpci.c,v 1.26 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: cmpci.c,v 1.25 2004/10/26 06:32:20 xtraeme Exp $ */
/*
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return 0;
}
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_SLINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
if (mode & AUMODE_PLAY) {
if (sc->sc_play_channel == 1) {
cmpci_reg_partial_write_4(sc,
-/* $OpenBSD: cs4280.c,v 1.33 2009/01/20 20:00:06 grange Exp $ */
+/* $OpenBSD: cs4280.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */
/*
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
/* set sample rate */
-/* $OpenBSD: cs4281.c,v 1.22 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: cs4281.c,v 1.23 2010/07/15 03:43:11 jakemsr Exp $ */
/* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */
/*
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
/* set sample rate */
-/* $OpenBSD: eap.c,v 1.39 2010/06/20 10:22:25 ratchov Exp $ */
+/* $OpenBSD: eap.c,v 1.40 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */
/*
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
if (!sc->sc_1371) {
-/* $OpenBSD: emuxki.c,v 1.33 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: emuxki.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: emuxki.c,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */
/*-
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (0);
}
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
return (emuxki_voice_set_audioparms(voice, p->channels == 2,
b16, p->sample_rate));
-/* $OpenBSD: envy.c,v 1.36 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: envy.c,v 1.37 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
strlcpy(enc->name, AudioEslinear_le, sizeof(enc->name));
enc->encoding = AUDIO_ENCODING_SLINEAR_LE;
enc->precision = 24;
+ enc->bps = 4;
+ enc->msb = 1;
enc->flags = 0;
return 0;
}
if (setmode & AUMODE_PLAY) {
p->encoding = AUDIO_ENCODING_SLINEAR;
p->precision = 24;
+ p->bps = 4;
+ p->msb = 1;
p->channels = sc->isht ? sc->card->noch : ENVY_PCHANS;
}
if (setmode & AUMODE_RECORD) {
r->encoding = AUDIO_ENCODING_SLINEAR;
r->precision = 24;
+ r->bps = 4;
+ r->msb = 1;
r->channels = sc->isht ? sc->card->nich : ENVY_RCHANS;
}
return 0;
-/* $OpenBSD: esa.c,v 1.18 2009/11/13 02:22:19 deraadt Exp $ */
+/* $OpenBSD: esa.c,v 1.19 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */
/*
int esa_resume(struct esa_softc *);
static audio_encoding_t esa_encoding[] = {
- { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0 },
- { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, AUDIO_ENCODINGFLAG_EMULATED },
- { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8,
- AUDIO_ENCODINGFLAG_EMULATED }, /* XXX: Are you sure? */
- { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0 },
- { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16,
- AUDIO_ENCODINGFLAG_EMULATED },
- { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16,
- AUDIO_ENCODINGFLAG_EMULATED }
+ { 0, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0 },
+ { 1, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 2, AudioEalaw, AUDIO_ENCODING_ALAW, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 3, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 1, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 4, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0 },
+ { 5, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 6, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED },
+ { 7, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, 2, 1,
+ AUDIO_ENCODINGFLAG_EMULATED }
};
#define ESA_NENCODINGS 8
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
ch->mode = *p;
}
-/* $OpenBSD: eso.c,v 1.31 2010/05/23 11:41:07 deraadt Exp $ */
+/* $OpenBSD: eso.c,v 1.32 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: eso.c,v 1.48 2006/12/18 23:13:39 kleink Exp $ */
/*
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
return (0);
}
params->sample_rate = 48000;
params->encoding = AUDIO_ENCODING_ULINEAR_LE;
params->precision = 16;
+ params->bps = 2;
+ params->msb = 1;
params->channels = 2;
params->sw_code = NULL;
params->factor = 1;
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
/*
* We'll compute both possible sample rate dividers and pick
-/* $OpenBSD: fms.c,v 1.21 2010/04/04 00:50:36 jakemsr Exp $ */
+/* $OpenBSD: fms.c,v 1.22 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: fms.c,v 1.5.4.1 2000/06/30 16:27:50 simonb Exp $ */
/*-
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 1:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return 0;
+ break;
case 2:
strlcpy(fp->name, AudioEulinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return 0;
+ break;
case 3:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 4:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 5:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 6:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
case 7:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return 0;
+ break;
default:
return EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return 0;
}
void
default:
return EINVAL;
}
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
+
for (i = 0; i < 10 && play->sample_rate > fms_rates[i].limit;
i++)
;
default:
return EINVAL;
}
+ rec->bps = AUDIO_BPS(rec->precision);
+ rec->msb = 1;
+
for (i = 0; i < 10 && rec->sample_rate > fms_rates[i].limit;
i++)
;
-/* $OpenBSD: maestro.c,v 1.28 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: maestro.c,v 1.29 2010/07/15 03:43:11 jakemsr Exp $ */
/* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */
/*
* FreeBSD's ESS Agogo/Maestro driver
}
struct audio_encoding maestro_tab[] = {
- {0, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 0},
- {1, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 0},
- {2, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 0},
- {3, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16,
+ {0, AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16, 2, 1, 0},
+ {1, AudioEslinear, AUDIO_ENCODING_SLINEAR, 8, 1, 1, 0},
+ {2, AudioEulinear, AUDIO_ENCODING_ULINEAR, 8, 1, 1, 0},
+ {3, AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {4, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16,
+ {4, AudioEulinear_le, AUDIO_ENCODING_ULINEAR_LE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {5, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16,
+ {5, AudioEulinear_be, AUDIO_ENCODING_ULINEAR_BE, 16, 2, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {6, AudioEmulaw, AUDIO_ENCODING_ULAW, 8,
+ {6, AudioEmulaw, AUDIO_ENCODING_ULAW, 8, 1, 1,
AUDIO_ENCODINGFLAG_EMULATED},
- {7, AudioEalaw, AUDIO_ENCODING_ALAW, 8,
+ {7, AudioEalaw, AUDIO_ENCODING_ALAW, 8, 1, 1,
AUDIO_ENCODINGFLAG_EMULATED}
};
else if (play->encoding != AUDIO_ENCODING_SLINEAR_LE)
return (EINVAL);
+ play->bps = AUDIO_BPS(play->precision);
+ play->msb = 1;
+
maestro_set_speed(&sc->play, &play->sample_rate);
return (0);
}
-/* $OpenBSD: neo.c,v 1.23 2008/10/25 22:30:43 jakemsr Exp $ */
+/* $OpenBSD: neo.c,v 1.24 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
-
return (0);
}
-/* $OpenBSD: sv.c,v 1.26 2009/06/23 06:39:48 jsg Exp $ */
+/* $OpenBSD: sv.c,v 1.27 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1998 Constantine Paul Sapuntzakis
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
int
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
/* Set the encoding */
reg = sv_read_indirect(sc, SV_DMA_DATA_FORMAT);
-/* $OpenBSD: yds.c,v 1.33 2010/04/06 22:28:07 tedu Exp $ */
+/* $OpenBSD: yds.c,v 1.34 2010/07/15 03:43:11 jakemsr Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = 0;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
void
default:
return (EINVAL);
}
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
return 0;
-/* $OpenBSD: cs4231.c,v 1.29 2008/04/21 00:32:43 jakemsr Exp $ */
+/* $OpenBSD: cs4231.c,v 1.30 2010/07/15 03:43:11 jakemsr Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
default:
err = EINVAL;
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
return (err);
}
p->sw_code = pswcode;
r->sw_code = rswcode;
+ p->bps = AUDIO_BPS(p->precision);
+ r->bps = AUDIO_BPS(r->precision);
+ p->msb = r->msb = 1;
sc->sc_format_bits = bits;
sc->sc_channels = p->channels;
-/* $OpenBSD: uaudio.c,v 1.73 2009/12/04 20:50:59 jakemsr Exp $ */
+/* $OpenBSD: uaudio.c,v 1.74 2010/07/15 03:43:12 jakemsr Exp $ */
/* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */
/*
fp->encoding = AUDIO_ENCODING_ULINEAR;
fp->precision = 8;
fp->flags = flags&HAS_8U ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 1:
strlcpy(fp->name, AudioEmulaw, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULAW;
fp->precision = 8;
fp->flags = flags&HAS_MULAW ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 2:
strlcpy(fp->name, AudioEalaw, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ALAW;
fp->precision = 8;
fp->flags = flags&HAS_ALAW ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 3:
strlcpy(fp->name, AudioEslinear, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR;
fp->precision = 8;
fp->flags = flags&HAS_8 ? 0 : AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 4:
strlcpy(fp->name, AudioEslinear_le, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
fp->precision = 16;
fp->flags = 0;
- return (0);
+ break;
case 5:
strlcpy(fp->name, AudioEulinear_le, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 6:
strlcpy(fp->name, AudioEslinear_be, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
case 7:
strlcpy(fp->name, AudioEulinear_be, sizeof(fp->name));
fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
fp->precision = 16;
fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
- return (0);
+ break;
default:
return (EINVAL);
}
+ fp->bps = AUDIO_BPS(fp->precision);
+ fp->msb = 1;
+
+ return (0);
}
const usb_interface_descriptor_t *
p->sample_rate = 44100;
p->encoding = AUDIO_ENCODING_SLINEAR_LE;
p->precision = 16;
+ p->bps = 2;
+ p->msb = 1;
p->channels = 2;
p->sw_code = NULL;
p->factor = 1;
}
uaudio_match_alt(sc, p, mode, p->encoding, p->precision);
+
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
}
int
p->sw_code = swcode;
p->factor = factor;
+ p->bps = AUDIO_BPS(p->precision);
+ p->msb = 1;
+
if (mode == AUMODE_PLAY)
paltidx = i;
else
-/* $OpenBSD: audioio.h,v 1.20 2008/11/16 23:36:54 jakemsr Exp $ */
+/* $OpenBSD: audioio.h,v 1.21 2010/07/15 03:43:12 jakemsr Exp $ */
/* $NetBSD: audioio.h,v 1.24 1998/08/13 06:28:41 mrg Exp $ */
/*
u_int sample_rate; /* sample rate in bit/s */
u_int channels; /* number of channels, usually 1 or 2 */
u_int precision; /* number of bits/sample */
+ u_int bps; /* number of bytes/sample */
+ u_int msb; /* data alignment */
u_int encoding; /* data encoding (AUDIO_ENCODING_* below) */
u_int gain; /* volume level */
u_int port; /* selected I/O port */
char name[MAX_AUDIO_DEV_LEN];
int encoding;
int precision;
+ int bps;
+ int msb;
int flags;
#define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */
} audio_encoding_t;
-/* $OpenBSD: audioctl.c,v 1.20 2009/11/12 07:32:26 ratchov Exp $ */
+/* $OpenBSD: audioctl.c,v 1.21 2010/07/15 03:43:12 jakemsr Exp $ */
/* $NetBSD: audioctl.c,v 1.14 1998/04/27 16:55:23 augustss Exp $ */
/*
{ "play.sample_rate", &info.play.sample_rate, UINT, ALIAS },
{ "play.channels", &info.play.channels, UINT, 0 },
{ "play.precision", &info.play.precision, UINT, 0 },
+ { "play.bps", &info.play.bps, UINT, 0 },
+ { "play.msb", &info.play.msb, UINT, 0 },
{ "play.encoding", &info.play.encoding, ENC, 0 },
{ "play.gain", &info.play.gain, UINT, 0 },
{ "play.balance", &info.play.balance, UCHAR, 0 },
{ "record.sample_rate", &info.record.sample_rate,UINT, ALIAS },
{ "record.channels", &info.record.channels, UINT, 0 },
{ "record.precision", &info.record.precision, UINT, 0 },
+ { "record.bps", &info.record.bps, UINT, 0 },
+ { "record.msb", &info.record.msb, UINT, 0 },
{ "record.encoding", &info.record.encoding, ENC, 0 },
{ "record.gain", &info.record.gain, UINT, 0 },
{ "record.balance", &info.record.balance, UCHAR, 0 },
break;
if (pos)
encbuf[pos++] = ',';
- snprintf(encbuf+pos, sizeof(encbuf)-pos, "%s:%d%s",
- enc.name, enc.precision,
+ snprintf(encbuf+pos, sizeof(encbuf)-pos, "%s:%d:%d:%d%s",
+ enc.name, enc.precision, enc.bps, enc.msb,
enc.flags & AUDIO_ENCODINGFLAG_EMULATED ? "*" : "");
pos += strlen(encbuf+pos);
}