<div dir="ltr"><div>Hi Christoph,</div><div>I don't know about /// but we have \\\</div><div><br></div><div>\\\ has been deprecated for some time now (huh, it's still in Kernel, but not recommended!).</div><div>Once upon a time, large integer division was slow enough that we would prefer to skip the final attempt to normalize LargeInteger -> SmallInteger that normally has to happen on both quotient and remainder.</div><div>For example, if we just want the quotient or just the remainder, we can get a slight speed up by not normalizing the one we do not use...</div><div>But then it's programmer's responsibility to apply the normalization.</div><div>That's what \\\ did, same as \\ but omitting final normalization.</div><div><br></div><div>When I have accelerated the LargeInteger arithmetic, the minor speed up was not of any value, it would just complexify programmation at best (the normalization step was sender responsibility), or lead to broken contracts at worse (it prevents optimizations like a LargeInteger is not zero, can be compared very quickly with a SmallInteger etc...).</div><div><br></div><div>So maybe /// is to // what \\\ is to \\  ...<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 11 déc. 2019 à 09:12, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div>


<div dir="ltr">
<div id="gmail-m_3863404642982763178x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p>Hi Dave,</p>
<p><br>
</p>
<p>I can take a look at it, but I have never really dived into sounds yet - I only polished a few interfaces so far.</p>
<p><br>
</p>
<p>However: Nice extension. I did not read the affected methods before, but the changes look reasonable to me :-)</p>
<p>What is #///? My image does not know it.</p>
<p><br>
</p>
<p>Best,</p>
<p>Christoph</p>
<div id="gmail-m_3863404642982763178x_Signature">
<div id="gmail-m_3863404642982763178x_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">
<div>
<div id="gmail-m_3863404642982763178x_Item.MessagePartBody">
<div id="gmail-m_3863404642982763178x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="gmail-m_3863404642982763178x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="gmail-m_3863404642982763178x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_3863404642982763178x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Von:</b> David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>><br>
<b>Gesendet:</b> Mittwoch, 11. Dezember 2019 05:08:09<br>
<b>An:</b> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a><br>
<b>Cc:</b> Thiede, Christoph<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Sound-dtl.67.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div>This commit harvests a fix by St?phane Rollandin, discussed on the<br>
squeak-dev list.<br>
<br>
We are in 5.3 feature freeze now, but it may be reasonable to move<br>
this to trunk because the fix is of high value to the small number<br>
of people who are affected by it.<br>
<br>
@Christoph,<br>
You have a number of other inbox submissions for the Sound package.<br>
If you have the time, would you mind reviewing and commenting on<br>
this one?<br>
<br>
Thanks,<br>
Dave<br>
<br>
<br>
On Wed, Dec 11, 2019 at 03:51:05AM +0000, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
> David T. Lewis uploaded a new version of Sound to project The Inbox:<br>
> <a href="http://source.squeak.org/inbox/Sound-dtl.67.mcz" target="_blank">http://source.squeak.org/inbox/Sound-dtl.67.mcz</a><br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: Sound-dtl.67<br>
> Author: dtl<br>
> Time: 10 December 2019, 10:51:04.985835 pm<br>
> UUID: ca970845-8428-41f9-b83c-f64a6cc732c1<br>
> Ancestors: Sound-eem.66<br>
> <br>
> Sound mixing improvements by St?phane Rollandin (spfa).<br>
> Allow adjusting volume of mixed sounds while playing. <br>
> Original discussion at <a href="http://forum.world.st/Adjusting-the-volume-of-a-sound-as-it-s-playing-td5102562.html" target="_blank">
http://forum.world.st/Adjusting-the-volume-of-a-sound-as-it-s-playing-td5102562.html</a><br>
> Patches posted to squeak-dev at <a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2019-December/205440.html" target="_blank">
http://lists.squeakfoundation.org/pipermail/squeak-dev/2019-December/205440.html</a><br>
> <br>
> =============== Diff against Sound-eem.66 ===============<br>
> <br>
> Item was changed:<br>
>   ----- Method: AbstractSound>>loudness (in category 'volume') -----<br>
>   loudness<br>
>        "Answer the current volume setting for this sound."<br>
>   <br>
> +      self hasVolumeEnvelope ifTrue: [^ self volumeEnvelope scale].<br>
> + <br>
> +      ^ scaledVol asFloat / ScaleFactor!<br>
> -      ^ scaledVol asFloat / ScaleFactor asFloat!<br>
> <br>
> Item was changed:<br>
>   ----- Method: MixedSound>>mixSampleCount:into:startingAt:leftVol:rightVol: (in category 'sound generation') -----<br>
>   mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol<br>
>        "Play a number of sounds concurrently. The level of each sound can be set independently for the left and right channels."<br>
>   <br>
>        | snd left right |<br>
>        1 to: sounds size do: [:i |<br>
>                (soundDone at: i) ifFalse: [<br>
>                        snd := sounds at: i.<br>
> +                      left := (leftVol * (leftVols at: i) * scaledVol / ScaleFactor) // ScaleFactor.<br>
> +                      right := (rightVol * (rightVols at: i) * scaledVol / ScaleFactor) // ScaleFactor.<br>
> -                      left := (leftVol * (leftVols at: i)) // ScaleFactor.<br>
> -                      right := (rightVol * (rightVols at: i)) // ScaleFactor.<br>
>                        snd samplesRemaining > 0<br>
>                                ifTrue: [<br>
>                                        snd mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: left rightVol: right]<br>
>                                ifFalse: [soundDone at: i put: true]]].<br>
>   !<br>
> <br>
> Item was changed:<br>
>   ----- Method: RepeatingSound>>mixSampleCount:into:startingAt:leftVol:rightVol: (in category 'sound generation') -----<br>
>   mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol<br>
>        "Play a collection of sounds in sequence."<br>
>        "(RepeatingSound new<br>
>                setSound: FMSound majorScale<br>
>                iterations: 2) play"<br>
>   <br>
>        | i count samplesNeeded |<br>
>        iteration <= 0 ifTrue: [^ self].<br>
>        i := startIndex.<br>
>        samplesNeeded := n.<br>
>        [samplesNeeded > 0] whileTrue: [<br>
>                count := sound samplesRemaining min: samplesNeeded.<br>
>                count = 0 ifTrue: [<br>
>                        iterationCount == #forever<br>
>                                ifFalse: [<br>
>                                        iteration := iteration - 1.<br>
>                                        iteration <= 0 ifTrue: [^ self]].  "done"<br>
>                        sound reset.<br>
>                        count := sound samplesRemaining min: samplesNeeded.<br>
>                        count = 0 ifTrue: [^ self]].  "zero length sound"<br>
>                sound mixSampleCount: count<br>
>                        into: aSoundBuffer<br>
>                        startingAt: i<br>
> +                      leftVol: leftVol * scaledVol // ScaleFactor<br>
> +                      rightVol: rightVol * scaledVol // ScaleFactor.<br>
> -                      leftVol: leftVol<br>
> -                      rightVol: rightVol.<br>
>                i := i + count.<br>
>                samplesNeeded := samplesNeeded - count].<br>
>   !<br>
> <br>
> Item was changed:<br>
>   ----- Method: SequentialSound>>mixSampleCount:into:startingAt:leftVol:rightVol: (in category 'sound generation') -----<br>
>   mixSampleCount: n into: aSoundBuffer startingAt: startIndex leftVol: leftVol rightVol: rightVol<br>
>        "Play a collection of sounds in sequence."<br>
>        "PluckedSound chromaticScale play"<br>
>   <br>
> +      | finalIndex i snd remaining count leftScaledVol rightScaledVol |<br>
> -      | finalIndex i snd remaining count |<br>
>        currentIndex = 0 ifTrue: [^ self].  "already done"<br>
> + <br>
> +      leftScaledVol := leftVol * scaledVol /// ScaleFactor.<br>
> +      rightScaledVol := rightVol * scaledVol /// ScaleFactor.<br>
> + <br>
>        finalIndex := (startIndex + n) - 1.<br>
>        i := startIndex.<br>
>        [i <= finalIndex] whileTrue: [<br>
>                snd := (sounds at: currentIndex).<br>
>                [(remaining := snd samplesRemaining) <= 0] whileTrue: [<br>
>                        "find next undone sound"<br>
>                        currentIndex < sounds size<br>
>                                ifTrue: [<br>
>                                        currentIndex := currentIndex + 1.<br>
>                                        snd := (sounds at: currentIndex)]<br>
>                                ifFalse: [<br>
>                                        currentIndex := 0.<br>
>                                        ^ self]].  "no more sounds"<br>
>                count := (finalIndex - i) + 1.<br>
>                remaining < count ifTrue: [count := remaining].<br>
> +              snd mixSampleCount: count into: aSoundBuffer startingAt: i <br>
> +                      leftVol: leftScaledVol<br>
> +                      rightVol: rightScaledVol.<br>
> -              snd mixSampleCount: count into: aSoundBuffer startingAt: i leftVol: leftVol rightVol: rightVol.<br>
>                i := i + count].<br>
>   !<br>
> <br>
<br>
> <br>
<br>
</div>
</span></font>
</div>

<br>
</blockquote></div>