diff -ru /linux/drivers/sound/dmabuf.c /linux.new/drivers/sound/dmabuf.c --- /linux/drivers/sound/dmabuf.c Sun Dec 31 14:34:13 1995 +++ /linux.new/drivers/sound/dmabuf.c Sun Dec 31 14:35:10 1995 @@ -443,6 +443,7 @@ { int fact = IOCTL_IN (arg); int bytes, count; + extern int sb_bits; if (fact == 0) return RET_ERROR (EIO); @@ -452,6 +453,8 @@ return RET_ERROR (EINVAL); bytes = fact & 0xffff; + if (sb_bits == 16) + bytes--; count = (fact >> 16) & 0xffff; if (count == 0) diff -ru /linux/drivers/sound/sb_dsp.c /linux.new/drivers/sound/sb_dsp.c --- /linux/drivers/sound/sb_dsp.c Sun Dec 31 14:34:13 1995 +++ /linux.new/drivers/sound/sb_dsp.c Sun Dec 31 14:35:09 1995 @@ -39,6 +39,7 @@ #include "sb_mixer.h" #undef SB_TEST_IRQ +int sb_bits = 8; int sbc_base = 0; static int sbc_irq = 0; static int open_mode = 0; /* Read, write or both */ @@ -94,6 +95,28 @@ #if !defined(EXCLUDE_MIDI) || !defined(EXCLUDE_AUDIO) + +void +sb_16_8_copy_from_user(int dev, char *localbuf, int localoffs, + snd_rw_buf * userbuf, int useroffs, int len) +{ + int i; + unsigned short in; + unsigned char *out = &localbuf[localoffs]; + + if (sb_bits == 16) { + for(i=0;i>8); + } + } else { + COPY_FROM_USER (&localbuf[localoffs], userbuf, useroffs, len); + } + +} + /* * Common code for the midi and pcm functions */ @@ -680,10 +703,11 @@ case SOUND_PCM_WRITE_BITS: case SOUND_PCM_READ_BITS: + if (local) - return 8; - return IOCTL_OUT (arg, 8);/* - * Only 8 bits/sample supported + return sb_bits=((arg==16)?16:8); + return IOCTL_OUT (arg, (sb_bits=(((IOCTL_IN(arg))==16)?16:8)));/* + * Only 8 or 16 bits/sample supported */ break; @@ -739,7 +763,7 @@ { "SoundBlaster", NOTHING_SPECIAL, - AFMT_U8, /* Just 8 bits. Poor old SB */ + AFMT_U8 | AFMT_S16_LE, /* Just 8 bits. Poor old SB */ NULL, sb_dsp_open, sb_dsp_close, @@ -750,8 +774,8 @@ sb_dsp_prepare_for_output, sb_dsp_reset, sb_dsp_halt_xfer, - NULL, /* local_qlen */ - NULL /* copy_from_user */ + NULL, /* local_qlen */ + sb_16_8_copy_from_user /* copy_from_user */ }; #endif diff -ru /linux/drivers/sound/sound_switch.c /linux.new/drivers/sound/sound_switch.c --- /linux/drivers/sound/sound_switch.c Sun Dec 31 14:34:13 1995 +++ /linux.new/drivers/sound/sound_switch.c Sun Dec 31 14:35:10 1995 @@ -52,6 +52,7 @@ static char *status_buf = NULL; static int status_len, status_ptr; static int status_busy = 0; +extern int sb_bits; static int put_status (char *s) @@ -330,6 +331,8 @@ case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: + if (sb_bits == 16) + return (2* audio_write (dev, file, buf, count /2)); return audio_write (dev, file, buf, count); break; @@ -402,6 +405,7 @@ case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: + sb_bits=8; if ((retval = audio_open (dev, file)) < 0) return retval; break;