The Trunk: Sound-tfel.58.mcz

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

The Trunk: Sound-tfel.58.mcz

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

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

Name: Sound-tfel.58
Author: tfel
Time: 21 August 2016, 4:48:44.407391 pm
UUID: 50e3fdac-34a3-412c-8cd6-bc672a2424ae
Ancestors: Sound-mt.57, Sound-tfel.57

merge trunk

=============== 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.
+ 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.
  !