buffer.c (139749) | buffer.c (148606) |
---|---|
1/*- 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <dev/sound/pcm/sound.h> 28 29#include "feeder_if.h" 30 | 1/*- 2 * Copyright (c) 1999 Cameron Grant <cg@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <dev/sound/pcm/sound.h> 28 29#include "feeder_if.h" 30 |
31SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/buffer.c 139749 2005-01-06 01:43:34Z imp $"); | 31SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/buffer.c 148606 2005-07-31 16:16:22Z netchild $"); |
32 33struct snd_dbuf * 34sndbuf_create(device_t dev, char *drv, char *desc, struct pcm_channel *channel) 35{ 36 struct snd_dbuf *b; 37 38 b = malloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO); 39 snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", drv, desc); --- 241 unchanged lines hidden (view full) --- 281} 282 283int 284sndbuf_setfmt(struct snd_dbuf *b, u_int32_t fmt) 285{ 286 b->fmt = fmt; 287 b->bps = 1; 288 b->bps <<= (b->fmt & AFMT_STEREO)? 1 : 0; | 32 33struct snd_dbuf * 34sndbuf_create(device_t dev, char *drv, char *desc, struct pcm_channel *channel) 35{ 36 struct snd_dbuf *b; 37 38 b = malloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO); 39 snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", drv, desc); --- 241 unchanged lines hidden (view full) --- 281} 282 283int 284sndbuf_setfmt(struct snd_dbuf *b, u_int32_t fmt) 285{ 286 b->fmt = fmt; 287 b->bps = 1; 288 b->bps <<= (b->fmt & AFMT_STEREO)? 1 : 0; |
289 b->bps <<= (b->fmt & AFMT_16BIT)? 1 : 0; 290 b->bps <<= (b->fmt & AFMT_32BIT)? 2 : 0; | 289 if (b->fmt & AFMT_16BIT) 290 b->bps <<= 1; 291 else if (b->fmt & AFMT_24BIT) 292 b->bps *= 3; 293 else if (b->fmt & AFMT_32BIT) 294 b->bps <<= 2; |
291 return 0; 292} 293 294unsigned int 295sndbuf_getspd(struct snd_dbuf *b) 296{ 297 return b->spd; 298} --- 292 unchanged lines hidden --- | 295 return 0; 296} 297 298unsigned int 299sndbuf_getspd(struct snd_dbuf *b) 300{ 301 return b->spd; 302} --- 292 unchanged lines hidden --- |