Audio, Streams, and MailMessage question

Andreas Raab andreas.raab at gmx.de
Thu Aug 23 17:28:44 UTC 2007


Brian Brown wrote:
> I'm setting my stream to binary, but I see that the binary message does 
> distinctly different things between a FileStream and 
> RWBinaryOrTextStream...
> 
> I'm stumped at this point, but I'm no expert on Streams either.

It's rather simple. If you look at the actual code (you have stepped it 
in the debugger to see what's happening or at least browsed to places 
that implement it, have you?) then you'll find a couple of places that 
look like:

   (aBinaryStream isKindOf: StandardFileStream)
     ifTrue:["optimization for files: write sound buffer directly to file"
       aBinaryStream next: (samples size // 2) putAll: samples 
startingAt: 1]  "size in words"
     ifFalse:[  "for non-file streams:"
       1 to: samples monoSampleCount do: [:i | aBinaryStream int16: 
(samples at: i)]].

There is your difference, right there.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list