<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi David, hi all, <span style="font-size:12pt">thanks for merging!</span></p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Do you know what Smalltalk endianness is good for? Is this maybe only relevant for FileStreams at all?
<div class="x__rp_U4 x_ms-font-weight-regular x_ms-font-color-neutralDark x_rpHighlightAllClass x_rpHighlightBodyClass" id="x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><font size="2"><span id="LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Best,</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">Christoph</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von David T. Lewis <lewis@mail.msen.com><br>
<b>Gesendet:</b> Dienstag, 1. September 2020 04:13:16<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Cc:</b> packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> Re: [squeak-dev] The Trunk: Sound-ct.71.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Thanks Christoph, good catch and thanks for the fix.<br>
<br>
I moved this and the supporting test immediately to trunk because it is<br>
clearly a worthwhile change. <br>
<br>
All - Christoph requests detailed review, please do so and make any updates<br>
if appropriate.<br>
<br>
I'm really happy to see long-overlooked details like this being addressed :-)<br>
<br>
Dave<br>
<br>
<br>
On Tue, Sep 01, 2020 at 02:01:27AM +0000, commits@source.squeak.org wrote:<br>
> David T. Lewis uploaded a new version of Sound to project The Trunk:<br>
> <a href="http://source.squeak.org/trunk/Sound-ct.71.mcz">http://source.squeak.org/trunk/Sound-ct.71.mcz</a><br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: Sound-ct.71<br>
> Author: ct<br>
> Time: 1 September 2020, 2:07:15.07999 am<br>
> UUID: 0d91a1bf-41cb-834c-ab0c-fa2ad832e408<br>
> Ancestors: Sound-nice.69<br>
> <br>
> Fixes wave sound streaming on non-filestream objects. The endianness was inverted because #int16: already uses Big Endian. This did not sound well - listen yourself in an unpatched image: :-)<br>
> <br>
> array := ByteArray streamContents: [:stream |<br>
>        PluckedSound bachFugue storeWAVSamplesOn: stream].<br>
> (FileStream fileNamed: 'bachFugue.wav') binary in: [:stream |<br>
>        [array do: [:ea | stream nextPut: ea]]<br>
>                ensure: [stream close]].<br>
> (SampledSound fromWaveFileNamed: 'bachFugue.wav') play.<br>
> <br>
> Please review in detail as this is one of my first contacts to the Sound system!<br>
> <br>
> =============== Diff against Sound-nice.69 ===============<br>
> <br>
> Item was changed:<br>
>   ----- Method: AbstractSound>>storeSampleCount:bigEndian:on: (in category 'file i/o') -----<br>
>   storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream<br>
>        "Store my samples on the given stream at the current SoundPlayer sampling rate. If bigFlag is true, then each 16-bit sample is stored most-significant byte first (AIFF files), otherwise it is stored least-significant byte first (WAV files). If self
 isStereo is true, both channels are stored, creating a stereo file. Otherwise, only the left channel is stored, creating a mono file."<br>
>   <br>
> +      | bufSize stereoBuffer reverseBytes streamDirect |<br>
> -      | bufSize stereoBuffer reverseBytes |<br>
>        self reset.<br>
>        bufSize := (2 * self samplingRate rounded) min: samplesToStore.  "two second buffer"<br>
>        stereoBuffer := SoundBuffer newStereoSampleCount: bufSize.<br>
> +      streamDirect := aBinaryStream isKindOf: StandardFileStream.<br>
> +      reverseBytes := (bigEndianFlag xor: Smalltalk isBigEndian) xor: streamDirect not.<br>
> -      reverseBytes := bigEndianFlag ~= (Smalltalk isBigEndian).<br>
>   <br>
>        'Storing audio...'<br>
>                displayProgressFrom: 0 to: samplesToStore during: [:bar | | remaining out |<br>
>                        remaining := samplesToStore.<br>
>                        [remaining > 0] whileTrue: [<br>
>                                bar value: samplesToStore - remaining.<br>
>                                stereoBuffer primFill: 0.  "clear the buffer"<br>
>                                self playSampleCount: (bufSize min: remaining) into: stereoBuffer startingAt: 1.<br>
>                                out := self isStereo<br>
>                                                ifTrue: [stereoBuffer]<br>
>                                                ifFalse: [stereoBuffer extractLeftChannel].<br>
>                                reverseBytes ifTrue: [out reverseEndianness].<br>
> +                              streamDirect<br>
> -                              (aBinaryStream isKindOf: StandardFileStream)<br>
>                                        ifTrue: [  "optimization for files: write sound buffer directly to file"<br>
>                                                aBinaryStream next: (out size // 2) putAll: out startingAt: 1]  "size in words"<br>
>                                        ifFalse: [  "for non-file streams:"<br>
>                                                1 to: out monoSampleCount do: [:i | aBinaryStream int16: (out at: i)]].<br>
> +                              remaining := remaining - bufSize]].!<br>
> -                              remaining := remaining - bufSize]].<br>
> - !<br>
> <br>
> <br>
<br>
</div>
</span></font>
</body>
</html>