[squeak-dev] The Trunk: Sound-tfel.59.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Aug 30 11:36:00 UTC 2016


Tim Felgentreff uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-tfel.59.mcz

==================== Summary ====================

Name: Sound-tfel.59
Author: tfel
Time: 30 August 2016, 1:35:33.820946 pm
UUID: ba31f5bd-7f7d-3144-99ac-d5c67d3cf6ee
Ancestors: Sound-tfel.58

Replace underscore assignments with :=

=============== Diff against Sound-mt.57 ===============

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.
- 	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 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.
  	self primStopRecording.
  	RecorderActive := false.
  	Smalltalk unregisterExternalObject: bufferAvailableSema.
  	((currentBuffer ~~ nil) and: [nextIndex > 1])
  		ifTrue: [self emitPartialBuffer].
+ 	codec ifNotNil: [codec reset].
  	self initializeRecordingState.
  !



More information about the Squeak-dev mailing list