liboss-commit Mailing List for Apple OS X libOSS (Page 3)
Brought to you by:
thesin
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(55) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(57) |
Nov
(52) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(16) |
Feb
(9) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Justin <th...@us...> - 2002-11-06 18:51:41
|
Update of /cvsroot/liboss/liboss/src In directory usw-pr-cvs1:/tmp/cvs-serv25516/src Modified Files: osscat.c Log Message: need to make a liboss_write for write calls, this is just the first version since i need to move some files I'll do that then finish this Index: osscat.c =================================================================== RCS file: /cvsroot/liboss/liboss/src/osscat.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- osscat.c 5 Nov 2002 22:07:28 -0000 1.9 +++ osscat.c 6 Nov 2002 18:51:35 -0000 1.10 @@ -1,8 +1,6 @@ #include "config.h" #include "soundcard.h" -#include <machine/endian.h> -#include <machine/byte_order.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> @@ -50,14 +48,8 @@ ioctl(play, SNDCTL_DSP_SPEED, &speed); while ( (sz = read(fd, buf, BUF_SIZE)) > 0 ) { + liboss_write(play, buf, sz); /* if it errors, keep going */ -#if BYTE_ORDER != ENDIAN - short* i; - for (i = (short*)buf; i < (short*)(buf + sz); ++i) - *i = NXSwapShort(*i); -#endif - - write(play, buf, sz); /* if it errors, keep going */ } return 0; |
From: Justin <th...@us...> - 2002-11-06 18:51:41
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv25516/include Modified Files: soundcard.h Log Message: need to make a liboss_write for write calls, this is just the first version since i need to move some files I'll do that then finish this Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- soundcard.h 6 Nov 2002 17:50:06 -0000 1.15 +++ soundcard.h 6 Nov 2002 18:51:34 -0000 1.16 @@ -111,6 +111,7 @@ /* Need native 16 bit format which depends on byte order */ #include <machine/endian.h> +#include <machine/byte_order.h> #if _BYTE_ORDER == _LITTLE_ENDIAN #define AFMT_S16_NE AFMT_S16_LE #else @@ -309,6 +310,8 @@ #include <stdarg.h> #include <unistd.h> +#include <esd.h> + #undef ioctl #undef open #undef close @@ -324,6 +327,8 @@ #ifndef LIBOSS_CLOSE # define LIBOSS_CLOSE close #endif + +extern int liboss_write (int, const void *, size_t); #ifndef LIBOSS_INTERNAL extern int liboss_ioctl (int,unsigned long,va_list); |
From: Justin <th...@us...> - 2002-11-06 18:51:41
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv25516/lib Modified Files: esddsp.c Log Message: need to make a liboss_write for write calls, this is just the first version since i need to move some files I'll do that then finish this Index: esddsp.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/esddsp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- esddsp.c 6 Nov 2002 03:14:54 -0000 1.7 +++ esddsp.c 6 Nov 2002 18:51:35 -0000 1.8 @@ -398,3 +398,16 @@ return (*func) (fd); } + +int +liboss_write (int play, const void *buf, size_t sz) +{ + int retval; + short* i; + + for (i = (short*)buf; i < (short*)(buf + sz); ++i) + *i = NXSwapShort(*i); + retval = write(play, buf, sz); /* if it errors, keep going */ + + return retval; +} |
From: Benjamin R. <ran...@us...> - 2002-11-06 18:14:58
|
Update of /cvsroot/liboss/liboss In directory usw-pr-cvs1:/tmp/cvs-serv7069 Modified Files: configure.in Log Message: ordering fixes Index: configure.in =================================================================== RCS file: /cvsroot/liboss/liboss/configure.in,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- configure.in 5 Nov 2002 17:35:32 -0000 1.29 +++ configure.in 6 Nov 2002 18:14:51 -0000 1.30 @@ -96,7 +96,7 @@ CLIENT_CFLAGS="$INCLUDES -Dopen=___sys_open -Dclose=___sys_close -Dioctl=___sys_ioctl -include soundcard.h" CPPFLAGS="$CPPFLAGS $CFLAGS" DEBUG_CFLAGS="$CFLAGS $DEBUG_CFLAGS" -LDFLAGS="$LDFLAGS -L${prefix}/lib" +LIBS="-L${prefix}/lib" AC_SUBST(NONPIC_CFLAGS) AC_SUBST(CLIENT_CFLAGS) @@ -169,6 +169,7 @@ esd=false; AC_MSG_CHECKING([for esd.h in little nooks and crannies]) for ESDDIR in ${esd_prefix} ${prefix} /usr /usr/local; do + ESDDIR=`echo "$ESDDIR" | sed 's,//*,/,g' | sed -e 's,/$,,'` if test -f "${ESDDIR}/include/esd.h"; then esd=true ESD_INCS="-I${ESDDIR}/include" @@ -183,17 +184,18 @@ AC_SUBST(ESD_INCS) LIBESD= +ESD_LDFLAGS= if test x$esd = xtrue; then AC_CHECK_LIB(esd,esd_open_sound,[ esd=true; - if test -n "${ESDDIR}"; then - LIBESD="-L${ESDDIR}/lib -lesd"; - else - LIBESD="-lesd"; + if test -n "${ESDDIR}" && test "${ESDDIR}/lib" != "${prefix}/lib"; then + ESD_LDFLAGS="-L${ESDDIR}/lib"; fi + LIBESD="-lesd"; ]) fi AC_SUBST(LIBESD) +AC_SUBST(ESD_LDFLAGS) AM_CONDITIONAL(ESD, test "x$esd" = "xtrue" ) |
From: Benjamin R. <ran...@us...> - 2002-11-06 18:14:55
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv7069/lib Modified Files: Makefile.am Log Message: ordering fixes Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/lib/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Makefile.am 5 Nov 2002 21:34:18 -0000 1.21 +++ Makefile.am 6 Nov 2002 18:14:52 -0000 1.22 @@ -10,7 +10,7 @@ liboss_la_DEPENDENCIES = liboss_la_LIBADD = $(COREAUDIO_LDFLAGS) $(LIBDL) $(LIBESD) liboss_la_LDFLAGS = -export-dynamic \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) $(ESD_LDFLAGS) include_HEADERS = |
From: Justin <th...@us...> - 2002-11-06 17:50:12
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv27677 Modified Files: soundcard.h Log Message: Oops Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- soundcard.h 6 Nov 2002 17:42:16 -0000 1.14 +++ soundcard.h 6 Nov 2002 17:50:06 -0000 1.15 @@ -338,6 +338,7 @@ va_start(l,y); result = liboss_ioctl(x,y,l); va_end (l); + return result; } static inline int LIBOSS_OPEN (const char* x, int y,...) |
From: Justin <th...@us...> - 2002-11-06 17:42:19
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv24494 Modified Files: soundcard.h Log Message: added calls to va_end for future hehe Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- soundcard.h 6 Nov 2002 17:36:34 -0000 1.13 +++ soundcard.h 6 Nov 2002 17:42:16 -0000 1.14 @@ -332,16 +332,23 @@ static inline int LIBOSS_IOCTL (int x, unsigned long y,...) { + int result; + va_list l; va_start(l,y); - return liboss_ioctl(x,y,l); + result = liboss_ioctl(x,y,l); + va_end (l); } static inline int LIBOSS_OPEN (const char* x, int y,...) { + int result; + va_list l; va_start(l,y); - return liboss_open(x,y,l); + result = liboss_open(x,y,l); + va_end (l); + return result; } static inline int LIBOSS_CLOSE (int x) {liboss_close(x); return x;} |
From: Benjamin R. <ran...@us...> - 2002-11-06 17:36:37
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv21347 Modified Files: soundcard.h Log Message: let you override the function names that get inlined Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- soundcard.h 6 Nov 2002 03:14:54 -0000 1.12 +++ soundcard.h 6 Nov 2002 17:36:34 -0000 1.13 @@ -312,26 +312,39 @@ #undef ioctl #undef open #undef close + +#ifndef LIBOSS_IOCTL +# define LIBOSS_IOCTL ioctl +#endif + +#ifndef LIBOSS_OPEN +# define LIBOSS_OPEN open +#endif + +#ifndef LIBOSS_CLOSE +# define LIBOSS_CLOSE close +#endif + #ifndef LIBOSS_INTERNAL extern int liboss_ioctl (int,unsigned long,va_list); extern int liboss_open (const char *,int,va_list); extern int liboss_close (int); -static inline int ioctl (int x, unsigned long y,...) +static inline int LIBOSS_IOCTL (int x, unsigned long y,...) { va_list l; va_start(l,y); return liboss_ioctl(x,y,l); } -static inline int open (const char* x, int y,...) +static inline int LIBOSS_OPEN (const char* x, int y,...) { va_list l; va_start(l,y); return liboss_open(x,y,l); } -static inline int close (int x) {liboss_close(x); return x;} +static inline int LIBOSS_CLOSE (int x) {liboss_close(x); return x;} #else extern int liboss_ioctl (int,unsigned long,va_list); extern int liboss_open (const char *,int,va_list); |
From: Justin <th...@us...> - 2002-11-06 04:34:12
|
Update of /cvsroot/liboss/liboss In directory usw-pr-cvs1:/tmp/cvs-serv21349 Modified Files: Makefile.am Log Message: Don't ask Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Makefile.am 6 Nov 2002 04:32:21 -0000 1.8 +++ Makefile.am 6 Nov 2002 04:34:10 -0000 1.9 @@ -2,7 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -SUBDIRS = include lib bin doc +SUBDIRS = include lib src doc noinst_HEADERS = config.h |
From: Justin <th...@us...> - 2002-11-06 04:32:24
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv20914/lib Modified Files: liboss.c Added Files: ossaudio.c Log Message: adding netbsd files for reference for now, BTW it will compile it, but the is no hijack code, might be useful though --- NEW FILE: ossaudio.c --- /* $NetBSD: ossaudio.c,v 1.10.4.4 2001/12/27 12:33:41 he Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * This is an OSS (Linux) sound API emulator. * It provides the essentials of the API. */ /* XXX This file is essentially the same as sys/compat/ossaudio.c. * With some preprocessor magic it could be the same file. */ #include <string.h> #include <sys/types.h> #include <sys/ioctl.h> #include "audioio.h" #include <sys/stat.h> #include <errno.h> #include "soundcard_oss.h" #undef ioctl #define GET_DEV(com) ((com) & 0xff) #define TO_OSSVOL(x) (((x) * 100 + 127) / 255) #define FROM_OSSVOL(x) ((((x) > 100 ? 100 : (x)) * 255 + 50) / 100) static struct audiodevinfo *getdevinfo(int); static void setblocksize(int, struct audio_info *); static int audio_ioctl(int, unsigned long, void *); static int mixer_ioctl(int, unsigned long, void *); static int opaque_to_enum(struct audiodevinfo *di, audio_mixer_name_t *label, int opq); static int enum_to_ord(struct audiodevinfo *di, int enm); static int enum_to_mask(struct audiodevinfo *di, int enm); #define INTARG (*(int*)argp) int _oss_ioctl(int fd, unsigned long com, void *argp) { if (IOCGROUP(com) == 'P') return audio_ioctl(fd, com, argp); else if (IOCGROUP(com) == 'M') return mixer_ioctl(fd, com, argp); else return ioctl(fd, com, argp); } static int audio_ioctl(int fd, unsigned long com, void *argp) { struct audio_info tmpinfo; struct audio_offset tmpoffs; struct audio_buf_info bufinfo; struct count_info cntinfo; struct audio_encoding tmpenc; u_int u; int idat, idata; int retval; switch (com) { case SNDCTL_DSP_RESET: retval = ioctl(fd, AUDIO_FLUSH, 0); if (retval < 0) return retval; break; case SNDCTL_DSP_SYNC: retval = ioctl(fd, AUDIO_DRAIN, 0); if (retval < 0) return retval; break; case SNDCTL_DSP_POST: /* This call is merely advisory, and may be a nop. */ break; case SNDCTL_DSP_SPEED: AUDIO_INITINFO(&tmpinfo); tmpinfo.play.sample_rate = tmpinfo.record.sample_rate = INTARG; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_RATE: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; INTARG = tmpinfo.play.sample_rate; break; case SNDCTL_DSP_STEREO: AUDIO_INITINFO(&tmpinfo); tmpinfo.play.channels = tmpinfo.record.channels = INTARG ? 2 : 1; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; INTARG = tmpinfo.play.channels - 1; break; case SNDCTL_DSP_GETBLKSIZE: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); INTARG = tmpinfo.blocksize; break; case SNDCTL_DSP_SETFMT: AUDIO_INITINFO(&tmpinfo); switch (INTARG) { case AFMT_MU_LAW: tmpinfo.play.precision = tmpinfo.record.precision = 8; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ULAW; break; case AFMT_A_LAW: tmpinfo.play.precision = tmpinfo.record.precision = 8; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ALAW; break; case AFMT_U8: tmpinfo.play.precision = tmpinfo.record.precision = 8; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR; break; case AFMT_S8: tmpinfo.play.precision = tmpinfo.record.precision = 8; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR; break; case AFMT_S16_LE: tmpinfo.play.precision = tmpinfo.record.precision = 16; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_LE; break; case AFMT_S16_BE: tmpinfo.play.precision = tmpinfo.record.precision = 16; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_SLINEAR_BE; break; case AFMT_U16_LE: tmpinfo.play.precision = tmpinfo.record.precision = 16; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_LE; break; case AFMT_U16_BE: tmpinfo.play.precision = tmpinfo.record.precision = 16; tmpinfo.play.encoding = tmpinfo.record.encoding = AUDIO_ENCODING_ULINEAR_BE; break; default: return EINVAL; } (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_BITS: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; switch (tmpinfo.play.encoding) { case AUDIO_ENCODING_ULAW: idat = AFMT_MU_LAW; break; case AUDIO_ENCODING_ALAW: idat = AFMT_A_LAW; break; case AUDIO_ENCODING_SLINEAR_LE: if (tmpinfo.play.precision == 16) idat = AFMT_S16_LE; else idat = AFMT_S8; break; case AUDIO_ENCODING_SLINEAR_BE: if (tmpinfo.play.precision == 16) idat = AFMT_S16_BE; else idat = AFMT_S8; break; case AUDIO_ENCODING_ULINEAR_LE: if (tmpinfo.play.precision == 16) idat = AFMT_U16_LE; else idat = AFMT_U8; break; case AUDIO_ENCODING_ULINEAR_BE: if (tmpinfo.play.precision == 16) idat = AFMT_U16_BE; else idat = AFMT_U8; break; case AUDIO_ENCODING_ADPCM: idat = AFMT_IMA_ADPCM; break; } INTARG = idat; break; case SNDCTL_DSP_CHANNELS: AUDIO_INITINFO(&tmpinfo); tmpinfo.play.channels = tmpinfo.record.channels = INTARG; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_CHANNELS: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; INTARG = tmpinfo.play.channels; break; case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_READ_FILTER: errno = EINVAL; return -1; /* XXX unimplemented */ case SNDCTL_DSP_SUBDIVIDE: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); idat = INTARG; if (idat == 0) idat = tmpinfo.play.buffer_size / tmpinfo.blocksize; idat = (tmpinfo.play.buffer_size / idat) & -4; AUDIO_INITINFO(&tmpinfo); tmpinfo.blocksize = idat; retval = ioctl(fd, AUDIO_SETINFO, &tmpinfo); if (retval < 0) return retval; INTARG = tmpinfo.play.buffer_size / tmpinfo.blocksize; break; case SNDCTL_DSP_SETFRAGMENT: AUDIO_INITINFO(&tmpinfo); idat = INTARG; if ((idat & 0xffff) < 4 || (idat & 0xffff) > 17) return EINVAL; tmpinfo.blocksize = 1 << (idat & 0xffff); tmpinfo.hiwat = ((unsigned)idat >> 16) & 0x7fff; if (tmpinfo.hiwat == 0) /* 0 means set to max */ tmpinfo.hiwat = 65536; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; u = tmpinfo.blocksize; for(idat = 0; u > 1; idat++, u >>= 1) ; idat |= (tmpinfo.hiwat & 0x7fff) << 16; INTARG = idat; break; case SNDCTL_DSP_GETFMTS: for(idat = 0, tmpenc.index = 0; ioctl(fd, AUDIO_GETENC, &tmpenc) == 0; tmpenc.index++) { switch(tmpenc.encoding) { case AUDIO_ENCODING_ULAW: idat |= AFMT_MU_LAW; break; case AUDIO_ENCODING_ALAW: idat |= AFMT_A_LAW; break; case AUDIO_ENCODING_SLINEAR: idat |= AFMT_S8; break; case AUDIO_ENCODING_SLINEAR_LE: if (tmpenc.precision == 16) idat |= AFMT_S16_LE; else idat |= AFMT_S8; break; case AUDIO_ENCODING_SLINEAR_BE: if (tmpenc.precision == 16) idat |= AFMT_S16_BE; else idat |= AFMT_S8; break; case AUDIO_ENCODING_ULINEAR: idat |= AFMT_U8; break; case AUDIO_ENCODING_ULINEAR_LE: if (tmpenc.precision == 16) idat |= AFMT_U16_LE; else idat |= AFMT_U8; break; case AUDIO_ENCODING_ULINEAR_BE: if (tmpenc.precision == 16) idat |= AFMT_U16_BE; else idat |= AFMT_U8; break; case AUDIO_ENCODING_ADPCM: idat |= AFMT_IMA_ADPCM; break; default: break; } } INTARG = idat; break; case SNDCTL_DSP_GETOSPACE: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); bufinfo.fragsize = tmpinfo.blocksize; bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.play.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek; *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_GETISPACE: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); bufinfo.fragsize = tmpinfo.blocksize; bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.record.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek; *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_NONBLOCK: idat = 1; retval = ioctl(fd, FIONBIO, &idat); if (retval < 0) return retval; break; case SNDCTL_DSP_GETCAPS: retval = ioctl(fd, AUDIO_GETPROPS, &idata); if (retval < 0) return retval; idat = DSP_CAP_TRIGGER; /* pretend we have trigger */ if (idata & AUDIO_PROP_FULLDUPLEX) idat |= DSP_CAP_DUPLEX; if (idata & AUDIO_PROP_MMAP) idat |= DSP_CAP_MMAP; INTARG = idat; break; #if 0 case SNDCTL_DSP_GETTRIGGER: retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; idat = (tmpinfo.play.pause ? 0 : PCM_ENABLE_OUTPUT) | (tmpinfo.record.pause ? 0 : PCM_ENABLE_INPUT); retval = copyout(&idat, SCARG(uap, data), sizeof idat); if (retval < 0) return retval; break; case SNDCTL_DSP_SETTRIGGER: AUDIO_INITINFO(&tmpinfo); retval = copyin(SCARG(uap, data), &idat, sizeof idat); if (retval < 0) return retval; tmpinfo.play.pause = (idat & PCM_ENABLE_OUTPUT) == 0; tmpinfo.record.pause = (idat & PCM_ENABLE_INPUT) == 0; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = copyout(&idat, SCARG(uap, data), sizeof idat); if (retval < 0) return retval; break; #else case SNDCTL_DSP_GETTRIGGER: case SNDCTL_DSP_SETTRIGGER: /* XXX Do nothing for now. */ INTARG = PCM_ENABLE_OUTPUT; break; #endif case SNDCTL_DSP_GETIPTR: retval = ioctl(fd, AUDIO_GETIOFFS, &tmpoffs); if (retval < 0) return retval; cntinfo.bytes = tmpoffs.samples; cntinfo.blocks = tmpoffs.deltablks; cntinfo.ptr = tmpoffs.offset; *(struct count_info *)argp = cntinfo; break; case SNDCTL_DSP_GETOPTR: retval = ioctl(fd, AUDIO_GETOOFFS, &tmpoffs); if (retval < 0) return retval; cntinfo.bytes = tmpoffs.samples; cntinfo.blocks = tmpoffs.deltablks; cntinfo.ptr = tmpoffs.offset; *(struct count_info *)argp = cntinfo; break; case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: case SNDCTL_DSP_SETSYNCRO: case SNDCTL_DSP_SETDUPLEX: case SNDCTL_DSP_PROFILE: errno = EINVAL; return -1; /* XXX unimplemented */ default: errno = EINVAL; return -1; } return 0; } /* If the NetBSD mixer device should have more than NETBSD_MAXDEVS devices * some will not be available to Linux */ #define NETBSD_MAXDEVS 64 struct audiodevinfo { int done; dev_t dev; int16_t devmap[SOUND_MIXER_NRDEVICES], rdevmap[NETBSD_MAXDEVS]; char names[NETBSD_MAXDEVS][MAX_AUDIO_DEV_LEN]; int enum2opaque[NETBSD_MAXDEVS]; u_long devmask, recmask, stereomask; u_long caps, source; }; static int opaque_to_enum(struct audiodevinfo *di, audio_mixer_name_t *label, int opq) { int i, o; for (i = 0; i < NETBSD_MAXDEVS; i++) { o = di->enum2opaque[i]; if (o == opq) break; if (o == -1 && label != NULL && !strncmp(di->names[i], label->name, sizeof di->names[i])) { di->enum2opaque[i] = opq; break; } } if (i >= NETBSD_MAXDEVS) i = -1; /*printf("opq_to_enum %s %d -> %d\n", label->name, opq, i);*/ return (i); } static int enum_to_ord(struct audiodevinfo *di, int enm) { if (enm >= NETBSD_MAXDEVS) return (-1); /*printf("enum_to_ord %d -> %d\n", enm, di->enum2opaque[enm]);*/ return (di->enum2opaque[enm]); } static int enum_to_mask(struct audiodevinfo *di, int enm) { int m; if (enm >= NETBSD_MAXDEVS) return (0); m = di->enum2opaque[enm]; if (m == -1) m = 0; /*printf("enum_to_mask %d -> %d\n", enm, di->enum2opaque[enm]);*/ return (m); } /* * Collect the audio device information to allow faster * emulation of the Linux mixer ioctls. Cache the information * to eliminate the overhead of repeating all the ioctls needed * to collect the information. */ static struct audiodevinfo * getdevinfo(int fd) { mixer_devinfo_t mi; int i, j, e; static struct { char *name; int code; } *dp, devs[] = { { AudioNmicrophone, SOUND_MIXER_MIC }, { AudioNline, SOUND_MIXER_LINE }, { AudioNcd, SOUND_MIXER_CD }, { AudioNdac, SOUND_MIXER_PCM }, { AudioNrecord, SOUND_MIXER_IMIX }, { AudioNmaster, SOUND_MIXER_VOLUME }, { AudioNtreble, SOUND_MIXER_TREBLE }, { AudioNbass, SOUND_MIXER_BASS }, { AudioNspeaker, SOUND_MIXER_SPEAKER }, /* { AudioNheadphone, ?? },*/ { AudioNoutput, SOUND_MIXER_OGAIN }, { AudioNinput, SOUND_MIXER_IGAIN }, /* { AudioNmaster, SOUND_MIXER_SPEAKER },*/ /* { AudioNstereo, ?? },*/ /* { AudioNmono, ?? },*/ { AudioNfmsynth, SOUND_MIXER_SYNTH }, /* { AudioNwave, SOUND_MIXER_PCM },*/ { AudioNmidi, SOUND_MIXER_SYNTH }, /* { AudioNmixerout, ?? },*/ { 0, -1 } }; static struct audiodevinfo devcache = { 0 }; struct audiodevinfo *di = &devcache; struct stat sb; /* Figure out what device it is so we can check if the * cached data is valid. */ if (fstat(fd, &sb) < 0) return 0; if (di->done && di->dev == sb.st_dev) return di; di->done = 1; di->dev = sb.st_dev; di->devmask = 0; di->recmask = 0; di->stereomask = 0; di->source = ~0; di->caps = 0; for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) di->devmap[i] = -1; for(i = 0; i < NETBSD_MAXDEVS; i++) { di->rdevmap[i] = -1; di->names[i][0] = '\0'; di->enum2opaque[i] = -1; } for(i = 0; i < NETBSD_MAXDEVS; i++) { mi.index = i; if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0) break; switch(mi.type) { case AUDIO_MIXER_VALUE: for(dp = devs; dp->name; dp++) if (strcmp(dp->name, mi.label.name) == 0) break; if (dp->code >= 0) { di->devmap[dp->code] = i; di->rdevmap[i] = dp->code; di->devmask |= 1 << dp->code; if (mi.un.v.num_channels == 2) di->stereomask |= 1 << dp->code; strncpy(di->names[i], mi.label.name, sizeof di->names[i]); } break; } } for(i = 0; i < NETBSD_MAXDEVS; i++) { mi.index = i; if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0) break; if (strcmp(mi.label.name, AudioNsource) != 0) continue; di->source = i; switch(mi.type) { case AUDIO_MIXER_ENUM: for(j = 0; j < mi.un.e.num_mem; j++) { e = opaque_to_enum(di, &mi.un.e.member[j].label, mi.un.e.member[j].ord); if (e >= 0) di->recmask |= 1 << di->rdevmap[e]; } di->caps = SOUND_CAP_EXCL_INPUT; break; case AUDIO_MIXER_SET: for(j = 0; j < mi.un.s.num_mem; j++) { e = opaque_to_enum(di, &mi.un.s.member[j].label, mi.un.s.member[j].mask); if (e >= 0) di->recmask |= 1 << di->rdevmap[e]; } break; } } return di; } int mixer_ioctl(int fd, unsigned long com, void *argp) { struct audiodevinfo *di; struct mixer_info *omi; struct audio_device adev; mixer_ctrl_t mc; int idat; int i; int retval; int l, r, n, error, e; di = getdevinfo(fd); if (di == 0) return -1; switch (com) { case OSS_GETVERSION: idat = SOUND_VERSION; break; case SOUND_MIXER_INFO: case SOUND_OLD_MIXER_INFO: error = ioctl(fd, AUDIO_GETDEV, &adev); if (error) return (error); omi = argp; if (com == SOUND_MIXER_INFO) omi->modify_counter = 1; strncpy(omi->id, adev.name, sizeof omi->id); strncpy(omi->name, adev.name, sizeof omi->name); return 0; case SOUND_MIXER_READ_RECSRC: if (di->source == -1) return EINVAL; mc.dev = di->source; if (di->caps & SOUND_CAP_EXCL_INPUT) { mc.type = AUDIO_MIXER_ENUM; retval = ioctl(fd, AUDIO_MIXER_READ, &mc); if (retval < 0) return retval; e = opaque_to_enum(di, NULL, mc.un.ord); if (e >= 0) idat = 1 << di->rdevmap[e]; } else { mc.type = AUDIO_MIXER_SET; retval = ioctl(fd, AUDIO_MIXER_READ, &mc); if (retval < 0) return retval; e = opaque_to_enum(di, NULL, mc.un.mask); if (e >= 0) idat = 1 << di->rdevmap[e]; } break; case SOUND_MIXER_READ_DEVMASK: idat = di->devmask; break; case SOUND_MIXER_READ_RECMASK: idat = di->recmask; break; case SOUND_MIXER_READ_STEREODEVS: idat = di->stereomask; break; case SOUND_MIXER_READ_CAPS: idat = di->caps; break; case SOUND_MIXER_WRITE_RECSRC: case SOUND_MIXER_WRITE_R_RECSRC: if (di->source == -1) return EINVAL; mc.dev = di->source; idat = INTARG; if (di->caps & SOUND_CAP_EXCL_INPUT) { mc.type = AUDIO_MIXER_ENUM; for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) if (idat & (1 << i)) break; if (i >= SOUND_MIXER_NRDEVICES || di->devmap[i] == -1) return EINVAL; mc.un.ord = enum_to_ord(di, di->devmap[i]); } else { mc.type = AUDIO_MIXER_SET; mc.un.mask = 0; for(i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (idat & (1 << i)) { if (di->devmap[i] == -1) return EINVAL; mc.un.mask |= enum_to_mask(di, di->devmap[i]); } } } return ioctl(fd, AUDIO_MIXER_WRITE, &mc); default: if (MIXER_READ(SOUND_MIXER_FIRST) <= com && com < MIXER_READ(SOUND_MIXER_NRDEVICES)) { n = GET_DEV(com); if (di->devmap[n] == -1) return EINVAL; mc.dev = di->devmap[n]; mc.type = AUDIO_MIXER_VALUE; doread: mc.un.value.num_channels = di->stereomask & (1<<n) ? 2 : 1; retval = ioctl(fd, AUDIO_MIXER_READ, &mc); if (retval < 0) return retval; if (mc.type != AUDIO_MIXER_VALUE) return EINVAL; if (mc.un.value.num_channels != 2) { l = r = mc.un.value.level[AUDIO_MIXER_LEVEL_MONO]; } else { l = mc.un.value.level[AUDIO_MIXER_LEVEL_LEFT]; r = mc.un.value.level[AUDIO_MIXER_LEVEL_RIGHT]; } idat = TO_OSSVOL(l) | (TO_OSSVOL(r) << 8); break; } else if ((MIXER_WRITE_R(SOUND_MIXER_FIRST) <= com && com < MIXER_WRITE_R(SOUND_MIXER_NRDEVICES)) || (MIXER_WRITE(SOUND_MIXER_FIRST) <= com && com < MIXER_WRITE(SOUND_MIXER_NRDEVICES))) { n = GET_DEV(com); if (di->devmap[n] == -1) return EINVAL; idat = INTARG; l = FROM_OSSVOL( idat & 0xff); r = FROM_OSSVOL((idat >> 8) & 0xff); mc.dev = di->devmap[n]; mc.type = AUDIO_MIXER_VALUE; if (di->stereomask & (1<<n)) { mc.un.value.num_channels = 2; mc.un.value.level[AUDIO_MIXER_LEVEL_LEFT] = l; mc.un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = r; } else { mc.un.value.num_channels = 1; mc.un.value.level[AUDIO_MIXER_LEVEL_MONO] = (l+r)/2; } retval = ioctl(fd, AUDIO_MIXER_WRITE, &mc); if (retval < 0) return retval; if (MIXER_WRITE(SOUND_MIXER_FIRST) <= com && com < MIXER_WRITE(SOUND_MIXER_NRDEVICES)) return 0; goto doread; } else { errno = EINVAL; return -1; } } INTARG = idat; return 0; } /* * Check that the blocksize is a power of 2 as OSS wants. * If not, set it to be. */ static void setblocksize(int fd, struct audio_info *info) { struct audio_info set; int s; if (info->blocksize & (info->blocksize-1)) { for(s = 32; s < info->blocksize; s <<= 1) ; AUDIO_INITINFO(&set); set.blocksize = s; ioctl(fd, AUDIO_SETINFO, &set); ioctl(fd, AUDIO_GETINFO, info); } } Index: liboss.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/liboss.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- liboss.c 5 Nov 2002 21:34:18 -0000 1.9 +++ liboss.c 6 Nov 2002 04:32:21 -0000 1.10 @@ -59,6 +59,7 @@ # include <CoreAudio/CoreAudio.h> #endif +#include "audioio.h" #include "soundcard.h" #undef ioctl @@ -247,50 +248,50 @@ static int oss_audio_ioctl(int fd, unsigned long com, void *argp) { - /* int retval = 0; */ + int retval = 0; /* FIXME: implement */ switch (com) { case SNDCTL_DSP_RESET: -/* retval = ioctl(fd, AUDIO_FLUSH, 0); + retval = ioctl(fd, AUDIO_FLUSH, 0); if (retval < 0) - return retval; */ + return retval; break; case SNDCTL_DSP_SYNC: -/* retval = ioctl(fd, AUDIO_DRAIN, 0); + retval = ioctl(fd, AUDIO_DRAIN, 0); if (retval < 0) - return retval; */ + return retval; break; case SNDCTL_DSP_POST: /* This call is merely advisory, and may be a nop. */ /* Except that it is relevant for fragment implementations */ break; case SNDCTL_DSP_SPEED: -/* tmpinfo.play.sample_rate = + tmpinfo.play.sample_rate = tmpinfo.record.sample_rate = INTARG; - (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); */ + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_RATE: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; - INTARG = tmpinfo.play.sample_rate; */ + INTARG = tmpinfo.play.sample_rate; break; case SNDCTL_DSP_STEREO: -/* tmpinfo.play.channels = + tmpinfo.play.channels = tmpinfo.record.channels = INTARG ? 2 : 1; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; - INTARG = tmpinfo.play.channels - 1; */ + INTARG = tmpinfo.play.channels - 1; break; case SNDCTL_DSP_GETBLKSIZE: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); - INTARG = tmpinfo.blocksize; */ + INTARG = tmpinfo.blocksize; break; case SNDCTL_DSP_SETFMT: switch (INTARG) { /* FIXME: add 32-bit, _NE, etc; remove A_LAW? */ @@ -313,10 +314,10 @@ default: return EINVAL; } -/* (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); */ + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_BITS: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; switch (tmpinfo.play.encoding) { @@ -354,25 +355,25 @@ idat = AFMT_IMA_ADPCM; break; } - INTARG = idat; */ + INTARG = idat; break; case SNDCTL_DSP_CHANNELS: -/* tmpinfo.play.channels = + tmpinfo.play.channels = tmpinfo.record.channels = INTARG; - (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); */ + (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); /* FALLTHRU */ case SOUND_PCM_READ_CHANNELS: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; - INTARG = tmpinfo.play.channels; */ + INTARG = tmpinfo.play.channels; break; case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_READ_FILTER: errno = EINVAL; - return -1; /* XXX unimplemented */ + return -1; /* XXX unimplemented case SNDCTL_DSP_SUBDIVIDE: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); @@ -385,17 +386,17 @@ retval = ioctl(fd, AUDIO_SETINFO, &tmpinfo); if (retval < 0) return retval; - INTARG = tmpinfo.play.buffer_size / tmpinfo.blocksize; */ + INTARG = tmpinfo.play.buffer_size / tmpinfo.blocksize; break; case SNDCTL_DSP_SETFRAGMENT: -/* AUDIO_INITINFO(&tmpinfo); + AUDIO_INITINFO(&tmpinfo); idat = INTARG; if ((idat & 0xffff) < 4 || (idat & 0xffff) > 17) return EINVAL; tmpinfo.blocksize = 1 << (idat & 0xffff); tmpinfo.hiwat = ((unsigned)idat >> 16) & 0x7fff; - if (tmpinfo.hiwat == 0) */ /* 0 means set to max */ -/* tmpinfo.hiwat = 65536; + if (tmpinfo.hiwat == 0) /* 0 means set to max */ + tmpinfo.hiwat = 65536; (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) @@ -407,7 +408,7 @@ INTARG = idat; */ break; case SNDCTL_DSP_GETFMTS: -/* for(idat = 0, tmpenc.index = 0; + for(idat = 0, tmpenc.index = 0; ioctl(fd, AUDIO_GETENC, &tmpenc) == 0; tmpenc.index++) { switch(tmpenc.encoding) { @@ -454,10 +455,10 @@ break; } } - INTARG = idat; */ + INTARG = idat; break; case SNDCTL_DSP_GETOSPACE: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); @@ -466,10 +467,10 @@ (tmpinfo.play.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek; - *(struct audio_buf_info *)argp = bufinfo; */ + *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_GETISPACE: -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; setblocksize(fd, &tmpinfo); @@ -478,38 +479,38 @@ (tmpinfo.record.seek + tmpinfo.blocksize - 1)/tmpinfo.blocksize; bufinfo.fragstotal = tmpinfo.hiwat; bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek; - *(struct audio_buf_info *)argp = bufinfo; */ + *(struct audio_buf_info *)argp = bufinfo; break; case SNDCTL_DSP_NONBLOCK: -/* idat = 1; + idat = 1; retval = ioctl(fd, FIONBIO, &idat); if (retval < 0) - return retval; */ + return retval; break; case SNDCTL_DSP_GETCAPS: -/* retval = ioctl(fd, AUDIO_GETPROPS, &idata); + retval = ioctl(fd, AUDIO_GETPROPS, &idata); if (retval < 0) return retval; - idat = DSP_CAP_TRIGGER; */ /* pretend we have trigger */ -/* if (idata & AUDIO_PROP_FULLDUPLEX) + idat = DSP_CAP_TRIGGER; /* pretend we have trigger */ + if (idata & AUDIO_PROP_FULLDUPLEX) idat |= DSP_CAP_DUPLEX; if (idata & AUDIO_PROP_MMAP) idat |= DSP_CAP_MMAP; - INTARG = idat; */ + INTARG = idat; break; case SNDCTL_DSP_GETTRIGGER: /* This was #if 0'd out. Why? */ -/* retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); + retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); if (retval < 0) return retval; idat = (tmpinfo.play.pause ? 0 : PCM_ENABLE_OUTPUT) | (tmpinfo.record.pause ? 0 : PCM_ENABLE_INPUT); retval = copyout(&idat, SCARG(uap, data), sizeof idat); if (retval < 0) - return retval; */ + return retval; break; case SNDCTL_DSP_SETTRIGGER: -/* AUDIO_INITINFO(&tmpinfo); + AUDIO_INITINFO(&tmpinfo); retval = copyin(SCARG(uap, data), &idat, sizeof idat); if (retval < 0) return retval; @@ -518,25 +519,25 @@ (void) ioctl(fd, AUDIO_SETINFO, &tmpinfo); retval = copyout(&idat, SCARG(uap, data), sizeof idat); if (retval < 0) - return retval; */ + return retval; break; case SNDCTL_DSP_GETIPTR: -/* retval = ioctl(fd, AUDIO_GETIOFFS, &tmpoffs); + retval = ioctl(fd, AUDIO_GETIOFFS, &tmpoffs); if (retval < 0) return retval; cntinfo.bytes = tmpoffs.samples; cntinfo.blocks = tmpoffs.deltablks; cntinfo.ptr = tmpoffs.offset; - *(struct count_info *)argp = cntinfo; */ + *(struct count_info *)argp = cntinfo; break; case SNDCTL_DSP_GETOPTR: -/* retval = ioctl(fd, AUDIO_GETOOFFS, &tmpoffs); + retval = ioctl(fd, AUDIO_GETOOFFS, &tmpoffs); if (retval < 0) return retval; cntinfo.bytes = tmpoffs.samples; cntinfo.blocks = tmpoffs.deltablks; cntinfo.ptr = tmpoffs.offset; - *(struct count_info *)argp = cntinfo; */ + *(struct count_info *)argp = cntinfo; break; case SNDCTL_DSP_MAPINBUF: case SNDCTL_DSP_MAPOUTBUF: @@ -560,7 +561,7 @@ errno = EINVAL; return -1; -/* struct audiodevinfo *di; + struct audiodevinfo *di; struct mixer_info *omi; struct audio_device adev; mixer_ctrl_t mc; @@ -705,5 +706,5 @@ } } INTARG = idat; - return 0; */ + return 0; } |
From: Justin <th...@us...> - 2002-11-06 04:32:24
|
Update of /cvsroot/liboss/liboss In directory usw-pr-cvs1:/tmp/cvs-serv20914 Modified Files: Makefile.am Log Message: adding netbsd files for reference for now, BTW it will compile it, but the is no hijack code, might be useful though Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Makefile.am 28 Oct 2002 05:30:39 -0000 1.7 +++ Makefile.am 6 Nov 2002 04:32:21 -0000 1.8 @@ -2,7 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -SUBDIRS = include lib src doc +SUBDIRS = include lib bin doc noinst_HEADERS = config.h |
From: Justin <th...@us...> - 2002-11-06 04:32:24
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv20914/include Added Files: soundcard_oss.h Log Message: adding netbsd files for reference for now, BTW it will compile it, but the is no hijack code, might be useful though --- NEW FILE: soundcard_oss.h --- /* $NetBSD: soundcard.h,v 1.13 2002/05/27 14:42:15 wiz Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Lennart Augustsson. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * WARNING! WARNING! * This is an OSS (Linux) audio emulator. * Use the Native NetBSD API for developing new code, and this * only for compiling Linux programs. */ #ifndef _SOUNDCARD_H_ #define _SOUNDCARD_H_ #define SOUND_VERSION 0x030001 #define SNDCTL_DSP_RESET _IO ('P', 0) #define SNDCTL_DSP_SYNC _IO ('P', 1) #define SNDCTL_DSP_SPEED _IOWR('P', 2, int) #define SOUND_PCM_READ_RATE _IOR ('P', 2, int) #define SNDCTL_DSP_STEREO _IOWR('P', 3, int) #define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) #define SNDCTL_DSP_SETFMT _IOWR('P', 5, int) #define AFMT_QUERY 0x00000000 #define AFMT_MU_LAW 0x00000001 #define AFMT_A_LAW 0x00000002 #define AFMT_IMA_ADPCM 0x00000004 #define AFMT_U8 0x00000008 #define AFMT_S16_LE 0x00000010 #define AFMT_S16_BE 0x00000020 #define AFMT_S8 0x00000040 #define AFMT_U16_LE 0x00000080 #define AFMT_U16_BE 0x00000100 #define AFMT_MPEG 0x00000200 #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT #define SOUND_PCM_READ_BITS _IOR ('P', 5, int) #define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int) #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS #define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) #define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) #define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) #define SNDCTL_DSP_POST _IO ('P', 8) #define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) #define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int) #define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int) #define SNDCTL_DSP_GETOSPACE _IOR ('P',12, struct audio_buf_info) #define SNDCTL_DSP_GETISPACE _IOR ('P',13, struct audio_buf_info) #define SNDCTL_DSP_NONBLOCK _IO ('P',14) #define SNDCTL_DSP_GETCAPS _IOR ('P',15, int) # define DSP_CAP_REVISION 0x000000ff # define DSP_CAP_DUPLEX 0x00000100 # define DSP_CAP_REALTIME 0x00000200 # define DSP_CAP_BATCH 0x00000400 # define DSP_CAP_COPROC 0x00000800 # define DSP_CAP_TRIGGER 0x00001000 # define DSP_CAP_MMAP 0x00002000 #define SNDCTL_DSP_GETTRIGGER _IOR ('P', 16, int) #define SNDCTL_DSP_SETTRIGGER _IOW ('P', 16, int) # define PCM_ENABLE_INPUT 0x00000001 # define PCM_ENABLE_OUTPUT 0x00000002 #define SNDCTL_DSP_GETIPTR _IOR ('P', 17, struct count_info) #define SNDCTL_DSP_GETOPTR _IOR ('P', 18, struct count_info) #define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, struct buffmem_desc) #define SNDCTL_DSP_MAPOUTBUF _IOR ('P', 20, struct buffmem_desc) #define SNDCTL_DSP_SETSYNCRO _IO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _IO ('P', 22) #define SNDCTL_DSP_PROFILE _IOW ('P', 23, int) #define APF_NORMAL 0 #define APF_NETWORK 1 #define APF_CPUINTENS 2 /* Need native 16 bit format which depends on byte order */ #include <machine/endian.h> #if _BYTE_ORDER == _LITTLE_ENDIAN #define AFMT_S16_NE AFMT_S16_LE #else #define AFMT_S16_NE AFMT_S16_BE #endif /* Aliases */ #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED #define SOUND_PCM_POST SNDCTL_DSP_POST #define SOUND_PCM_RESET SNDCTL_DSP_RESET #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF /* Mixer defines */ #define SOUND_MIXER_FIRST 0 #define SOUND_MIXER_NRDEVICES 25 #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 #define SOUND_MIXER_SYNTH 3 #define SOUND_MIXER_PCM 4 #define SOUND_MIXER_SPEAKER 5 #define SOUND_MIXER_LINE 6 #define SOUND_MIXER_MIC 7 #define SOUND_MIXER_CD 8 #define SOUND_MIXER_IMIX 9 #define SOUND_MIXER_ALTPCM 10 #define SOUND_MIXER_RECLEV 11 #define SOUND_MIXER_IGAIN 12 #define SOUND_MIXER_OGAIN 13 #define SOUND_MIXER_LINE1 14 #define SOUND_MIXER_LINE2 15 #define SOUND_MIXER_LINE3 16 #define SOUND_MIXER_DIGITAL1 17 #define SOUND_MIXER_DIGITAL2 18 #define SOUND_MIXER_DIGITAL3 19 #define SOUND_MIXER_PHONEIN 20 #define SOUND_MIXER_PHONEOUT 21 #define SOUND_MIXER_VIDEO 22 #define SOUND_MIXER_RADIO 23 #define SOUND_MIXER_MONITOR 24 #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 #define SOUND_MIXER_NONE 31 #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ "line1", "line2", "line3", "dig1", "dig2", "dig3", \ "phin", "phout", "video", "radio", "monitor"} #define SOUND_MIXER_RECSRC 0xff #define SOUND_MIXER_DEVMASK 0xfe #define SOUND_MIXER_RECMASK 0xfd #define SOUND_MIXER_CAPS 0xfc #define SOUND_CAP_EXCL_INPUT 1 #define SOUND_MIXER_STEREODEVS 0xfb #define MIXER_READ(dev) _IOR('M', dev, int) #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) #define MIXER_WRITE(dev) _IOW ('M', dev, int) #define MIXER_WRITE_R(dev) _IOWR('M', dev, int) #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) #define SOUND_MIXER_WRITE_R_RECSRC MIXER_WRITE_R(SOUND_MIXER_RECSRC) #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) typedef struct mixer_info { char id[16]; char name[32]; int modify_counter; int fillers[10]; } mixer_info; typedef struct _old_mixer_info { char id[16]; char name[32]; } _old_mixer_info; #define SOUND_MIXER_INFO _IOR('M', 101, mixer_info) #define SOUND_OLD_MIXER_INFO _IOR('M', 101, _old_mixer_info) #define OSS_GETVERSION _IOR ('M', 118, int) typedef struct audio_buf_info { int fragments; int fragstotal; int fragsize; int bytes; } audio_buf_info; typedef struct count_info { int bytes; int blocks; int ptr; } count_info; typedef struct buffmem_desc { unsigned int *buffer; int size; } buffmem_desc; #if 0 /* This is what we'd like to have, but it causes prototype conflicts. */ #define ioctl _oss_ioctl #else #define ioctl(x,y,z) _oss_ioctl(x,y,z) #endif #include <sys/cdefs.h> __BEGIN_DECLS int _oss_ioctl __P((int fd, unsigned long com, void *argp)); __END_DECLS #endif /* !_SOUNDCARD_H_ */ |
From: Justin <th...@us...> - 2002-11-06 03:14:59
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv32223/lib Modified Files: esddsp.c Log Message: osscat works as it should hopefully others will follow, added audioio.h to control audioio structs and defs Index: esddsp.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/esddsp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- esddsp.c 6 Nov 2002 00:00:04 -0000 1.6 +++ esddsp.c 6 Nov 2002 03:14:54 -0000 1.7 @@ -38,6 +38,7 @@ #include <stdio.h> #include "soundcard.h" +#include "audioio.h" #include <esd.h> @@ -189,16 +190,25 @@ static int speed; int *arg = (int *) argp; + int retval = 0; switch (request) { case SNDCTL_DSP_RESET: - case SNDCTL_DSP_POST: + retval = liboss_ioctl(fd, AUDIO_FLUSH, 0); + if (retval < 0) + return retval; break; - case SNDCTL_DSP_SETFMT: - fmt |= (*arg & 0x30) ? ESD_BITS16 : ESD_BITS8; - settings |= 1; + case SNDCTL_DSP_SYNC: + retval = liboss_ioctl(fd, AUDIO_DRAIN, 0); + if (retval < 0) + return retval; + break; + + case SNDCTL_DSP_POST: + /* This call is merely advisory, and may be a nop. */ + /* Execpt that it is relevant for fragment implementations */ break; case SNDCTL_DSP_SPEED: @@ -213,6 +223,11 @@ case SNDCTL_DSP_GETBLKSIZE: *arg = ESD_BUF_SIZE; + break; + + case SNDCTL_DSP_SETFMT: + fmt |= (*arg & 0x30) ? ESD_BITS16 : ESD_BITS8; + settings |= 1; break; case SNDCTL_DSP_GETFMTS: |
From: Justin <th...@us...> - 2002-11-06 03:14:59
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv32223/include Modified Files: Makefile.am soundcard.h Added Files: audioio.h Log Message: osscat works as it should hopefully others will follow, added audioio.h to control audioio structs and defs --- NEW FILE: audioio.h --- /* $NetBSD: audioio.h,v 1.25.2.1 2002/10/18 02:45:38 nathanw Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Computer Systems * Engineering Group at Lawrence Berkeley Laboratory. * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef _SYS_AUDIOIO_H_ #define _SYS_AUDIOIO_H_ /* * Audio device */ struct audio_prinfo { 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 encoding; /* data encoding (AUDIO_ENCODING_* below) */ u_int gain; /* volume level */ u_int port; /* selected I/O port */ u_int seek; /* BSD extension */ u_int avail_ports; /* available I/O ports */ u_int buffer_size; /* total size audio buffer */ u_int _ispare[1]; /* Current state of device: */ u_int samples; /* number of samples */ u_int eof; /* End Of File (zero-size writes) counter */ u_char pause; /* non-zero if paused, zero to resume */ u_char error; /* non-zero if underflow/overflow ocurred */ u_char waiting; /* non-zero if another process hangs in open */ u_char balance; /* stereo channel balance */ u_char cspare[2]; u_char open; /* non-zero if currently open */ u_char active; /* non-zero if I/O is currently active */ }; typedef struct audio_prinfo audio_prinfo_t; struct audio_info { struct audio_prinfo play; /* Info for play (output) side */ struct audio_prinfo record; /* Info for record (input) side */ u_int monitor_gain; /* input to output mix */ /* BSD extensions */ u_int blocksize; /* H/W read/write block size */ u_int hiwat; /* output high water mark */ u_int lowat; /* output low water mark */ u_int _ispare1; u_int mode; /* current device mode */ #define AUMODE_PLAY 0x01 #define AUMODE_RECORD 0x02 #define AUMODE_PLAY_ALL 0x04 /* don't do real-time correction */ }; typedef struct audio_info audio_info_t; #define AUDIO_INITINFO(p) \ (void)memset((void *)(p), 0xff, sizeof(struct audio_info)) /* * Parameter for the AUDIO_GETDEV ioctl to determine current * audio devices. */ #define MAX_AUDIO_DEV_LEN 16 typedef struct audio_device { char name[MAX_AUDIO_DEV_LEN]; char version[MAX_AUDIO_DEV_LEN]; char config[MAX_AUDIO_DEV_LEN]; } audio_device_t; typedef struct audio_offset { u_int samples; /* Total number of bytes transferred */ u_int deltablks; /* Blocks transferred since last checked */ u_int offset; /* Physical transfer offset in buffer */ } audio_offset_t; /* * Supported audio encodings */ /* Encoding ID's */ #define AUDIO_ENCODING_NONE 0 /* no encoding assigned */ #define AUDIO_ENCODING_ULAW 1 /* ITU G.711 mu-law */ #define AUDIO_ENCODING_ALAW 2 /* ITU G.711 A-law */ #define AUDIO_ENCODING_PCM16 3 /* signed linear PCM, obsolete */ #define AUDIO_ENCODING_LINEAR AUDIO_ENCODING_PCM16 /* SunOS compat */ #define AUDIO_ENCODING_PCM8 4 /* unsigned linear PCM, obsolete */ #define AUDIO_ENCODING_LINEAR8 AUDIO_ENCODING_PCM8 /* SunOS compat */ #define AUDIO_ENCODING_ADPCM 5 /* adaptive differential PCM */ #define AUDIO_ENCODING_SLINEAR_LE 6 #define AUDIO_ENCODING_SLINEAR_BE 7 #define AUDIO_ENCODING_ULINEAR_LE 8 #define AUDIO_ENCODING_ULINEAR_BE 9 #define AUDIO_ENCODING_SLINEAR 10 #define AUDIO_ENCODING_ULINEAR 11 #define AUDIO_ENCODING_MPEG_L1_STREAM 12 #define AUDIO_ENCODING_MPEG_L1_PACKETS 13 #define AUDIO_ENCODING_MPEG_L1_SYSTEM 14 #define AUDIO_ENCODING_MPEG_L2_STREAM 15 #define AUDIO_ENCODING_MPEG_L2_PACKETS 16 #define AUDIO_ENCODING_MPEG_L2_SYSTEM 17 typedef struct audio_encoding { int index; char name[MAX_AUDIO_DEV_LEN]; int encoding; int precision; int flags; #define AUDIO_ENCODINGFLAG_EMULATED 1 /* software emulation mode */ } audio_encoding_t; /* * Balance settings. */ #define AUDIO_LEFT_BALANCE 0 /* left channel only */ #define AUDIO_MID_BALANCE 32 /* equal left/right channel */ #define AUDIO_RIGHT_BALANCE 64 /* right channel only */ #define AUDIO_BALANCE_SHIFT 3 /* * Output ports */ #define AUDIO_SPEAKER 0x01 /* built-in speaker */ #define AUDIO_HEADPHONE 0x02 /* headphone jack */ #define AUDIO_LINE_OUT 0x04 /* line out */ /* * Input ports */ #define AUDIO_MICROPHONE 0x01 /* microphone */ #define AUDIO_LINE_IN 0x02 /* line in */ #define AUDIO_CD 0x04 /* on-board CD inputs */ #define AUDIO_INTERNAL_CD_IN AUDIO_CD /* internal CDROM */ /* * Audio device operations */ #define AUDIO_GETINFO _IOR('A', 21, struct audio_info) #define AUDIO_SETINFO _IOWR('A', 22, struct audio_info) #define AUDIO_DRAIN _IO('A', 23) #define AUDIO_FLUSH _IO('A', 24) #define AUDIO_WSEEK _IOR('A', 25, u_long) #define AUDIO_RERROR _IOR('A', 26, int) #define AUDIO_GETDEV _IOR('A', 27, struct audio_device) #define AUDIO_GETENC _IOWR('A', 28, struct audio_encoding) #define AUDIO_GETFD _IOR('A', 29, int) #define AUDIO_SETFD _IOWR('A', 30, int) #define AUDIO_PERROR _IOR('A', 31, int) #define AUDIO_GETIOFFS _IOR('A', 32, struct audio_offset) #define AUDIO_GETOOFFS _IOR('A', 33, struct audio_offset) #define AUDIO_GETPROPS _IOR('A', 34, int) #define AUDIO_PROP_FULLDUPLEX 0x01 #define AUDIO_PROP_MMAP 0x02 #define AUDIO_PROP_INDEPENDENT 0x04 /* * Mixer device */ #define AUDIO_MIN_GAIN 0 #define AUDIO_MAX_GAIN 255 typedef struct mixer_level { int num_channels; u_char level[8]; /* [num_channels] */ } mixer_level_t; #define AUDIO_MIXER_LEVEL_MONO 0 #define AUDIO_MIXER_LEVEL_LEFT 0 #define AUDIO_MIXER_LEVEL_RIGHT 1 /* * Device operations */ typedef struct audio_mixer_name { char name[MAX_AUDIO_DEV_LEN]; int msg_id; } audio_mixer_name_t; typedef struct mixer_devinfo { int index; audio_mixer_name_t label; int type; #define AUDIO_MIXER_CLASS 0 #define AUDIO_MIXER_ENUM 1 #define AUDIO_MIXER_SET 2 #define AUDIO_MIXER_VALUE 3 int mixer_class; int next, prev; #define AUDIO_MIXER_LAST -1 union { struct audio_mixer_enum { int num_mem; struct { audio_mixer_name_t label; int ord; } member[32]; } e; struct audio_mixer_set { int num_mem; struct { audio_mixer_name_t label; int mask; } member[32]; } s; struct audio_mixer_value { audio_mixer_name_t units; int num_channels; int delta; } v; } un; } mixer_devinfo_t; typedef struct mixer_ctrl { int dev; int type; union { int ord; /* enum */ int mask; /* set */ mixer_level_t value; /* value */ } un; } mixer_ctrl_t; /* * Mixer operations */ #define AUDIO_MIXER_READ _IOWR('M', 0, mixer_ctrl_t) #define AUDIO_MIXER_WRITE _IOWR('M', 1, mixer_ctrl_t) #define AUDIO_MIXER_DEVINFO _IOWR('M', 2, mixer_devinfo_t) /* * Well known device names */ #define AudioNmicrophone "mic" #define AudioNline "line" #define AudioNcd "cd" #define AudioNdac "dac" #define AudioNaux "aux" #define AudioNrecord "record" #define AudioNvolume "volume" #define AudioNmonitor "monitor" #define AudioNtreble "treble" #define AudioNmid "mid" #define AudioNbass "bass" #define AudioNbassboost "bassboost" #define AudioNspeaker "speaker" #define AudioNheadphone "headphones" #define AudioNoutput "output" #define AudioNinput "input" #define AudioNmaster "master" #define AudioNstereo "stereo" #define AudioNmono "mono" #define AudioNloudness "loudness" #define AudioNspatial "spatial" #define AudioNsurround "surround" #define AudioNpseudo "pseudo" #define AudioNmute "mute" #define AudioNenhanced "enhanced" #define AudioNpreamp "preamp" #define AudioNon "on" #define AudioNoff "off" #define AudioNmode "mode" #define AudioNsource "source" #define AudioNfmsynth "fmsynth" #define AudioNwave "wave" #define AudioNmidi "midi" #define AudioNmixerout "mixerout" #define AudioNswap "swap" /* swap left and right channels */ #define AudioNagc "agc" #define AudioNdelay "delay" #define AudioNselect "select" /* select destination */ #define AudioNvideo "video" #define AudioNcenter "center" #define AudioNdepth "depth" #define AudioNlfe "lfe" #define AudioEmulaw "mulaw" #define AudioEalaw "alaw" #define AudioEadpcm "adpcm" #define AudioEslinear "slinear" #define AudioEslinear_le "slinear_le" #define AudioEslinear_be "slinear_be" #define AudioEulinear "ulinear" #define AudioEulinear_le "ulinear_le" #define AudioEulinear_be "ulinear_be" #define AudioEmpeg_l1_stream "mpeg_l1_stream" #define AudioEmpeg_l1_packets "mpeg_l1_packets" #define AudioEmpeg_l1_system "mpeg_l1_system" #define AudioEmpeg_l2_stream "mpeg_l2_stream" #define AudioEmpeg_l2_packets "mpeg_l2_packets" #define AudioEmpeg_l2_system "mpeg_l2_system" #define AudioCinputs "inputs" #define AudioCoutputs "outputs" #define AudioCrecord "record" #define AudioCmonitor "monitor" #define AudioCequalization "equalization" #endif /* !_SYS_AUDIOIO_H_ */ Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/include/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.am 22 Oct 2002 05:24:02 -0000 1.3 +++ Makefile.am 6 Nov 2002 03:14:54 -0000 1.4 @@ -2,7 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -include_HEADERS = soundcard.h +include_HEADERS = audioio.h soundcard.h noinst_HEADERS = Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- soundcard.h 6 Nov 2002 00:00:04 -0000 1.11 +++ soundcard.h 6 Nov 2002 03:14:54 -0000 1.12 @@ -43,50 +43,25 @@ /* FIXME: what is this? */ #define SOUND_VERSION 0x030001 +/* SNDCTL Defines */ #define SNDCTL_DSP_RESET _IO ('P', 0) #define SNDCTL_DSP_SYNC _IO ('P', 1) #define SNDCTL_DSP_SPEED _IOWR('P', 2, int) -#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) -#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) -#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) -#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int) -#define AFMT_QUERY 0x00000000 -#define AFMT_MU_LAW 0x00000001 -#define AFMT_A_LAW 0x00000002 -#define AFMT_IMA_ADPCM 0x00000004 -#define AFMT_U8 0x00000008 -#define AFMT_S16_LE 0x00000010 -#define AFMT_S16_BE 0x00000020 -#define AFMT_S8 0x00000040 -#define AFMT_U16_LE 0x00000080 -#define AFMT_U16_BE 0x00000100 -#define AFMT_MPEG 0x00000200 +#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) +#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) +#define SNDCTL_DSP_SETFMT _IOWR('P', 5, int) #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT -#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) -#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int) -#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS -#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) -#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) -#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) -#define SNDCTL_DSP_POST _IO ('P', 8) +#define SNDCTL_DSP_CHANNELS _IOWR('P', 6, int) +#define SNDCTL_DSP_POST _IO ('P', 8) #define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) -#define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int) -#define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int) +#define SNDCTL_DSP_SETFRAGMENT _IOWR('P', 10, int) +#define SNDCTL_DSP_GETFMTS _IOR ('P', 11, int) #define SNDCTL_DSP_GETOSPACE _IOR ('P',12, struct audio_buf_info) #define SNDCTL_DSP_GETISPACE _IOR ('P',13, struct audio_buf_info) #define SNDCTL_DSP_NONBLOCK _IO ('P',14) #define SNDCTL_DSP_GETCAPS _IOR ('P',15, int) -# define DSP_CAP_REVISION 0x000000ff -# define DSP_CAP_DUPLEX 0x00000100 -# define DSP_CAP_REALTIME 0x00000200 -# define DSP_CAP_BATCH 0x00000400 -# define DSP_CAP_COPROC 0x00000800 -# define DSP_CAP_TRIGGER 0x00001000 -# define DSP_CAP_MMAP 0x00002000 #define SNDCTL_DSP_GETTRIGGER _IOR ('P', 16, int) #define SNDCTL_DSP_SETTRIGGER _IOW ('P', 16, int) -# define PCM_ENABLE_INPUT 0x00000001 -# define PCM_ENABLE_OUTPUT 0x00000002 #define SNDCTL_DSP_GETIPTR _IOR ('P', 17, struct count_info) #define SNDCTL_DSP_GETOPTR _IOR ('P', 18, struct count_info) #define SNDCTL_DSP_MAPINBUF _IOR ('P', 19, struct buffmem_desc) @@ -94,9 +69,45 @@ #define SNDCTL_DSP_SETSYNCRO _IO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _IO ('P', 22) #define SNDCTL_DSP_PROFILE _IOW ('P', 23, int) -#define APF_NORMAL 0 -#define APF_NETWORK 1 -#define APF_CPUINTENS 2 + +/* AFMT Defines */ +#define AFMT_QUERY 0x00000000 +#define AFMT_MU_LAW 0x00000001 +#define AFMT_A_LAW 0x00000002 +#define AFMT_IMA_ADPCM 0x00000004 +#define AFMT_U8 0x00000008 +#define AFMT_S16_LE 0x00000010 +#define AFMT_S16_BE 0x00000020 +#define AFMT_S8 0x00000040 +#define AFMT_U16_LE 0x00000080 +#define AFMT_U16_BE 0x00000100 +#define AFMT_MPEG 0x00000200 + +/* SOUND Defines */ +#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) +#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) +#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) +#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) + +/* DSP Defines */ +#define DSP_CAP_REVISION 0x000000ff +#define DSP_CAP_DUPLEX 0x00000100 +#define DSP_CAP_REALTIME 0x00000200 +#define DSP_CAP_BATCH 0x00000400 +#define DSP_CAP_COPROC 0x00000800 +#define DSP_CAP_TRIGGER 0x00001000 +#define DSP_CAP_MMAP 0x00002000 + +/* PCM Defines */ +#define PCM_ENABLE_INPUT 0x00000001 +#define PCM_ENABLE_OUTPUT 0x00000002 + +/* APF Defines */ +#define APF_NORMAL 0 +#define APF_NETWORK 1 +#define APF_CPUINTENS 2 /* Need native 16 bit format which depends on byte order */ #include <machine/endian.h> @@ -143,7 +154,6 @@ /* Mixer defines */ #define SOUND_MIXER_FIRST 0 #define SOUND_MIXER_NRDEVICES 25 - #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 @@ -169,12 +179,9 @@ #define SOUND_MIXER_VIDEO 22 #define SOUND_MIXER_RADIO 23 #define SOUND_MIXER_MONITOR 24 - #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 - #define SOUND_MIXER_NONE 31 - #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ |
From: Justin <th...@us...> - 2002-11-06 00:00:07
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv4741/lib Modified Files: esddsp.c Log Message: was a little noisy, thus removed some print outs, and added to the TODO list, I think it's just that stuff that is missing. lots of it is done in liboss.c prolly why i got it to work once I'll continue going through this stuff when I get home tonight Index: esddsp.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/esddsp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- esddsp.c 27 Oct 2002 23:01:10 -0000 1.5 +++ esddsp.c 6 Nov 2002 00:00:04 -0000 1.6 @@ -145,7 +145,7 @@ dsp_init(); } -int oss_open (const char *pathname, int flags, va_list args) +int liboss_open (const char *pathname, int flags, va_list args) { static int (*func) (const char *, int, mode_t) = NULL; mode_t mode; @@ -190,9 +190,6 @@ int *arg = (int *) argp; - DPRINTF ("hijacking /dev/dsp ioctl, and sending it to esd " - "(%d : %x - %p)\n", fd, request, argp); - switch (request) { case SNDCTL_DSP_RESET: @@ -283,9 +280,6 @@ int *arg = (int *) argp; - DPRINTF ("hijacking /dev/mixer ioctl, and sending it to esd " - "(%d : %x - %p)\n", fd, request, argp); - switch (request) { case SOUND_MIXER_READ_DEVMASK: @@ -350,7 +344,7 @@ } int -oss_ioctl (int fd, request_t request, va_list args) +liboss_ioctl (int fd, request_t request, va_list args) { static int (*func) (int, request_t, void *) = NULL; void *argp; @@ -375,7 +369,7 @@ } int -oss_close (int fd) +liboss_close (int fd) { static int (*func) (int) = NULL; |
From: Justin <th...@us...> - 2002-11-06 00:00:07
|
Update of /cvsroot/liboss/liboss In directory usw-pr-cvs1:/tmp/cvs-serv4741 Modified Files: TODO Log Message: was a little noisy, thus removed some print outs, and added to the TODO list, I think it's just that stuff that is missing. lots of it is done in liboss.c prolly why i got it to work once I'll continue going through this stuff when I get home tonight Index: TODO =================================================================== RCS file: /cvsroot/liboss/liboss/TODO,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TODO 23 Oct 2002 01:28:12 -0000 1.6 +++ TODO 6 Nov 2002 00:00:03 -0000 1.7 @@ -1,3 +1,21 @@ +- Need to add to dspctl + - SNDCTL_DSP_SYNC + - SNDCTL_DSP_CHANNELS + - SNDCTL_DSP_SUBDIVIDE + - SNDCTL_DSP_SETFRAGMENT + - SNDCTL_DSP_GETISPACE + - SNDCTL_DSP_NONBLOCK + - SNDCTL_DSP_GETCAPS + - SNDCTL_DSP_GETTRIGGER + - SNDCTL_DSP_SETTRIGGER + - SNDCTL_DSP_GETIPTR + - SNDCTL_DSP_GETOPTR + - SNDCTL_DSP_MAPINBUF + - SNDCTL_DSP_MAPOUTBUF + - SNDCTL_DSP_SETSYNCRO + - SNDCTL_DSP_SETDUPLEX + - SNDCTL_DSP_PROFILE + - Create sockets to emulate "opening" /dev/audio. Create libosscat, analogous to artscat or esdcat, such that "libosscat foo" is equivalent to "cat foo > /dev/audio" on Linux. |
From: Justin <th...@us...> - 2002-11-06 00:00:07
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv4741/include Modified Files: soundcard.h Log Message: was a little noisy, thus removed some print outs, and added to the TODO list, I think it's just that stuff that is missing. lots of it is done in liboss.c prolly why i got it to work once I'll continue going through this stuff when I get home tonight Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- soundcard.h 5 Nov 2002 21:34:17 -0000 1.10 +++ soundcard.h 6 Nov 2002 00:00:04 -0000 1.11 @@ -306,29 +306,29 @@ #undef open #undef close #ifndef LIBOSS_INTERNAL -extern int oss_ioctl (int,unsigned long,va_list); -extern int oss_open (const char *,int,va_list); -extern int oss_close (int); +extern int liboss_ioctl (int,unsigned long,va_list); +extern int liboss_open (const char *,int,va_list); +extern int liboss_close (int); static inline int ioctl (int x, unsigned long y,...) { va_list l; va_start(l,y); - return oss_ioctl(x,y,l); + return liboss_ioctl(x,y,l); } static inline int open (const char* x, int y,...) { va_list l; va_start(l,y); - return oss_open(x,y,l); + return liboss_open(x,y,l); } -static inline int close (int x) {oss_close(x); return x;} +static inline int close (int x) {liboss_close(x); return x;} #else -extern int oss_ioctl (int,unsigned long,va_list); -extern int oss_open (const char *,int,va_list); -extern int oss_close (int); +extern int liboss_ioctl (int,unsigned long,va_list); +extern int liboss_open (const char *,int,va_list); +extern int liboss_close (int); #endif __END_DECLS #endif /* !_SOUNDCARD_H_ */ |
From: Justin <th...@us...> - 2002-11-05 22:07:31
|
Update of /cvsroot/liboss/liboss/src In directory usw-pr-cvs1:/tmp/cvs-serv17520 Modified Files: osscat.c Log Message: okay it needs to be set to mono Index: osscat.c =================================================================== RCS file: /cvsroot/liboss/liboss/src/osscat.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- osscat.c 5 Nov 2002 21:50:31 -0000 1.8 +++ osscat.c 5 Nov 2002 22:07:28 -0000 1.9 @@ -16,9 +16,9 @@ /* What kind of sound is this, anyway? */ /* NB: .wav is usually {1, 16, 20500, 0} */ -#define STEREO 1 +#define STEREO 0 #define BITS 16 -#define RATE 44100 //20500 +#define RATE 20500 #define ENDIAN LITTLE_ENDIAN |
From: Justin <th...@us...> - 2002-11-05 21:50:34
|
Update of /cvsroot/liboss/liboss/src In directory usw-pr-cvs1:/tmp/cvs-serv9733/src Modified Files: osscat.c Log Message: osscat hard codes sample speed, I just doubled it to play kde wavs at right speed Index: osscat.c =================================================================== RCS file: /cvsroot/liboss/liboss/src/osscat.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- osscat.c 22 Oct 2002 19:28:01 -0000 1.7 +++ osscat.c 5 Nov 2002 21:50:31 -0000 1.8 @@ -18,7 +18,7 @@ /* NB: .wav is usually {1, 16, 20500, 0} */ #define STEREO 1 #define BITS 16 -#define RATE 20500 +#define RATE 44100 //20500 #define ENDIAN LITTLE_ENDIAN |
From: Justin <th...@us...> - 2002-11-05 21:34:21
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv3553/lib Modified Files: Makefile.am liboss.c Log Message: osscat works perfectly, still working on mpg123, just static Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/lib/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Makefile.am 5 Nov 2002 19:48:05 -0000 1.20 +++ Makefile.am 5 Nov 2002 21:34:18 -0000 1.21 @@ -6,8 +6,7 @@ lib_LTLIBRARIES = liboss.la -liboss_la_SOURCES = esddsp.c \ - liboss.c +liboss_la_SOURCES = esddsp.c liboss_la_DEPENDENCIES = liboss_la_LIBADD = $(COREAUDIO_LDFLAGS) $(LIBDL) $(LIBESD) liboss_la_LDFLAGS = -export-dynamic \ Index: liboss.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/liboss.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- liboss.c 5 Nov 2002 17:16:30 -0000 1.8 +++ liboss.c 5 Nov 2002 21:34:18 -0000 1.9 @@ -97,10 +97,14 @@ static int initialized = 0; static pthread_t server; -/* int -oss_open(const char *path, int flags, mode_t mode) +oss_open(const char *path, int flags, va_list args) { + mode_t mode; + + mode = va_arg (args, int); + va_end (args); + static char buf[MAXPATHLEN]; if (realpath(path, buf) == NULL) @@ -109,14 +113,16 @@ if (0 == strcmp("/dev/dspW", buf)) { return oss_audio_open(flags); } else { - // FIXME: add mixer stuff + /* FIXME: add mixer stuff */ return open(path, flags, mode); } } int -oss_ioctl(int fd, unsigned long com, void *argp) +oss_ioctl(int fd, unsigned long com, va_list args) { + void *argp; + if (IOCGROUP(com) == 'P') return oss_audio_ioctl(fd, com, argp); else if (IOCGROUP(com) == 'M') @@ -128,14 +134,16 @@ static int oss_audio_open(int flags) { - FIXME: Don't forget recording! - Set up format defaults. - setsockopt() - Close sockets (and alert Mac side) if they're open already. - Apparently you can't test if a socket is closed at the other end, - so we have to override close() too. - Account for multiple, different /dev/blahs (use a table). - Stop abusing clients. + /* FIXME: Don't forget recording! + * Set up format defaults. + * setsockopt() + * + * Close sockets (and alert Mac side) if they're open already. + * Apparently you can't test if a socket is closed at the other + * end, so we have to override close() too. + * Account for multiple, different /dev/blahs (use a table). + * Stop abusing clients. + */ int socks[2]; rw_e rw; @@ -146,7 +154,9 @@ } switch (flags & O_ACCMODE) { - case O_RDONLY: rw = OSS_WRITE; break; // If they want to read, we must write + case O_RDONLY: rw = OSS_WRITE; break; /* If they want to + * read, we must write + */ case O_WRONLY: rw = OSS_READ; break; case O_RDWR: rw = OSS_RW; break; default: @@ -176,7 +186,7 @@ return socks[1]; } -*/ + static int oss_init(void) { |
From: Justin <th...@us...> - 2002-11-05 21:34:21
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv3553/include Modified Files: soundcard.h Log Message: osscat works perfectly, still working on mpg123, just static Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- soundcard.h 5 Nov 2002 19:46:52 -0000 1.9 +++ soundcard.h 5 Nov 2002 21:34:17 -0000 1.10 @@ -324,7 +324,7 @@ return oss_open(x,y,l); } -static inline int close (int x) {oss_close(x);} +static inline int close (int x) {oss_close(x); return x;} #else extern int oss_ioctl (int,unsigned long,va_list); extern int oss_open (const char *,int,va_list); |
From: Justin <th...@us...> - 2002-11-05 19:48:10
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv26049 Modified Files: Makefile.am Removed Files: libossins.c Log Message: libossins doesn't work removing Index: Makefile.am =================================================================== RCS file: /cvsroot/liboss/liboss/lib/Makefile.am,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Makefile.am 5 Nov 2002 16:23:12 -0000 1.19 +++ Makefile.am 5 Nov 2002 19:48:05 -0000 1.20 @@ -4,7 +4,7 @@ CFLAGS = $(ESD_INCS) $(COREAUDIO_CFLAGS) $(DLSYM_UNDERSCORE) -DLIBOSS_INTERNAL -lib_LTLIBRARIES = liboss.la libossins.la +lib_LTLIBRARIES = liboss.la liboss_la_SOURCES = esddsp.c \ liboss.c @@ -12,13 +12,6 @@ liboss_la_LIBADD = $(COREAUDIO_LDFLAGS) $(LIBDL) $(LIBESD) liboss_la_LDFLAGS = -export-dynamic \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) - -libossins_la_SOURCES = libossins.c -libossins_la_DEPENDENCIES = liboss.la -libossins_la_LIBADD = $(top_builddir)/lib/liboss.la -libossins_la_LDFLAGS = -export-dynamic \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) - include_HEADERS = --- libossins.c DELETED --- |
From: Justin <th...@us...> - 2002-11-05 19:46:57
|
Update of /cvsroot/liboss/liboss/include In directory usw-pr-cvs1:/tmp/cvs-serv25301 Modified Files: soundcard.h Log Message: some additions and some little fixes Index: soundcard.h =================================================================== RCS file: /cvsroot/liboss/liboss/include/soundcard.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- soundcard.h 5 Nov 2002 16:43:12 -0000 1.8 +++ soundcard.h 5 Nov 2002 19:46:52 -0000 1.9 @@ -106,6 +106,18 @@ #define AFMT_S16_NE AFMT_S16_BE #endif +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define AFMT_U16_NE AFMT_U16_LE +#else +#define AFMT_U16_NE AFMT_U16_BE +#endif + +#if _BYTE_ORDER == _LITTLE_ENDIAN +#define OSS_LITTLE_ENDIAN +#else +#define OSS_BIG_ENDIAN +#endif + /* Aliases */ #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED @@ -312,7 +324,7 @@ return oss_open(x,y,l); } -static inline void close (int x) {oss_close(x);} +static inline int close (int x) {oss_close(x);} #else extern int oss_ioctl (int,unsigned long,va_list); extern int oss_open (const char *,int,va_list); |
From: Justin <th...@us...> - 2002-11-05 17:35:37
|
Update of /cvsroot/liboss/liboss In directory usw-pr-cvs1:/tmp/cvs-serv3121 Modified Files: configure.in Log Message: I few more clean ups, compiles and osscat makes sound Index: configure.in =================================================================== RCS file: /cvsroot/liboss/liboss/configure.in,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- configure.in 5 Nov 2002 16:41:10 -0000 1.28 +++ configure.in 5 Nov 2002 17:35:32 -0000 1.29 @@ -92,8 +92,8 @@ dnl Common cflags for all platforms CFLAGS="$CFLAGS $nocpp $wall -I${prefix}/include -O2 -fprefetch-loop-arrays -frename-registers -mcpu=750 -mtune=750 -mmultiple -mstring" -NONPIC_CFLAGS="$CFLAGS $nopic" -CLIENT_CFLAGS="$CFLAGS $INCLUDES -Dopen=___sys_open -Dclose=___sys_close -Dioctl=___sys_ioctl -include soundcard.h" +NONPIC_CFLAGS="$nopic" +CLIENT_CFLAGS="$INCLUDES -Dopen=___sys_open -Dclose=___sys_close -Dioctl=___sys_ioctl -include soundcard.h" CPPFLAGS="$CPPFLAGS $CFLAGS" DEBUG_CFLAGS="$CFLAGS $DEBUG_CFLAGS" LDFLAGS="$LDFLAGS -L${prefix}/lib" |
From: Justin <th...@us...> - 2002-11-05 17:16:33
|
Update of /cvsroot/liboss/liboss/lib In directory usw-pr-cvs1:/tmp/cvs-serv27309/lib Modified Files: liboss.c Log Message: Compiles now Index: liboss.c =================================================================== RCS file: /cvsroot/liboss/liboss/lib/liboss.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- liboss.c 10 May 2002 14:53:29 -0000 1.7 +++ liboss.c 5 Nov 2002 17:16:30 -0000 1.8 @@ -97,6 +97,7 @@ static int initialized = 0; static pthread_t server; +/* int oss_open(const char *path, int flags, mode_t mode) { @@ -108,7 +109,7 @@ if (0 == strcmp("/dev/dspW", buf)) { return oss_audio_open(flags); } else { - /* FIXME: add mixer stuff */ + // FIXME: add mixer stuff return open(path, flags, mode); } } @@ -126,16 +127,16 @@ static int oss_audio_open(int flags) -{ - /* FIXME: Don't forget recording! - Set up format defaults. - setsockopt() - Close sockets (and alert Mac side) if they're open already. - Apparently you can't test if a socket is closed at the other end, - so we have to override close() too. - Account for multiple, different /dev/blahs (use a table). - Stop abusing clients. - */ +{ + FIXME: Don't forget recording! + Set up format defaults. + setsockopt() + Close sockets (and alert Mac side) if they're open already. + Apparently you can't test if a socket is closed at the other end, + so we have to override close() too. + Account for multiple, different /dev/blahs (use a table). + Stop abusing clients. + int socks[2]; rw_e rw; @@ -145,7 +146,7 @@ } switch (flags & O_ACCMODE) { - case O_RDONLY: rw = OSS_WRITE; break; /* If they want to read, we must write */ + case O_RDONLY: rw = OSS_WRITE; break; // If they want to read, we must write case O_WRONLY: rw = OSS_READ; break; case O_RDWR: rw = OSS_RW; break; default: @@ -175,7 +176,7 @@ return socks[1]; } - +*/ static int oss_init(void) { @@ -236,7 +237,7 @@ static int oss_audio_ioctl(int fd, unsigned long com, void *argp) { - int retval = 0; + /* int retval = 0; */ /* FIXME: implement */ switch (com) { |