[Pkg] The Trunk: Sound-tfel.57.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Aug 31 18:44:29 UTC 2016
Tim Felgentreff uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-tfel.57.mcz
==================== Summary ====================
Name: Sound-tfel.57
Author: tfel
Time: 2 August 2016, 10:04:17.197368 am
UUID: f696e8c2-a220-ef46-a307-d490412936c3
Ancestors: Sound-mt.56, Sound-kfr.27
merge from Squeakland Etoys image
=============== Diff against Sound-mt.56 ===============
Item was changed:
----- Method: AbstractSound class>>fileInSoundLibraryNamed: (in category 'sound library-file in/out') -----
fileInSoundLibraryNamed: fileName
"File in the sound library with the given file name, and add its contents to the current sound library."
| s newSounds |
+ s _ FileStream readOnlyFileNamed: fileName.
+ newSounds _ s fileInObjectAndCode.
- s := FileStream oldFileNamed: fileName.
- newSounds := s fileInObjectAndCode.
s close.
newSounds associationsDo:
[:assoc | self storeFiledInSound: assoc value named: assoc key].
AbstractSound updateScorePlayers.
Smalltalk garbageCollect. "Large objects may have been released"
!
Item was changed:
----- Method: SampledSound class>>soundNamed: (in category 'sound library') -----
soundNamed: aString
"Answer the sound of the given name, or, if there is no sound of that name, put up an informer so stating, and answer nil"
"(SampledSound soundNamed: 'shutterClick') play"
^ self soundNamed: aString ifAbsent:
+ [self inform: aString, ' not found in the Sound Library' translated.
- [self inform: aString, ' not found in the Sound Library'.
nil]!
Item was changed:
----- Method: SampledSound class>>soundNamed:ifAbsent: (in category 'sound library') -----
soundNamed: aString ifAbsent: aBlock
"Answer the sound of the given name, or if there is no sound of that name, answer the result of evaluating aBlock"
"(SampledSound soundNamed: 'shutterClick') play"
+ | entry samples compressedSound |
+ entry _ SoundLibrary
- | entry samples |
- entry := SoundLibrary
at: aString
ifAbsent:
[^ aBlock value].
entry ifNil: [^ aBlock value].
+ entry second isString
+ ifTrue: [compressedSound := Compiler evaluate: entry second.
+ compressedSound source: entry first.
+ ^ compressedSound asSound]
+ ifFalse: [samples _ entry at: 1.
+ samples class isBytes ifTrue: [samples _ self convert8bitSignedTo16Bit: samples].
+ ^ self samples: samples samplingRate: (entry at: 2)]
- samples := entry at: 1.
- samples class isBytes ifTrue: [samples := self convert8bitSignedTo16Bit: samples].
- ^ self samples: samples samplingRate: (entry at: 2)
!
Item was changed:
----- Method: SampledSound class>>universalSoundKeys (in category 'sound library') -----
universalSoundKeys
"Answer a list of the sound-names that are expected to be found in the SoundLibrary of every image."
+ ^ {'camera' translatedNoop. 'chirp' translatedNoop. 'chomp' translatedNoop. 'click' translatedNoop. 'clink' translatedNoop. 'coyote' translatedNoop. 'croak' translatedNoop. 'horn' translatedNoop. 'laugh' translatedNoop. 'meow' translatedNoop. 'motor' translatedNoop. 'peaks' translatedNoop. 'scrape' translatedNoop. 'scratch' translatedNoop. 'scritch' translatedNoop. 'silence' translatedNoop. 'splash' translatedNoop. 'warble' translatedNoop.}!
-
- ^ #('splash' 'peaks' 'clink' 'croak' 'scratch' 'chirp' 'scritch' 'warble' 'scrape' 'camera' 'coyote' 'silence' 'motor')
-
- !
Item was changed:
----- Method: SampledSound>>compressWith: (in category 'accessing') -----
+ compressWith: codecClass
+ | codec result |
+ codec := codecClass new.
+ result := codec compressSound: self.
+ codec release.
+ ^ result!
- compressWith: codecClass
- ^ codecClass new compressSound: self!
Item was changed:
----- Method: SampledSound>>compressWith:atRate: (in category 'accessing') -----
+ compressWith: codecClass atRate: aSamplingRate
+ | codec result |
+ codec := codecClass new.
+ result := codec compressSound: self atRate: aSamplingRate.
+ codec release.
+ ^ result!
- compressWith: codecClass atRate: aSamplingRate
-
- ^ codecClass new compressSound: self atRate: aSamplingRate!
Item was changed:
----- Method: SoundRecorder>>stopRecording (in category 'recording controls') -----
stopRecording
"Stop the recording process and turn of the sound input driver."
recordProcess ifNotNil: [recordProcess terminate].
+ recordProcess _ nil.
- recordProcess := nil.
self primStopRecording.
+ RecorderActive _ false.
- RecorderActive := false.
Smalltalk unregisterExternalObject: bufferAvailableSema.
((currentBuffer ~~ nil) and: [nextIndex > 1])
ifTrue: [self emitPartialBuffer].
+ codec ifNotNil: [codec reset].
self initializeRecordingState.
!
More information about the Packages
mailing list