The Trunk: Sound-eem.76.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Sound-eem.76.mcz

commits-2
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])!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Sound-eem.76.mcz

marcel.taeumel
Hi Eliot,

do you know about: "5 seconds wait"? :-)

Best,
Marcel



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Sound-eem.76.mcz

Eliot Miranda-2
On Wed, Dec 2, 2020 at 1:23 AM marcel.taeumel <[hidden email]> wrote:
Hi Eliot,

do you know about: "5 seconds wait"? :-)

<blush>Yes, I do, but it isn't stuck in my memory like the things I learnt in 1983</blush>

Thanks, I'll go edit my workspace now ;-)

_,,,^..^,,,_
best, Eliot