Eliot Miranda uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-eem.76.mcz==================== Summary ====================
Name: Sound-eem.76
Author: eem
Time: 1 December 2020, 4:41:34.045008 pm
UUID: bc35632b-366a-4d24-81f7-024beb3dbda7
Ancestors: Sound-eem.75
Fix a bug in SoundRecorder so that the following works:
[:r| r resumeRecording. (Delay forSeconds: 5) wait. r playback] value: SoundRecorder new
Arguably this should work too:
[:r| r startRecording. (Delay forSeconds: 5) wait. r playback] value: SoundRecorder new
i.e. startRecording should set paused to false. But this is a change in API that could affect clients so I'll oput the suggestion out there and leave it to others to judge.
=============== Diff against Sound-eem.75 ===============
Item was changed:
----- Method: SoundRecorder>>emitBuffer: (in category 'private') -----
emitBuffer: buffer
+ | sound ratio |
- | sound ratio resultBuf |
-
"since some sound recording devices cannot (or will not) record below a certain sample rate,
trim the samples down if the user really wanted fewer samples"
+ sound := (desiredSampleRate isNil or: [(ratio := samplingRate // desiredSampleRate) <= 1])
+ ifTrue: [SampledSound new setSamples: buffer samplingRate: samplingRate]
+ ifFalse:
+ [| resultBuf |
+ resultBuf := SoundBuffer
+ averageEvery: ratio
+ from: buffer
+ upTo: buffer monoSampleCount.
+ SampledSound new setSamples: resultBuf samplingRate: samplingRate / ratio].
+ recordedSound ifNil:
+ [recordedSound := SequentialSound new].
- (desiredSampleRate isNil or: [(ratio := samplingRate // desiredSampleRate) <= 1]) ifTrue: [
- sound := SampledSound new setSamples: buffer samplingRate: samplingRate.
- ] ifFalse: [
- resultBuf := SoundBuffer
- averageEvery: ratio
- from: buffer
- upTo: buffer monoSampleCount.
- sound := SampledSound new setSamples: resultBuf samplingRate: samplingRate / ratio.
- ].
-
recordedSound add: (codec ifNil: [sound] ifNotNil: [codec compressSound: sound])!