SoundStream.st
changeset 1556 8a78c9a5a8f7
parent 1480 dbfc64f5af59
child 1583 a45ac92afbc8
--- a/SoundStream.st	Mon May 30 11:05:12 2005 +0200
+++ b/SoundStream.st	Tue May 31 20:49:10 2005 +0200
@@ -201,7 +201,7 @@
 #ifdef WIN32
 # ifndef USE_DIRECTSOUND
 
-static void CALLBACK 
+static void CALLBACK
 waveCallBack(HWAVE waveHandle, UINT msg, DWORD inst, DWORD p1, DWORD p2)
 {
     if (msg == MM_WOM_DONE) {
@@ -241,7 +241,7 @@
 "
     Preliminary (unfinished) interface to audio device.
     Currently works with LINUXs or SUNs /dev/audio driver and
-    IRIX (indy). 
+    IRIX (indy).
     On iris, the default setup is for 8 bit mono
     so I can play the standard sound files I have here.
     It needs much more work, for stereo, different sampling rates etc.
@@ -258,9 +258,9 @@
 
 initialize
     UnsupportedOperationSignal isNil ifTrue:[
-        UnsupportedOperationSignal := StreamError newSignalMayProceed:true.
-        UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
-        UnsupportedOperationSignal notifierString:'unsupported operation'.
+	UnsupportedOperationSignal := StreamError newSignalMayProceed:true.
+	UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
+	UnsupportedOperationSignal notifierString:'unsupported operation'.
     ]
 ! !
 
@@ -331,7 +331,7 @@
     |newStream|
 
     OperatingSystem getCPUType ~= 'irix' ifTrue:[
-        self error:'unsupported audio mode'.
+	self error:'unsupported audio mode'.
     ].
     newStream := (self basicNew) initialize.
     newStream bitsPerSample:16.
@@ -366,7 +366,7 @@
 	int __sign = 0;
 	int __absVal = __intVal(a16bitSignedValue);
 	int __exp, __mantissa, __byte;
-	static char __uLawExp[] = 
+	static char __uLawExp[] =
 		    {
 			0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
 			5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
@@ -405,15 +405,15 @@
     ^ 0
 
     "
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:0)    
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:32256)   
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-32256)  
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:32767) 
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:0)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:32256)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-32256)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:32767)
      SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-32767)
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:100)   
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-100)  
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:104)   
-     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-104)  
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:100)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-100)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:104)
+     SoundStream uLawToLinear16:(SoundStream linear16ToUlaw:-104)
     "
 
     "Modified: / 9.12.1997 / 16:46:24 / cg"
@@ -689,16 +689,16 @@
 
 defaultAudioFormat
     OperatingSystem getOSType = 'win32' ifTrue:[
-	^ #S16 
+	^ #S16
     ].
-    ^ #U8 
+    ^ #U8
 !
 
 defaultBitsPerSample
     "minimum, supported by all audio systems"
 
     OperatingSystem getOSType = 'win32' ifTrue:[
-	^ 16 
+	^ 16
     ].
     ^ 8
 !
@@ -739,8 +739,8 @@
 
     buffer := ByteArray new:4096.
     [(count := inStream nextBytesInto:buffer) > 0] whileTrue:[
-        totalCount := totalCount + count.
-        soundStream nextPutBytes:count from:buffer.
+	totalCount := totalCount + count.
+	soundStream nextPutBytes:count from:buffer.
     ].
 
     inStream close.
@@ -828,22 +828,22 @@
 
     fd := self fileDescriptor.
     fd isNil ifTrue:[
-        self errorNotOpen.
-        ^ nil
+	self errorNotOpen.
+	^ nil
     ].
     audioFormat == #S16 ifTrue:[
-        UninterpretedBytes isBigEndian ifTrue:[
-            audioFormat := #S16_BE
-        ] ifFalse:[
-            audioFormat := #S16_LE
-        ]
+	UninterpretedBytes isBigEndian ifTrue:[
+	    audioFormat := #S16_BE
+	] ifFalse:[
+	    audioFormat := #S16_LE
+	]
     ].
     audioFormat == #U16 ifTrue:[
-        UninterpretedBytes isBigEndian ifTrue:[
-            audioFormat := #U16_BE
-        ] ifFalse:[
-            audioFormat := #U16_LE
-        ]
+	UninterpretedBytes isBigEndian ifTrue:[
+	    audioFormat := #U16_BE
+	] ifFalse:[
+	    audioFormat := #U16_LE
+	]
     ].
 
 %{
@@ -858,59 +858,59 @@
     }
 #  ifdef AFMT_MU_LAW
     else if (__INST(audioFormat) == @symbol(MU_LAW)) {
-        __format = AFMT_MU_LAW;
+	__format = AFMT_MU_LAW;
     }
 #  endif
 #  ifdef AFMT_A_LAW
     else if (__INST(audioFormat) == @symbol(A_LAW)) {
-        __format = AFMT_A_LAW;
+	__format = AFMT_A_LAW;
     }
 #  endif
 #  ifdef AFMT_IMA_ADPCM
     else if (__INST(audioFormat) == @symbol(IMA_ADPCM)) {
-        __format = AFMT_IMA_ADPCM;
+	__format = AFMT_IMA_ADPCM;
     }
 #  endif
 #  ifdef AFMT_U8
     else if (__INST(audioFormat) == @symbol(U8)) {
-        __format = AFMT_U8;
+	__format = AFMT_U8;
     }
 #  endif
 #  ifdef AFMT_S16_LE
     else if (__INST(audioFormat) == @symbol(S16_LE)) {
-        __format = AFMT_S16_LE;
+	__format = AFMT_S16_LE;
     }
 #  endif
 #  ifdef AFMT_S16_BE
     else if (__INST(audioFormat) == @symbol(S16_BE)) {
-        __format = AFMT_S16_BE;
+	__format = AFMT_S16_BE;
     }
 #  endif
 #  ifdef AFMT_S8
     else if (__INST(audioFormat) == @symbol(S8)) {
-        __format = AFMT_S8;
+	__format = AFMT_S8;
     }
 #  endif
 #  ifdef AFMT_U16_LE
     else if (__INST(audioFormat) == @symbol(U16_LE)) {
-        __format = AFMT_U16_LE;
+	__format = AFMT_U16_LE;
     }
 #  endif
 #  ifdef AFMT_U16_BE
     else if (__INST(audioFormat) == @symbol(U16_BE)) {
-        __format = AFMT_U16_BE;
+	__format = AFMT_U16_BE;
     }
 #  endif
 #  ifdef AFMT_MPEG
     else if (__INST(audioFormat) == @symbol(MPEG)) {
-        __format = AFMT_MPEG;
+	__format = AFMT_MPEG;
     }
 #  endif
     else {
-        __format = -1;
+	__format = -1;
     }
 
-#if defined(DEV_AUDIO) 
+#if defined(DEV_AUDIO)
     channels = nil;
     blockSize = nil;
     stereo = nil;
@@ -918,102 +918,102 @@
 
 # if defined(SNDCTL_DSP_GETBLKSIZE)
     if (ioctl(f, SNDCTL_DSP_GETBLKSIZE, &__blockSize) >= 0) {
-        blockSize = __MKSMALLINT(__blockSize);
+	blockSize = __MKSMALLINT(__blockSize);
     }
 # endif
 # if defined(SNDCTL_DSP_CHANNELS)
     if (ioctl(f, SNDCTL_DSP_CHANNELS, &__channels) >= 0) {
-        channels = __MKSMALLINT(__channels);
-        stereo = __MKSMALLINT(__channels > 1);
+	channels = __MKSMALLINT(__channels);
+	stereo = __MKSMALLINT(__channels > 1);
     }
 # else
 #  if defined(SNDCTL_DSP_STEREO)
     if (ioctl(f, SNDCTL_DSP_STEREO, &__stereo) >= 0) {
-        stereo = __MKSMALLINT(__stereo);
+	stereo = __MKSMALLINT(__stereo);
     }
 #  endif
 # endif
 # if defined(SNDCTL_DSP_SPEED)
     if (ioctl(f, SNDCTL_DSP_SPEED, &__speed) >= 0) {
-        speed = __MKSMALLINT(__speed);
+	speed = __MKSMALLINT(__speed);
     }
 # endif
 # if defined(SNDCTL_DSP_GETFMT)
     if (ioctl(f, SNDCTL_DSP_GETFMT, &__format) >= 0) {
-        format = __MKSMALLINT(__format);
+	format = __MKSMALLINT(__format);
     }
 # else
 #  if defined(SNDCTL_DSP_SETFMT) && defined(AFMT_QUERY)
     __format = AFMT_QUERY;
     if (ioctl(f, SNDCTL_DSP_SETFMT, &__format) >= 0) {
-        switch (__format) {
+	switch (__format) {
 #ifdef AFMT_MU_LAW
-            case AFMT_MU_LAW:
-                format = @symbol(MU_LAW);
-                break;
+	    case AFMT_MU_LAW:
+		format = @symbol(MU_LAW);
+		break;
 #endif
 #ifdef AFMT_A_LAW
-            case AFMT_A_LAW:
-                format = @symbol(A_LAW);
-                break;
+	    case AFMT_A_LAW:
+		format = @symbol(A_LAW);
+		break;
 #endif
 #ifdef AFMT_U8
-            case AFMT_U8:
-                format = @symbol(U8);
-                break;
+	    case AFMT_U8:
+		format = @symbol(U8);
+		break;
 #endif
 #ifdef AFMT_S8
-            case AFMT_S8:
-                format = @symbol(S8);
-                break;
+	    case AFMT_S8:
+		format = @symbol(S8);
+		break;
 #endif
 #ifdef AFMT_S16_LE
-            case AFMT_S16_LE:
-                format = @symbol(S16_LE);
-                break;
+	    case AFMT_S16_LE:
+		format = @symbol(S16_LE);
+		break;
 #endif
 #ifdef AFMT_S16_BE
-            case AFMT_S16_BE:
-                format = @symbol(S16_BE);
-                break;
+	    case AFMT_S16_BE:
+		format = @symbol(S16_BE);
+		break;
 #endif
 #ifdef AFMT_U16_LE
-            case AFMT_U16_LE:
-                format = @symbol(U16_LE);
-                break;
+	    case AFMT_U16_LE:
+		format = @symbol(U16_LE);
+		break;
 #endif
 #ifdef AFMT_U16_BE
-            case AFMT_U16_BE:
-                format = @symbol(U16_BE);
-                break;
+	    case AFMT_U16_BE:
+		format = @symbol(U16_BE);
+		break;
 #endif
 #ifdef AFMT_MPEG
-            case AFMT_MPEG:
-                format = @symbol(MPEG);
-                break;
+	    case AFMT_MPEG:
+		format = @symbol(MPEG);
+		break;
 #endif
-            default:
-                format = nil;
-        }
+	    default:
+		format = nil;
+	}
     }
 #  endif
 # endif
 #endif /* DEV_AUDIO */
 %}.
     format notNil ifTrue:[
-        Transcript show:'format: '; showCR:format
+	Transcript show:'format: '; showCR:format
     ].
     blockSize notNil ifTrue:[
-        Transcript show:'blockSize: '; showCR:blockSize
+	Transcript show:'blockSize: '; showCR:blockSize
     ].
     speed notNil ifTrue:[
-        Transcript show:'speed: '; showCR:speed
+	Transcript show:'speed: '; showCR:speed
     ].
     channels notNil ifTrue:[
-        Transcript show:'channels: '; showCR:channels
+	Transcript show:'channels: '; showCR:channels
     ].
     stereo notNil ifTrue:[
-        Transcript show:'stereo: '; showCR:stereo
+	Transcript show:'stereo: '; showCR:stereo
     ].
 
     Transcript show:'supported audioFormats: '; showCR:(self supportedAudioFormats).
@@ -1023,7 +1023,7 @@
     "
 !
 
-initialize 
+initialize
     "initialize for least common mode"
 
     buffered := false.
@@ -1035,12 +1035,12 @@
     pathName := nil.
 
     OperatingSystem getOSType ~= 'win32' ifTrue:[
-        '/dev/audio' asFilename exists ifTrue:[
-            "/
-            "/ sunos or linux
-            "/
-            pathName := '/dev/audio'.
-        ].
+	'/dev/audio' asFilename exists ifTrue:[
+	    "/
+	    "/ sunos or linux
+	    "/
+	    pathName := '/dev/audio'.
+	].
     ].
 
     "Created: 17.11.1995 / 17:28:14 / cg"
@@ -1052,11 +1052,11 @@
     |fd|
 
     filePointer notNil ifTrue:[
-        fd := self fileDescriptor.
-        fd isNil ifTrue:[
-        self errorNotOpen.
-            ^ nil
-        ]
+	fd := self fileDescriptor.
+	fd isNil ifTrue:[
+	self errorNotOpen.
+	    ^ nil
+	]
     ].
 %{
     int f = __intVal(fd);
@@ -1065,9 +1065,9 @@
 #if defined(DEV_AUDIO)
     if (__isSmallInteger(fd)) {
 # if defined(SNDCTL_DSP_RESET)
-        if (ioctl(f, SNDCTL_DSP_RESET, &__dummy) >= 0) {
-            RETURN (self);
-        }
+	if (ioctl(f, SNDCTL_DSP_RESET, &__dummy) >= 0) {
+	    RETURN (self);
+	}
 # endif
     }
 #endif
@@ -1086,127 +1086,127 @@
     |fd|
 
     filePointer notNil ifTrue:[
-        fd := self fileDescriptor.
-        fd isNil ifTrue:[
-            self errorNotOpen.
-            ^ nil
-        ]
+	fd := self fileDescriptor.
+	fd isNil ifTrue:[
+	    self errorNotOpen.
+	    ^ nil
+	]
     ].
 %{
     OBJ sym = aSymbol;
 
     if (__INST(audioFormat) == sym) {
-        RETURN (self);
+	RETURN (self);
     }
 
 #if defined(DEV_AUDIO)
     if (__isSmallInteger(fd)) {
-        int f = __intVal(fd);
-        int __fmt = 0, __fmtWant;
-        union {
-            unsigned short us;
-            unsigned char ub[2];
-        } u;
+	int f = __intVal(fd);
+	int __fmt = 0, __fmtWant;
+	union {
+	    unsigned short us;
+	    unsigned char ub[2];
+	} u;
 
-        if (__isSymbol(sym)) {
-            if (sym == @symbol(U16)) {
-                u.us = 0x1234;
-                if (u.ub[0] == 0x34) {
+	if (__isSymbol(sym)) {
+	    if (sym == @symbol(U16)) {
+		u.us = 0x1234;
+		if (u.ub[0] == 0x34) {
 /* printf("U16_LE\n"); */
-                    sym = @symbol(U16_LE);
-                } else {
+		    sym = @symbol(U16_LE);
+		} else {
 /* printf("U16_BE\n"); */
-                    sym = @symbol(U16_BE);
-                }
-            } else if (sym == @symbol(S16)) {
-                u.us = 0x1234;
-                if (u.ub[0] == 0x34) {
+		    sym = @symbol(U16_BE);
+		}
+	    } else if (sym == @symbol(S16)) {
+		u.us = 0x1234;
+		if (u.ub[0] == 0x34) {
 /* printf("S16_LE\n"); */
-                   sym = @symbol(S16_LE);
-                } else {
+		   sym = @symbol(S16_LE);
+		} else {
 /* printf("S16_BE\n"); */
-                   sym = @symbol(S16_BE);
-                }
-            }
+		   sym = @symbol(S16_BE);
+		}
+	    }
 
-            if (0) {
+	    if (0) {
 # ifdef AFMT_MU_LAW
-            } else if (sym == @symbol(MU_LAW)) {
-                __fmt = AFMT_MU_LAW;
+	    } else if (sym == @symbol(MU_LAW)) {
+		__fmt = AFMT_MU_LAW;
 # endif
 # ifdef AFMT_A_LAW
-            } else if (sym == @symbol(A_LAW)) {
-                __fmt = AFMT_A_LAW;
+	    } else if (sym == @symbol(A_LAW)) {
+		__fmt = AFMT_A_LAW;
 # endif
 # ifdef AFMT_IMA_ADPCM
-            } else if (sym == @symbol(IMA_ADPCM)) {
-                __fmt = AFMT_IMA_ADPCM;
+	    } else if (sym == @symbol(IMA_ADPCM)) {
+		__fmt = AFMT_IMA_ADPCM;
 # endif
 # ifdef AFMT_U8
-            } else if (sym == @symbol(U8)) {
-                __fmt = AFMT_U8;
+	    } else if (sym == @symbol(U8)) {
+		__fmt = AFMT_U8;
 # endif
 # ifdef AFMT_S8
-            } else if (sym == @symbol(S8)) {
-                __fmt = AFMT_S8;
+	    } else if (sym == @symbol(S8)) {
+		__fmt = AFMT_S8;
 # endif
 # ifdef AFMT_U16_LE
-            } else if (sym == @symbol(U16_LE)) {
-                __fmt = AFMT_U16_LE;
+	    } else if (sym == @symbol(U16_LE)) {
+		__fmt = AFMT_U16_LE;
 # endif
 # ifdef AFMT_U16_BE
-            } else if (sym == @symbol(U16_BE)) {
-                __fmt = AFMT_U16_BE;
+	    } else if (sym == @symbol(U16_BE)) {
+		__fmt = AFMT_U16_BE;
 # endif
 # ifdef AFMT_S16_LE
-            } else if (sym == @symbol(S16_LE)) {
-                __fmt = AFMT_S16_LE;
+	    } else if (sym == @symbol(S16_LE)) {
+		__fmt = AFMT_S16_LE;
 # endif
 # ifdef AFMT_S16_BE
-            } else if (sym == @symbol(S16_BE)) {
-                __fmt = AFMT_S16_BE;
+	    } else if (sym == @symbol(S16_BE)) {
+		__fmt = AFMT_S16_BE;
 # endif
 # ifdef AFMT_MPEG
-            } else if (sym == @symbol(MPEG)) {
-                __fmt = AFMT_MPEG;
+	    } else if (sym == @symbol(MPEG)) {
+		__fmt = AFMT_MPEG;
 # endif
 
 # ifdef AUDIO_FORMAT_LINEAR16BIT
-            } else if (sym == @symbol(S16)) {
-                __fmt = AUDIO_FORMAT_LINEAR16BIT;
+	    } else if (sym == @symbol(S16)) {
+		__fmt = AUDIO_FORMAT_LINEAR16BIT;
 # endif
 # ifdef AUDIO_FORMAT_ULAW
-            } else if (sym == @symbol(MU_LAW)) {
-                __fmt = AUDIO_FORMAT_ULAW;
+	    } else if (sym == @symbol(MU_LAW)) {
+		__fmt = AUDIO_FORMAT_ULAW;
 # endif
 # ifdef AUDIO_FORMAT_ALAW
-            } else if (sym == @symbol(A_LAW)) {
-                __fmt = AUDIO_FORMAT_ALAW;
+	    } else if (sym == @symbol(A_LAW)) {
+		__fmt = AUDIO_FORMAT_ALAW;
 # endif
-            } else {
-                fprintf(stderr, "bad format: %s\n", __stringVal(sym));
-                goto bad;
-            }
-        }
+	    } else {
+		fprintf(stderr, "bad format: %s\n", __stringVal(sym));
+		goto bad;
+	    }
+	}
 
 # ifdef SNDCTL_DSP_SETFMT
-        __fmtWant = __fmt;
+	__fmtWant = __fmt;
 
-        if (ioctl(f, SNDCTL_DSP_SETFMT, &__fmt) >= 0) {
-            if (__fmt == __fmtWant) {
-                __INST(audioFormat) = sym;
-                RETURN (self);
-            } else {
-                /* fprintf(stderr, "want: %x; got: %x\n", __fmtWant, __fmt); */
-            }
-        } else {
-                /* fprintf(stderr, "got err-ret from setFmp %x\n", __fmt); */
-        }
+	if (ioctl(f, SNDCTL_DSP_SETFMT, &__fmt) >= 0) {
+	    if (__fmt == __fmtWant) {
+		__INST(audioFormat) = sym;
+		RETURN (self);
+	    } else {
+		/* fprintf(stderr, "want: %x; got: %x\n", __fmtWant, __fmt); */
+	    }
+	} else {
+		/* fprintf(stderr, "got err-ret from setFmp %x\n", __fmt); */
+	}
 # else
 #  ifdef AUDIO_SET_DATA_FORMAT /* hpux */
-        if (ioctl (f, AUDIO_SET_DATA_FORMAT, __fmt)) {
-            /* fprintf(stderr, "got err-ret from AUDIO_SET_DATA_FORMAT\n"); */
-        }
+	if (ioctl (f, AUDIO_SET_DATA_FORMAT, __fmt)) {
+	    /* fprintf(stderr, "got err-ret from AUDIO_SET_DATA_FORMAT\n"); */
+	}
 #  endif
 # endif /* SNDCTL_DSP_SETFMT */
 
@@ -1233,45 +1233,45 @@
     |fd|
 
     filePointer notNil ifTrue:[
-        fd := self fileDescriptor.
-        fd isNil ifTrue:[
-            self errorNotOpen.
-            ^ nil
-        ]
+	fd := self fileDescriptor.
+	fd isNil ifTrue:[
+	    self errorNotOpen.
+	    ^ nil
+	]
     ].
 %{
 
 #if defined(DEV_AUDIO)
     if (__isSmallInteger(fd) && __isSmallInteger(nChannels)) {
-        int f = __intVal(fd);
-        int __nCh = __intVal(nChannels);
+	int f = __intVal(fd);
+	int __nCh = __intVal(nChannels);
 
 # if defined(SNDCTL_DSP_STEREO)
-        if ((__nCh == 1) || (__nCh == 2)) {
-            int __stereo = (__nCh == 2) ? 1 : 0;
+	if ((__nCh == 1) || (__nCh == 2)) {
+	    int __stereo = (__nCh == 2) ? 1 : 0;
 
-            if (ioctl(f, SNDCTL_DSP_STEREO, &__stereo) >= 0) {
-                if (__stereo == 0) {
-                    __INST(numberOfChannels) = __MKSMALLINT(1);
-                } else {
-                    __INST(numberOfChannels) = __MKSMALLINT(2);
-                }
-                RETURN (self);
-            }
-        }
+	    if (ioctl(f, SNDCTL_DSP_STEREO, &__stereo) >= 0) {
+		if (__stereo == 0) {
+		    __INST(numberOfChannels) = __MKSMALLINT(1);
+		} else {
+		    __INST(numberOfChannels) = __MKSMALLINT(2);
+		}
+		RETURN (self);
+	    }
+	}
 # else
 #  if defined(SOUND_PCM_WRITE_CHANNELS)
-        if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &__nCh) >= 0) {
-            __INST(numberOfChannels) = nChannels;
-            RETURN (self);
-        }
+	if (ioctl(f, SOUND_PCM_WRITE_CHANNELS, &__nCh) >= 0) {
+	    __INST(numberOfChannels) = nChannels;
+	    RETURN (self);
+	}
 #  else
 #   ifdef AUDIO_SET_CHANNELS /* hpux */
-        if (ioctl (f, AUDIO_SET_CHANNELS, __nCh)) {
-            /* fprintf(stderr, "got err-ret from AUDIO_SET_CHANNELS\n"); */
-            __INST(numberOfChannels) = nChannels;
-            RETURN (self);
-        }
+	if (ioctl (f, AUDIO_SET_CHANNELS, __nCh)) {
+	    /* fprintf(stderr, "got err-ret from AUDIO_SET_CHANNELS\n"); */
+	    __INST(numberOfChannels) = nChannels;
+	    RETURN (self);
+	}
 #   endif
 #  endif
 # endif
@@ -1294,31 +1294,31 @@
     |fd|
 
     filePointer notNil ifTrue:[
-        fd := self fileDescriptor.
-        fd isNil ifTrue:[
-            self errorNotOpen.
-            ^ nil
-        ]
+	fd := self fileDescriptor.
+	fd isNil ifTrue:[
+	    self errorNotOpen.
+	    ^ nil
+	]
     ].
 %{
     int f = __intVal(fd);
     int __blockSize = 0;
 
-#if defined(DEV_AUDIO) 
+#if defined(DEV_AUDIO)
     if (__isSmallInteger(fd) && __isSmallInteger(blockSize)) {
-        __blockSize = __intVal(blockSize);
+	__blockSize = __intVal(blockSize);
 # if defined(SNDCTL_DSP_SETFRAGMENT)
-        if (ioctl(f, SNDCTL_DSP_SETFRAGMENT, &__blockSize) >= 0) {
-            /* __INST(blockSize) = blockSize; */
-            RETURN (self);
-        }
+	if (ioctl(f, SNDCTL_DSP_SETFRAGMENT, &__blockSize) >= 0) {
+	    /* __INST(blockSize) = blockSize; */
+	    RETURN (self);
+	}
 # endif
 # ifdef AUDIO_SET_CHANNELS /* hpux */
-        if (ioctl (f, AUDIO_SET_TXBUFSIZE, __blockSize)) {
-            /* fprintf(stderr, "got err-ret from AUDIO_SET_TXBUFSIZE\n"); */
-            /* __INST(blockSize) = blockSize; */
-            RETURN (self);
-        }
+	if (ioctl (f, AUDIO_SET_TXBUFSIZE, __blockSize)) {
+	    /* fprintf(stderr, "got err-ret from AUDIO_SET_TXBUFSIZE\n"); */
+	    /* __INST(blockSize) = blockSize; */
+	    RETURN (self);
+	}
 # endif
     }
 #endif
@@ -1333,45 +1333,45 @@
     |fd|
 
     filePointer notNil ifTrue:[
-        fd := self fileDescriptor.
-        fd isNil ifTrue:[
-            self errorNotOpen.
-            ^ nil
-        ]
+	fd := self fileDescriptor.
+	fd isNil ifTrue:[
+	    self errorNotOpen.
+	    ^ nil
+	]
     ].
 %{
-#if defined(DEV_AUDIO) 
+#if defined(DEV_AUDIO)
     if (__isSmallInteger(fd) && __isSmallInteger(hz)) {
-        int f = __intVal(fd);
-        int __rate = __intVal(hz);
-        int __rateWant = __rate;
+	int f = __intVal(fd);
+	int __rate = __intVal(hz);
+	int __rateWant = __rate;
 
 # if defined(SNDCTL_DSP_SPEED)
-        if (ioctl(f, SNDCTL_DSP_SPEED, &__rate) >= 0) {
-            if (__rate != __rateWant) {
-                fprintf(stderr, "SoundStream [warning]: actual rate is %d\n", __rate);
-                hz = __MKSMALLINT(__rate);
-            }
-            __INST(sampleRate) = hz;
-            RETURN (self);
-        }
+	if (ioctl(f, SNDCTL_DSP_SPEED, &__rate) >= 0) {
+	    if (__rate != __rateWant) {
+		fprintf(stderr, "SoundStream [warning]: actual rate is %d\n", __rate);
+		hz = __MKSMALLINT(__rate);
+	    }
+	    __INST(sampleRate) = hz;
+	    RETURN (self);
+	}
 # else
 #  if defined(SOUND_PCM_WRITE_RATE)
-        if (ioctl(f, SOUND_PCM_WRITE_RATE, &__rate) >= 0) {
-            if (__rate != __rateWant) {
-                fprintf(stderr, "SoundStream [warning]: actual rate is %d\n", __rate);
-                hz = __MKSMALLINT(__rate);
-            }
-            __INST(sampleRate) = hz;
-            RETURN (self);
-        }
+	if (ioctl(f, SOUND_PCM_WRITE_RATE, &__rate) >= 0) {
+	    if (__rate != __rateWant) {
+		fprintf(stderr, "SoundStream [warning]: actual rate is %d\n", __rate);
+		hz = __MKSMALLINT(__rate);
+	    }
+	    __INST(sampleRate) = hz;
+	    RETURN (self);
+	}
 #  else
 #   ifdef AUDIO_SET_SAMPLE_RATE /* hpux */
-        if (ioctl (f, AUDIO_SET_SAMPLE_RATE, __rate)) {
-            /* fprintf(stderr, "got err-ret from AUDIO_SET_SAMPLE_RATE\n"); */
-            __INST(sampleRate) = hz;
-            RETURN (self);
-        }
+	if (ioctl (f, AUDIO_SET_SAMPLE_RATE, __rate)) {
+	    /* fprintf(stderr, "got err-ret from AUDIO_SET_SAMPLE_RATE\n"); */
+	    __INST(sampleRate) = hz;
+	    RETURN (self);
+	}
 #   endif
 #  endif
 # endif
@@ -1390,18 +1390,18 @@
 supportedAudioFormats
     "return a collection of supported audio formats.
      returned symbols are:
-        U8        unsigned 8bit samples
-        S8        signed 8bit samples
-        MU_LAW    u-law encoded 8bit samples
-        A_LAW     a-law encoded 8bit samples
-        IMA_ADPCM adpcm encoded
-        U16       unsigned 16bit samples
-        U16_LE    unsigned 16bit big endian samples
-        U16_BE    unsigned 16bit big endian samples
-        S16       signed 16bit little endian samples
-        S16_LE    signed 16bit little endian samples
-        S16_BE    signed 16bit big endian samples
-        MPEG      audio mpeg encoded
+	U8        unsigned 8bit samples
+	S8        signed 8bit samples
+	MU_LAW    u-law encoded 8bit samples
+	A_LAW     a-law encoded 8bit samples
+	IMA_ADPCM adpcm encoded
+	U16       unsigned 16bit samples
+	U16_LE    unsigned 16bit big endian samples
+	U16_BE    unsigned 16bit big endian samples
+	S16       signed 16bit little endian samples
+	S16_LE    signed 16bit little endian samples
+	S16_BE    signed 16bit big endian samples
+	MPEG      audio mpeg encoded
     "
 
     |fd audioFormatMask
@@ -1414,8 +1414,8 @@
 
     fd := self fileDescriptor.
     fd isNil ifTrue:[
-        self errorNotOpen.
-        ^ nil
+	self errorNotOpen.
+	^ nil
     ].
 %{
     int f = __intVal(fd);
@@ -1426,37 +1426,37 @@
 
 # if defined(SNDCTL_DSP_GETFMTS)
     if (ioctl(f, SNDCTL_DSP_GETFMTS, &__audioFormatMask) >= 0) {
-        audioFormatMask = __MKSMALLINT(__audioFormatMask);
+	audioFormatMask = __MKSMALLINT(__audioFormatMask);
 
 #  ifdef AFMT_MU_LAW
-        supports_MU_LAW = (__audioFormatMask & AFMT_MU_LAW) ? true : false;
+	supports_MU_LAW = (__audioFormatMask & AFMT_MU_LAW) ? true : false;
 #  endif
 #  ifdef AFMT_A_LAW
-        supports_A_LAW = (__audioFormatMask & AFMT_A_LAW) ? true : false;
+	supports_A_LAW = (__audioFormatMask & AFMT_A_LAW) ? true : false;
 #  endif
 #  ifdef AFMT_IMA_ADPCM
-        supports_IMA_ADPCM = (__audioFormatMask & AFMT_IMA_ADPCM) ? true : false;
+	supports_IMA_ADPCM = (__audioFormatMask & AFMT_IMA_ADPCM) ? true : false;
 #  endif
 #  ifdef AFMT_U8
-        supports_U8 = (__audioFormatMask & AFMT_U8) ? true : false;
+	supports_U8 = (__audioFormatMask & AFMT_U8) ? true : false;
 #  endif
 #  ifdef AFMT_S16_LE
-        supports_S16_LE = (__audioFormatMask & AFMT_S16_LE) ? true : false;
+	supports_S16_LE = (__audioFormatMask & AFMT_S16_LE) ? true : false;
 #  endif
 #  ifdef AFMT_S16_BE
-        supports_S16_BE = (__audioFormatMask & AFMT_S16_BE) ? true : false;
+	supports_S16_BE = (__audioFormatMask & AFMT_S16_BE) ? true : false;
 #  endif
 #  ifdef AFMT_S8
-        supports_S8 = (__audioFormatMask & AFMT_S8) ? true : false;
+	supports_S8 = (__audioFormatMask & AFMT_S8) ? true : false;
 #  endif
 #  ifdef AFMT_U16_LE
-        supports_U16_LE = (__audioFormatMask & AFMT_U16_LE) ? true : false;
+	supports_U16_LE = (__audioFormatMask & AFMT_U16_LE) ? true : false;
 #  endif
 #  ifdef AFMT_U16_BE
-        supports_U16_BE = (__audioFormatMask & AFMT_U16_BE) ? true : false;
+	supports_U16_BE = (__audioFormatMask & AFMT_U16_BE) ? true : false;
 #  endif
 #  ifdef AFMT_MPEG
-        supports_MPEG = (__audioFormatMask & AFMT_MPEG) ? true : false;
+	supports_MPEG = (__audioFormatMask & AFMT_MPEG) ? true : false;
 #  endif
     }
 # endif
@@ -1480,46 +1480,46 @@
 %}.
     supportedFormats := IdentitySet new.
     supports_MU_LAW ifTrue:[
-        supportedFormats add:#'MU_LAW'
+	supportedFormats add:#'MU_LAW'
     ].
     supports_A_LAW ifTrue:[
-        supportedFormats add:#'A_LAW'
+	supportedFormats add:#'A_LAW'
     ].
     supports_IMA_ADPCM ifTrue:[
-        supportedFormats add:#'IMA_ADPCM'
+	supportedFormats add:#'IMA_ADPCM'
     ].
     supports_S8 ifTrue:[
-        supportedFormats add:#'S8'
+	supportedFormats add:#'S8'
     ].
     supports_U8 ifTrue:[
-        supportedFormats add:#'U8'
+	supportedFormats add:#'U8'
     ].
     supports_S16_LE ifTrue:[
-        supportedFormats add:#'S16_LE'.
-        UninterpretedBytes isBigEndian ifFalse:[
-            supportedFormats add:#'S16'.
-        ]
+	supportedFormats add:#'S16_LE'.
+	UninterpretedBytes isBigEndian ifFalse:[
+	    supportedFormats add:#'S16'.
+	]
     ].
     supports_S16_BE ifTrue:[
-        supportedFormats add:#'S16_BE'.
-        UninterpretedBytes isBigEndian ifTrue:[
-            supportedFormats add:#'S16'.
-        ]
+	supportedFormats add:#'S16_BE'.
+	UninterpretedBytes isBigEndian ifTrue:[
+	    supportedFormats add:#'S16'.
+	]
     ].
     supports_U16_LE ifTrue:[
-        supportedFormats add:#'U16_LE'.
-        UninterpretedBytes isBigEndian ifFalse:[
-            supportedFormats add:#'U16'.
-        ]
+	supportedFormats add:#'U16_LE'.
+	UninterpretedBytes isBigEndian ifFalse:[
+	    supportedFormats add:#'U16'.
+	]
     ].
     supports_U16_BE ifTrue:[
-        supportedFormats add:#'U16_BE'.
-        UninterpretedBytes isBigEndian ifTrue:[
-            supportedFormats add:#'U16'.
-        ]
+	supportedFormats add:#'U16_BE'.
+	UninterpretedBytes isBigEndian ifTrue:[
+	    supportedFormats add:#'U16'.
+	]
     ].
     supports_MPEG ifTrue:[
-        supportedFormats add:#'MPEG'
+	supportedFormats add:#'MPEG'
     ].
     ^ supportedFormats.
 
@@ -1529,7 +1529,7 @@
      s := self writing.
      formats := s supportedAudioFormats.
      s close.
-     formats 
+     formats
     "
 ! !
 
@@ -1580,7 +1580,7 @@
     if ((oWaveHandle = __INST(waveHandle)) != nil) {
 	t_waveHandle = __WaveHandleVal(oWaveHandle);
 
-#  ifdef NO_WAIT_IN_CLOSE 
+#  ifdef NO_WAIT_IN_CLOSE
 	/* Force cancellation of any pending buffers */
 	(void)waveOutReset(t_waveHandle);
 #  endif
@@ -1590,7 +1590,7 @@
 	    WaitForSingleObject(free_buffer_event, INFINITE);
 	}
 
-#  ifndef NO_WAIT_IN_CLOSE 
+#  ifndef NO_WAIT_IN_CLOSE
 	/* Force cancellation of any pending buffers */
 	(void)waveOutReset(t_waveHandle);
 #  endif
@@ -1655,7 +1655,7 @@
     |fd|
 
     fd := self fileDescriptor.
-%{ 
+%{
 #ifdef IRIS_AUDIO
     OPJ port;
     ALport p;
@@ -1701,23 +1701,23 @@
     char *cp;
 
     if ((port = __INST(alPort)) != nil) {
-        if (__INST(mode) != _writeonly) {
-            if (__bothSmallInteger(count, start)) {
-                cnt = __intVal(count);
-                offs = __intVal(start) - 1;
-                p = __ALportVal(port);
-                objSize = _Size(anObject) - OHDR_SIZE;
-                if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
-                    cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
-                    if (__INST(bitsPerSample) == __MKSMALLINT(16))
-                        nSamp = cnt / 2;
-                    else
-                        nSamp = cnt;
-                    ALreadsamps(p, cp, nSamp);
-                    RETURN ( __MKSMALLINT(cnt) );
-                }
-            }
-        }
+	if (__INST(mode) != _writeonly) {
+	    if (__bothSmallInteger(count, start)) {
+		cnt = __intVal(count);
+		offs = __intVal(start) - 1;
+		p = __ALportVal(port);
+		objSize = _Size(anObject) - OHDR_SIZE;
+		if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) {
+		    cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
+		    if (__INST(bitsPerSample) == __MKSMALLINT(16))
+			nSamp = cnt / 2;
+		    else
+			nSamp = cnt;
+		    ALreadsamps(p, cp, nSamp);
+		    RETURN ( __MKSMALLINT(cnt) );
+		}
+	    }
+	}
     }
   }
 #endif
@@ -1739,56 +1739,56 @@
     int fd;
 
     if ((fp = __INST(filePointer)) != nil) {
-        f = __FILEVal(fp);
-        if (__INST(mode) != @symbol(writeonly)) {
-            if (__bothSmallInteger(count, start)) {
-                cnt = __intVal(count);
-                offs = __intVal(start) - 1;
+	f = __FILEVal(fp);
+	if (__INST(mode) != @symbol(writeonly)) {
+	    if (__bothSmallInteger(count, start)) {
+		cnt = __intVal(count);
+		offs = __intVal(start) - 1;
 
-                objSize = _Size(anObject) - OHDR_SIZE;
-                if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
-                    do {
-                        cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
+		objSize = _Size(anObject) - OHDR_SIZE;
+		if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
+		    do {
+			cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
 
-                        n = cnt;
+			n = cnt;
 /*                        if (n > 4096) n = 4096; */
 # ifdef LINUX
-                        sigsetmask(~0);
+			sigsetmask(~0);
 # endif
-                        if (__INST(buffered) == true) {
-                            n = fread(cp, 1, n, f);
-                        } else {
-                            fd = fileno(f);
-                            n = read(fd, cp, n);
-                        }
+			if (__INST(buffered) == true) {
+			    n = fread(cp, 1, n, f);
+			} else {
+			    fd = fileno(f);
+			    n = read(fd, cp, n);
+			}
 # ifdef LINUX
-                        sigsetmask(0);
+			sigsetmask(0);
 # endif
-                        __BEGIN_INTERRUPTABLE__
-                        __END_INTERRUPTABLE__
+			__BEGIN_INTERRUPTABLE__
+			__END_INTERRUPTABLE__
 /* printf("SoundStream: read %d bytes\n", n); */
-                        if (n > 0) {
-                            offs += n;
-                            cnt -= n;
-                        } else {
-                            if (n < 0) {
-                                fprintf(stderr, "read error: %d\n", __threadErrno);
-                                RETURN (count);
-                            }
-                        }
-                    } while (cnt);
-                }
-                RETURN (count);
-            }
-        }
+			if (n > 0) {
+			    offs += n;
+			    cnt -= n;
+			} else {
+			    if (n < 0) {
+				fprintf(stderr, "read error: %d\n", __threadErrno);
+				RETURN (count);
+			    }
+			}
+		    } while (cnt);
+		}
+		RETURN (count);
+	    }
+	}
     }
 #endif
 
 %}.
     OperatingSystem getOSType = 'irix' ifFalse:[
-        OperatingSystem getOSType = 'win32' ifFalse:[
-            ^ super nextPutBytes:count from:anObject startingAt:start
-        ].
+	OperatingSystem getOSType = 'win32' ifFalse:[
+	    ^ super nextPutBytes:count from:anObject startingAt:start
+	].
     ].
     filePointer isNil ifTrue:[^ self errorNotOpen].
     (mode == #writeonly) ifTrue:[^ self errorWriteOnly].
@@ -1811,27 +1811,27 @@
     char *cp;
 
     if ((port = __INST(alPort)) != nil) {
-        if (__INST(mode) != @symbol(readonly)) {
-            if (__bothSmallInteger(count, start)) {
-                cnt = __intVal(count);
-                offs = __intVal(start) - 1;
-                p = __ALportVal(port);
+	if (__INST(mode) != @symbol(readonly)) {
+	    if (__bothSmallInteger(count, start)) {
+		cnt = __intVal(count);
+		offs = __intVal(start) - 1;
+		p = __ALportVal(port);
 
-                /*
-                 * compute number of samples
-                 */
-                objSize = _Size(anObject) - OHDR_SIZE;
-                if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
-                    cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
-                    if (__INST(bitsPerSample) == __MKSMALLINT(16))
-                        nSamp = cnt / 2;
-                    else
-                        nSamp = cnt;
-                    ALwritesamps(p, cp, cnt);
-                    RETURN ( count );
-                }
-            }
-        }
+		/*
+		 * compute number of samples
+		 */
+		objSize = _Size(anObject) - OHDR_SIZE;
+		if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
+		    cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
+		    if (__INST(bitsPerSample) == __MKSMALLINT(16))
+			nSamp = cnt / 2;
+		    else
+			nSamp = cnt;
+		    ALwritesamps(p, cp, cnt);
+		    RETURN ( count );
+		}
+	    }
+	}
     }
   }
 #endif /* SGI_AUDIO */
@@ -1855,15 +1855,15 @@
       int cnt, offs;
 
       if ((oDSBuffer = __INST(pDSBuffer)) != nil) {
-          t_pDSBuffer = __DSBufferVal(oDSBuffer);
+	  t_pDSBuffer = __DSBufferVal(oDSBuffer);
       }
       if ((oDirectSound = __INST(pDirectSound)) != nil) {
-          t_pDirectSound = __DirectSoundVal(oDirectSound);
+	  t_pDirectSound = __DirectSoundVal(oDirectSound);
       }
 
       if (!t_pDSBuffer || !t_pDirectSound) {
-          fprintf(stderr, "SoundStream not open!\n");
-          RETURN (0);
+	  fprintf(stderr, "SoundStream not open!\n");
+	  RETURN (0);
       }
       t_cbBufOffset = __intVal(__INST(bufferOffset));
       t_cbBufSize = __intVal(__INST(bufferSize));
@@ -1875,47 +1875,47 @@
       // Should be playing, right?
       hr = IDirectSoundBuffer_GetStatus(t_pDSBuffer, &status );
       if (!(status && DSBSTATUS_PLAYING)) {
-          fprintf(stderr, "Buffer not playing!\n");
-          RETURN (0);
+	  fprintf(stderr, "Buffer not playing!\n");
+	  RETURN (0);
       }
 
       // Sleep until we have enough room in buffer.
       hr = IDirectSoundBuffer_GetCurrentPosition(t_pDSBuffer, &playPos, &safePos );
       if( hr != DS_OK ) {
-          fprintf(stderr, "Cannot get position!\n");
-          RETURN (0);
+	  fprintf(stderr, "Cannot get position!\n");
+	  RETURN (0);
       }
-      if( playPos < t_cbBufOffset ) playPos += t_cbBufSize; 
+      if( playPos < t_cbBufOffset ) playPos += t_cbBufSize;
 
       endWrite = t_cbBufOffset + (cnt * sizeof(short));
       while ( playPos < endWrite ) {
-          // Calculate number of milliseconds until we will have room, as
-          // time = distance * (milliseconds/second) / ((bytes/sample) * (samples/second)),
-          // rounded up.
-          millis = (DWORD) (1.0 + ((endWrite - playPos) * 1000.0) / ( sizeof(short) * __intVal(__INST(sampleRate))));
+	  // Calculate number of milliseconds until we will have room, as
+	  // time = distance * (milliseconds/second) / ((bytes/sample) * (samples/second)),
+	  // rounded up.
+	  millis = (DWORD) (1.0 + ((endWrite - playPos) * 1000.0) / ( sizeof(short) * __intVal(__INST(sampleRate))));
 
-          // Sleep for that long
-          Sleep( millis );
+	  // Sleep for that long
+	  Sleep( millis );
 
-          // Wake up, find out where we are now
-          hr = IDirectSoundBuffer_GetCurrentPosition(t_pDSBuffer, &playPos, &safePos );
-          if( hr != DS_OK ) {
-              fprintf(stderr, "Cannot get position!\n");
-              RETURN (0);
-          }
-          if( playPos < t_cbBufOffset ) playPos += t_cbBufSize; // unwrap offset
+	  // Wake up, find out where we are now
+	  hr = IDirectSoundBuffer_GetCurrentPosition(t_pDSBuffer, &playPos, &safePos );
+	  if( hr != DS_OK ) {
+	      fprintf(stderr, "Cannot get position!\n");
+	      RETURN (0);
+	  }
+	  if( playPos < t_cbBufOffset ) playPos += t_cbBufSize; // unwrap offset
       }
 
       // Lock free space in the DS
       hr = IDirectSoundBuffer_Lock(t_pDSBuffer, t_cbBufOffset, cnt * sizeof(short), &lpbuf1, &dwsize1, &lpbuf2, &dwsize2, 0);
       if (hr == DS_OK) {
-          // Copy the buffer into the DS
-          CopyMemory(lpbuf1, buf, dwsize1);
-          if(NULL != lpbuf2) CopyMemory(lpbuf2, buf+dwsize1, dwsize2);
+	  // Copy the buffer into the DS
+	  CopyMemory(lpbuf1, buf, dwsize1);
+	  if(NULL != lpbuf2) CopyMemory(lpbuf2, buf+dwsize1, dwsize2);
 
-          // Update our buffer offset and unlock sound buffer
-          t_cbBufOffset = (t_cbBufOffset + dwsize1 + dwsize2) % t_cbBufSize;
-          IDirectSoundBuffer_Unlock(t_pDSBuffer, lpbuf1, dwsize1, lpbuf2, dwsize2);
+	  // Update our buffer offset and unlock sound buffer
+	  t_cbBufOffset = (t_cbBufOffset + dwsize1 + dwsize2) % t_cbBufSize;
+	  IDirectSoundBuffer_Unlock(t_pDSBuffer, lpbuf1, dwsize1, lpbuf2, dwsize2);
       }
       __INST(buffferOffset) = __MKSMALLINT(t_cbBufOffset);
 
@@ -1923,7 +1923,7 @@
   }
 # else
   {
-    struct buf *bp;             
+    struct buf *bp;
     int len, i, r;
     int dataLen, offs;
     char *buf;
@@ -1932,7 +1932,7 @@
     OBJ oWaveHandle;
 
     if ((oWaveHandle = __INST(waveHandle)) == nil) {
-        RETURN(0);
+	RETURN(0);
     }
     t_waveHandle = __WaveHandleVal(oWaveHandle);
 
@@ -1941,50 +1941,50 @@
     buf = (short *)__InstPtr(anObject) + OHDR_SIZE + offs;
 
     while (dataLen > 0) {
-        if (free_list == NULL && total_buffers < MAXBUF) {
-            /* Expand available buffer space */
-            bp = (struct buf *)malloc(sizeof(struct buf));
-            total_buffers++;
-        } else {
-            if (free_list == NULL) {
-                /* We must wait for a free buffer */
-                while (free_list == NULL) {
-                    WaitForSingleObject(free_buffer_event, INFINITE);
-                }
-            }
-            EnterCriticalSection(&free_list_lock);
-            bp = free_list;
-            free_list = free_list->next;
-            --free_buffers;
-            LeaveCriticalSection(&free_list_lock);
-            r = waveOutUnprepareHeader(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
-            if (r != 0) {
-                printf("waveOutUnprepareHeader\n");
-                RETURN(self);
-            }
-        }
-        len = min(dataLen, DATALEN);
-        bp->hdr.lpData = (char *)bp->data;
-        bp->hdr.dwBufferLength = len;
-        bp->hdr.dwBytesRecorded = len;
-        bp->hdr.dwUser = (DWORD)bp;
-        bp->hdr.dwFlags = 0;
-        bp->hdr.dwLoops = 0;
-        r = waveOutPrepareHeader(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
-        if (r != 0) {
-            printf("waveOutPrepareHeader\n");
-            RETURN(self);
-        }
-        for (i = 0; i < len; i++) {
-            bp->data[i] = buf[i];
-        }
-        r = waveOutWrite(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
-        if (r != 0) {
-            printf("waveOutWrite\n");
-            RETURN(self);
-        }
-        buf += len;
-        dataLen -= len;
+	if (free_list == NULL && total_buffers < MAXBUF) {
+	    /* Expand available buffer space */
+	    bp = (struct buf *)malloc(sizeof(struct buf));
+	    total_buffers++;
+	} else {
+	    if (free_list == NULL) {
+		/* We must wait for a free buffer */
+		while (free_list == NULL) {
+		    WaitForSingleObject(free_buffer_event, INFINITE);
+		}
+	    }
+	    EnterCriticalSection(&free_list_lock);
+	    bp = free_list;
+	    free_list = free_list->next;
+	    --free_buffers;
+	    LeaveCriticalSection(&free_list_lock);
+	    r = waveOutUnprepareHeader(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
+	    if (r != 0) {
+		printf("waveOutUnprepareHeader\n");
+		RETURN(self);
+	    }
+	}
+	len = min(dataLen, DATALEN);
+	bp->hdr.lpData = (char *)bp->data;
+	bp->hdr.dwBufferLength = len;
+	bp->hdr.dwBytesRecorded = len;
+	bp->hdr.dwUser = (DWORD)bp;
+	bp->hdr.dwFlags = 0;
+	bp->hdr.dwLoops = 0;
+	r = waveOutPrepareHeader(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
+	if (r != 0) {
+	    printf("waveOutPrepareHeader\n");
+	    RETURN(self);
+	}
+	for (i = 0; i < len; i++) {
+	    bp->data[i] = buf[i];
+	}
+	r = waveOutWrite(t_waveHandle, &bp->hdr, sizeof(WAVEHDR));
+	if (r != 0) {
+	    printf("waveOutWrite\n");
+	    RETURN(self);
+	}
+	buf += len;
+	dataLen -= len;
     }
     RETURN (count);
   }
@@ -2010,47 +2010,47 @@
     int fd;
 
     if ((fp = __INST(filePointer)) != nil) {
-        f = __FILEVal(fp);
-        if (__INST(mode) != @symbol(readonly)) {
-            if (__bothSmallInteger(count, start)) {
-                cnt = __intVal(count);
-                offs = __intVal(start) - 1;
+	f = __FILEVal(fp);
+	if (__INST(mode) != @symbol(readonly)) {
+	    if (__bothSmallInteger(count, start)) {
+		cnt = __intVal(count);
+		offs = __intVal(start) - 1;
 
-                objSize = _Size(anObject) - OHDR_SIZE;
-                if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
-                    do {
-                        cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
+		objSize = _Size(anObject) - OHDR_SIZE;
+		if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
+		    do {
+			cp = (char *)__InstPtr(anObject) + OHDR_SIZE + offs;
 
-                        n = cnt;
+			n = cnt;
 /*                        if (n > 4096) n = 4096; */
 # ifdef LINUX
-                        sigsetmask(~0);
+			sigsetmask(~0);
 # endif
-                        if (__INST(buffered) == true) {
-                            n = fwrite(cp, 1, n, f);
-                        } else {
-                            fd = fileno(f);
-                            n = write(fd, cp, n);
-                        }
+			if (__INST(buffered) == true) {
+			    n = fwrite(cp, 1, n, f);
+			} else {
+			    fd = fileno(f);
+			    n = write(fd, cp, n);
+			}
 # ifdef LINUX
-                        sigsetmask(0);
+			sigsetmask(0);
 # endif
-                        __BEGIN_INTERRUPTABLE__
-                        __END_INTERRUPTABLE__
-                        if (n > 0) {
-                            offs += n;
-                            cnt -= n;
-                        } else {
-                            if (n < 0) {
-                                fprintf(stderr, "write error: %d\n", __threadErrno);
-                                RETURN (count);
-                            }
-                        }
-                    } while (cnt);
-                }
-                RETURN (count);
-            }
-        }
+			__BEGIN_INTERRUPTABLE__
+			__END_INTERRUPTABLE__
+			if (n > 0) {
+			    offs += n;
+			    cnt -= n;
+			} else {
+			    if (n < 0) {
+				fprintf(stderr, "write error: %d\n", __threadErrno);
+				RETURN (count);
+			    }
+			}
+		    } while (cnt);
+		}
+		RETURN (count);
+	    }
+	}
     }
 #endif
 
@@ -2067,33 +2067,33 @@
     ALconfig config;
     ALport p;
     long params[] = {
-        AL_INPUT_SOURCE, AL_INPUT_MIC,
-        AL_INPUT_RATE, 8000,
-        AL_OUTPUT_RATE, 8000,
+	AL_INPUT_SOURCE, AL_INPUT_MIC,
+	AL_INPUT_RATE, 8000,
+	AL_OUTPUT_RATE, 8000,
     };
 
     config = ALnewconfig();
     if (__INST(numberOfChannels) == __MKSMALLINT(2))
-        ALsetchannels(config, AL_STEREO);
+	ALsetchannels(config, AL_STEREO);
     else
-        ALsetchannels(config, AL_MONO);
+	ALsetchannels(config, AL_MONO);
     if (__INST(bitsPerSample) == __MKSMALLINT(16))
-        ALsetwidth(config, AL_SAMPLE_16);
+	ALsetwidth(config, AL_SAMPLE_16);
     else
-        ALsetwidth(config, AL_SAMPLE_8);
+	ALsetwidth(config, AL_SAMPLE_8);
 
     if (__isSmallInteger(__INST(sampleRate)))
-        params[3] = params[5] = __intVal(__INST(sampleRate));
+	params[3] = params[5] = __intVal(__INST(sampleRate));
 
     ALsetparams(AL_DEFAULT_DEVICE, params, 6);
     p = ALopenport("smallchat", (char *)_stringVal(aMode), config);
     if (p) {
-        OBJ t;
+	OBJ t;
 
-        __INST(alPort) = t = __MKEXTERNALADDRESS(p); __STORE(self, t);
+	t = __MKEXTERNALADDRESS(p); __INST(alPort) = t; __STORE(self, t);
     } else {
-        __INST(alPort) = nil;
-        goto out;
+	__INST(alPort) = nil;
+	goto out;
     }
     __INST(binary) = true;
 
@@ -2103,27 +2103,27 @@
      */
     config = ALgetconfig(p);
     switch (ALgetchannels(config)) {
-        default:
-            /* cannot happen */
-        case AL_MONO:
-            __INST(numberOfChannels) = __MKSMALLINT(1);
-            break;
-        case AL_STEREO:
-            __INST(numberOfChannels) = __MKSMALLINT(2);
-            break;
+	default:
+	    /* cannot happen */
+	case AL_MONO:
+	    __INST(numberOfChannels) = __MKSMALLINT(1);
+	    break;
+	case AL_STEREO:
+	    __INST(numberOfChannels) = __MKSMALLINT(2);
+	    break;
     }
     switch (ALgetwidth(config)) {
-        default:
-            /* cannot happen */
-        case AL_SAMPLE_8:
-            __INST(bitsPerSample) = __MKSMALLINT(8);
-            break;
-        case AL_SAMPLE_16:
-            __INST(bitsPerSample) = __MKSMALLINT(16);
-            break;
-        case AL_SAMPLE_24:
-            __INST(bitsPerSample) = __MKSMALLINT(24);
-            break;
+	default:
+	    /* cannot happen */
+	case AL_SAMPLE_8:
+	    __INST(bitsPerSample) = __MKSMALLINT(8);
+	    break;
+	case AL_SAMPLE_16:
+	    __INST(bitsPerSample) = __MKSMALLINT(16);
+	    break;
+	case AL_SAMPLE_24:
+	    __INST(bitsPerSample) = __MKSMALLINT(24);
+	    break;
     }
     ALgetparams(AL_DEFAULT_DEVICE, params, 6);
     __INST(sampleRate) = __MKSMALLINT(params[3]);
@@ -2148,8 +2148,8 @@
 
     /* Create the DS object */
     if ((result = DirectSoundCreate(NULL, &t_pDirectSound, NULL)) != DS_OK) {
-        fprintf(stderr,"SoundStream: Cannot open default sound device!!\n");
-        goto out;
+	fprintf(stderr,"SoundStream: Cannot open default sound device!!\n");
+	goto out;
     }
 
     /* Define the wave format structure */
@@ -2170,20 +2170,20 @@
 
     /* Create the primary DS buffer */
     if ((result = IDirectSound_CreateSoundBuffer(t_pDirectSound, &primarydsbDesc,
-                                                 &t_pDSPrimeBuffer, NULL)) != DS_OK) {
-        fprintf(stderr,"SoundStream: Cannot get the primary DS buffer address!\n");
-        IDirectSound_Release(t_pDirectSound);
-        goto out;
+						 &t_pDSPrimeBuffer, NULL)) != DS_OK) {
+	fprintf(stderr,"SoundStream: Cannot get the primary DS buffer address!\n");
+	IDirectSound_Release(t_pDirectSound);
+	goto out;
     }
 
     /* Set the primary DS buffer sound format.  We have to do this because
        the default primary buffer is 8-bit, 22kHz! */
     if ((result = IDirectSoundBuffer_SetFormat(t_pDSPrimeBuffer, &wfFormat)) != DS_OK) {
-        fprintf(stderr,"SoundStream: Cannot set the primary DS buffer to proper sound format (%x) (%d)!\n", result, result);
-        IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
-        IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
-        IDirectSound_Release(t_pDirectSound);
-        goto out;
+	fprintf(stderr,"SoundStream: Cannot set the primary DS buffer to proper sound format (%x) (%d)!\n", result, result);
+	IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
+	IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
+	IDirectSound_Release(t_pDirectSound);
+	goto out;
     }
 #  endif /* 0 */
 
@@ -2199,22 +2199,22 @@
 
     /* Create the secondary DS buffer */
     if ((result = IDirectSound_CreateSoundBuffer(t_pDirectSound, &dsbdDesc, &t_pDSBuffer, NULL)) != DS_OK) {
-        fprintf(stderr,"SoundStream: couldn't create sound buffer!\n");
-        IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
-        IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
-        IDirectSound_Release(t_pDirectSound);
-        goto out;
+	fprintf(stderr,"SoundStream: couldn't create sound buffer!\n");
+	IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
+	IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
+	IDirectSound_Release(t_pDirectSound);
+	goto out;
     }
 
     /* Lock the DS buffer */
     if ((result = IDirectSoundBuffer_Lock(t_pDSBuffer, 0, t_cbBufSize, (LPLPVOID)&pDSBuffData,
-                                          &dwDataLen, NULL, NULL, 0)) != DS_OK) {
-        fprintf(stderr,"SoundStream: couldn't lock sound buffer!\n");
-        IDirectSoundBuffer_Stop(t_pDSBuffer);
-        IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
-        IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
-        IDirectSound_Release(t_pDirectSound);
-        goto out;
+					  &dwDataLen, NULL, NULL, 0)) != DS_OK) {
+	fprintf(stderr,"SoundStream: couldn't lock sound buffer!\n");
+	IDirectSoundBuffer_Stop(t_pDSBuffer);
+	IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
+	IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
+	IDirectSound_Release(t_pDirectSound);
+	goto out;
     }
 
     /* Zero the DS buffer */
@@ -2222,32 +2222,32 @@
 
     /* Unlock the DS buffer */
     if ((result = IDirectSoundBuffer_Unlock(t_pDSBuffer, pDSBuffData, dwDataLen, NULL, 0)) != DS_OK) {
-        fprintf(stderr,"SoundStream: couldn't unlock sound buffer!\n");
-        IDirectSoundBuffer_Stop(t_pDSBuffer);
-        IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
-        IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
-        IDirectSound_Release(t_pDirectSound);
-        goto out;
+	fprintf(stderr,"SoundStream: couldn't unlock sound buffer!\n");
+	IDirectSoundBuffer_Stop(t_pDSBuffer);
+	IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
+	IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
+	IDirectSound_Release(t_pDirectSound);
+	goto out;
     }
 
     __INST(bufferOffset) = __MKSMALLINT(0);  // reset last write position to start of buffer
 
     /* Start the buffer playback */
     if ((result = IDirectSoundBuffer_Play(t_pDSBuffer, 0, 0, DSBPLAY_LOOPING) != DS_OK)) {
-        fprintf(stderr,"SoundStream: couldn't play sound buffer!\n");
-        IDirectSoundBuffer_Stop(t_pDSBuffer);
-        IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
-        IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
-        IDirectSound_Release(t_pDirectSound);
-        ok = false;
-        goto out;
+	fprintf(stderr,"SoundStream: couldn't play sound buffer!\n");
+	IDirectSoundBuffer_Stop(t_pDSBuffer);
+	IDirectSoundBuffer_Stop(t_pDSPrimeBuffer);
+	IDirectSoundBuffer_Release(t_pDSPrimeBuffer);
+	IDirectSound_Release(t_pDirectSound);
+	ok = false;
+	goto out;
     }
 
     {
-        OBJ t;
+	OBJ t;
 
-        __INST(pDSBuffer) = t = __MKEXTERNALADDRESS(t_pDSBuffer); __STORE(self, t);
-        __INST(pDirectSound) = t = __MKEXTERNALADDRESS(t_pDirectSound); __STORE(self, t);
+	t = __MKEXTERNALADDRESS(t_pDSBuffer); __INST(pDSBuffer) = t; __STORE(self, t);
+	t = __MKEXTERNALADDRESS(t_pDirectSound); __INST(pDirectSound) = t; __STORE(self, t);
     }
     ok = true;
     goto out;
@@ -2260,8 +2260,8 @@
     OBJ oWaveHandle;
 
     if ((oWaveHandle = __INST(waveHandle)) != nil) {
-        ok = false;
-        goto out;
+	ok = false;
+	goto out;
     }
 
     waveFormat.wf.wFormatTag = WAVE_FORMAT_PCM;
@@ -2271,16 +2271,16 @@
     waveFormat.wf.nBlockAlign = waveFormat.wf.nChannels * waveFormat.wBitsPerSample / 8;
     waveFormat.wf.nAvgBytesPerSec = waveFormat.wf.nSamplesPerSec * waveFormat.wf.nBlockAlign;
 
-    r = waveOutOpen(&t_waveHandle, 
-                    WAVE_MAPPER,
-                    (WAVEFORMAT *)&waveFormat,
-                    (DWORD)waveCallBack,
-                    0,
-                    CALLBACK_FUNCTION);
+    r = waveOutOpen(&t_waveHandle,
+		    WAVE_MAPPER,
+		    (WAVEFORMAT *)&waveFormat,
+		    (DWORD)waveCallBack,
+		    0,
+		    CALLBACK_FUNCTION);
     if (r != 0) {
-        printf("waveOutOpen\n");
-        ok = false;
-        goto out;
+	printf("waveOutOpen\n");
+	ok = false;
+	goto out;
     }
 
     (void)waveOutReset(t_waveHandle);
@@ -2292,9 +2292,9 @@
     total_buffers = 0;
 
     {
-        OBJ t;
+	OBJ t;
 
-        __INST(waveHandle) = t = __MKEXTERNALADDRESS(t_waveHandle); __STORE(self, t);
+	t = __MKEXTERNALADDRESS(t_waveHandle); __INST(waveHandle) = t; __STORE(self, t);
     }
 
 #if 0
@@ -2305,12 +2305,12 @@
      * why - DAC
      */
     {
-        char null[DATALEN];
-        int i;
-        for (i = 0; i < DATALEN; i++) {
-            null[i] = 127;
-        }
-        audioWrite(null, DATALEN);
+	char null[DATALEN];
+	int i;
+	for (i = 0; i < DATALEN; i++) {
+	    null[i] = 127;
+	}
+	audioWrite(null, DATALEN);
     }
 #endif /* 0 */
     ok = true;
@@ -2320,70 +2320,70 @@
 #endif /* WIN32 */
 
 #ifdef DEV_AUDIO
-        {
-            int __fd;
-            int __mode;
-            FILE *f;
+	{
+	    int __fd;
+	    int __mode;
+	    FILE *f;
 
-            if (strcmp(__stringVal(aMode), "w") == 0) {
-                __mode = O_WRONLY;
-            } else if (strcmp(__stringVal(aMode), "r") == 0) {
-                __mode = O_RDONLY;
-            } else {
-                __mode = O_RDWR;
-            }
-            do {
-                __BEGIN_INTERRUPTABLE__
-                __fd = open((char *) __stringVal(__INST(pathName)), __mode /* |O_NDELAY */);
-                __END_INTERRUPTABLE__
-            } while ((__fd < 0) && (__threadErrno == EINTR));
+	    if (strcmp(__stringVal(aMode), "w") == 0) {
+		__mode = O_WRONLY;
+	    } else if (strcmp(__stringVal(aMode), "r") == 0) {
+		__mode = O_RDONLY;
+	    } else {
+		__mode = O_RDWR;
+	    }
+	    do {
+		__BEGIN_INTERRUPTABLE__
+		__fd = open((char *) __stringVal(__INST(pathName)), __mode /* |O_NDELAY */);
+		__END_INTERRUPTABLE__
+	    } while ((__fd < 0) && (__threadErrno == EINTR));
 
-            if (__fd >= 0) {
-                /* 
-                 * make it a FILE * 
-                 */
-                f = fdopen(__fd, __stringVal(aMode));
-                if (! f) {
-                    __BEGIN_INTERRUPTABLE__
-                    close(__fd);
-                    __END_INTERRUPTABLE__
-                    ok = false;
-                    goto out;
-                } 
-                setbuf(f, NULL);
-                __INST(buffered) = false;
-                __INST(filePointer) = __MKOBJ(f);
-                __STORESELF(filePointer);
+	    if (__fd >= 0) {
+		/*
+		 * make it a FILE *
+		 */
+		f = fdopen(__fd, __stringVal(aMode));
+		if (! f) {
+		    __BEGIN_INTERRUPTABLE__
+		    close(__fd);
+		    __END_INTERRUPTABLE__
+		    ok = false;
+		    goto out;
+		}
+		setbuf(f, NULL);
+		__INST(buffered) = false;
+		__INST(filePointer) = __MKOBJ(f);
+		__STORESELF(filePointer);
 
 #if defined(PCM_ENABLE_OUTPUT) && defined(PCM_ENABLE_INPUT)
 # if defined(SNDCTL_DSP_SETTRIGGER)
-                if (__mode == O_RDWR) {
-                    int enable_bits = ~(PCM_ENABLE_OUTPUT|PCM_ENABLE_INPUT);
+		if (__mode == O_RDWR) {
+		    int enable_bits = ~(PCM_ENABLE_OUTPUT|PCM_ENABLE_INPUT);
 
-                    if (ioctl(__fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) == -1)
-                    {
-                        fprintf(stderr, "can't request synchronous start of fullduplex operation");
-                    }
-                }
+		    if (ioctl(__fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) == -1)
+		    {
+			fprintf(stderr, "can't request synchronous start of fullduplex operation");
+		    }
+		}
 # endif
 #endif
-                ok = true;
-                goto out;
-            }
-        }
+		ok = true;
+		goto out;
+	    }
+	}
 
 #endif /* DEV_AUDIO */
 out:;
 %}.
     ok == false ifTrue:[
-        self openError. 
-        "not reached"
-        ^ nil.
+	self openError.
+	"not reached"
+	^ nil.
     ].
-        
+
     ok isNil ifTrue:[
-        "its a regular file open (i.e. /dev/audio) "
-        ^ super openWithMode:aMode attributes:attributeSpec.
+	"its a regular file open (i.e. /dev/audio) "
+	^ super openWithMode:aMode attributes:attributeSpec.
     ].
 
     Lobby register:self.
@@ -2399,10 +2399,10 @@
     |buffer numSamples val scale isUnsigned|
 
     (audioFormat startsWith:#U16) ifFalse:[
-        (audioFormat startsWith:#S16) ifFalse:[
-            self error:'must be in 16bit mode' mayProceed:true.
-            ^ self
-        ]
+	(audioFormat startsWith:#S16) ifFalse:[
+	    self error:'must be in 16bit mode' mayProceed:true.
+	    ^ self
+	]
     ].
 
     numSamples := (self sampleRate * seconds) truncated.
@@ -2414,12 +2414,12 @@
 
     scale := freq * 2 * (Float pi).
     1 to:numSamples do:[:i |
-        val := (scale * i / self sampleRate) sin.
-        val := (val * 16r7FFF) rounded bitAnd:16rFFFF.
-        isUnsigned ifTrue:[
-            val := val + 32768
-        ].
-        buffer at:i put:val
+	val := (scale * i / self sampleRate) sin.
+	val := (val * 16r7FFF) rounded bitAnd:16rFFFF.
+	isUnsigned ifTrue:[
+	    val := val + 32768
+	].
+	buffer at:i put:val
     ].
 
     self nextPutBytes:(numSamples*2) from:buffer startingAt:1
@@ -2479,10 +2479,10 @@
     |buffer numSamples val scale oldFormat|
 
     (audioFormat startsWith:#U16) ifFalse:[
-        (audioFormat startsWith:#S16) ifFalse:[
-            self error:'must be in 16bit mode' mayProceed:true.
-            ^ self
-        ]
+	(audioFormat startsWith:#S16) ifFalse:[
+	    self error:'must be in 16bit mode' mayProceed:true.
+	    ^ self
+	]
     ].
 
     "allocate memory for 1sec playing time"
@@ -2493,18 +2493,18 @@
 
     scale := freq * 2 * (Float pi).
     1 to:numSamples do:[:i |
-        val := (scale * i / numSamples) sin.
-        val := (val * 16r7FFF) rounded bitAnd:16rFFFF.
-        audioFormat == #U16 ifTrue:[
-            val := val + 32768
-        ].
-        buffer at:i put:val
+	val := (scale * i / numSamples) sin.
+	val := (val * 16r7FFF) rounded bitAnd:16rFFFF.
+	audioFormat == #U16 ifTrue:[
+	    val := val + 32768
+	].
+	buffer at:i put:val
     ].
 
     oldFormat := audioFormat.
     self setAudioFormat:#S16.
     1 to:3 do:[:s |
-        self nextPutBytes:(numSamples*2) from:buffer startingAt:1
+	self nextPutBytes:(numSamples*2) from:buffer startingAt:1
     ].
     self setAudioFormat:oldFormat.
 
@@ -2527,10 +2527,10 @@
     |buffer numSamples val scale oldFormat|
 
     (audioFormat == #U8) ifFalse:[
-        (audioFormat == #S8) ifFalse:[
-            self error:'must be in 8bit mode' mayProceed:true.
-            ^ self
-        ]
+	(audioFormat == #S8) ifFalse:[
+	    self error:'must be in 8bit mode' mayProceed:true.
+	    ^ self
+	]
     ].
 
     "allocate memory for 1sec playing time"
@@ -2541,15 +2541,15 @@
 
     scale := freq * 2 * (Float pi).
     1 to:numSamples do:[:i |
-        val := (scale * i / numSamples) sin.
-        val := (val * 127 + 128) rounded.
-        buffer at:i put:val
+	val := (scale * i / numSamples) sin.
+	val := (val * 127 + 128) rounded.
+	buffer at:i put:val
     ].
 
     oldFormat := audioFormat.
     self setAudioFormat:#U8.
     1 to:3 do:[:s |
-        self nextPutBytes:numSamples from:buffer startingAt:1
+	self nextPutBytes:numSamples from:buffer startingAt:1
     ].
     self setAudioFormat:oldFormat.
 
@@ -2581,12 +2581,12 @@
 !
 
 tuneTone:freq
-    ((audioFormat startsWith:#S16) 
+    ((audioFormat startsWith:#S16)
     or:[audioFormat startsWith:#U16]) ifTrue:[
-        ^ self tuneTone16:freq
+	^ self tuneTone16:freq
     ].
     audioFormat == #MU_LAW ifTrue:[
-        ^ self tuneToneMU:freq
+	^ self tuneToneMU:freq
     ].
     self tuneTone8:freq
 
@@ -2662,7 +2662,7 @@
 !SoundStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/SoundStream.st,v 1.66 2004-09-29 13:40:59 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/SoundStream.st,v 1.67 2005-05-31 18:49:10 cg Exp $'
 ! !
 
 SoundStream initialize!