A new version of Sound was added to project The Inbox: http://source.squeak.org/inbox/Sound-mad.90.mcz
==================== Summary ====================
Name: Sound-mad.90 Author: mad Time: 22 September 2023, 1:54:04.433028 pm UUID: 903c4996-a9b8-46a7-b794-a8a1e04f41b4 Ancestors: Sound-mt.89
Ports fix of storeSampleCount:bigEndian:on: from AbstractSound (by ct) to SampledSound.
=============== Diff against Sound-mt.89 ===============
Item was added: + ----- Method: SampledSound>>storeSampleCount:bigEndian:on: (in category 'file i/o') ----- + storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream + "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)." + + | streamDirect reverseBytes | + self samplingRate ~= originalSamplingRate ifTrue: [ + ^ super storeSampleCount: samplesToStore bigEndian: bigEndianFlag on: aBinaryStream]. + + "optimization: if sampling rates match, just store my buffer" + streamDirect := aBinaryStream isKindOf: StandardFileStream. + reverseBytes := (bigEndianFlag xor: Smalltalk isBigEndian) xor: streamDirect not. + reverseBytes ifTrue: [samples reverseEndianness]. + streamDirect + 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)]]. + reverseBytes ifTrue: [samples reverseEndianness]. "restore to original endianness" + !
squeak-dev@lists.squeakfoundation.org